Re: [PATCH 2/2] regulator: max20339: add Maxim MAX20339 regulator driver
From: Krzysztof Kozlowski
Date: Tue Sep 17 2024 - 04:16:29 EST
On 17/09/2024 10:15, Krzysztof Kozlowski wrote:
>>
>>>> + irq_flags |= irqd_get_trigger_type(irq_get_irq_data(client->irq));
>>>> +
>>>> + ret = devm_request_threaded_irq(&client->dev, client->irq,
>>>
>>> Shared interrupts should not be devm. It leads to tricky cases during
>>> removal. If you investigated the code and you are 100% sure there is no
>>> issue, please write a short comment in the code confirming that. Or just
>>> don't use devm.
>>
>> I wasn't aware of this, thanks. I'll drop the shared and somebody can
>> revisit it in the future if required. BTW, a naive grep returned +400
>> drivers that use shared together with devm.
>
> Yeah, I was once thinking to check them, because there is an easy hint
> problems are possible: if driver has remove() callback which does
> anything with resources. However even if driver code looks unsafe, it
> requires quite some time to figure out if the issue is real - need to
> find other driver who will trigger the interrupt afterwards.
>
> You can BTW test it with CONFIG_DEBUG_SHIRQ + bind/unbind.
>
> Maybe we need some more explicit documentation around devm() or IRQF_SHARED.
Also discussion here:
https://lore.kernel.org/all/20220929050426.955139-1-dmitry.torokhov@xxxxxxxxx/
Best regards,
Krzysztof