kernel: update 3.18 to 3.18.1
[openwrt.git] / target / linux / generic / patches-3.18 / 020-ssb_update.patch
1 --- a/drivers/ssb/pcihost_wrapper.c
2 +++ b/drivers/ssb/pcihost_wrapper.c
3 @@ -11,15 +11,17 @@
4   * Licensed under the GNU/GPL. See COPYING for details.
5   */
6  
7 +#include <linux/pm.h>
8  #include <linux/pci.h>
9  #include <linux/export.h>
10  #include <linux/slab.h>
11  #include <linux/ssb/ssb.h>
12  
13  
14 -#ifdef CONFIG_PM
15 -static int ssb_pcihost_suspend(struct pci_dev *dev, pm_message_t state)
16 +#ifdef CONFIG_PM_SLEEP
17 +static int ssb_pcihost_suspend(struct device *d)
18  {
19 +       struct pci_dev *dev = to_pci_dev(d);
20         struct ssb_bus *ssb = pci_get_drvdata(dev);
21         int err;
22  
23 @@ -28,17 +30,23 @@ static int ssb_pcihost_suspend(struct pc
24                 return err;
25         pci_save_state(dev);
26         pci_disable_device(dev);
27 -       pci_set_power_state(dev, pci_choose_state(dev, state));
28 +
29 +       /* if there is a wakeup enabled child device on ssb bus,
30 +          enable pci wakeup posibility. */
31 +       device_set_wakeup_enable(d, d->power.wakeup_path);
32 +
33 +       pci_prepare_to_sleep(dev);
34  
35         return 0;
36  }
37  
38 -static int ssb_pcihost_resume(struct pci_dev *dev)
39 +static int ssb_pcihost_resume(struct device *d)
40  {
41 +       struct pci_dev *dev = to_pci_dev(d);
42         struct ssb_bus *ssb = pci_get_drvdata(dev);
43         int err;
44  
45 -       pci_set_power_state(dev, PCI_D0);
46 +       pci_back_from_sleep(dev);
47         err = pci_enable_device(dev);
48         if (err)
49                 return err;
50 @@ -49,10 +57,12 @@ static int ssb_pcihost_resume(struct pci
51  
52         return 0;
53  }
54 -#else /* CONFIG_PM */
55 -# define ssb_pcihost_suspend   NULL
56 -# define ssb_pcihost_resume    NULL
57 -#endif /* CONFIG_PM */
58 +
59 +static const struct dev_pm_ops ssb_pcihost_pm_ops = {
60 +       SET_SYSTEM_SLEEP_PM_OPS(ssb_pcihost_suspend, ssb_pcihost_resume)
61 +};
62 +
63 +#endif /* CONFIG_PM_SLEEP */
64  
65  static int ssb_pcihost_probe(struct pci_dev *dev,
66                              const struct pci_device_id *id)
67 @@ -115,8 +125,9 @@ int ssb_pcihost_register(struct pci_driv
68  {
69         driver->probe = ssb_pcihost_probe;
70         driver->remove = ssb_pcihost_remove;
71 -       driver->suspend = ssb_pcihost_suspend;
72 -       driver->resume = ssb_pcihost_resume;
73 +#ifdef CONFIG_PM_SLEEP
74 +       driver->driver.pm = &ssb_pcihost_pm_ops;
75 +#endif
76  
77         return pci_register_driver(driver);
78  }