From 96ad0012709824789c26d112693e2de5f08f3ba7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E9=BB=84=E6=B6=9B?= Date: Tue, 1 Apr 2014 18:29:36 +0800 Subject: [PATCH] bq24296: fix reboot warning WARNING: at kernel/irq/manage.c:1249 __free_irq+0x88/0x184() Trying to free already-free IRQ 200 Modules linked in: CPU: 0 PID: 1 Comm: init Not tainted 3.10.0 #296 [] (unwind_backtrace+0x0/0xe0) from [] (show_stack+0x10/0x14) [] (show_stack+0x10/0x14) from [] (warn_slowpath_common+0x4c/0x68) [] (warn_slowpath_common+0x4c/0x68) from [] (warn_slowpath_fmt+0x2c/0x3c) [] (warn_slowpath_fmt+0x2c/0x3c) from [] (__free_irq+0x88/0x184) [] (__free_irq+0x88/0x184) from [] (free_irq+0x74/0x98) [] (free_irq+0x74/0x98) from [] (i2c_device_shutdown+0x3c/0x44) [] (i2c_device_shutdown+0x3c/0x44) from [] (device_shutdown+0x110/0x170) [] (device_shutdown+0x110/0x170) from [] (kernel_restart+0xc/0x50) [] (kernel_restart+0xc/0x50) from [] (SyS_reboot+0x150/0x1b0) [] (SyS_reboot+0x150/0x1b0) from [] (ret_fast_syscall+0x0/0x30) --- drivers/power/bq24296_charger.c | 14 +++++++------- include/linux/power/bq24296_charger.h | 1 + 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/power/bq24296_charger.c b/drivers/power/bq24296_charger.c index d5a2cfa1adc0..7312c87c06f9 100755 --- a/drivers/power/bq24296_charger.c +++ b/drivers/power/bq24296_charger.c @@ -523,7 +523,7 @@ static int bq24296_battery_probe(struct i2c_client *client,const struct i2c_devi u8 retval = 0; struct bq24296_board *pdev; struct device_node *bq24296_node; - int ret=0,irq=0; + int ret=0; DBG("%s,line=%d\n", __func__,__LINE__); @@ -578,8 +578,8 @@ static int bq24296_battery_probe(struct i2c_client *client,const struct i2c_devi if (gpio_is_valid(pdev->chg_irq_pin)){ - irq = gpio_to_irq(pdev->chg_irq_pin); - ret = request_threaded_irq(irq, NULL,chg_irq_func, IRQF_TRIGGER_FALLING| IRQF_ONESHOT, "bq24296_chg_irq", di); + pdev->chg_irq = gpio_to_irq(pdev->chg_irq_pin); + ret = request_threaded_irq(pdev->chg_irq, NULL, chg_irq_func, IRQF_TRIGGER_FALLING| IRQF_ONESHOT, "bq24296_chg_irq", di); if (ret) { ret = -EINVAL; printk("failed to request bq24296_chg_irq\n"); @@ -600,12 +600,12 @@ batt_failed_2: static void bq24296_battery_shutdown(struct i2c_client *client) { + struct bq24296_device_info *di = i2c_get_clientdata(client); - if (gpio_is_valid(bq24296_pdata->chg_irq_pin)){ - free_irq(gpio_to_irq(bq24296_pdata->chg_irq_pin), NULL); - } - + if (bq24296_pdata->chg_irq) + free_irq(bq24296_pdata->chg_irq, di); } + static int bq24296_battery_remove(struct i2c_client *client) { struct bq24296_device_info *di = i2c_get_clientdata(client); diff --git a/include/linux/power/bq24296_charger.h b/include/linux/power/bq24296_charger.h index 12358ed048c3..24a53626e6ce 100755 --- a/include/linux/power/bq24296_charger.h +++ b/include/linux/power/bq24296_charger.h @@ -153,6 +153,7 @@ struct bq24296_platform_data { struct bq24296_board { unsigned int otg_usb_pin; unsigned int chg_irq_pin; + unsigned int chg_irq; unsigned int dc_det_pin; unsigned int psel_pin; struct device_node *of_node; -- 2.34.1