Re: [PATCH 1/2] extcon: extcon-dra7xx: Add extcon driver for USB IDdetection

From: Chanwoo Choi
Date: Tue Aug 20 2013 - 19:07:34 EST


>>>>> +
>>>>> + if (dra7xx_usb->irq_gpio) {
>>>>> + status = devm_request_threaded_irq(dra7xx_usb->dev, irq_num,
>>>>> + NULL, id_irq_handler, IRQF_SHARED |
>>>>> + IRQF_ONESHOT | IRQF_TRIGGER_FALLING,
>>>>> + dev_name(&pdev->dev), (void *) dra7xx_usb);
>>>>> + if (status)
>>>>> + dev_err(dra7xx_usb->dev, "failed to request irq #%d\n",
>>>>> + irq_num);
>>>> If devm_request_threaded_irq() return fail state, why did not you do add error exception?
>>> If interrupt fails I fallback to polling thread.
>>>>> + else
>>>>> + return 0;
>>>> If devm_request_threaded_irq() return success state, why did you directly call 'return'?
>>>> kthread_create operation isn't necessary?
>>> Yes kthread is optional. Some boards doenot have the ID pin hooked onto the GPIO.
>>> In such cases we will run the kthread and poll on the ID pin values.
>>>>> + }
>>>>> +
>>>>> + dra7xx_usb->thread_task = kthread_create(id_poll_func, dra7xx_usb,
>>>>> + dev_name(&pdev->dev));
>>>> Should you use polling method with kthread? I think it isn't proper method.
>>>> You did get the irq number by using DT helper function and register irq handler
>>>> with devm_request_threaded_irq(). I prefer interrupt method for detection of cable state.
>>> I also prefer interrupt method. If any implementation does not have ID pin connected to GPIOs then still
>>> it could use the driver in polling mode.
>> As I mentioned above, I don't prefer interrupt method for cable detection.
>
> I hope you meant, you prefer interrupt method for cable detection over polling .

Right, my mistake. I prefer interrupt method.

Thanks,
Chanwoo CHoi


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/