power: supply: bq27xxx: Fix I2C IRQ race on remove
commit 444ff00734f3878cd54ddd1ed5e2e6dbea9326d5 upstream.
devm_request_threaded_irq() requested IRQs are only free-ed after
the driver's remove function has ran. So the IRQ could trigger and
call bq27xxx_battery_update() after bq27xxx_battery_teardown() has
already run.
Switch to explicitly free-ing the IRQ in bq27xxx_battery_i2c_remove()
to fix this.
Fixes: 8807feb91b
("power: bq27xxx_battery: Add interrupt handling support")
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
7b3b119649
commit
dafe9136be
@ -187,7 +187,7 @@ static int bq27xxx_battery_i2c_probe(struct i2c_client *client,
|
|||||||
i2c_set_clientdata(client, di);
|
i2c_set_clientdata(client, di);
|
||||||
|
|
||||||
if (client->irq) {
|
if (client->irq) {
|
||||||
ret = devm_request_threaded_irq(&client->dev, client->irq,
|
ret = request_threaded_irq(client->irq,
|
||||||
NULL, bq27xxx_battery_irq_handler_thread,
|
NULL, bq27xxx_battery_irq_handler_thread,
|
||||||
IRQF_ONESHOT,
|
IRQF_ONESHOT,
|
||||||
di->name, di);
|
di->name, di);
|
||||||
@ -217,6 +217,7 @@ static int bq27xxx_battery_i2c_remove(struct i2c_client *client)
|
|||||||
{
|
{
|
||||||
struct bq27xxx_device_info *di = i2c_get_clientdata(client);
|
struct bq27xxx_device_info *di = i2c_get_clientdata(client);
|
||||||
|
|
||||||
|
free_irq(client->irq, di);
|
||||||
bq27xxx_battery_teardown(di);
|
bq27xxx_battery_teardown(di);
|
||||||
|
|
||||||
mutex_lock(&battery_mutex);
|
mutex_lock(&battery_mutex);
|
||||||
|
Loading…
Reference in New Issue
Block a user