Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1192438 > unrolled thread

Re: [RFT/RFC] power_supply: bq2415x_charger: Initialize workqueue before scheduling it

Started byPali Rohár <pali.rohar@gmail.com>
First post2015-07-25 23:50 +0200
Last post2015-07-27 16:50 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [RFT/RFC] power_supply: bq2415x_charger: Initialize workqueue before scheduling it Pali Rohár <pali.rohar@gmail.com> - 2015-07-25 23:50 +0200
    Re: [RFT/RFC] power_supply: bq2415x_charger: Initialize workqueue  before scheduling it Sebastian Reichel <sre@kernel.org> - 2015-07-27 16:30 +0200
      Re: [RFT/RFC] power_supply: bq2415x_charger: Initialize workqueue  before scheduling it Pali Rohár <pali.rohar@gmail.com> - 2015-07-27 16:50 +0200

#1192438 — Re: [RFT/RFC] power_supply: bq2415x_charger: Initialize workqueue before scheduling it

FromPali Rohár <pali.rohar@gmail.com>
Date2015-07-25 23:50 +0200
SubjectRe: [RFT/RFC] power_supply: bq2415x_charger: Initialize workqueue before scheduling it
Message-ID<pQfuq-8qO-15@gated-at.bofh.it>

[Multipart message — attachments visible in raw view] — view raw

