summaryrefslogtreecommitdiff
path: root/drivers/power
diff options
context:
space:
mode:
authorMilo Kim <woogyom.kim@gmail.com>2016-12-18 05:54:26 +0300
committerSebastian Reichel <sre@kernel.org>2017-01-05 00:00:14 +0300
commit9ef0bf1184a6dfb6d6dca1feca4c28d0d8da519c (patch)
tree5b5b74063dd17a55e7f9028f30f4022db34964b1 /drivers/power
parentbdca5d9e6b9ab0082a2aeb810941d78f10b75e63 (diff)
downloadlinux-9ef0bf1184a6dfb6d6dca1feca4c28d0d8da519c.tar.xz
power: supply: tps65217: Use 'poll_task' on unloading the module
Use the task_struct variable for running polling thread. If polling task is activated, then use it to stop running thread. This is a preceding step of supporting two interrupts of TPS65217 charger, so checking single IRQ number is not appropriate when the module is removed. Signed-off-by: Milo Kim <woogyom.kim@gmail.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
Diffstat (limited to 'drivers/power')
-rw-r--r--drivers/power/supply/tps65217_charger.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/power/supply/tps65217_charger.c b/drivers/power/supply/tps65217_charger.c
index 9fd019f9b88c..4fe71abe1bd3 100644
--- a/drivers/power/supply/tps65217_charger.c
+++ b/drivers/power/supply/tps65217_charger.c
@@ -200,6 +200,7 @@ static int tps65217_charger_probe(struct platform_device *pdev)
struct tps65217 *tps = dev_get_drvdata(pdev->dev.parent);
struct tps65217_charger *charger;
struct power_supply_config cfg = {};
+ struct task_struct *poll_task;
int irq;
int ret;
@@ -250,14 +251,16 @@ static int tps65217_charger_probe(struct platform_device *pdev)
/* Check current state */
tps65217_charger_irq(irq, charger);
} else {
- charger->poll_task = kthread_run(tps65217_charger_poll_task,
- charger, "ktps65217charger");
- if (IS_ERR(charger->poll_task)) {
- ret = PTR_ERR(charger->poll_task);
+ poll_task = kthread_run(tps65217_charger_poll_task,
+ charger, "ktps65217charger");
+ if (IS_ERR(poll_task)) {
+ ret = PTR_ERR(poll_task);
dev_err(charger->dev,
"Unable to run kthread err %d\n", ret);
return ret;
}
+
+ charger->poll_task = poll_task;
}
return 0;
@@ -267,7 +270,7 @@ static int tps65217_charger_remove(struct platform_device *pdev)
{
struct tps65217_charger *charger = platform_get_drvdata(pdev);
- if (charger->irq == -ENXIO)
+ if (charger->poll_task)
kthread_stop(charger->poll_task);
return 0;