lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20220224112354.stx4ssnd2b3gpuvp@mercury.elektranox.org>
Date:   Thu, 24 Feb 2022 12:23:54 +0100
From:   Sebastian Reichel <sebastian.reichel@...labora.com>
To:     Christophe JAILLET <christophe.jaillet@...adoo.fr>
Cc:     linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org,
        linux-pm@...r.kernel.org
Subject: Re: [PATCH] power: supply: max8997_charger: Use
 devm_work_autocancel()

Hi,

On Sun, Feb 13, 2022 at 12:19:31PM +0100, Christophe JAILLET wrote:
> Use devm_work_autocancel() instead of hand writing it.
> It saves a few lines of code.
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
> ---

Thanks, queued.

-- Sebastian

>  drivers/power/supply/max8997_charger.c | 12 +++---------
>  1 file changed, 3 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/power/supply/max8997_charger.c b/drivers/power/supply/max8997_charger.c
> index 25207fe2aa68..127c73b0b3bd 100644
> --- a/drivers/power/supply/max8997_charger.c
> +++ b/drivers/power/supply/max8997_charger.c
> @@ -14,6 +14,7 @@
>  #include <linux/mfd/max8997.h>
>  #include <linux/mfd/max8997-private.h>
>  #include <linux/regulator/consumer.h>
> +#include <linux/devm-helpers.h>
>  
>  /* MAX8997_REG_STATUS4 */
>  #define DCINOK_SHIFT		1
> @@ -94,13 +95,6 @@ static int max8997_battery_get_property(struct power_supply *psy,
>  	return 0;
>  }
>  
> -static void max8997_battery_extcon_evt_stop_work(void *data)
> -{
> -	struct charger_data *charger = data;
> -
> -	cancel_work_sync(&charger->extcon_work);
> -}
> -
>  static void max8997_battery_extcon_evt_worker(struct work_struct *work)
>  {
>  	struct charger_data *charger =
> @@ -255,8 +249,8 @@ static int max8997_battery_probe(struct platform_device *pdev)
>  	}
>  
>  	if (!IS_ERR(charger->reg) && !IS_ERR_OR_NULL(charger->edev)) {
> -		INIT_WORK(&charger->extcon_work, max8997_battery_extcon_evt_worker);
> -		ret = devm_add_action(&pdev->dev, max8997_battery_extcon_evt_stop_work, charger);
> +		ret = devm_work_autocancel(&pdev->dev, &charger->extcon_work,
> +					   max8997_battery_extcon_evt_worker);
>  		if (ret) {
>  			dev_err(&pdev->dev, "failed to add extcon evt stop action: %d\n", ret);
>  			return ret;
> -- 
> 2.32.0
> 

Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