diff mbox series

power: supply: axp288_charger: use devm_add_action_or_reset

Message ID 1608208594-29081-1-git-send-email-tiantao6@hisilicon.com (mailing list archive)
State Not Applicable, archived
Headers show
Series power: supply: axp288_charger: use devm_add_action_or_reset | expand

Commit Message

tiantao (H) Dec. 17, 2020, 12:36 p.m. UTC
When devm_add_action returns non-zero, it will return directly and
there is no place to call axp288_charger_cancel_work, while when
devm_add_action_or_reset returns non-zero, the system will
automatically call axp288_charger_cancel_work.

Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
---
 drivers/power/supply/axp288_charger.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Hans de Goede Dec. 17, 2020, 6:34 p.m. UTC | #1
Hi,

On 12/17/20 1:36 PM, Tian Tao wrote:
> When devm_add_action returns non-zero, it will return directly and
> there is no place to call axp288_charger_cancel_work, while when
> devm_add_action_or_reset returns non-zero, the system will
> automatically call axp288_charger_cancel_work.
> 
> Signed-off-by: Tian Tao <tiantao6@hisilicon.com>

As I explained in my reply to the previous version of this:

"As the comment 1 line above the devm_add_action states, the action gets
registered *before* the notifiers get registered, so before the work can
ever be triggered.

IOW there is no need for the reset here. It cannot hurt, but it is not
necessay, so NACK."

This patch is not necessary.


Still NACK, please stop sending this patch,

Regards,

Hans



> ---
>  drivers/power/supply/axp288_charger.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/power/supply/axp288_charger.c b/drivers/power/supply/axp288_charger.c
> index a4df1ea..6480c2e 100644
> --- a/drivers/power/supply/axp288_charger.c
> +++ b/drivers/power/supply/axp288_charger.c
> @@ -855,7 +855,7 @@ static int axp288_charger_probe(struct platform_device *pdev)
>  	}
>  
>  	/* Cancel our work on cleanup, register this before the notifiers */
> -	ret = devm_add_action(dev, axp288_charger_cancel_work, info);
> +	ret = devm_add_action_or_reset(dev, axp288_charger_cancel_work, info);
>  	if (ret)
>  		return ret;
>  
>
diff mbox series

Patch

diff --git a/drivers/power/supply/axp288_charger.c b/drivers/power/supply/axp288_charger.c
index a4df1ea..6480c2e 100644
--- a/drivers/power/supply/axp288_charger.c
+++ b/drivers/power/supply/axp288_charger.c
@@ -855,7 +855,7 @@  static int axp288_charger_probe(struct platform_device *pdev)
 	}
 
 	/* Cancel our work on cleanup, register this before the notifiers */
-	ret = devm_add_action(dev, axp288_charger_cancel_work, info);
+	ret = devm_add_action_or_reset(dev, axp288_charger_cancel_work, info);
 	if (ret)
 		return ret;