Re: [PATCH v2] extcon: fix extcon_get_extcon_dev() error handling

From: Chanwoo Choi
Date: Thu Dec 16 2021 - 20:09:08 EST


On 12/17/21 12:59 AM, Dan Carpenter wrote:
> On Thu, Dec 16, 2021 at 05:38:04PM +0900, Chanwoo Choi wrote:
>>>
>>> To be honest, I'm not sure how this differs from other functions which
>>> return -EPROBE_DEFER. How do other functions guarantee they will only
>>> be called from probe()?
>>
>> If it is possible to know extcon_get_extcon_dev() will be only callled on probe,
>> it is no problem. But, it is not able to guarantee that extcon_get_extcon_dev()
>> is called on probe. Because of this reason, this issue should be handled in each device driver.
>>
>> -EPROBE_DEFER is only for probe step. If return -EPROBE_DEFER except for probe,
>> it is wrong return value.
>
> The future is vast and unknowable. We can't really future proof code
> and we should never try do that if it makes the code more complicated
> right now.
>
> When Andy submitted basically the same patch as me three years ago we
> worried about future developers so we didn't merge his patch. But
> three years later no non-probe() were introduced. Meanwhile the bad API
> created bugs in the kernel for current users.

As you mentioned, there were no use case except for probe step.
OK. I agree this approach.


For merging this patch, need to get ack from power-supply and usb maintainer.
After getting the ack, I'll merge it. Thanks.

--
Best Regards,
Chanwoo Choi
Samsung Electronics