Linux Power Management development
 help / color / mirror / Atom feed
From: Sebastian Reichel <sre@kernel.org>
To: Tony Lindgren <tony@atomide.com>
Cc: Liam Breck <liam@networkimprov.net>,
	"Mark A . Greer" <mgreer@animalcreek.com>,
	linux-pm@vger.kernel.org, linux-omap@vger.kernel.org,
	Liam Breck <kernel@networkimprov.net>,
	Matt Ranostay <matt@ranostay.consulting>
Subject: Re: [PATCH 1/6] power: bq24190_charger: Call enable_irq() only at the end of probe()
Date: Thu, 12 Jan 2017 22:40:52 +0100	[thread overview]
Message-ID: <20170112214051.kx6oaghah5sxtwr3@earth> (raw)
In-Reply-To: <20170112205811.GJ2630@atomide.com>

[-- Attachment #1: Type: text/plain, Size: 2860 bytes --]

Hi,

On Thu, Jan 12, 2017 at 12:58:11PM -0800, Tony Lindgren wrote:
> * Liam Breck <liam@networkimprov.net> [170112 12:25]:
> > On Thu, Jan 12, 2017 at 9:44 AM, Sebastian Reichel <sre@kernel.org> wrote:
> > > On Wed, Jan 11, 2017 at 04:41:49PM -0800, Tony Lindgren wrote:
> > >> From: Liam Breck <kernel@networkimprov.net>
> > >>
> > >> The device specific data is not fully initialized after
> > >> request_threaded_irq().
> > >>
> > >> This causes problems when the IRQ handler tries to reference them.
> > >> Fix the issue by enabling IRQ only at the end of the probe.
> > >>
> > >> Fixes: d7bf353fd0aa3 ("bq24190_charger: Add support for TI BQ24190
> > >> Battery Charger")
> > >> Cc: Mark A. Greer <mgreer@animalcreek.com>
> > >> Cc: Matt Ranostay <matt@ranostay.consulting>
> > >> Signed-off-by: Liam Breck <kernel@networkimprov.net>
> > >> [tony@atomide.com: cleaned up patch description a bit]
> > >> Signed-off-by: Tony Lindgren <tony@atomide.com>
> > >> ---
> > >>  drivers/power/supply/bq24190_charger.c | 3 +++
> > >>  1 file changed, 3 insertions(+)
> > >>
> > >> diff --git a/drivers/power/supply/bq24190_charger.c b/drivers/power/supply/bq24190_charger.c
> > >> --- a/drivers/power/supply/bq24190_charger.c
> > >> +++ b/drivers/power/supply/bq24190_charger.c
> > >> @@ -1392,6 +1392,7 @@ static int bq24190_probe(struct i2c_client *client,
> > >>               return -EINVAL;
> > >>       }
> > >>
> > >> +     irq_set_status_flags(bdi->irq, IRQ_NOAUTOEN);
> > >>       ret = devm_request_threaded_irq(dev, bdi->irq, NULL,
> > >>                       bq24190_irq_handler_thread,
> > >>                       IRQF_TRIGGER_RISING | IRQF_ONESHOT,
> > >> @@ -1436,6 +1437,8 @@ static int bq24190_probe(struct i2c_client *client,
> > >>               goto out4;
> > >>       }
> > >>
> > >> +     enable_irq(bdi->irq);
> > >> +
> > >>       return 0;
> > >>
> > >>  out4:
> > >
> > > Can't you just move the irq request towards the end of the probe?
> > > That way it will also be released before the power-supply structure
> > > is released.
> > 
> > I did that in a first draft I showed Tony. He suggested this way.
> > Tony, rationale?
> 
> Both will work for me just fine as long as done in a single patch
> with no other changes.
> 
> The first option is less changes if needed as a fix, up to Sebastian
> depending on what he prefers.

Then please send the variant, which moves the block in the v2
patchset, since it behaves correctly during driver removal and
results in less lines of code.

> > diff --git a/drivers/power/bq24190_charger.c b/drivers/power/bq24190_charger.c

Also make sure, that you base your patches on power-supply's
for-next branch. Your base is way too *old*, since the driver
lives in drivers/power/supply/bq24190_charger.c nowadays.

-- Sebastian

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2017-01-12 21:40 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-12  0:41 [PATCH 0/6] Few bq24190-charger fixes and improvments Tony Lindgren
2017-01-12  0:41 ` [PATCH 1/6] power: bq24190_charger: Call enable_irq() only at the end of probe() Tony Lindgren
2017-01-12 17:44   ` Sebastian Reichel
2017-01-12 20:02     ` Liam Breck
2017-01-12 20:58       ` Tony Lindgren
2017-01-12 21:40         ` Sebastian Reichel [this message]
2017-01-12 22:17           ` Liam Breck
2017-01-12  0:41 ` [PATCH 2/6] power: bq24190_charger: Fix irq triggering to IRQF_TRIGGER_FALLING Tony Lindgren
2017-01-12  0:41 ` [PATCH 3/6] power: bq24190_charger: Call power_supply_changed() only for relevant component Tony Lindgren
2017-01-12  0:41 ` [PATCH 4/6] power: bq24190_charger: Don't read fault register outside irq_handle_thread() Tony Lindgren
2017-01-12  1:32   ` Liam Breck
2017-01-12  2:11   ` Liam Breck
2017-01-12 16:22     ` Tony Lindgren
2017-01-12  0:41 ` [PATCH 5/6] power: bq24190_charger: Check the interrupt status on resume Tony Lindgren
2017-01-12  2:05   ` Liam Breck
2017-01-12 15:49     ` Tony Lindgren
2017-01-16 19:15   ` Mark Greer
2017-01-12  0:41 ` [PATCH 6/6] power: bq24190_charger: Use PM runtime autosuspend Tony Lindgren
2017-01-12  2:02   ` Liam Breck
2017-01-12 15:46     ` Tony Lindgren
2017-01-16 19:22       ` Mark Greer

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=20170112214051.kx6oaghah5sxtwr3@earth \
    --to=sre@kernel.org \
    --cc=kernel@networkimprov.net \
    --cc=liam@networkimprov.net \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=matt@ranostay.consulting \
    --cc=mgreer@animalcreek.com \
    --cc=tony@atomide.com \
    /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