On Tuesday 14 July 2015 02:34:13 Krzysztof Kozlowski wrote:
> The driver during probe registers a power supply notifier
> (with bq2415x_notifier_call() callback) and calls it manually right
> after. The notifier callback function schedules driver's workqueue
> (bq->work).
> 
> However the workqueue was initialized after these two events (after
> registering power supply notifier and calling manually the callback).
> 
> When power supply core notified the driver (executing its
> bq2415x_notifier_call() callback) the scheduled workqueue could be
> still uninitialized.
> 
> Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> Reported-by: Pali Rohár <pali.rohar@gmail.com>
> 
> ---
> 
> I don't have the hardware, please test. Additionally I could not find
> the commit which introduced the issue so I did not cc-stable.
> ---
>  drivers/power/bq2415x_charger.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/power/bq2415x_charger.c
> b/drivers/power/bq2415x_charger.c index e98dcb661cc9..527ed0f18796
> 100644
> --- a/drivers/power/bq2415x_charger.c
> +++ b/drivers/power/bq2415x_charger.c
> @@ -1601,6 +1601,7 @@ static int bq2415x_probe(struct i2c_client
> *client, bq->reported_mode = BQ2415X_MODE_OFF;
>  	bq->autotimer = 0;
>  	bq->automode = 0;
> +	INIT_DELAYED_WORK(&bq->work, bq2415x_timer_work);
> 
>  	if (np || ACPI_HANDLE(bq->dev)) {
>  		ret = device_property_read_u32(bq->dev,
> @@ -1677,7 +1678,6 @@ static int bq2415x_probe(struct i2c_client
> *client, dev_info(bq->dev, "automode not supported\n");
>  	}
> 
> -	INIT_DELAYED_WORK(&bq->work, bq2415x_timer_work);
>  	bq2415x_set_autotimer(bq, 1);
> 
>  	dev_info(bq->dev, "driver registered\n");

Looks like this is really problem. I sent alternative patch to mailing 
list which should fix this problem too plus allows to load 
bq2415x_charger.ko in n900 qemu.

-- 
Pali Rohár
pali.rohar@gmail.com

[toc] | [next] | [standalone]


#1193185 — Re: [RFT/RFC] power_supply: bq2415x_charger: Initialize workqueue before scheduling it

FromSebastian Reichel <sre@kernel.org>
Date2015-07-27 16:30 +0200
SubjectRe: [RFT/RFC] power_supply: bq2415x_charger: Initialize workqueue before scheduling it
Message-ID<pQRzI-4u1-11@gated-at.bofh.it>
In reply to#1192438

[Multipart message — attachments visible in raw view] — view raw

Hi,

On Sat, Jul 25, 2015 at 11:49:06PM +0200, Pali Rohár wrote:
> On Tuesday 14 July 2015 02:34:13 Krzysztof Kozlowski wrote:
> > The driver during probe registers a power supply notifier
> > (with bq2415x_notifier_call() callback) and calls it manually right
> > after. The notifier callback function schedules driver's workqueue
> > (bq->work).
> > 
> > However the workqueue was initialized after these two events (after
> > registering power supply notifier and calling manually the callback).
> > 
> > When power supply core notified the driver (executing its
> > bq2415x_notifier_call() callback) the scheduled workqueue could be
> > still uninitialized.
> > 
> > Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> > Reported-by: Pali Rohár <pali.rohar@gmail.com>
> > 
> > ---
> > 
> > I don't have the hardware, please test. Additionally I could not find
> > the commit which introduced the issue so I did not cc-stable.
> > ---
> >  drivers/power/bq2415x_charger.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/power/bq2415x_charger.c
> > b/drivers/power/bq2415x_charger.c index e98dcb661cc9..527ed0f18796
> > 100644
> > --- a/drivers/power/bq2415x_charger.c
> > +++ b/drivers/power/bq2415x_charger.c
> > @@ -1601,6 +1601,7 @@ static int bq2415x_probe(struct i2c_client
> > *client, bq->reported_mode = BQ2415X_MODE_OFF;
> >  	bq->autotimer = 0;
> >  	bq->automode = 0;
> > +	INIT_DELAYED_WORK(&bq->work, bq2415x_timer_work);
> > 
> >  	if (np || ACPI_HANDLE(bq->dev)) {
> >  		ret = device_property_read_u32(bq->dev,
> > @@ -1677,7 +1678,6 @@ static int bq2415x_probe(struct i2c_client
> > *client, dev_info(bq->dev, "automode not supported\n");
> >  	}
> > 
> > -	INIT_DELAYED_WORK(&bq->work, bq2415x_timer_work);
> >  	bq2415x_set_autotimer(bq, 1);
> > 
> >  	dev_info(bq->dev, "driver registered\n");
> 
> Looks like this is really problem. I sent alternative patch to mailing 
> list which should fix this problem too plus allows to load 
> bq2415x_charger.ko in n900 qemu.

I have not yet reviewed your patch (just skipped over it), but the
qemu changes are a bit intrusive for -rc. I suggest to apply this
patch for 4.2-rc. The extended patch can then be added in 4.3.

-- Sebastian

[toc] | [prev] | [next] | [standalone]


#1193201 — Re: [RFT/RFC] power_supply: bq2415x_charger: Initialize workqueue before scheduling it

FromPali Rohár <pali.rohar@gmail.com>
Date2015-07-27 16:50 +0200
SubjectRe: [RFT/RFC] power_supply: bq2415x_charger: Initialize workqueue before scheduling it
Message-ID<pQRT4-4QW-5@gated-at.bofh.it>
In reply to#1193185
On Monday 27 July 2015 16:22:29 Sebastian Reichel wrote:
> Hi,
> 
> On Sat, Jul 25, 2015 at 11:49:06PM +0200, Pali Rohár wrote:
> > On Tuesday 14 July 2015 02:34:13 Krzysztof Kozlowski wrote:
> > > The driver during probe registers a power supply notifier
> > > (with bq2415x_notifier_call() callback) and calls it manually right
> > > after. The notifier callback function schedules driver's workqueue
> > > (bq->work).
> > > 
> > > However the workqueue was initialized after these two events (after
> > > registering power supply notifier and calling manually the callback).
> > > 
> > > When power supply core notified the driver (executing its
> > > bq2415x_notifier_call() callback) the scheduled workqueue could be
> > > still uninitialized.
> > > 
> > > Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> > > Reported-by: Pali Rohár <pali.rohar@gmail.com>
> > > 
> > > ---
> > > 
> > > I don't have the hardware, please test. Additionally I could not find
> > > the commit which introduced the issue so I did not cc-stable.
> > > ---
> > >  drivers/power/bq2415x_charger.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/power/bq2415x_charger.c
> > > b/drivers/power/bq2415x_charger.c index e98dcb661cc9..527ed0f18796
> > > 100644
> > > --- a/drivers/power/bq2415x_charger.c
> > > +++ b/drivers/power/bq2415x_charger.c
> > > @@ -1601,6 +1601,7 @@ static int bq2415x_probe(struct i2c_client
> > > *client, bq->reported_mode = BQ2415X_MODE_OFF;
> > >  	bq->autotimer = 0;
> > >  	bq->automode = 0;
> > > +	INIT_DELAYED_WORK(&bq->work, bq2415x_timer_work);
> > > 
> > >  	if (np || ACPI_HANDLE(bq->dev)) {
> > >  		ret = device_property_read_u32(bq->dev,
> > > @@ -1677,7 +1678,6 @@ static int bq2415x_probe(struct i2c_client
> > > *client, dev_info(bq->dev, "automode not supported\n");
> > >  	}
> > > 
> > > -	INIT_DELAYED_WORK(&bq->work, bq2415x_timer_work);
> > >  	bq2415x_set_autotimer(bq, 1);
> > > 
> > >  	dev_info(bq->dev, "driver registered\n");
> > 
> > Looks like this is really problem. I sent alternative patch to mailing 
> > list which should fix this problem too plus allows to load 
> > bq2415x_charger.ko in n900 qemu.
> 
> I have not yet reviewed your patch (just skipped over it), but the
> qemu changes are a bit intrusive for -rc. I suggest to apply this
> patch for 4.2-rc. The extended patch can then be added in 4.3.
> 
> -- Sebastian

I'm not sure if this patch is enough... as timer_work should be called
after that init bq2415x_set_autotimer call.

I'm ok with postponing my patch later for 4.3. So if you think apply
this one for 4.2...

-- 
Pali Rohár
pali.rohar@gmail.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web