libata: Apply NOLPM quirk to Crucial MX100 512GB SSDs
[pandora-kernel.git] / drivers / power / pda_power.c
index 69f8aa3..4873eaf 100644 (file)
@@ -33,9 +33,9 @@ static inline unsigned int get_irq_flags(struct resource *res)
 static struct device *dev;
 static struct pda_power_pdata *pdata;
 static struct resource *ac_irq, *usb_irq;
-static struct timer_list charger_timer;
-static struct timer_list supply_timer;
-static struct timer_list polling_timer;
+static struct delayed_work charger_work;
+static struct delayed_work polling_work;
+static struct delayed_work supply_work;
 static int polling;
 
 #ifdef CONFIG_USB_OTG_UTILS
@@ -144,7 +144,7 @@ static void update_charger(void)
        }
 }
 
-static void supply_timer_func(unsigned long unused)
+static void supply_work_func(struct work_struct *work)
 {
        if (ac_status == PDA_PSY_TO_CHANGE) {
                ac_status = new_ac_status;
@@ -165,11 +165,12 @@ static void psy_changed(void)
         * Okay, charger set. Now wait a bit before notifying supplicants,
         * charge power should stabilize.
         */
-       mod_timer(&supply_timer,
-                 jiffies + msecs_to_jiffies(pdata->wait_for_charger));
+       cancel_delayed_work(&supply_work);
+       schedule_delayed_work(&supply_work,
+                             msecs_to_jiffies(pdata->wait_for_charger));
 }
 
-static void charger_timer_func(unsigned long unused)
+static void charger_work_func(struct work_struct *work)
 {
        update_status();
        psy_changed();
@@ -188,13 +189,14 @@ static irqreturn_t power_changed_isr(int irq, void *power_supply)
         * Wait a bit before reading ac/usb line status and setting charger,
         * because ac/usb status readings may lag from irq.
         */
-       mod_timer(&charger_timer,
-                 jiffies + msecs_to_jiffies(pdata->wait_for_status));
+       cancel_delayed_work(&charger_work);
+       schedule_delayed_work(&charger_work,
+                             msecs_to_jiffies(pdata->wait_for_status));
 
        return IRQ_HANDLED;
 }
 
-static void polling_timer_func(unsigned long unused)
+static void polling_work_func(struct work_struct *work)
 {
        int changed = 0;
 
@@ -215,8 +217,9 @@ static void polling_timer_func(unsigned long unused)
        if (changed)
                psy_changed();
 
-       mod_timer(&polling_timer,
-                 jiffies + msecs_to_jiffies(pdata->polling_interval));
+       cancel_delayed_work(&polling_work);
+       schedule_delayed_work(&polling_work,
+                             msecs_to_jiffies(pdata->polling_interval));
 }
 
 #ifdef CONFIG_USB_OTG_UTILS
@@ -262,8 +265,8 @@ static int pda_power_probe(struct platform_device *pdev)
        if (!pdata->ac_max_uA)
                pdata->ac_max_uA = 500000;
 
-       setup_timer(&charger_timer, charger_timer_func, 0);
-       setup_timer(&supply_timer, supply_timer_func, 0);
+       INIT_DELAYED_WORK(&charger_work, charger_work_func);
+       INIT_DELAYED_WORK(&supply_work, supply_work_func);
 
        ac_irq = platform_get_resource_byname(pdev, IORESOURCE_IRQ, "ac");
        usb_irq = platform_get_resource_byname(pdev, IORESOURCE_IRQ, "usb");
@@ -333,9 +336,10 @@ static int pda_power_probe(struct platform_device *pdev)
 
        if (polling) {
                dev_dbg(dev, "will poll for status\n");
-               setup_timer(&polling_timer, polling_timer_func, 0);
-               mod_timer(&polling_timer,
-                         jiffies + msecs_to_jiffies(pdata->polling_interval));
+               INIT_DELAYED_WORK(&polling_work, polling_work_func);
+               cancel_delayed_work(&polling_work);
+               schedule_delayed_work(&polling_work,
+                                     msecs_to_jiffies(pdata->polling_interval));
        }
 
        if (ac_irq || usb_irq)
@@ -376,9 +380,9 @@ static int pda_power_remove(struct platform_device *pdev)
                free_irq(ac_irq->start, &pda_psy_ac);
 
        if (polling)
-               del_timer_sync(&polling_timer);
-       del_timer_sync(&charger_timer);
-       del_timer_sync(&supply_timer);
+               cancel_delayed_work_sync(&polling_work);
+       cancel_delayed_work_sync(&charger_work);
+       cancel_delayed_work_sync(&supply_work);
 
        if (pdata->is_usb_online)
                power_supply_unregister(&pda_psy_usb);