aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/device_pm.c1
-rw-r--r--drivers/amba/bus.c2
-rw-r--r--drivers/ata/libata-core.c2
-rw-r--r--drivers/base/platform.c1
-rw-r--r--drivers/base/power/domain.c1
-rw-r--r--drivers/base/power/generic_ops.c23
-rw-r--r--drivers/base/power/runtime.c12
-rw-r--r--drivers/dma/intel_mid_dma.c2
-rw-r--r--drivers/gpio/gpio-langwell.c6
-rw-r--r--drivers/i2c/i2c-core.c2
-rw-r--r--drivers/mfd/ab8500-gpadc.c8
-rw-r--r--drivers/mmc/core/bus.c2
-rw-r--r--drivers/mmc/core/sdio_bus.c2
-rw-r--r--drivers/pci/pci-driver.c14
-rw-r--r--drivers/scsi/scsi_pm.c11
-rw-r--r--drivers/sh/pm_runtime.c2
-rw-r--r--drivers/spi/spi.c2
-rw-r--r--drivers/tty/serial/mfd.c9
-rw-r--r--drivers/usb/core/driver.c3
-rw-r--r--drivers/usb/core/port.c1
20 files changed, 27 insertions, 79 deletions
diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c
index bc493aa3af19..1eb8b6258786 100644
--- a/drivers/acpi/device_pm.c
+++ b/drivers/acpi/device_pm.c
@@ -886,7 +886,6 @@ static struct dev_pm_domain acpi_general_pm_domain = {
886#ifdef CONFIG_PM_RUNTIME 886#ifdef CONFIG_PM_RUNTIME
887 .runtime_suspend = acpi_subsys_runtime_suspend, 887 .runtime_suspend = acpi_subsys_runtime_suspend,
888 .runtime_resume = acpi_subsys_runtime_resume, 888 .runtime_resume = acpi_subsys_runtime_resume,
889 .runtime_idle = pm_generic_runtime_idle,
890#endif 889#endif
891#ifdef CONFIG_PM_SLEEP 890#ifdef CONFIG_PM_SLEEP
892 .prepare = acpi_subsys_prepare, 891 .prepare = acpi_subsys_prepare,
diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c
index cdbad3a454a0..c6707278a6bb 100644
--- a/drivers/amba/bus.c
+++ b/drivers/amba/bus.c
@@ -284,7 +284,7 @@ static const struct dev_pm_ops amba_pm = {
284 SET_RUNTIME_PM_OPS( 284 SET_RUNTIME_PM_OPS(
285 amba_pm_runtime_suspend, 285 amba_pm_runtime_suspend,
286 amba_pm_runtime_resume, 286 amba_pm_runtime_resume,
287 pm_generic_runtime_idle 287 NULL
288 ) 288 )
289}; 289};
290 290
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 63c743baf920..84e3b62aa368 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -5430,7 +5430,7 @@ static int ata_port_runtime_idle(struct device *dev)
5430 return -EBUSY; 5430 return -EBUSY;
5431 } 5431 }
5432 5432
5433 return pm_runtime_suspend(dev); 5433 return 0;
5434} 5434}
5435 5435
5436static int ata_port_runtime_suspend(struct device *dev) 5436static int ata_port_runtime_suspend(struct device *dev)
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index 9eda84246ffd..96a930387ebc 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -888,7 +888,6 @@ int platform_pm_restore(struct device *dev)
888static const struct dev_pm_ops platform_dev_pm_ops = { 888static const struct dev_pm_ops platform_dev_pm_ops = {
889 .runtime_suspend = pm_generic_runtime_suspend, 889 .runtime_suspend = pm_generic_runtime_suspend,
890 .runtime_resume = pm_generic_runtime_resume, 890 .runtime_resume = pm_generic_runtime_resume,
891 .runtime_idle = pm_generic_runtime_idle,
892 USE_PLATFORM_PM_SLEEP_OPS 891 USE_PLATFORM_PM_SLEEP_OPS
893}; 892};
894 893
diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index 7072404c8b6d..bfb8955c406c 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -2143,7 +2143,6 @@ void pm_genpd_init(struct generic_pm_domain *genpd,
2143 genpd->max_off_time_changed = true; 2143 genpd->max_off_time_changed = true;
2144 genpd->domain.ops.runtime_suspend = pm_genpd_runtime_suspend; 2144 genpd->domain.ops.runtime_suspend = pm_genpd_runtime_suspend;
2145 genpd->domain.ops.runtime_resume = pm_genpd_runtime_resume; 2145 genpd->domain.ops.runtime_resume = pm_genpd_runtime_resume;
2146 genpd->domain.ops.runtime_idle = pm_generic_runtime_idle;
2147 genpd->domain.ops.prepare = pm_genpd_prepare; 2146 genpd->domain.ops.prepare = pm_genpd_prepare;
2148 genpd->domain.ops.suspend = pm_genpd_suspend; 2147 genpd->domain.ops.suspend = pm_genpd_suspend;
2149 genpd->domain.ops.suspend_late = pm_genpd_suspend_late; 2148 genpd->domain.ops.suspend_late = pm_genpd_suspend_late;
diff --git a/drivers/base/power/generic_ops.c b/drivers/base/power/generic_ops.c
index bfd898b8988e..5ee030a864f9 100644
--- a/drivers/base/power/generic_ops.c
+++ b/drivers/base/power/generic_ops.c
@@ -12,29 +12,6 @@
12 12
13#ifdef CONFIG_PM_RUNTIME 13#ifdef CONFIG_PM_RUNTIME
14/** 14/**
15 * pm_generic_runtime_idle - Generic runtime idle callback for subsystems.
16 * @dev: Device to handle.
17 *
18 * If PM operations are defined for the @dev's driver and they include
19 * ->runtime_idle(), execute it and return its error code, if nonzero.
20 * Otherwise, execute pm_runtime_suspend() for the device and return 0.
21 */
22int pm_generic_runtime_idle(struct device *dev)
23{
24 const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
25
26 if (pm && pm->runtime_idle) {
27 int ret = pm->runtime_idle(dev);
28 if (ret)
29 return ret;
30 }
31
32 pm_runtime_suspend(dev);
33 return 0;
34}
35EXPORT_SYMBOL_GPL(pm_generic_runtime_idle);
36
37/**
38 * pm_generic_runtime_suspend - Generic runtime suspend callback for subsystems. 15 * pm_generic_runtime_suspend - Generic runtime suspend callback for subsystems.
39 * @dev: Device to suspend. 16 * @dev: Device to suspend.
40 * 17 *
diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c
index ef13ad08afb2..268a35097578 100644
--- a/drivers/base/power/runtime.c
+++ b/drivers/base/power/runtime.c
@@ -293,11 +293,8 @@ static int rpm_idle(struct device *dev, int rpmflags)
293 /* Pending requests need to be canceled. */ 293 /* Pending requests need to be canceled. */
294 dev->power.request = RPM_REQ_NONE; 294 dev->power.request = RPM_REQ_NONE;
295 295
296 if (dev->power.no_callbacks) { 296 if (dev->power.no_callbacks)
297 /* Assume ->runtime_idle() callback would have suspended. */
298 retval = rpm_suspend(dev, rpmflags);
299 goto out; 297 goto out;
300 }
301 298
302 /* Carry out an asynchronous or a synchronous idle notification. */ 299 /* Carry out an asynchronous or a synchronous idle notification. */
303 if (rpmflags & RPM_ASYNC) { 300 if (rpmflags & RPM_ASYNC) {
@@ -306,7 +303,8 @@ static int rpm_idle(struct device *dev, int rpmflags)
306 dev->power.request_pending = true; 303 dev->power.request_pending = true;
307 queue_work(pm_wq, &dev->power.work); 304 queue_work(pm_wq, &dev->power.work);
308 } 305 }
309 goto out; 306 trace_rpm_return_int(dev, _THIS_IP_, 0);
307 return 0;
310 } 308 }
311 309
312 dev->power.idle_notification = true; 310 dev->power.idle_notification = true;
@@ -326,14 +324,14 @@ static int rpm_idle(struct device *dev, int rpmflags)
326 callback = dev->driver->pm->runtime_idle; 324 callback = dev->driver->pm->runtime_idle;
327 325
328 if (callback) 326 if (callback)
329 __rpm_callback(callback, dev); 327 retval = __rpm_callback(callback, dev);
330 328
331 dev->power.idle_notification = false; 329 dev->power.idle_notification = false;
332 wake_up_all(&dev->power.wait_queue); 330 wake_up_all(&dev->power.wait_queue);
333 331
334 out: 332 out:
335 trace_rpm_return_int(dev, _THIS_IP_, retval); 333 trace_rpm_return_int(dev, _THIS_IP_, retval);
336 return retval; 334 return retval ? retval : rpm_suspend(dev, rpmflags);
337} 335}
338 336
339/** 337/**
diff --git a/drivers/dma/intel_mid_dma.c b/drivers/dma/intel_mid_dma.c
index a0de82e21a7c..a975ebebea8a 100644
--- a/drivers/dma/intel_mid_dma.c
+++ b/drivers/dma/intel_mid_dma.c
@@ -1405,7 +1405,7 @@ static int dma_runtime_idle(struct device *dev)
1405 return -EAGAIN; 1405 return -EAGAIN;
1406 } 1406 }
1407 1407
1408 return pm_schedule_suspend(dev, 0); 1408 return 0;
1409} 1409}
1410 1410
1411/****************************************************************************** 1411/******************************************************************************
diff --git a/drivers/gpio/gpio-langwell.c b/drivers/gpio/gpio-langwell.c
index 62ef10a641c4..89d0d2a3b1bb 100644
--- a/drivers/gpio/gpio-langwell.c
+++ b/drivers/gpio/gpio-langwell.c
@@ -305,11 +305,7 @@ static const struct irq_domain_ops lnw_gpio_irq_ops = {
305 305
306static int lnw_gpio_runtime_idle(struct device *dev) 306static int lnw_gpio_runtime_idle(struct device *dev)
307{ 307{
308 int err = pm_schedule_suspend(dev, 500); 308 pm_schedule_suspend(dev, 500);
309
310 if (!err)
311 return 0;
312
313 return -EBUSY; 309 return -EBUSY;
314} 310}
315 311
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 48e31ed69dbf..f32ca293ae0e 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -435,7 +435,7 @@ static const struct dev_pm_ops i2c_device_pm_ops = {
435 SET_RUNTIME_PM_OPS( 435 SET_RUNTIME_PM_OPS(
436 pm_generic_runtime_suspend, 436 pm_generic_runtime_suspend,
437 pm_generic_runtime_resume, 437 pm_generic_runtime_resume,
438 pm_generic_runtime_idle 438 NULL
439 ) 439 )
440}; 440};
441 441
diff --git a/drivers/mfd/ab8500-gpadc.c b/drivers/mfd/ab8500-gpadc.c
index 13f7866de46e..3598b0ecf8c7 100644
--- a/drivers/mfd/ab8500-gpadc.c
+++ b/drivers/mfd/ab8500-gpadc.c
@@ -886,12 +886,6 @@ static int ab8500_gpadc_runtime_resume(struct device *dev)
886 return ret; 886 return ret;
887} 887}
888 888
889static int ab8500_gpadc_runtime_idle(struct device *dev)
890{
891 pm_runtime_suspend(dev);
892 return 0;
893}
894
895static int ab8500_gpadc_suspend(struct device *dev) 889static int ab8500_gpadc_suspend(struct device *dev)
896{ 890{
897 struct ab8500_gpadc *gpadc = dev_get_drvdata(dev); 891 struct ab8500_gpadc *gpadc = dev_get_drvdata(dev);
@@ -1039,7 +1033,7 @@ static int ab8500_gpadc_remove(struct platform_device *pdev)
1039static const struct dev_pm_ops ab8500_gpadc_pm_ops = { 1033static const struct dev_pm_ops ab8500_gpadc_pm_ops = {
1040 SET_RUNTIME_PM_OPS(ab8500_gpadc_runtime_suspend, 1034 SET_RUNTIME_PM_OPS(ab8500_gpadc_runtime_suspend,
1041 ab8500_gpadc_runtime_resume, 1035 ab8500_gpadc_runtime_resume,
1042 ab8500_gpadc_runtime_idle) 1036 NULL)
1043 SET_SYSTEM_SLEEP_PM_OPS(ab8500_gpadc_suspend, 1037 SET_SYSTEM_SLEEP_PM_OPS(ab8500_gpadc_suspend,
1044 ab8500_gpadc_resume) 1038 ab8500_gpadc_resume)
1045 1039
diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c
index e219c97a02a4..9d5c71125576 100644
--- a/drivers/mmc/core/bus.c
+++ b/drivers/mmc/core/bus.c
@@ -164,7 +164,7 @@ static int mmc_runtime_resume(struct device *dev)
164 164
165static int mmc_runtime_idle(struct device *dev) 165static int mmc_runtime_idle(struct device *dev)
166{ 166{
167 return pm_runtime_suspend(dev); 167 return 0;
168} 168}
169 169
170#endif /* !CONFIG_PM_RUNTIME */ 170#endif /* !CONFIG_PM_RUNTIME */
diff --git a/drivers/mmc/core/sdio_bus.c b/drivers/mmc/core/sdio_bus.c
index 546c67c2bbbf..6d67492a9247 100644
--- a/drivers/mmc/core/sdio_bus.c
+++ b/drivers/mmc/core/sdio_bus.c
@@ -211,7 +211,7 @@ static const struct dev_pm_ops sdio_bus_pm_ops = {
211 SET_RUNTIME_PM_OPS( 211 SET_RUNTIME_PM_OPS(
212 pm_generic_runtime_suspend, 212 pm_generic_runtime_suspend,
213 pm_generic_runtime_resume, 213 pm_generic_runtime_resume,
214 pm_generic_runtime_idle 214 NULL
215 ) 215 )
216}; 216};
217 217
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index 79277fb36c6b..e6515e21afa3 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -1050,26 +1050,22 @@ static int pci_pm_runtime_idle(struct device *dev)
1050{ 1050{
1051 struct pci_dev *pci_dev = to_pci_dev(dev); 1051 struct pci_dev *pci_dev = to_pci_dev(dev);
1052 const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; 1052 const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
1053 int ret = 0;
1053 1054
1054 /* 1055 /*
1055 * If pci_dev->driver is not set (unbound), the device should 1056 * If pci_dev->driver is not set (unbound), the device should
1056 * always remain in D0 regardless of the runtime PM status 1057 * always remain in D0 regardless of the runtime PM status
1057 */ 1058 */
1058 if (!pci_dev->driver) 1059 if (!pci_dev->driver)
1059 goto out; 1060 return 0;
1060 1061
1061 if (!pm) 1062 if (!pm)
1062 return -ENOSYS; 1063 return -ENOSYS;
1063 1064
1064 if (pm->runtime_idle) { 1065 if (pm->runtime_idle)
1065 int ret = pm->runtime_idle(dev); 1066 ret = pm->runtime_idle(dev);
1066 if (ret)
1067 return ret;
1068 }
1069 1067
1070out: 1068 return ret;
1071 pm_runtime_suspend(dev);
1072 return 0;
1073} 1069}
1074 1070
1075#else /* !CONFIG_PM_RUNTIME */ 1071#else /* !CONFIG_PM_RUNTIME */
diff --git a/drivers/scsi/scsi_pm.c b/drivers/scsi/scsi_pm.c
index 42539ee2cb11..4c5aabe21755 100644
--- a/drivers/scsi/scsi_pm.c
+++ b/drivers/scsi/scsi_pm.c
@@ -229,8 +229,6 @@ static int scsi_runtime_resume(struct device *dev)
229 229
230static int scsi_runtime_idle(struct device *dev) 230static int scsi_runtime_idle(struct device *dev)
231{ 231{
232 int err;
233
234 dev_dbg(dev, "scsi_runtime_idle\n"); 232 dev_dbg(dev, "scsi_runtime_idle\n");
235 233
236 /* Insert hooks here for targets, hosts, and transport classes */ 234 /* Insert hooks here for targets, hosts, and transport classes */
@@ -240,14 +238,11 @@ static int scsi_runtime_idle(struct device *dev)
240 238
241 if (sdev->request_queue->dev) { 239 if (sdev->request_queue->dev) {
242 pm_runtime_mark_last_busy(dev); 240 pm_runtime_mark_last_busy(dev);
243 err = pm_runtime_autosuspend(dev); 241 pm_runtime_autosuspend(dev);
244 } else { 242 return -EBUSY;
245 err = pm_runtime_suspend(dev);
246 } 243 }
247 } else {
248 err = pm_runtime_suspend(dev);
249 } 244 }
250 return err; 245 return 0;
251} 246}
252 247
253int scsi_autopm_get_device(struct scsi_device *sdev) 248int scsi_autopm_get_device(struct scsi_device *sdev)
diff --git a/drivers/sh/pm_runtime.c b/drivers/sh/pm_runtime.c
index afe9282629b9..8afa5a4589f2 100644
--- a/drivers/sh/pm_runtime.c
+++ b/drivers/sh/pm_runtime.c
@@ -25,7 +25,7 @@
25static int default_platform_runtime_idle(struct device *dev) 25static int default_platform_runtime_idle(struct device *dev)
26{ 26{
27 /* suspend synchronously to disable clocks immediately */ 27 /* suspend synchronously to disable clocks immediately */
28 return pm_runtime_suspend(dev); 28 return 0;
29} 29}
30 30
31static struct dev_pm_domain default_pm_domain = { 31static struct dev_pm_domain default_pm_domain = {
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 32b7bb111eb6..095cfaded1c0 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -223,7 +223,7 @@ static const struct dev_pm_ops spi_pm = {
223 SET_RUNTIME_PM_OPS( 223 SET_RUNTIME_PM_OPS(
224 pm_generic_runtime_suspend, 224 pm_generic_runtime_suspend,
225 pm_generic_runtime_resume, 225 pm_generic_runtime_resume,
226 pm_generic_runtime_idle 226 NULL
227 ) 227 )
228}; 228};
229 229
diff --git a/drivers/tty/serial/mfd.c b/drivers/tty/serial/mfd.c
index 5f4765a7a5c5..5dfcf3bae23a 100644
--- a/drivers/tty/serial/mfd.c
+++ b/drivers/tty/serial/mfd.c
@@ -1248,13 +1248,8 @@ static int serial_hsu_resume(struct pci_dev *pdev)
1248#ifdef CONFIG_PM_RUNTIME 1248#ifdef CONFIG_PM_RUNTIME
1249static int serial_hsu_runtime_idle(struct device *dev) 1249static int serial_hsu_runtime_idle(struct device *dev)
1250{ 1250{
1251 int err; 1251 pm_schedule_suspend(dev, 500);
1252 1252 return -EBUSY;
1253 err = pm_schedule_suspend(dev, 500);
1254 if (err)
1255 return -EBUSY;
1256
1257 return 0;
1258} 1253}
1259 1254
1260static int serial_hsu_runtime_suspend(struct device *dev) 1255static int serial_hsu_runtime_suspend(struct device *dev)
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index 6eab440e1542..7609ac4aed1c 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -1765,7 +1765,8 @@ int usb_runtime_idle(struct device *dev)
1765 */ 1765 */
1766 if (autosuspend_check(udev) == 0) 1766 if (autosuspend_check(udev) == 0)
1767 pm_runtime_autosuspend(dev); 1767 pm_runtime_autosuspend(dev);
1768 return 0; 1768 /* Tell the core not to suspend it, though. */
1769 return -EBUSY;
1769} 1770}
1770 1771
1771int usb_set_usb2_hardware_lpm(struct usb_device *udev, int enable) 1772int usb_set_usb2_hardware_lpm(struct usb_device *udev, int enable)
diff --git a/drivers/usb/core/port.c b/drivers/usb/core/port.c
index b8bad294eeb8..8c1b2c509467 100644
--- a/drivers/usb/core/port.c
+++ b/drivers/usb/core/port.c
@@ -141,7 +141,6 @@ static const struct dev_pm_ops usb_port_pm_ops = {
141#ifdef CONFIG_PM_RUNTIME 141#ifdef CONFIG_PM_RUNTIME
142 .runtime_suspend = usb_port_runtime_suspend, 142 .runtime_suspend = usb_port_runtime_suspend,
143 .runtime_resume = usb_port_runtime_resume, 143 .runtime_resume = usb_port_runtime_resume,
144 .runtime_idle = pm_generic_runtime_idle,
145#endif 144#endif
146}; 145};
147 146