Message ID | 20240917193914.47566-1-bvanassche@acm.org (mailing list archive) |
---|---|
State | Handled Elsewhere, archived |
Headers | show |
Series | power: supply: core: Remove might_sleep() from power_supply_put() | expand |
On Tue, Sep 17, 2024 at 12:39:14PM -0700, Bart Van Assche wrote: > The put_device() call in power_supply_put() may call > power_supply_dev_release(). The latter function does not sleep so > power_supply_put() doesn't sleep either. Hence, remove the might_sleep() > call from power_supply_put(). This patch suppresses false positive > complaints about calling a sleeping function from atomic context if > power_supply_put() is called from atomic context. > > Cc: Kyle Tso <kyletso@google.com> > Cc: Krzysztof Kozlowski <krzk@kernel.org> > Fixes: 1a352462b537 ("power_supply: Add power_supply_put for decrementing device reference counter") > Signed-off-by: Bart Van Assche <bvanassche@acm.org> > --- > drivers/power/supply/power_supply_core.c | 2 -- > 1 file changed, 2 deletions(-) Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Best regards, Krzysztof
On Tue, 17 Sep 2024 12:39:14 -0700, Bart Van Assche wrote: > The put_device() call in power_supply_put() may call > power_supply_dev_release(). The latter function does not sleep so > power_supply_put() doesn't sleep either. Hence, remove the might_sleep() > call from power_supply_put(). This patch suppresses false positive > complaints about calling a sleeping function from atomic context if > power_supply_put() is called from atomic context. > > [...] Applied, thanks! [1/1] power: supply: core: Remove might_sleep() from power_supply_put() commit: f6da4553ff24a5d1c959c9627c965323adc3d307 Best regards,
diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c index 8f6025acd10a..3c493555c5a4 100644 --- a/drivers/power/supply/power_supply_core.c +++ b/drivers/power/supply/power_supply_core.c @@ -483,8 +483,6 @@ EXPORT_SYMBOL_GPL(power_supply_get_by_name); */ void power_supply_put(struct power_supply *psy) { - might_sleep(); - atomic_dec(&psy->use_cnt); put_device(&psy->dev); }
The put_device() call in power_supply_put() may call power_supply_dev_release(). The latter function does not sleep so power_supply_put() doesn't sleep either. Hence, remove the might_sleep() call from power_supply_put(). This patch suppresses false positive complaints about calling a sleeping function from atomic context if power_supply_put() is called from atomic context. Cc: Kyle Tso <kyletso@google.com> Cc: Krzysztof Kozlowski <krzk@kernel.org> Fixes: 1a352462b537 ("power_supply: Add power_supply_put for decrementing device reference counter") Signed-off-by: Bart Van Assche <bvanassche@acm.org> --- drivers/power/supply/power_supply_core.c | 2 -- 1 file changed, 2 deletions(-)