Commit bca73e4b authored by Jeff Garzik's avatar Jeff Garzik Committed by Linus Torvalds

[PATCH] move pm_register/etc. to CONFIG_PM_LEGACY, pm_legacy.h

Since few people need the support anymore, this moves the legacy
pm_xxx functions to CONFIG_PM_LEGACY, and include/linux/pm_legacy.h.
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 95e861db
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <linux/apm_bios.h> #include <linux/apm_bios.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/pm.h> #include <linux/pm.h>
#include <linux/pm_legacy.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/list.h> #include <linux/list.h>
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include <linux/config.h> #include <linux/config.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/pm.h> #include <linux/pm.h>
#include <linux/pm_legacy.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/sysctl.h> #include <linux/sysctl.h>
......
...@@ -699,7 +699,7 @@ depends on PM && !X86_VISWS ...@@ -699,7 +699,7 @@ depends on PM && !X86_VISWS
config APM config APM
tristate "APM (Advanced Power Management) BIOS support" tristate "APM (Advanced Power Management) BIOS support"
depends on PM depends on PM && PM_LEGACY
---help--- ---help---
APM is a BIOS specification for saving power using several different APM is a BIOS specification for saving power using several different
techniques. This is mostly useful for battery powered laptops with techniques. This is mostly useful for battery powered laptops with
......
...@@ -218,6 +218,7 @@ ...@@ -218,6 +218,7 @@
#include <linux/time.h> #include <linux/time.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/pm.h> #include <linux/pm.h>
#include <linux/pm_legacy.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/smp.h> #include <linux/smp.h>
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <linux/config.h> #include <linux/config.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/pm.h> #include <linux/pm.h>
#include <linux/pm_legacy.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/sysctl.h> #include <linux/sysctl.h>
#include <linux/jiffies.h> #include <linux/jiffies.h>
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <linux/list.h> #include <linux/list.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/pm.h> #include <linux/pm.h>
#include <linux/pm_legacy.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#ifdef CONFIG_X86 #ifdef CONFIG_X86
...@@ -754,7 +755,7 @@ static int __init acpi_init(void) ...@@ -754,7 +755,7 @@ static int __init acpi_init(void)
result = acpi_bus_init(); result = acpi_bus_init();
if (!result) { if (!result) {
#ifdef CONFIG_PM #ifdef CONFIG_PM_LEGACY
if (!PM_IS_ACTIVE()) if (!PM_IS_ACTIVE())
pm_active = 1; pm_active = 1;
else { else {
......
...@@ -84,6 +84,7 @@ static int max_interrupt_work = 10; ...@@ -84,6 +84,7 @@ static int max_interrupt_work = 10;
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
#include <linux/pm.h> #include <linux/pm.h>
#include <linux/pm_legacy.h>
#include <linux/skbuff.h> #include <linux/skbuff.h>
#include <linux/delay.h> /* for udelay() */ #include <linux/delay.h> /* for udelay() */
#include <linux/spinlock.h> #include <linux/spinlock.h>
...@@ -173,7 +174,7 @@ struct el3_private { ...@@ -173,7 +174,7 @@ struct el3_private {
/* skb send-queue */ /* skb send-queue */
int head, size; int head, size;
struct sk_buff *queue[SKB_QUEUE_SIZE]; struct sk_buff *queue[SKB_QUEUE_SIZE];
#ifdef CONFIG_PM #ifdef CONFIG_PM_LEGACY
struct pm_dev *pmdev; struct pm_dev *pmdev;
#endif #endif
enum { enum {
...@@ -200,7 +201,7 @@ static void el3_tx_timeout (struct net_device *dev); ...@@ -200,7 +201,7 @@ static void el3_tx_timeout (struct net_device *dev);
static void el3_down(struct net_device *dev); static void el3_down(struct net_device *dev);
static void el3_up(struct net_device *dev); static void el3_up(struct net_device *dev);
static struct ethtool_ops ethtool_ops; static struct ethtool_ops ethtool_ops;
#ifdef CONFIG_PM #ifdef CONFIG_PM_LEGACY
static int el3_suspend(struct pm_dev *pdev); static int el3_suspend(struct pm_dev *pdev);
static int el3_resume(struct pm_dev *pdev); static int el3_resume(struct pm_dev *pdev);
static int el3_pm_callback(struct pm_dev *pdev, pm_request_t rqst, void *data); static int el3_pm_callback(struct pm_dev *pdev, pm_request_t rqst, void *data);
...@@ -361,7 +362,7 @@ static void el3_common_remove (struct net_device *dev) ...@@ -361,7 +362,7 @@ static void el3_common_remove (struct net_device *dev)
struct el3_private *lp = netdev_priv(dev); struct el3_private *lp = netdev_priv(dev);
(void) lp; /* Keep gcc quiet... */ (void) lp; /* Keep gcc quiet... */
#ifdef CONFIG_PM #ifdef CONFIG_PM_LEGACY
if (lp->pmdev) if (lp->pmdev)
pm_unregister(lp->pmdev); pm_unregister(lp->pmdev);
#endif #endif
...@@ -571,7 +572,7 @@ static int __init el3_probe(int card_idx) ...@@ -571,7 +572,7 @@ static int __init el3_probe(int card_idx)
if (err) if (err)
goto out1; goto out1;
#ifdef CONFIG_PM #ifdef CONFIG_PM_LEGACY
/* register power management */ /* register power management */
lp->pmdev = pm_register(PM_ISA_DEV, card_idx, el3_pm_callback); lp->pmdev = pm_register(PM_ISA_DEV, card_idx, el3_pm_callback);
if (lp->pmdev) { if (lp->pmdev) {
...@@ -1479,7 +1480,7 @@ el3_up(struct net_device *dev) ...@@ -1479,7 +1480,7 @@ el3_up(struct net_device *dev)
} }
/* Power Management support functions */ /* Power Management support functions */
#ifdef CONFIG_PM #ifdef CONFIG_PM_LEGACY
static int static int
el3_suspend(struct pm_dev *pdev) el3_suspend(struct pm_dev *pdev)
...@@ -1548,7 +1549,7 @@ el3_pm_callback(struct pm_dev *pdev, pm_request_t rqst, void *data) ...@@ -1548,7 +1549,7 @@ el3_pm_callback(struct pm_dev *pdev, pm_request_t rqst, void *data)
return 0; return 0;
} }
#endif /* CONFIG_PM */ #endif /* CONFIG_PM_LEGACY */
/* Parameters that may be passed into the module. */ /* Parameters that may be passed into the module. */
static int debug = -1; static int debug = -1;
......
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include <asm/byteorder.h> #include <asm/byteorder.h>
#include <linux/pm.h> #include <linux/pm.h>
#include <linux/pm_legacy.h>
#include <net/irda/wrapper.h> #include <net/irda/wrapper.h>
#include <net/irda/irda.h> #include <net/irda/irda.h>
......
...@@ -59,6 +59,7 @@ ...@@ -59,6 +59,7 @@
#include <asm/byteorder.h> #include <asm/byteorder.h>
#include <linux/pm.h> #include <linux/pm.h>
#include <linux/pm_legacy.h>
#include <net/irda/wrapper.h> #include <net/irda/wrapper.h>
#include <net/irda/irda.h> #include <net/irda/irda.h>
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include <linux/keyboard.h> #include <linux/keyboard.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/pm.h> #include <linux/pm.h>
#include <linux/pm_legacy.h>
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/delay.h> #include <linux/delay.h>
...@@ -1343,7 +1344,7 @@ static void show_serial_version(void) ...@@ -1343,7 +1344,7 @@ static void show_serial_version(void)
printk("MC68328 serial driver version 1.00\n"); printk("MC68328 serial driver version 1.00\n");
} }
#ifdef CONFIG_PM #ifdef CONFIG_PM_LEGACY
/* Serial Power management /* Serial Power management
* The console (currently fixed at line 0) is a special case for power * The console (currently fixed at line 0) is a special case for power
* management because the kernel is so chatty. The console will be * management because the kernel is so chatty. The console will be
...@@ -1393,7 +1394,7 @@ void startup_console(void) ...@@ -1393,7 +1394,7 @@ void startup_console(void)
struct m68k_serial *info = &m68k_soft[0]; struct m68k_serial *info = &m68k_soft[0];
startup(info); startup(info);
} }
#endif #endif /* CONFIG_PM_LEGACY */
static struct tty_operations rs_ops = { static struct tty_operations rs_ops = {
...@@ -1486,7 +1487,7 @@ rs68328_init(void) ...@@ -1486,7 +1487,7 @@ rs68328_init(void)
IRQ_FLG_STD, IRQ_FLG_STD,
"M68328_UART", NULL)) "M68328_UART", NULL))
panic("Unable to attach 68328 serial interrupt\n"); panic("Unable to attach 68328 serial interrupt\n");
#ifdef CONFIG_PM #ifdef CONFIG_PM_LEGACY
serial_pm[i] = pm_register(PM_SYS_DEV, PM_SYS_COM, serial_pm_callback); serial_pm[i] = pm_register(PM_SYS_DEV, PM_SYS_COM, serial_pm_callback);
if (serial_pm[i]) if (serial_pm[i])
serial_pm[i]->data = info; serial_pm[i]->data = info;
......
...@@ -94,55 +94,6 @@ struct pm_dev ...@@ -94,55 +94,6 @@ struct pm_dev
struct list_head entry; struct list_head entry;
}; };
#ifdef CONFIG_PM
extern int pm_active;
#define PM_IS_ACTIVE() (pm_active != 0)
/*
* Register a device with power management
*/
struct pm_dev __deprecated *
pm_register(pm_dev_t type, unsigned long id, pm_callback callback);
/*
* Unregister a device with power management
*/
void __deprecated pm_unregister(struct pm_dev *dev);
/*
* Unregister all devices with matching callback
*/
void __deprecated pm_unregister_all(pm_callback callback);
/*
* Send a request to all devices
*/
int __deprecated pm_send_all(pm_request_t rqst, void *data);
#else /* CONFIG_PM */
#define PM_IS_ACTIVE() 0
static inline struct pm_dev *pm_register(pm_dev_t type,
unsigned long id,
pm_callback callback)
{
return NULL;
}
static inline void pm_unregister(struct pm_dev *dev) {}
static inline void pm_unregister_all(pm_callback callback) {}
static inline int pm_send_all(pm_request_t rqst, void *data)
{
return 0;
}
#endif /* CONFIG_PM */
/* Functions above this comment are list-based old-style power /* Functions above this comment are list-based old-style power
* managment. Please avoid using them. */ * managment. Please avoid using them. */
......
#ifndef __LINUX_PM_LEGACY_H__
#define __LINUX_PM_LEGACY_H__
#include <linux/config.h>
#ifdef CONFIG_PM_LEGACY
extern int pm_active;
#define PM_IS_ACTIVE() (pm_active != 0)
/*
* Register a device with power management
*/
struct pm_dev __deprecated *
pm_register(pm_dev_t type, unsigned long id, pm_callback callback);
/*
* Unregister a device with power management
*/
void __deprecated pm_unregister(struct pm_dev *dev);
/*
* Unregister all devices with matching callback
*/
void __deprecated pm_unregister_all(pm_callback callback);
/*
* Send a request to all devices
*/
int __deprecated pm_send_all(pm_request_t rqst, void *data);
#else /* CONFIG_PM_LEGACY */
#define PM_IS_ACTIVE() 0
static inline struct pm_dev *pm_register(pm_dev_t type,
unsigned long id,
pm_callback callback)
{
return NULL;
}
static inline void pm_unregister(struct pm_dev *dev) {}
static inline void pm_unregister_all(pm_callback callback) {}
static inline int pm_send_all(pm_request_t rqst, void *data)
{
return 0;
}
#endif /* CONFIG_PM_LEGACY */
#endif /* __LINUX_PM_LEGACY_H__ */
...@@ -19,6 +19,15 @@ config PM ...@@ -19,6 +19,15 @@ config PM
will issue the hlt instruction if nothing is to be done, thereby will issue the hlt instruction if nothing is to be done, thereby
sending the processor to sleep and saving power. sending the processor to sleep and saving power.
config PM_LEGACY
bool "Legacy Power Management API"
depends on PM
default y
---help---
Support for pm_register() and friends.
If unsure, say Y.
config PM_DEBUG config PM_DEBUG
bool "Power Management Debug Support" bool "Power Management Debug Support"
depends on PM depends on PM
......
...@@ -3,7 +3,8 @@ ifeq ($(CONFIG_PM_DEBUG),y) ...@@ -3,7 +3,8 @@ ifeq ($(CONFIG_PM_DEBUG),y)
EXTRA_CFLAGS += -DDEBUG EXTRA_CFLAGS += -DDEBUG
endif endif
obj-y := main.o process.o console.o pm.o obj-y := main.o process.o console.o
obj-$(CONFIG_PM_LEGACY) += pm.o
obj-$(CONFIG_SOFTWARE_SUSPEND) += swsusp.o disk.o snapshot.o obj-$(CONFIG_SOFTWARE_SUSPEND) += swsusp.o disk.o snapshot.o
obj-$(CONFIG_SUSPEND_SMP) += smp.o obj-$(CONFIG_SUSPEND_SMP) += smp.o
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/pm.h> #include <linux/pm.h>
#include <linux/pm_legacy.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
int pm_active; int pm_active;
......
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/stddef.h> #include <linux/stddef.h>
#include <linux/pm.h> #include <linux/pm.h>
#include <linux/pm_legacy.h>
#include <linux/isapnp.h> #include <linux/isapnp.h>
#include <linux/pnp.h> #include <linux/pnp.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
......
...@@ -298,6 +298,7 @@ struct cs4281_state { ...@@ -298,6 +298,7 @@ struct cs4281_state {
struct cs4281_pipeline pl[CS4281_NUMBER_OF_PIPELINES]; struct cs4281_pipeline pl[CS4281_NUMBER_OF_PIPELINES];
}; };
#include <linux/pm_legacy.h>
#include "cs4281pm-24.c" #include "cs4281pm-24.c"
#if CSDEBUG #if CSDEBUG
......
...@@ -231,6 +231,7 @@ ...@@ -231,6 +231,7 @@
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <linux/pm.h> #include <linux/pm.h>
#include <linux/pm_legacy.h>
static int maestro_pm_callback(struct pm_dev *dev, pm_request_t rqst, void *d); static int maestro_pm_callback(struct pm_dev *dev, pm_request_t rqst, void *d);
#include "maestro.h" #include "maestro.h"
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/pm.h> #include <linux/pm.h>
#include <linux/pm_legacy.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include "sound_config.h" #include "sound_config.h"
......
...@@ -70,6 +70,7 @@ ...@@ -70,6 +70,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/pm.h> #include <linux/pm.h>
#include <linux/pm_legacy.h>
#include "sound_config.h" #include "sound_config.h"
#include "ad1848.h" #include "ad1848.h"
...@@ -138,7 +139,7 @@ typedef struct { ...@@ -138,7 +139,7 @@ typedef struct {
struct pnp_dev* pdev; struct pnp_dev* pdev;
int activated; /* Whether said devices have been activated */ int activated; /* Whether said devices have been activated */
#endif #endif
#ifdef CONFIG_PM #ifdef CONFIG_PM_LEGACY
unsigned int in_suspend; unsigned int in_suspend;
struct pm_dev *pmdev; struct pm_dev *pmdev;
#endif #endif
...@@ -341,7 +342,7 @@ static void opl3sa2_mixer_reset(opl3sa2_state_t* devc) ...@@ -341,7 +342,7 @@ static void opl3sa2_mixer_reset(opl3sa2_state_t* devc)
} }
/* Currently only used for power management */ /* Currently only used for power management */
#ifdef CONFIG_PM #ifdef CONFIG_PM_LEGACY
static void opl3sa2_mixer_restore(opl3sa2_state_t* devc) static void opl3sa2_mixer_restore(opl3sa2_state_t* devc)
{ {
if (devc) { if (devc) {
...@@ -354,7 +355,7 @@ static void opl3sa2_mixer_restore(opl3sa2_state_t* devc) ...@@ -354,7 +355,7 @@ static void opl3sa2_mixer_restore(opl3sa2_state_t* devc)
} }
} }
} }
#endif #endif /* CONFIG_PM_LEGACY */
static inline void arg_to_vol_mono(unsigned int vol, int* value) static inline void arg_to_vol_mono(unsigned int vol, int* value)
{ {
...@@ -831,7 +832,8 @@ static struct pnp_driver opl3sa2_driver = { ...@@ -831,7 +832,8 @@ static struct pnp_driver opl3sa2_driver = {
/* End of component functions */ /* End of component functions */
#ifdef CONFIG_PM #ifdef CONFIG_PM_LEGACY
static DEFINE_SPINLOCK(opl3sa2_lock); static DEFINE_SPINLOCK(opl3sa2_lock);
/* Power Management support functions */ /* Power Management support functions */
...@@ -906,7 +908,7 @@ static int opl3sa2_pm_callback(struct pm_dev *pdev, pm_request_t rqst, void *dat ...@@ -906,7 +908,7 @@ static int opl3sa2_pm_callback(struct pm_dev *pdev, pm_request_t rqst, void *dat
} }
return 0; return 0;
} }
#endif /* CONFIG_PM */ #endif /* CONFIG_PM_LEGACY */
/* /*
* Install OPL3-SA2 based card(s). * Install OPL3-SA2 based card(s).
...@@ -1019,12 +1021,12 @@ static int __init init_opl3sa2(void) ...@@ -1019,12 +1021,12 @@ static int __init init_opl3sa2(void)
/* ewww =) */ /* ewww =) */
opl3sa2_state[card].card = card; opl3sa2_state[card].card = card;
#ifdef CONFIG_PM #ifdef CONFIG_PM_LEGACY
/* register our power management capabilities */ /* register our power management capabilities */
opl3sa2_state[card].pmdev = pm_register(PM_ISA_DEV, card, opl3sa2_pm_callback); opl3sa2_state[card].pmdev = pm_register(PM_ISA_DEV, card, opl3sa2_pm_callback);
if (opl3sa2_state[card].pmdev) if (opl3sa2_state[card].pmdev)
opl3sa2_state[card].pmdev->data = &opl3sa2_state[card]; opl3sa2_state[card].pmdev->data = &opl3sa2_state[card];
#endif /* CONFIG_PM */ #endif /* CONFIG_PM_LEGACY */
/* /*
* Set the Yamaha 3D enhancement mode (aka Ymersion) if asked to and * Set the Yamaha 3D enhancement mode (aka Ymersion) if asked to and
...@@ -1081,7 +1083,7 @@ static void __exit cleanup_opl3sa2(void) ...@@ -1081,7 +1083,7 @@ static void __exit cleanup_opl3sa2(void)
int card; int card;
for(card = 0; card < opl3sa2_cards_num; card++) { for(card = 0; card < opl3sa2_cards_num; card++) {
#ifdef CONFIG_PM #ifdef CONFIG_PM_LEGACY
if (opl3sa2_state[card].pmdev) if (opl3sa2_state[card].pmdev)
pm_unregister(opl3sa2_state[card].pmdev); pm_unregister(opl3sa2_state[card].pmdev);
#endif #endif
......
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