Commit e39a71ef authored by Magnus Damm's avatar Magnus Damm Committed by Rafael J. Wysocki

PM: Rename device_power_down/up()

Rename the functions performing "_noirq" dev_pm_ops
operations from device_power_down() and device_power_up()
to device_suspend_noirq() and device_resume_noirq().

The new function names are chosen to show that the functions
are responsible for calling the _noirq() versions to finalize
the suspend/resume operation. The current function names do
not perform power down/up anymore so the names may be misleading.

Global function renames:
- device_power_down() -> device_suspend_noirq()
- device_power_up() -> device_resume_noirq()

Static function renames:
- suspend_device_noirq() -> __device_suspend_noirq()
- resume_device_noirq() -> __device_resume_noirq()
Signed-off-by: default avatarMagnus Damm <damm@igel.co.jp>
Acked-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
Acked-by: default avatarLen Brown <lenb@kernel.org>
Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
parent 1380a37e
...@@ -1235,7 +1235,7 @@ static int suspend(int vetoable) ...@@ -1235,7 +1235,7 @@ static int suspend(int vetoable)
device_suspend(PMSG_SUSPEND); device_suspend(PMSG_SUSPEND);
device_power_down(PMSG_SUSPEND); device_suspend_noirq(PMSG_SUSPEND);
local_irq_disable(); local_irq_disable();
sysdev_suspend(PMSG_SUSPEND); sysdev_suspend(PMSG_SUSPEND);
...@@ -1259,7 +1259,7 @@ static int suspend(int vetoable) ...@@ -1259,7 +1259,7 @@ static int suspend(int vetoable)
sysdev_resume(); sysdev_resume();
local_irq_enable(); local_irq_enable();
device_power_up(PMSG_RESUME); device_resume_noirq(PMSG_RESUME);
device_resume(PMSG_RESUME); device_resume(PMSG_RESUME);
queue_event(APM_NORMAL_RESUME, NULL); queue_event(APM_NORMAL_RESUME, NULL);
...@@ -1277,7 +1277,7 @@ static void standby(void) ...@@ -1277,7 +1277,7 @@ static void standby(void)
{ {
int err; int err;
device_power_down(PMSG_SUSPEND); device_suspend_noirq(PMSG_SUSPEND);
local_irq_disable(); local_irq_disable();
sysdev_suspend(PMSG_SUSPEND); sysdev_suspend(PMSG_SUSPEND);
...@@ -1291,7 +1291,7 @@ static void standby(void) ...@@ -1291,7 +1291,7 @@ static void standby(void)
sysdev_resume(); sysdev_resume();
local_irq_enable(); local_irq_enable();
device_power_up(PMSG_RESUME); device_resume_noirq(PMSG_RESUME);
} }
static apm_event_t get_event(void) static apm_event_t get_event(void)
......
...@@ -315,13 +315,13 @@ static void pm_dev_err(struct device *dev, pm_message_t state, char *info, ...@@ -315,13 +315,13 @@ static void pm_dev_err(struct device *dev, pm_message_t state, char *info,
/*------------------------- Resume routines -------------------------*/ /*------------------------- Resume routines -------------------------*/
/** /**
* resume_device_noirq - Power on one device (early resume). * __device_resume_noirq - Power on one device (early resume).
* @dev: Device. * @dev: Device.
* @state: PM transition of the system being carried out. * @state: PM transition of the system being carried out.
* *
* Must be called with interrupts disabled. * Must be called with interrupts disabled.
*/ */
static int resume_device_noirq(struct device *dev, pm_message_t state) static int __device_resume_noirq(struct device *dev, pm_message_t state)
{ {
int error = 0; int error = 0;
...@@ -363,7 +363,7 @@ static void dpm_power_up(pm_message_t state) ...@@ -363,7 +363,7 @@ static void dpm_power_up(pm_message_t state)
int error; int error;
dev->power.status = DPM_OFF; dev->power.status = DPM_OFF;
error = resume_device_noirq(dev, state); error = __device_resume_noirq(dev, state);
if (error) if (error)
pm_dev_err(dev, state, " early", error); pm_dev_err(dev, state, " early", error);
} }
...@@ -371,18 +371,18 @@ static void dpm_power_up(pm_message_t state) ...@@ -371,18 +371,18 @@ static void dpm_power_up(pm_message_t state)
} }
/** /**
* device_power_up - Turn on all devices that need special attention. * device_resume_noirq - Turn on all devices that need special attention.
* @state: PM transition of the system being carried out. * @state: PM transition of the system being carried out.
* *
* Call the "early" resume handlers and enable device drivers to receive * Call the "early" resume handlers and enable device drivers to receive
* interrupts. * interrupts.
*/ */
void device_power_up(pm_message_t state) void device_resume_noirq(pm_message_t state)
{ {
dpm_power_up(state); dpm_power_up(state);
resume_device_irqs(); resume_device_irqs();
} }
EXPORT_SYMBOL_GPL(device_power_up); EXPORT_SYMBOL_GPL(device_resume_noirq);
/** /**
* resume_device - Restore state for one device. * resume_device - Restore state for one device.
...@@ -577,13 +577,13 @@ static pm_message_t resume_event(pm_message_t sleep_state) ...@@ -577,13 +577,13 @@ static pm_message_t resume_event(pm_message_t sleep_state)
} }
/** /**
* suspend_device_noirq - Shut down one device (late suspend). * __device_suspend_noirq - Shut down one device (late suspend).
* @dev: Device. * @dev: Device.
* @state: PM transition of the system being carried out. * @state: PM transition of the system being carried out.
* *
* This is called with interrupts off and only a single CPU running. * This is called with interrupts off and only a single CPU running.
*/ */
static int suspend_device_noirq(struct device *dev, pm_message_t state) static int __device_suspend_noirq(struct device *dev, pm_message_t state)
{ {
int error = 0; int error = 0;
...@@ -602,7 +602,7 @@ static int suspend_device_noirq(struct device *dev, pm_message_t state) ...@@ -602,7 +602,7 @@ static int suspend_device_noirq(struct device *dev, pm_message_t state)
} }
/** /**
* device_power_down - Shut down special devices. * device_suspend_noirq - Shut down special devices.
* @state: PM transition of the system being carried out. * @state: PM transition of the system being carried out.
* *
* Prevent device drivers from receiving interrupts and call the "late" * Prevent device drivers from receiving interrupts and call the "late"
...@@ -610,7 +610,7 @@ static int suspend_device_noirq(struct device *dev, pm_message_t state) ...@@ -610,7 +610,7 @@ static int suspend_device_noirq(struct device *dev, pm_message_t state)
* *
* Must be called under dpm_list_mtx. * Must be called under dpm_list_mtx.
*/ */
int device_power_down(pm_message_t state) int device_suspend_noirq(pm_message_t state)
{ {
struct device *dev; struct device *dev;
int error = 0; int error = 0;
...@@ -618,7 +618,7 @@ int device_power_down(pm_message_t state) ...@@ -618,7 +618,7 @@ int device_power_down(pm_message_t state)
suspend_device_irqs(); suspend_device_irqs();
mutex_lock(&dpm_list_mtx); mutex_lock(&dpm_list_mtx);
list_for_each_entry_reverse(dev, &dpm_list, power.entry) { list_for_each_entry_reverse(dev, &dpm_list, power.entry) {
error = suspend_device_noirq(dev, state); error = __device_suspend_noirq(dev, state);
if (error) { if (error) {
pm_dev_err(dev, state, " late", error); pm_dev_err(dev, state, " late", error);
break; break;
...@@ -627,10 +627,10 @@ int device_power_down(pm_message_t state) ...@@ -627,10 +627,10 @@ int device_power_down(pm_message_t state)
} }
mutex_unlock(&dpm_list_mtx); mutex_unlock(&dpm_list_mtx);
if (error) if (error)
device_power_up(resume_event(state)); device_resume_noirq(resume_event(state));
return error; return error;
} }
EXPORT_SYMBOL_GPL(device_power_down); EXPORT_SYMBOL_GPL(device_suspend_noirq);
/** /**
* suspend_device - Save state of one device. * suspend_device - Save state of one device.
......
...@@ -43,7 +43,7 @@ static int xen_suspend(void *data) ...@@ -43,7 +43,7 @@ static int xen_suspend(void *data)
if (err) { if (err) {
printk(KERN_ERR "xen_suspend: sysdev_suspend failed: %d\n", printk(KERN_ERR "xen_suspend: sysdev_suspend failed: %d\n",
err); err);
device_power_up(PMSG_RESUME); device_resume_noirq(PMSG_RESUME);
return err; return err;
} }
...@@ -69,7 +69,7 @@ static int xen_suspend(void *data) ...@@ -69,7 +69,7 @@ static int xen_suspend(void *data)
} }
sysdev_resume(); sysdev_resume();
device_power_up(PMSG_RESUME); device_resume_noirq(PMSG_RESUME);
return 0; return 0;
} }
...@@ -101,9 +101,9 @@ static void do_suspend(void) ...@@ -101,9 +101,9 @@ static void do_suspend(void)
printk(KERN_DEBUG "suspending xenstore...\n"); printk(KERN_DEBUG "suspending xenstore...\n");
xs_suspend(); xs_suspend();
err = device_power_down(PMSG_SUSPEND); err = device_suspend_noirq(PMSG_SUSPEND);
if (err) { if (err) {
printk(KERN_ERR "device_power_down failed: %d\n", err); printk(KERN_ERR "device_suspend_noirq failed: %d\n", err);
goto resume_devices; goto resume_devices;
} }
...@@ -119,7 +119,7 @@ static void do_suspend(void) ...@@ -119,7 +119,7 @@ static void do_suspend(void)
} else } else
xs_suspend_cancel(); xs_suspend_cancel();
device_power_up(PMSG_RESUME); device_resume_noirq(PMSG_RESUME);
resume_devices: resume_devices:
device_resume(PMSG_RESUME); device_resume(PMSG_RESUME);
......
...@@ -382,12 +382,12 @@ struct dev_pm_info { ...@@ -382,12 +382,12 @@ struct dev_pm_info {
#ifdef CONFIG_PM_SLEEP #ifdef CONFIG_PM_SLEEP
extern void device_pm_lock(void); extern void device_pm_lock(void);
extern int sysdev_resume(void); extern int sysdev_resume(void);
extern void device_power_up(pm_message_t state); extern void device_resume_noirq(pm_message_t state);
extern void device_resume(pm_message_t state); extern void device_resume(pm_message_t state);
extern void device_pm_unlock(void); extern void device_pm_unlock(void);
extern int sysdev_suspend(pm_message_t state); extern int sysdev_suspend(pm_message_t state);
extern int device_power_down(pm_message_t state); extern int device_suspend_noirq(pm_message_t state);
extern int device_suspend(pm_message_t state); extern int device_suspend(pm_message_t state);
extern int device_prepare_suspend(pm_message_t state); extern int device_prepare_suspend(pm_message_t state);
......
...@@ -1452,13 +1452,13 @@ int kernel_kexec(void) ...@@ -1452,13 +1452,13 @@ int kernel_kexec(void)
if (error) if (error)
goto Resume_console; goto Resume_console;
/* At this point, device_suspend() has been called, /* At this point, device_suspend() has been called,
* but *not* device_power_down(). We *must* * but *not* device_suspend_noirq(). We *must* call
* device_power_down() now. Otherwise, drivers for * device_suspend_noirq() now. Otherwise, drivers for
* some devices (e.g. interrupt controllers) become * some devices (e.g. interrupt controllers) become
* desynchronized with the actual state of the * desynchronized with the actual state of the
* hardware at resume time, and evil weirdness ensues. * hardware at resume time, and evil weirdness ensues.
*/ */
error = device_power_down(PMSG_FREEZE); error = device_suspend_noirq(PMSG_FREEZE);
if (error) if (error)
goto Resume_devices; goto Resume_devices;
error = disable_nonboot_cpus(); error = disable_nonboot_cpus();
...@@ -1486,7 +1486,7 @@ int kernel_kexec(void) ...@@ -1486,7 +1486,7 @@ int kernel_kexec(void)
local_irq_enable(); local_irq_enable();
Enable_cpus: Enable_cpus:
enable_nonboot_cpus(); enable_nonboot_cpus();
device_power_up(PMSG_RESTORE); device_resume_noirq(PMSG_RESTORE);
Resume_devices: Resume_devices:
device_resume(PMSG_RESTORE); device_resume(PMSG_RESTORE);
Resume_console: Resume_console:
......
...@@ -216,12 +216,12 @@ static int create_image(int platform_mode) ...@@ -216,12 +216,12 @@ static int create_image(int platform_mode)
return error; return error;
/* At this point, device_suspend() has been called, but *not* /* At this point, device_suspend() has been called, but *not*
* device_power_down(). We *must* call device_power_down() now. * device_suspend_noirq(). We *must* call device_suspend_noirq() now.
* Otherwise, drivers for some devices (e.g. interrupt controllers) * Otherwise, drivers for some devices (e.g. interrupt controllers)
* become desynchronized with the actual state of the hardware * become desynchronized with the actual state of the hardware
* at resume time, and evil weirdness ensues. * at resume time, and evil weirdness ensues.
*/ */
error = device_power_down(PMSG_FREEZE); error = device_suspend_noirq(PMSG_FREEZE);
if (error) { if (error) {
printk(KERN_ERR "PM: Some devices failed to power down, " printk(KERN_ERR "PM: Some devices failed to power down, "
"aborting hibernation\n"); "aborting hibernation\n");
...@@ -262,7 +262,7 @@ static int create_image(int platform_mode) ...@@ -262,7 +262,7 @@ static int create_image(int platform_mode)
Power_up: Power_up:
sysdev_resume(); sysdev_resume();
/* NOTE: device_power_up() is just a resume() for devices /* NOTE: device_resume_noirq() is just a resume() for devices
* that suspended with irqs off ... no overall powerup. * that suspended with irqs off ... no overall powerup.
*/ */
...@@ -275,7 +275,7 @@ static int create_image(int platform_mode) ...@@ -275,7 +275,7 @@ static int create_image(int platform_mode)
Platform_finish: Platform_finish:
platform_finish(platform_mode); platform_finish(platform_mode);
device_power_up(in_suspend ? device_resume_noirq(in_suspend ?
(error ? PMSG_RECOVER : PMSG_THAW) : PMSG_RESTORE); (error ? PMSG_RECOVER : PMSG_THAW) : PMSG_RESTORE);
return error; return error;
...@@ -339,7 +339,7 @@ static int resume_target_kernel(bool platform_mode) ...@@ -339,7 +339,7 @@ static int resume_target_kernel(bool platform_mode)
{ {
int error; int error;
error = device_power_down(PMSG_QUIESCE); error = device_suspend_noirq(PMSG_QUIESCE);
if (error) { if (error) {
printk(KERN_ERR "PM: Some devices failed to power down, " printk(KERN_ERR "PM: Some devices failed to power down, "
"aborting resume\n"); "aborting resume\n");
...@@ -394,7 +394,7 @@ static int resume_target_kernel(bool platform_mode) ...@@ -394,7 +394,7 @@ static int resume_target_kernel(bool platform_mode)
Cleanup: Cleanup:
platform_restore_cleanup(platform_mode); platform_restore_cleanup(platform_mode);
device_power_up(PMSG_RECOVER); device_resume_noirq(PMSG_RECOVER);
return error; return error;
} }
...@@ -454,7 +454,7 @@ int hibernation_platform_enter(void) ...@@ -454,7 +454,7 @@ int hibernation_platform_enter(void)
goto Resume_devices; goto Resume_devices;
} }
error = device_power_down(PMSG_HIBERNATE); error = device_suspend_noirq(PMSG_HIBERNATE);
if (error) if (error)
goto Resume_devices; goto Resume_devices;
...@@ -479,7 +479,7 @@ int hibernation_platform_enter(void) ...@@ -479,7 +479,7 @@ int hibernation_platform_enter(void)
Platofrm_finish: Platofrm_finish:
hibernation_ops->finish(); hibernation_ops->finish();
device_power_up(PMSG_RESTORE); device_suspend_noirq(PMSG_RESTORE);
Resume_devices: Resume_devices:
entering_platform_hibernation = false; entering_platform_hibernation = false;
......
...@@ -295,7 +295,7 @@ static int suspend_enter(suspend_state_t state) ...@@ -295,7 +295,7 @@ static int suspend_enter(suspend_state_t state)
return error; return error;
} }
error = device_power_down(PMSG_SUSPEND); error = device_suspend_noirq(PMSG_SUSPEND);
if (error) { if (error) {
printk(KERN_ERR "PM: Some devices failed to power down\n"); printk(KERN_ERR "PM: Some devices failed to power down\n");
goto Platfrom_finish; goto Platfrom_finish;
...@@ -335,7 +335,7 @@ static int suspend_enter(suspend_state_t state) ...@@ -335,7 +335,7 @@ static int suspend_enter(suspend_state_t state)
suspend_ops->wake(); suspend_ops->wake();
Power_up_devices: Power_up_devices:
device_power_up(PMSG_RESUME); device_resume_noirq(PMSG_RESUME);
Platfrom_finish: Platfrom_finish:
if (suspend_ops->finish) if (suspend_ops->finish)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment