PM: Rename struct pm_ops and related things
authorRafael J. Wysocki <rjw@sisk.pl>
Thu, 18 Oct 2007 10:04:40 +0000 (03:04 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Thu, 18 Oct 2007 21:37:18 +0000 (14:37 -0700)
The name of 'struct pm_ops' suggests that it is related to the power
management in general, but in fact it is only related to suspend.   Moreover,
its name should indicate what this structure is used for, so it seems
reasonable to change it to 'struct platform_suspend_ops'.   In that case, the
name of the global variable of this type used by the PM core and the names of
related functions should be changed accordingly.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@ucw.cz>
Cc: Len Brown <lenb@kernel.org>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 files changed:
Documentation/power/interface.txt
arch/arm/common/sharpsl_pm.c
arch/arm/mach-at91/pm.c
arch/arm/mach-omap1/pm.c
arch/arm/mach-omap2/pm.c
arch/arm/mach-pnx4008/pm.c
arch/arm/mach-pxa/pm.c
arch/arm/mach-pxa/pxa25x.c
arch/arm/mach-sa1100/pm.c
arch/arm/plat-s3c24xx/pm.c
arch/blackfin/mach-common/pm.c
arch/powerpc/platforms/52xx/mpc52xx_pm.c
arch/sh/boards/hp6xx/pm.c
drivers/acpi/sleep/main.c
include/linux/suspend.h
kernel/power/main.c

index fd5192a8fa8abebd12fe86aefd99404978d88f34..e67211fe0ee2f432044efe62e8909702f0b46fc9 100644 (file)
@@ -20,7 +20,7 @@ states.
 /sys/power/disk controls the operating mode of the suspend-to-disk
 mechanism. Suspend-to-disk can be handled in several ways. We have a
 few options for putting the system to sleep - using the platform driver
-(e.g. ACPI or other pm_ops), powering off the system or rebooting the
+(e.g. ACPI or other suspend_ops), powering off the system or rebooting the
 system (for testing).
 
 Additionally, /sys/power/disk can be used to turn on one of the two testing
index 85795a765a46ce1f7f072b1f752251e1e3d2a5cc..5bba5255b119dc7ee18d72cc8efc2d8c1d2963c2 100644 (file)
@@ -766,9 +766,9 @@ static void sharpsl_apm_get_power_status(struct apm_power_info *info)
        info->battery_life = sharpsl_pm.battstat.mainbat_percent;
 }
 
-static struct pm_ops sharpsl_pm_ops = {
+static struct platform_suspend_ops sharpsl_pm_ops = {
        .enter          = corgi_pxa_pm_enter,
-       .valid          = pm_valid_only_mem,
+       .valid          = suspend_valid_only_mem,
 };
 
 static int __init sharpsl_pm_probe(struct platform_device *pdev)
@@ -800,7 +800,7 @@ static int __init sharpsl_pm_probe(struct platform_device *pdev)
 
        apm_get_power_status = sharpsl_apm_get_power_status;
 
-       pm_set_ops(&sharpsl_pm_ops);
+       suspend_set_ops(&sharpsl_pm_ops);
 
        mod_timer(&sharpsl_pm.ac_timer, jiffies + msecs_to_jiffies(250));
 
@@ -809,7 +809,7 @@ static int __init sharpsl_pm_probe(struct platform_device *pdev)
 
 static int sharpsl_pm_remove(struct platform_device *pdev)
 {
-       pm_set_ops(NULL);
+       suspend_set_ops(NULL);
 
        device_remove_file(&pdev->dev, &dev_attr_battery_percentage);
        device_remove_file(&pdev->dev, &dev_attr_battery_voltage);
index c7c81c9f769cb48c398f663f8a8dbdde753bd975..98cb61482917a921d5ddaec2bc13925999097a0b 100644 (file)
@@ -198,7 +198,7 @@ error:
 }
 
 
-static struct pm_ops at91_pm_ops ={
+static struct platform_suspend_ops at91_pm_ops ={
        .valid          = at91_pm_valid_state,
        .set_target     = at91_pm_set_target,
        .enter          = at91_pm_enter,
@@ -219,7 +219,7 @@ static int __init at91_pm_init(void)
        /* Disable SDRAM low-power mode.  Cannot be used with self-refresh. */
        at91_sys_write(AT91_SDRAMC_LPR, 0);
 
-       pm_set_ops(&at91_pm_ops);
+       suspend_set_ops(&at91_pm_ops);
 
        return 0;
 }
index 1a27611096a9651a315f774cd9447ea17ae0d859..8db38dd247a41018d026a526047c41d43109e4eb 100644 (file)
@@ -673,11 +673,11 @@ static struct irqaction omap_wakeup_irq = {
 
 
 
-static struct pm_ops omap_pm_ops ={
+static struct platform_suspend_ops omap_pm_ops ={
        .prepare        = omap_pm_prepare,
        .enter          = omap_pm_enter,
        .finish         = omap_pm_finish,
-       .valid          = pm_valid_only_mem,
+       .valid          = suspend_valid_only_mem,
 };
 
 static int __init omap_pm_init(void)
@@ -734,7 +734,7 @@ static int __init omap_pm_init(void)
        else if (cpu_is_omap16xx())
                omap_writel(OMAP1610_IDLECT3_VAL, OMAP1610_IDLECT3);
 
-       pm_set_ops(&omap_pm_ops);
+       suspend_set_ops(&omap_pm_ops);
 
 #if defined(DEBUG) && defined(CONFIG_PROC_FS)
        omap_pm_init_proc();
index f9fd3e3d0a59dfa4e300a1a64ac1cb6f6601ac02..9aaa7a2633e825b7eb5a82e7f4d57ccb971565b6 100644 (file)
@@ -362,11 +362,11 @@ static int omap2_pm_finish(suspend_state_t state)
        return 0;
 }
 
-static struct pm_ops omap_pm_ops = {
+static struct platform_suspend_ops omap_pm_ops = {
        .prepare        = omap2_pm_prepare,
        .enter          = omap2_pm_enter,
        .finish         = omap2_pm_finish,
-       .valid          = pm_valid_only_mem,
+       .valid          = suspend_valid_only_mem,
 };
 
 int __init omap2_pm_init(void)
@@ -390,7 +390,7 @@ int __init omap2_pm_init(void)
        omap2_sram_suspend = omap_sram_push(omap24xx_cpu_suspend,
                                            omap24xx_cpu_suspend_sz);
 
-       pm_set_ops(&omap_pm_ops);
+       suspend_set_ops(&omap_pm_ops);
        pm_idle = omap2_pm_idle;
 
        pmdomain_init();
index 23307861f6d5806dfbc3f653b72b15a276943c19..40116d2543496c284af73a8fde5d94c789951cd5 100644 (file)
@@ -117,7 +117,7 @@ static int pnx4008_pm_valid(suspend_state_t state)
               (state == PM_SUSPEND_MEM);
 }
 
-static struct pm_ops pnx4008_pm_ops = {
+static struct platform_suspend_ops pnx4008_pm_ops = {
        .enter = pnx4008_pm_enter,
        .valid = pnx4008_pm_valid,
 };
@@ -146,7 +146,7 @@ static int __init pnx4008_pm_init(void)
                return -ENOMEM;
        }
 
-       pm_set_ops(&pnx4008_pm_ops);
+       suspend_set_ops(&pnx4008_pm_ops);
        return 0;
 }
 
index b59a81a8e7d32d35d1ad9c3b1ce4cc833bf7eb7b..a941c71c7d06cb36be51c43dfb3f456da7c344b9 100644 (file)
@@ -86,7 +86,7 @@ static int pxa_pm_valid(suspend_state_t state)
        return -EINVAL;
 }
 
-static struct pm_ops pxa_pm_ops = {
+static struct platform_suspend_ops pxa_pm_ops = {
        .valid          = pxa_pm_valid,
        .enter          = pxa_pm_enter,
 };
@@ -104,7 +104,7 @@ static int __init pxa_pm_init(void)
                return -ENOMEM;
        }
 
-       pm_set_ops(&pxa_pm_ops);
+       suspend_set_ops(&pxa_pm_ops);
        return 0;
 }
 
index 08ccd8f6fbc0c1a08fae85ccc47bc603ab1415d8..dcd81f8d0833f28da844c3e468bf89ea8becfa40 100644 (file)
@@ -215,7 +215,7 @@ static void pxa25x_cpu_pm_enter(suspend_state_t state)
 
 static struct pxa_cpu_pm_fns pxa25x_cpu_pm_fns = {
        .save_size      = SLEEP_SAVE_SIZE,
-       .valid          = pm_valid_only_mem,
+       .valid          = suspend_valid_only_mem,
        .save           = pxa25x_cpu_pm_save,
        .restore        = pxa25x_cpu_pm_restore,
        .enter          = pxa25x_cpu_pm_enter,
index 01a37d3c0727de0c631dcbcd5e9c5378433c2946..246c573e7252dc0d833f1325222809bd1782e36d 100644 (file)
@@ -122,14 +122,14 @@ unsigned long sleep_phys_sp(void *sp)
        return virt_to_phys(sp);
 }
 
-static struct pm_ops sa11x0_pm_ops = {
+static struct platform_suspend_ops sa11x0_pm_ops = {
        .enter          = sa11x0_pm_enter,
-       .valid          = pm_valid_only_mem,
+       .valid          = suspend_valid_only_mem,
 };
 
 static int __init sa11x0_pm_init(void)
 {
-       pm_set_ops(&sa11x0_pm_ops);
+       suspend_set_ops(&sa11x0_pm_ops);
        return 0;
 }
 
index eab1850616d860ef5488cbc4f5c489d0f763da49..4fdb3117744fe1f543f1ee78aa3f7df9fb81b237 100644 (file)
@@ -612,9 +612,9 @@ static int s3c2410_pm_enter(suspend_state_t state)
        return 0;
 }
 
-static struct pm_ops s3c2410_pm_ops = {
+static struct platform_suspend_ops s3c2410_pm_ops = {
        .enter          = s3c2410_pm_enter,
-       .valid          = pm_valid_only_mem,
+       .valid          = suspend_valid_only_mem,
 };
 
 /* s3c2410_pm_init
@@ -628,6 +628,6 @@ int __init s3c2410_pm_init(void)
 {
        printk("S3C2410 Power Management, (c) 2004 Simtec Electronics\n");
 
-       pm_set_ops(&s3c2410_pm_ops);
+       suspend_set_ops(&s3c2410_pm_ops);
        return 0;
 }
index bcb5a49e3520d947cdc475e24b08c45e10020750..6901891905cc452f7a1cec82296ca877e2955203 100644 (file)
@@ -163,7 +163,7 @@ static int bfin_pm_valid(suspend_state_t state)
        return (state == PM_SUSPEND_STANDBY);
 }
 
-struct pm_ops bfin_pm_ops = {
+struct platform_suspend_ops bfin_pm_ops = {
        .prepare = bfin_pm_prepare,
        .enter = bfin_pm_enter,
        .finish = bfin_pm_finish,
@@ -172,7 +172,7 @@ struct pm_ops bfin_pm_ops = {
 
 static int __init bfin_pm_init(void)
 {
-       pm_set_ops(&bfin_pm_ops);
+       suspend_set_ops(&bfin_pm_ops);
        return 0;
 }
 
index 0809ec1d725ca71d23d0c0ea8db77e4184653157..44fb064c7a16e8c4163e6335e9795aed291daf1c 100644 (file)
@@ -177,7 +177,7 @@ int mpc52xx_pm_finish(suspend_state_t state)
        return 0;
 }
 
-static struct pm_ops mpc52xx_pm_ops = {
+static struct platform_suspend_ops mpc52xx_pm_ops = {
        .valid          = mpc52xx_pm_valid,
        .prepare        = mpc52xx_pm_prepare,
        .enter          = mpc52xx_pm_enter,
@@ -186,6 +186,6 @@ static struct pm_ops mpc52xx_pm_ops = {
 
 int __init mpc52xx_pm_init(void)
 {
-       pm_set_ops(&mpc52xx_pm_ops);
+       suspend_set_ops(&mpc52xx_pm_ops);
        return 0;
 }
index 8143d1b948e7e2b4d33820abba8d5984866c8eaf..d22f6eac9ccabb1816e76e10a0a0263e0c00b69c 100644 (file)
@@ -67,14 +67,14 @@ static int hp6x0_pm_enter(suspend_state_t state)
        return 0;
 }
 
-static struct pm_ops hp6x0_pm_ops = {
+static struct platform_suspend_ops hp6x0_pm_ops = {
        .enter          = hp6x0_pm_enter,
-       .valid          = pm_valid_only_mem,
+       .valid          = suspend_valid_only_mem,
 };
 
 static int __init hp6x0_pm_init(void)
 {
-       pm_set_ops(&hp6x0_pm_ops);
+       suspend_set_ops(&hp6x0_pm_ops);
        return 0;
 }
 
index 5055acf2163c6d4e55fec3f68871c90ec6c41c1d..3271850a1f357691525a0a2cbeb558f64b206f11 100644 (file)
@@ -50,7 +50,7 @@ int acpi_sleep_prepare(u32 acpi_state)
 }
 
 #ifdef CONFIG_SUSPEND
-static struct pm_ops acpi_pm_ops;
+static struct platform_suspend_ops acpi_pm_ops;
 
 extern void do_suspend_lowlevel(void);
 
@@ -203,7 +203,7 @@ static int acpi_pm_state_valid(suspend_state_t pm_state)
        }
 }
 
-static struct pm_ops acpi_pm_ops = {
+static struct platform_suspend_ops acpi_pm_ops = {
        .valid = acpi_pm_state_valid,
        .set_target = acpi_pm_set_target,
        .prepare = acpi_pm_prepare,
@@ -417,7 +417,7 @@ int __init acpi_sleep_init(void)
                }
        }
 
-       pm_set_ops(&acpi_pm_ops);
+       suspend_set_ops(&acpi_pm_ops);
 #endif
 
 #ifdef CONFIG_HIBERNATION
index c230680d5252fbee0959d74bd47233b3c89ce9a2..dce47825dbb890fcb43b8c6ce57077188da351fc 100644 (file)
@@ -27,16 +27,16 @@ typedef int __bitwise suspend_state_t;
 #define PM_SUSPEND_MAX         ((__force suspend_state_t) 4)
 
 /**
- * struct pm_ops - Callbacks for managing platform dependent system sleep
- *     states.
+ * struct platform_suspend_ops - Callbacks for managing platform dependent
+ *     system sleep states.
  *
  * @valid: Callback to determine if given system sleep state is supported by
  *     the platform.
  *     Valid (ie. supported) states are advertised in /sys/power/state.  Note
  *     that it still may be impossible to enter given system sleep state if the
  *     conditions aren't right.
- *     There is the %pm_valid_only_mem function available that can be assigned
- *     to this if the platform only supports mem sleep.
+ *     There is the %suspend_valid_only_mem function available that can be
+ *     assigned to this if the platform only supports mem sleep.
  *
  * @set_target: Tell the platform which system sleep state is going to be
  *     entered.
@@ -73,7 +73,7 @@ typedef int __bitwise suspend_state_t;
  *     that implement @prepare().  If implemented, it is always called after
  *     @enter() (even if @enter() fails).
  */
-struct pm_ops {
+struct platform_suspend_ops {
        int (*valid)(suspend_state_t state);
        int (*set_target)(suspend_state_t state);
        int (*prepare)(suspend_state_t state);
@@ -82,14 +82,14 @@ struct pm_ops {
 };
 
 #ifdef CONFIG_SUSPEND
-extern struct pm_ops *pm_ops;
+extern struct platform_suspend_ops *suspend_ops;
 
 /**
- * pm_set_ops - set platform dependent power management ops
- * @pm_ops: The new power management operations to set.
+ * suspend_set_ops - set platform dependent suspend operations
+ * @ops: The new suspend operations to set.
  */
-extern void pm_set_ops(struct pm_ops *pm_ops);
-extern int pm_valid_only_mem(suspend_state_t state);
+extern void suspend_set_ops(struct platform_suspend_ops *ops);
+extern int suspend_valid_only_mem(suspend_state_t state);
 
 /**
  * arch_suspend_disable_irqs - disable IRQs for suspend
@@ -113,7 +113,7 @@ extern int pm_suspend(suspend_state_t state);
 #else /* !CONFIG_SUSPEND */
 #define suspend_valid_only_mem NULL
 
-static inline void pm_set_ops(struct pm_ops *pm_ops) {}
+static inline void suspend_set_ops(struct platform_suspend_ops *ops) {}
 static inline int pm_suspend(suspend_state_t state) { return -ENOSYS; }
 #endif /* !CONFIG_SUSPEND */
 
index 2a46b6d62f76ec93d51456b40f46cc4cc3f8260e..854bf0811d40877eee5e3ed0d5161a3374f6c9a4 100644 (file)
@@ -32,28 +32,28 @@ DEFINE_MUTEX(pm_mutex);
 /* This is just an arbitrary number */
 #define FREE_PAGE_NUMBER (100)
 
-struct pm_ops *pm_ops;
+struct platform_suspend_ops *suspend_ops;
 
 /**
- *     pm_set_ops - Set the global power method table. 
+ *     suspend_set_ops - Set the global suspend method table.
  *     @ops:   Pointer to ops structure.
  */
 
-void pm_set_ops(struct pm_ops * ops)
+void suspend_set_ops(struct platform_suspend_ops *ops)
 {
        mutex_lock(&pm_mutex);
-       pm_ops = ops;
+       suspend_ops = ops;
        mutex_unlock(&pm_mutex);
 }
 
 /**
- * pm_valid_only_mem - generic memory-only valid callback
+ * suspend_valid_only_mem - generic memory-only valid callback
  *
- * pm_ops drivers that implement mem suspend only and only need
+ * Platform drivers that implement mem suspend only and only need
  * to check for that in their .valid callback can use this instead
  * of rolling their own .valid callback.
  */
-int pm_valid_only_mem(suspend_state_t state)
+int suspend_valid_only_mem(suspend_state_t state)
 {
        return state == PM_SUSPEND_MEM;
 }
@@ -61,8 +61,8 @@ int pm_valid_only_mem(suspend_state_t state)
 
 static inline void pm_finish(suspend_state_t state)
 {
-       if (pm_ops->finish)
-               pm_ops->finish(state);
+       if (suspend_ops->finish)
+               suspend_ops->finish(state);
 }
 
 /**
@@ -76,7 +76,7 @@ static int suspend_prepare(void)
        int error;
        unsigned int free_pages;
 
-       if (!pm_ops || !pm_ops->enter)
+       if (!suspend_ops || !suspend_ops->enter)
                return -EPERM;
 
        error = pm_notifier_call_chain(PM_SUSPEND_PREPARE);
@@ -139,7 +139,7 @@ static int suspend_enter(suspend_state_t state)
                printk(KERN_ERR "Some devices failed to power down\n");
                goto Done;
        }
-       error = pm_ops->enter(state);
+       error = suspend_ops->enter(state);
        device_power_up();
  Done:
        arch_suspend_enable_irqs();
@@ -156,11 +156,11 @@ int suspend_devices_and_enter(suspend_state_t state)
 {
        int error;
 
-       if (!pm_ops)
+       if (!suspend_ops)
                return -ENOSYS;
 
-       if (pm_ops->set_target) {
-               error = pm_ops->set_target(state);
+       if (suspend_ops->set_target) {
+               error = suspend_ops->set_target(state);
                if (error)
                        return error;
        }
@@ -170,8 +170,8 @@ int suspend_devices_and_enter(suspend_state_t state)
                printk(KERN_ERR "Some devices failed to suspend\n");
                goto Resume_console;
        }
-       if (pm_ops->prepare) {
-               error = pm_ops->prepare(state);
+       if (suspend_ops->prepare) {
+               error = suspend_ops->prepare(state);
                if (error)
                        goto Resume_devices;
        }
@@ -214,7 +214,7 @@ static inline int valid_state(suspend_state_t state)
        /* All states need lowlevel support and need to be valid
         * to the lowlevel implementation, no valid callback
         * implies that none are valid. */
-       if (!pm_ops || !pm_ops->valid || !pm_ops->valid(state))
+       if (!suspend_ops || !suspend_ops->valid || !suspend_ops->valid(state))
                return 0;
        return 1;
 }