]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
power_supply: Don't use flush_scheduled_work()
authorTejun Heo <tj@kernel.org>
Sat, 11 Dec 2010 16:51:45 +0000 (17:51 +0100)
committerAnton Vorontsov <cbouatmailru@gmail.com>
Tue, 21 Dec 2010 23:39:56 +0000 (02:39 +0300)
flush_scheduled_work() is deprecated and scheduled to be removed.

In battery drivers, the work can be canceled on probe failure and
removal and should be flushed on suspend.  Replace
flush_scheduled_work() usages with direct cancels and flushes.

Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
drivers/power/collie_battery.c
drivers/power/intel_mid_battery.c
drivers/power/power_supply_core.c
drivers/power/tosa_battery.c
drivers/power/wm97xx_battery.c
drivers/power/z2_battery.c

index 039f41ae217d5beedff750f992c795591ae5c31f..548d263b1ad0b1444cf65198c112e7c237b9f1bc 100644 (file)
@@ -295,7 +295,7 @@ static struct {
 static int collie_bat_suspend(struct ucb1x00_dev *dev, pm_message_t state)
 {
        /* flush all pending status updates */
-       flush_scheduled_work();
+       flush_work_sync(&bat_work);
        return 0;
 }
 
@@ -362,7 +362,7 @@ err_psy_reg_bu:
 err_psy_reg_main:
 
        /* see comment in collie_bat_remove */
-       flush_scheduled_work();
+       cancel_work_sync(&bat_work);
 
        i--;
 err_gpio:
@@ -382,12 +382,11 @@ static void __devexit collie_bat_remove(struct ucb1x00_dev *dev)
        power_supply_unregister(&collie_bat_main.psy);
 
        /*
-        * now flush all pending work.
-        * we won't get any more schedules, since all
-        * sources (isr and external_power_changed)
-        * are unregistered now.
+        * Now cancel the bat_work.  We won't get any more schedules,
+        * since all sources (isr and external_power_changed) are
+        * unregistered now.
         */
-       flush_scheduled_work();
+       cancel_work_sync(&bat_work);
 
        for (i = ARRAY_SIZE(gpios) - 1; i >= 0; i--)
                gpio_free(gpios[i].gpio);
index 2a10cd361181292f9d6bbef7ef38cda9772c839b..236147c3a5c659c9e754429bf412243465994460 100644 (file)
@@ -767,7 +767,7 @@ static int __devexit platform_pmic_battery_remove(struct platform_device *pdev)
        power_supply_unregister(&pbi->usb);
        power_supply_unregister(&pbi->batt);
 
-       flush_scheduled_work();
+       cancel_work_sync(&pbi->handler);
        kfree(pbi);
        return 0;
 }
index f06bad047d76ebcf674cfe4eed5b9627335dddf0..970f7335d3a7f67bade76d6fad08eb954427a949 100644 (file)
@@ -201,7 +201,7 @@ EXPORT_SYMBOL_GPL(power_supply_register);
 
 void power_supply_unregister(struct power_supply *psy)
 {
-       flush_scheduled_work();
+       cancel_work_sync(&psy->changed_work);
        power_supply_remove_triggers(psy);
        device_unregister(psy->dev);
 }
index ee04936b2db56da2b49258bb067e8a813126d7f9..53f0d3524fcd58f483a0ebcda42ccc0a353726e8 100644 (file)
@@ -332,7 +332,7 @@ static struct {
 static int tosa_bat_suspend(struct platform_device *dev, pm_message_t state)
 {
        /* flush all pending status updates */
-       flush_scheduled_work();
+       flush_work_sync(&bat_work);
        return 0;
 }
 
@@ -422,7 +422,7 @@ err_psy_reg_jacket:
 err_psy_reg_main:
 
        /* see comment in tosa_bat_remove */
-       flush_scheduled_work();
+       cancel_work_sync(&bat_work);
 
        i--;
 err_gpio:
@@ -445,12 +445,11 @@ static int __devexit tosa_bat_remove(struct platform_device *dev)
        power_supply_unregister(&tosa_bat_main.psy);
 
        /*
-        * now flush all pending work.
-        * we won't get any more schedules, since all
-        * sources (isr and external_power_changed)
-        * are unregistered now.
+        * Now cancel the bat_work.  We won't get any more schedules,
+        * since all sources (isr and external_power_changed) are
+        * unregistered now.
         */
-       flush_scheduled_work();
+       cancel_work_sync(&bat_work);
 
        for (i = ARRAY_SIZE(gpios) - 1; i >= 0; i--)
                gpio_free(gpios[i].gpio);
index 5071d85ec12df66438a7b9a41b337f59e333ff50..156559e56fa5e808e48ce095efde1b3178767e91 100644 (file)
@@ -147,7 +147,7 @@ static irqreturn_t wm97xx_chrg_irq(int irq, void *data)
 #ifdef CONFIG_PM
 static int wm97xx_bat_suspend(struct device *dev)
 {
-       flush_scheduled_work();
+       flush_work_sync(&bat_work);
        return 0;
 }
 
@@ -273,7 +273,7 @@ static int __devexit wm97xx_bat_remove(struct platform_device *dev)
                free_irq(gpio_to_irq(pdata->charge_gpio), dev);
                gpio_free(pdata->charge_gpio);
        }
-       flush_scheduled_work();
+       cancel_work_sync(&bat_work);
        power_supply_unregister(&bat_ps);
        kfree(prop);
        return 0;
index 85064a9f649ed34acbfad8db3980afd42bb208ec..e5ed52d719376e41c35de6c1368c8723af532f89 100644 (file)
@@ -254,7 +254,7 @@ static int __devexit z2_batt_remove(struct i2c_client *client)
        struct z2_charger *charger = i2c_get_clientdata(client);
        struct z2_battery_info *info = charger->info;
 
-       flush_scheduled_work();
+       cancel_work_sync(&charger->bat_work);
        power_supply_unregister(&charger->batt_ps);
 
        kfree(charger->batt_ps.properties);
@@ -271,7 +271,9 @@ static int __devexit z2_batt_remove(struct i2c_client *client)
 #ifdef CONFIG_PM
 static int z2_batt_suspend(struct i2c_client *client, pm_message_t state)
 {
-       flush_scheduled_work();
+       struct z2_charger *charger = i2c_get_clientdata(client);
+
+       flush_work_sync(&charger->bat_work);
        return 0;
 }