@@ -351,8 +351,8 @@ static void pm_dev_dbg(struct device *dev, pm_message_t state, char *info)
static void pm_dev_err(struct device *dev, pm_message_t state, char *info,
int error)
{
- printk(KERN_ERR "PM: Device %s failed to %s%s: error %d\n",
- dev_name(dev), pm_verb(state.event), info, error);
+ dev_err(dev, "PM: failed to %s%s: error %d\n",
+ pm_verb(state.event), info, error);
}
static void dpm_show_time(ktime_t starttime, pm_message_t state, char *info)
@@ -385,7 +385,7 @@ static int dpm_run_callback(pm_callback_t cb, struct device *dev,
pm_dev_dbg(dev, state, info);
error = cb(dev);
- suspend_report_result(cb, error);
+ suspend_report_result(dev, cb, error);
initcall_debug_report(dev, calltime, error, state, info);
@@ -1112,7 +1112,7 @@ static int legacy_suspend(struct device *dev, pm_message_t state,
calltime = initcall_debug_start(dev);
error = cb(dev, state);
- suspend_report_result(cb, error);
+ suspend_report_result(dev, cb, error);
initcall_debug_report(dev, calltime, error, state, info);
@@ -1345,7 +1345,7 @@ static int device_prepare(struct device *dev, pm_message_t state)
if (callback) {
error = callback(dev);
- suspend_report_result(callback, error);
+ suspend_report_result(dev, callback, error);
}
device_unlock(dev);
@@ -1381,9 +1381,8 @@ int dpm_prepare(pm_message_t state)
error = 0;
continue;
}
- printk(KERN_INFO "PM: Device %s not prepared "
- "for power transition: code %d\n",
- dev_name(dev), error);
+ dev_info(dev, "PM: not prepared for power transition: code %d\n",
+ error);
put_device(dev);
break;
}
@@ -1417,10 +1416,11 @@ int dpm_suspend_start(pm_message_t state)
}
EXPORT_SYMBOL_GPL(dpm_suspend_start);
-void __suspend_report_result(const char *function, void *fn, int ret)
+void __suspend_report_result(const struct device *dev,
+ const char *function, void *fn, int ret)
{
if (ret)
- printk(KERN_ERR "%s(): %pF returns %d\n", function, fn, ret);
+ dev_err(dev, "PM: %s(): %pF returns %d\n", function, fn, ret);
}
EXPORT_SYMBOL_GPL(__suspend_report_result);
@@ -484,7 +484,7 @@ static int pci_legacy_suspend(struct device *dev, pm_message_t state)
int error;
error = drv->suspend(pci_dev, state);
- suspend_report_result(drv->suspend, error);
+ suspend_report_result(dev, drv->suspend, error);
if (error)
return error;
@@ -511,7 +511,7 @@ static int pci_legacy_suspend_late(struct device *dev, pm_message_t state)
int error;
error = drv->suspend_late(pci_dev, state);
- suspend_report_result(drv->suspend_late, error);
+ suspend_report_result(dev, drv->suspend_late, error);
if (error)
return error;
@@ -638,7 +638,7 @@ static int pci_pm_suspend(struct device *dev)
int error;
error = pm->suspend(dev);
- suspend_report_result(pm->suspend, error);
+ suspend_report_result(dev, pm->suspend, error);
if (error)
return error;
@@ -674,7 +674,7 @@ static int pci_pm_suspend_noirq(struct device *dev)
int error;
error = pm->suspend_noirq(dev);
- suspend_report_result(pm->suspend_noirq, error);
+ suspend_report_result(dev, pm->suspend_noirq, error);
if (error)
return error;
@@ -791,7 +791,7 @@ static int pci_pm_freeze(struct device *dev)
int error;
error = pm->freeze(dev);
- suspend_report_result(pm->freeze, error);
+ suspend_report_result(dev, pm->freeze, error);
if (error)
return error;
}
@@ -814,7 +814,7 @@ static int pci_pm_freeze_noirq(struct device *dev)
int error;
error = drv->pm->freeze_noirq(dev);
- suspend_report_result(drv->pm->freeze_noirq, error);
+ suspend_report_result(dev, drv->pm->freeze_noirq, error);
if (error)
return error;
}
@@ -898,7 +898,7 @@ static int pci_pm_poweroff(struct device *dev)
int error;
error = pm->poweroff(dev);
- suspend_report_result(pm->poweroff, error);
+ suspend_report_result(dev, pm->poweroff, error);
if (error)
return error;
}
@@ -927,7 +927,7 @@ static int pci_pm_poweroff_noirq(struct device *dev)
int error;
error = drv->pm->poweroff_noirq(dev);
- suspend_report_result(drv->pm->poweroff_noirq, error);
+ suspend_report_result(dev, drv->pm->poweroff_noirq, error);
if (error)
return error;
}
@@ -1040,7 +1040,7 @@ static int pci_pm_runtime_suspend(struct device *dev)
pci_dev->state_saved = false;
pci_dev->no_d3cold = false;
error = pm->runtime_suspend(dev);
- suspend_report_result(pm->runtime_suspend, error);
+ suspend_report_result(dev, pm->runtime_suspend, error);
if (error)
return error;
if (!pci_dev->d3cold_allowed)
@@ -165,7 +165,7 @@ static int __pnp_bus_suspend(struct device *dev, pm_message_t state)
if (pnp_drv->driver.pm && pnp_drv->driver.pm->suspend) {
error = pnp_drv->driver.pm->suspend(dev);
- suspend_report_result(pnp_drv->driver.pm->suspend, error);
+ suspend_report_result(dev, pnp_drv->driver.pm->suspend, error);
if (error)
return error;
}
@@ -453,7 +453,7 @@ static int suspend_common(struct device *dev, bool do_wakeup)
HCD_WAKEUP_PENDING(hcd->shared_hcd))
return -EBUSY;
retval = hcd->driver->pci_suspend(hcd, do_wakeup);
- suspend_report_result(hcd->driver->pci_suspend, retval);
+ suspend_report_result(dev, hcd->driver->pci_suspend, retval);
/* Check again in case wakeup raced with pci_suspend */
if ((retval == 0 && do_wakeup && HCD_WAKEUP_PENDING(hcd)) ||
@@ -566,7 +566,7 @@ static int hcd_pci_suspend_noirq(struct device *dev)
dev_dbg(dev, "--> PCI %s\n",
pci_power_name(pci_dev->current_state));
} else {
- suspend_report_result(pci_prepare_to_sleep, retval);
+ suspend_report_result(dev, pci_prepare_to_sleep, retval);
return retval;
}
@@ -644,12 +644,11 @@ extern int dpm_suspend_start(pm_message_t state);
extern int dpm_suspend(pm_message_t state);
extern int dpm_prepare(pm_message_t state);
-extern void __suspend_report_result(const char *function, void *fn, int ret);
+extern void __suspend_report_result(const struct device *dev,
+ const char *function, void *fn, int ret);
-#define suspend_report_result(fn, ret) \
- do { \
- __suspend_report_result(__func__, fn, ret); \
- } while (0)
+#define suspend_report_result(dev, fn, ret) \
+ __suspend_report_result(dev, __func__, fn, ret)
extern int device_pm_wait_for_dev(struct device *sub, struct device *dev);
extern void dpm_for_each_dev(void *data, void (*fn)(struct device *, void *));
@@ -685,7 +684,10 @@ static inline int dpm_suspend_start(pm_message_t state)
return 0;
}
-#define suspend_report_result(fn, ret) do {} while (0)
+static inline void suspend_report_result(const struct device *dev,
+ const char *fn, int ret)
+{
+}
static inline int device_pm_wait_for_dev(struct device *a, struct device *b)
{