linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
To: wens@csie.org
Cc: Hans de Goede <hdegoede@redhat.com>,
	Sebastian Reichel <sre@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	"open list:THERMAL" <linux-pm@vger.kernel.org>
Subject: Re: [PATCH v3 6/8] power: supply: Clean-up few drivers by using managed work init
Date: Wed, 24 Mar 2021 09:43:33 +0200	[thread overview]
Message-ID: <d26f1e700b98ed9069e6508aefa8137675343b99.camel@fi.rohmeurope.com> (raw)
In-Reply-To: <CAGb2v67Jd6qFS-zmD+Hm4BJHA+-kx0nAxvDovUwW=WwZTEGYeg@mail.gmail.com>

Hello Chen-Yu, Hans, Greg,

On Tue, 2021-03-23 at 22:36 +0800, Chen-Yu Tsai wrote:
> Hi,
> 
> On Tue, Mar 23, 2021 at 9:58 PM Matti Vaittinen
> <matti.vaittinen@fi.rohmeurope.com> wrote:
> > Few drivers implement remove call-back only for ensuring a delayed
> > work gets cancelled prior driver removal. Clean-up these by
> > switching
> > to use devm_delayed_work_autocancel() instead.
> > 
> > This change is compile-tested only. All testing is appreciated.
> > 
> > Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
> > Acked-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> > ---
> > Changelog from RFCv2:
> >  - RFC dropped. No functional changes.
> > 
> >  drivers/power/supply/axp20x_usb_power.c      | 15 +++++----------
> >  drivers/power/supply/bq24735-charger.c       | 18 ++++++--------
> > ----
> >  drivers/power/supply/ltc2941-battery-gauge.c | 20 +++++++---------
> > ----
> >  drivers/power/supply/sbs-battery.c           | 16 +++++-----------
> >  4 files changed, 23 insertions(+), 46 deletions(-)
> > 
> > diff --git a/drivers/power/supply/axp20x_usb_power.c
> > b/drivers/power/supply/axp20x_usb_power.c
> > index 8933ae26c3d6..4259709e3491 100644
> > --- a/drivers/power/supply/axp20x_usb_power.c
> > +++ b/drivers/power/supply/axp20x_usb_power.c
> > @@ -8,6 +8,7 @@
> > 
> >  #include <linux/bitops.h>
> >  #include <linux/device.h>
> > +#include <linux/devm-helpers.h>
> >  #include <linux/init.h>
> >  #include <linux/interrupt.h>
> >  #include <linux/kernel.h>
> > @@ -646,21 +647,16 @@ static int axp20x_usb_power_probe(struct
> > platform_device *pdev)
> >                 }
> >         }
> > 
> > +       ret = devm_delayed_work_autocancel(&pdev->dev, &power-
> > >vbus_detect,
> > +                                          axp20x_usb_power_poll_vb
> > us);
> > +       if (ret)
> > +               return ret;
> 
> This doesn't look right. The IRQ is requested before this, and the
> delayed_work
> struct is initialized even earlier, so you'd be re-initializing the
> struct,
> with the work item potentially running or queued up already.

Sigh. The company mail had redirected this to spam... :/
I will check this and send appropriate follow-up fix(es) to Greg. Big
thanks for the heads-up!

--Matti



  reply	other threads:[~2021-03-24  7:44 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-23 13:49 [PATCH v3 0/8] Add managed version of delayed work init Matti Vaittinen
2021-03-23 13:56 ` [PATCH v3 1/8] workqueue: Add resource " Matti Vaittinen
2021-03-23 13:59   ` Hans de Goede
2021-03-23 13:56 ` [PATCH v3 2/8] MAINTAINERS: Add entry for devm helpers Matti Vaittinen
2021-03-23 13:58   ` Hans de Goede
2021-03-23 14:19     ` Greg KH
2021-04-21  7:51       ` Matti Vaittinen
2021-04-21 11:58         ` Hans de Goede
2021-04-21 12:09           ` Greg KH
2021-04-21 12:39             ` Matti Vaittinen
2021-04-21 12:17           ` Vaittinen, Matti
2021-04-21 12:26             ` Hans de Goede
2021-04-21 12:54               ` Vaittinen, Matti
2021-03-23 13:57 ` [PATCH v3 3/8] extconn: Clean-up few drivers by using managed work init Matti Vaittinen
2021-03-23 13:59   ` Hans de Goede
2021-03-24  2:09   ` Chanwoo Choi
2021-03-24  5:02     ` Matti Vaittinen
2021-03-24  7:19       ` Hans de Goede
2021-03-23 13:57 ` [PATCH v3 4/8] hwmon: raspberry-pi: " Matti Vaittinen
2021-03-23 13:57 ` [PATCH v3 5/8] platform/x86: gpd pocket fan: Clean-up " Matti Vaittinen
2021-03-23 15:30   ` Hans de Goede
2021-03-23 13:57 ` [PATCH v3 6/8] power: supply: Clean-up few drivers " Matti Vaittinen
2021-03-23 14:36   ` Chen-Yu Tsai
2021-03-24  7:43     ` Matti Vaittinen [this message]
2021-03-24  7:52     ` Matti Vaittinen
2021-03-23 13:58 ` [PATCH v3 7/8] regulator: qcom_spmi-regulator: Clean-up " Matti Vaittinen
2021-03-23 17:37   ` Mark Brown
2021-03-23 13:58 ` [PATCH v3 8/8] watchdog: retu_wdt: " Matti Vaittinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d26f1e700b98ed9069e6508aefa8137675343b99.camel@fi.rohmeurope.com \
    --to=matti.vaittinen@fi.rohmeurope.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hdegoede@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=sre@kernel.org \
    --cc=wens@csie.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).