Re: [PATCH 1/6] power: bq24190_charger: Call enable_irq() only at the end of probe()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Liam & Tony,

On Wed, Jan 11, 2017 at 04:41:49PM -0800, Tony Lindgren wrote:
> From: Liam Breck <kernel@xxxxxxxxxxxxxxxxx>
> 
> 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@xxxxxxxxxxxxxxx>
> Cc: Matt Ranostay <matt@ranostay.consulting>
> Signed-off-by: Liam Breck <kernel@xxxxxxxxxxxxxxxxx>
> [tony@xxxxxxxxxxx: cleaned up patch description a bit]
> Signed-off-by: Tony Lindgren <tony@xxxxxxxxxxx>
> ---
>  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.

-- Sebastian

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux