[PATCH] DRIVER MODEL: Get rid of the obsolete tri-level suspend/resume callbacks

In PM v1, all devices were called at SUSPEND_DISABLE level.  Then
all devices were called at SUSPEND_SAVE_STATE level, and finally
SUSPEND_POWER_DOWN level.  However, with PM v2, to maintain
compatibility for platform devices, I arranged for the PM v2
suspend/resume callbacks to call the old PM v1 suspend/resume
callbacks three times with each level in order so that existing
drivers continued to work.

Since this is obsolete infrastructure which is no longer necessary,
we can remove it.  Here's an (untested) patch to do exactly that.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Russell King 2005-10-28 09:52:56 -07:00 committed by Greg Kroah-Hartman
parent a3a3395e48
commit 9480e307cd
66 changed files with 321 additions and 688 deletions

View file

@ -196,67 +196,11 @@ it into a supported low-power state.
int (*suspend) (struct device * dev, pm_message_t state, u32 level);
suspend is called to put the device in a low power state. There are
several stages to successfully suspending a device, which is denoted in
the @level parameter. Breaking the suspend transition into several
stages affords the platform flexibility in performing device power
management based on the requirements of the system and the
user-defined policy.
SUSPEND_NOTIFY notifies the device that a suspend transition is about
to happen. This happens on system power state transitions to verify
that all devices can successfully suspend.
A driver may choose to fail on this call, which should cause the
entire suspend transition to fail. A driver should fail only if it
knows that the device will not be able to be resumed properly when the
system wakes up again. It could also fail if it somehow determines it
is in the middle of an operation too important to stop.
SUSPEND_DISABLE tells the device to stop I/O transactions. When it
stops transactions, or what it should do with unfinished transactions
is a policy of the driver. After this call, the driver should not
accept any other I/O requests.
SUSPEND_SAVE_STATE tells the device to save the context of the
hardware. This includes any bus-specific hardware state and
device-specific hardware state. A pointer to this saved state can be
stored in the device's saved_state field.
SUSPEND_POWER_DOWN tells the driver to place the device in the low
power state requested.
Whether suspend is called with a given level is a policy of the
platform. Some levels may be omitted; drivers must not assume the
reception of any level. However, all levels must be called in the
order above; i.e. notification will always come before disabling;
disabling the device will come before suspending the device.
All calls are made with interrupts enabled, except for the
SUSPEND_POWER_DOWN level.
suspend is called to put the device in a low power state.
int (*resume) (struct device * dev, u32 level);
Resume is used to bring a device back from a low power state. Like the
suspend transition, it happens in several stages.
RESUME_POWER_ON tells the driver to set the power state to the state
before the suspend call (The device could have already been in a low
power state before the suspend call to put in a lower power state).
RESUME_RESTORE_STATE tells the driver to restore the state saved by
the SUSPEND_SAVE_STATE suspend call.
RESUME_ENABLE tells the driver to start accepting I/O transactions
again. Depending on driver policy, the device may already have pending
I/O requests.
RESUME_POWER_ON is called with interrupts disabled. The other resume
levels are called with interrupts enabled.
As with the various suspend stages, the driver must not assume that
any other resume calls have been or will be made. Each call should be
self-contained and not dependent on any external state.
Resume is used to bring a device back from a low power state.
Attributes

View file

@ -550,15 +550,12 @@ struct locomo_save_data {
u16 LCM_SPIMD;
};
static int locomo_suspend(struct device *dev, pm_message_t state, u32 level)
static int locomo_suspend(struct device *dev, pm_message_t state)
{
struct locomo *lchip = dev_get_drvdata(dev);
struct locomo_save_data *save;
unsigned long flags;
if (level != SUSPEND_DISABLE)
return 0;
save = kmalloc(sizeof(struct locomo_save_data), GFP_KERNEL);
if (!save)
return -ENOMEM;
@ -597,16 +594,13 @@ static int locomo_suspend(struct device *dev, pm_message_t state, u32 level)
return 0;
}
static int locomo_resume(struct device *dev, u32 level)
static int locomo_resume(struct device *dev)
{
struct locomo *lchip = dev_get_drvdata(dev);
struct locomo_save_data *save;
unsigned long r;
unsigned long flags;
if (level != RESUME_ENABLE)
return 0;
save = (struct locomo_save_data *) dev->power.saved_state;
if (!save)
return 0;

View file

@ -801,7 +801,7 @@ struct sa1111_save_data {
#ifdef CONFIG_PM
static int sa1111_suspend(struct device *dev, pm_message_t state, u32 level)
static int sa1111_suspend(struct device *dev, pm_message_t state)
{
struct sa1111 *sachip = dev_get_drvdata(dev);
struct sa1111_save_data *save;
@ -809,9 +809,6 @@ static int sa1111_suspend(struct device *dev, pm_message_t state, u32 level)
unsigned int val;
void __iomem *base;
if (level != SUSPEND_DISABLE)
return 0;
save = kmalloc(sizeof(struct sa1111_save_data), GFP_KERNEL);
if (!save)
return -ENOMEM;
@ -856,23 +853,19 @@ static int sa1111_suspend(struct device *dev, pm_message_t state, u32 level)
/*
* sa1111_resume - Restore the SA1111 device state.
* @dev: device to restore
* @level: resume level
*
* Restore the general state of the SA1111; clock control and
* interrupt controller. Other parts of the SA1111 must be
* restored by their respective drivers, and must be called
* via LDM after this function.
*/
static int sa1111_resume(struct device *dev, u32 level)
static int sa1111_resume(struct device *dev)
{
struct sa1111 *sachip = dev_get_drvdata(dev);
struct sa1111_save_data *save;
unsigned long flags, id;
void __iomem *base;
if (level != RESUME_ENABLE)
return 0;
save = (struct sa1111_save_data *)dev->power.saved_state;
if (!save)
return 0;

View file

@ -102,26 +102,24 @@ static void check_scoop_reg(struct scoop_dev *sdev)
}
#ifdef CONFIG_PM
static int scoop_suspend(struct device *dev, pm_message_t state, uint32_t level)
static int scoop_suspend(struct device *dev, pm_message_t state)
{
if (level == SUSPEND_POWER_DOWN) {
struct scoop_dev *sdev = dev_get_drvdata(dev);
struct scoop_dev *sdev = dev_get_drvdata(dev);
check_scoop_reg(sdev);
sdev->scoop_gpwr = SCOOP_REG(sdev->base, SCOOP_GPWR);
SCOOP_REG(sdev->base, SCOOP_GPWR) = (sdev->scoop_gpwr & ~sdev->suspend_clr) | sdev->suspend_set;
check_scoop_reg(sdev);
sdev->scoop_gpwr = SCOOP_REG(sdev->base, SCOOP_GPWR);
SCOOP_REG(sdev->base, SCOOP_GPWR) = (sdev->scoop_gpwr & ~sdev->suspend_clr) | sdev->suspend_set;
}
return 0;
}
static int scoop_resume(struct device *dev, uint32_t level)
static int scoop_resume(struct device *dev)
{
if (level == RESUME_POWER_ON) {
struct scoop_dev *sdev = dev_get_drvdata(dev);
struct scoop_dev *sdev = dev_get_drvdata(dev);
check_scoop_reg(sdev);
SCOOP_REG(sdev->base,SCOOP_GPWR) = sdev->scoop_gpwr;
check_scoop_reg(sdev);
SCOOP_REG(sdev->base,SCOOP_GPWR) = sdev->scoop_gpwr;
}
return 0;
}
#else

View file

@ -222,24 +222,22 @@ static int corgi_ssp_remove(struct device *dev)
return 0;
}
static int corgi_ssp_suspend(struct device *dev, pm_message_t state, u32 level)
static int corgi_ssp_suspend(struct device *dev, pm_message_t state)
{
if (level == SUSPEND_POWER_DOWN) {
ssp_flush(&corgi_ssp_dev);
ssp_save_state(&corgi_ssp_dev,&corgi_ssp_state);
}
ssp_flush(&corgi_ssp_dev);
ssp_save_state(&corgi_ssp_dev,&corgi_ssp_state);
return 0;
}
static int corgi_ssp_resume(struct device *dev, u32 level)
static int corgi_ssp_resume(struct device *dev)
{
if (level == RESUME_POWER_ON) {
GPSR(ssp_machinfo->cs_lcdcon) = GPIO_bit(ssp_machinfo->cs_lcdcon); /* High - Disable LCD Control/Timing Gen */
GPSR(ssp_machinfo->cs_max1111) = GPIO_bit(ssp_machinfo->cs_max1111); /* High - Disable MAX1111*/
GPSR(ssp_machinfo->cs_ads7846) = GPIO_bit(ssp_machinfo->cs_ads7846); /* High - Disable ADS7846*/
ssp_restore_state(&corgi_ssp_dev,&corgi_ssp_state);
ssp_enable(&corgi_ssp_dev);
}
GPSR(ssp_machinfo->cs_lcdcon) = GPIO_bit(ssp_machinfo->cs_lcdcon); /* High - Disable LCD Control/Timing Gen */
GPSR(ssp_machinfo->cs_max1111) = GPIO_bit(ssp_machinfo->cs_max1111); /* High - Disable MAX1111*/
GPSR(ssp_machinfo->cs_ads7846) = GPIO_bit(ssp_machinfo->cs_ads7846); /* High - Disable ADS7846*/
ssp_restore_state(&corgi_ssp_dev,&corgi_ssp_state);
ssp_enable(&corgi_ssp_dev);
return 0;
}

View file

@ -178,33 +178,27 @@ static int neponset_probe(struct device *dev)
/*
* LDM power management.
*/
static int neponset_suspend(struct device *dev, pm_message_t state, u32 level)
static int neponset_suspend(struct device *dev, pm_message_t state)
{
/*
* Save state.
*/
if (level == SUSPEND_SAVE_STATE ||
level == SUSPEND_DISABLE ||
level == SUSPEND_POWER_DOWN) {
if (!dev->power.saved_state)
dev->power.saved_state = kmalloc(sizeof(unsigned int), GFP_KERNEL);
if (!dev->power.saved_state)
return -ENOMEM;
if (!dev->power.saved_state)
dev->power.saved_state = kmalloc(sizeof(unsigned int), GFP_KERNEL);
if (!dev->power.saved_state)
return -ENOMEM;
*(unsigned int *)dev->power.saved_state = NCR_0;
}
*(unsigned int *)dev->power.saved_state = NCR_0;
return 0;
}
static int neponset_resume(struct device *dev, u32 level)
static int neponset_resume(struct device *dev)
{
if (level == RESUME_RESTORE_STATE || level == RESUME_ENABLE) {
if (dev->power.saved_state) {
NCR_0 = *(unsigned int *)dev->power.saved_state;
kfree(dev->power.saved_state);
dev->power.saved_state = NULL;
}
if (dev->power.saved_state) {
NCR_0 = *(unsigned int *)dev->power.saved_state;
kfree(dev->power.saved_state);
dev->power.saved_state = NULL;
}
return 0;

View file

@ -281,13 +281,9 @@ static int platform_suspend(struct device * dev, pm_message_t state)
{
int ret = 0;
if (dev->driver && dev->driver->suspend) {
ret = dev->driver->suspend(dev, state, SUSPEND_DISABLE);
if (ret == 0)
ret = dev->driver->suspend(dev, state, SUSPEND_SAVE_STATE);
if (ret == 0)
ret = dev->driver->suspend(dev, state, SUSPEND_POWER_DOWN);
}
if (dev->driver && dev->driver->suspend)
ret = dev->driver->suspend(dev, state);
return ret;
}
@ -295,13 +291,9 @@ static int platform_resume(struct device * dev)
{
int ret = 0;
if (dev->driver && dev->driver->resume) {
ret = dev->driver->resume(dev, RESUME_POWER_ON);
if (ret == 0)
ret = dev->driver->resume(dev, RESUME_RESTORE_STATE);
if (ret == 0)
ret = dev->driver->resume(dev, RESUME_ENABLE);
}
if (dev->driver && dev->driver->resume)
ret = dev->driver->resume(dev);
return ret;
}

View file

@ -519,30 +519,28 @@ static struct timespec s3c2410_rtc_delta;
static int ticnt_save;
static int s3c2410_rtc_suspend(struct device *dev, pm_message_t state, u32 level)
static int s3c2410_rtc_suspend(struct device *dev, pm_message_t state)
{
struct rtc_time tm;
struct timespec time;
time.tv_nsec = 0;
if (level == SUSPEND_POWER_DOWN) {
/* save TICNT for anyone using periodic interrupts */
/* save TICNT for anyone using periodic interrupts */
ticnt_save = readb(S3C2410_TICNT);
ticnt_save = readb(S3C2410_TICNT);
/* calculate time delta for suspend */
/* calculate time delta for suspend */
s3c2410_rtc_gettime(&tm);
rtc_tm_to_time(&tm, &time.tv_sec);
save_time_delta(&s3c2410_rtc_delta, &time);
s3c2410_rtc_enable(dev, 0);
}
s3c2410_rtc_gettime(&tm);
rtc_tm_to_time(&tm, &time.tv_sec);
save_time_delta(&s3c2410_rtc_delta, &time);
s3c2410_rtc_enable(dev, 0);
return 0;
}
static int s3c2410_rtc_resume(struct device *dev, u32 level)
static int s3c2410_rtc_resume(struct device *dev)
{
struct rtc_time tm;
struct timespec time;

View file

@ -1167,19 +1167,17 @@ static int sonypi_disable(void)
#ifdef CONFIG_PM
static int old_camera_power;
static int sonypi_suspend(struct device *dev, pm_message_t state, u32 level)
static int sonypi_suspend(struct device *dev, pm_message_t state)
{
if (level == SUSPEND_DISABLE) {
old_camera_power = sonypi_device.camera_power;
sonypi_disable();
}
old_camera_power = sonypi_device.camera_power;
sonypi_disable();
return 0;
}
static int sonypi_resume(struct device *dev, u32 level)
static int sonypi_resume(struct device *dev)
{
if (level == RESUME_ENABLE)
sonypi_enable(old_camera_power);
sonypi_enable(old_camera_power);
return 0;
}
#endif

View file

@ -464,32 +464,28 @@ static void s3c2410wdt_shutdown(struct device *dev)
static unsigned long wtcon_save;
static unsigned long wtdat_save;
static int s3c2410wdt_suspend(struct device *dev, pm_message_t state, u32 level)
static int s3c2410wdt_suspend(struct device *dev, pm_message_t state)
{
if (level == SUSPEND_POWER_DOWN) {
/* Save watchdog state, and turn it off. */
wtcon_save = readl(wdt_base + S3C2410_WTCON);
wtdat_save = readl(wdt_base + S3C2410_WTDAT);
/* Save watchdog state, and turn it off. */
wtcon_save = readl(wdt_base + S3C2410_WTCON);
wtdat_save = readl(wdt_base + S3C2410_WTDAT);
/* Note that WTCNT doesn't need to be saved. */
s3c2410wdt_stop();
}
/* Note that WTCNT doesn't need to be saved. */
s3c2410wdt_stop();
return 0;
}
static int s3c2410wdt_resume(struct device *dev, u32 level)
static int s3c2410wdt_resume(struct device *dev)
{
if (level == RESUME_POWER_ON) {
/* Restore watchdog state. */
/* Restore watchdog state. */
writel(wtdat_save, wdt_base + S3C2410_WTDAT);
writel(wtdat_save, wdt_base + S3C2410_WTCNT); /* Reset count */
writel(wtcon_save, wdt_base + S3C2410_WTCON);
writel(wtdat_save, wdt_base + S3C2410_WTDAT);
writel(wtdat_save, wdt_base + S3C2410_WTCNT); /* Reset count */
writel(wtcon_save, wdt_base + S3C2410_WTCON);
printk(KERN_INFO PFX "watchdog %sabled\n",
(wtcon_save & S3C2410_WTCON_ENABLE) ? "en" : "dis");
}
printk(KERN_INFO PFX "watchdog %sabled\n",
(wtcon_save & S3C2410_WTCON_ENABLE) ? "en" : "dis");
return 0;
}

View file

@ -296,11 +296,9 @@ static int hdaps_probe(struct device *dev)
return 0;
}
static int hdaps_resume(struct device *dev, u32 level)
static int hdaps_resume(struct device *dev)
{
if (level == RESUME_ENABLE)
return hdaps_device_init();
return 0;
return hdaps_device_init();
}
static struct device_driver hdaps_driver = {

View file

@ -879,14 +879,12 @@ static int s3c24xx_i2c_remove(struct device *dev)
}
#ifdef CONFIG_PM
static int s3c24xx_i2c_resume(struct device *dev, u32 level)
static int s3c24xx_i2c_resume(struct device *dev)
{
struct s3c24xx_i2c *i2c = dev_get_drvdata(dev);
if (i2c != NULL && level == RESUME_ENABLE) {
dev_dbg(dev, "resume: level %d\n", level);
if (i2c != NULL)
s3c24xx_i2c_init(i2c);
}
return 0;
}

View file

@ -48,7 +48,7 @@ static int i2c_bus_suspend(struct device * dev, pm_message_t state)
int rc = 0;
if (dev->driver && dev->driver->suspend)
rc = dev->driver->suspend(dev,state,0);
rc = dev->driver->suspend(dev, state);
return rc;
}
@ -57,7 +57,7 @@ static int i2c_bus_resume(struct device * dev)
int rc = 0;
if (dev->driver && dev->driver->resume)
rc = dev->driver->resume(dev,0);
rc = dev->driver->resume(dev);
return rc;
}

View file

@ -1292,7 +1292,7 @@ static void nodemgr_suspend_ne(struct node_entry *ne)
if (ud->device.driver &&
(!ud->device.driver->suspend ||
ud->device.driver->suspend(&ud->device, PMSG_SUSPEND, 0)))
ud->device.driver->suspend(&ud->device, PMSG_SUSPEND)))
device_release_driver(&ud->device);
}
up_write(&ne->device.bus->subsys.rwsem);
@ -1315,7 +1315,7 @@ static void nodemgr_resume_ne(struct node_entry *ne)
continue;
if (ud->device.driver && ud->device.driver->resume)
ud->device.driver->resume(&ud->device, 0);
ud->device.driver->resume(&ud->device);
}
up_read(&ne->device.bus->subsys.rwsem);

View file

@ -259,24 +259,22 @@ static void corgikbd_hinge_timer(unsigned long data)
}
#ifdef CONFIG_PM
static int corgikbd_suspend(struct device *dev, pm_message_t state, uint32_t level)
static int corgikbd_suspend(struct device *dev, pm_message_t state)
{
if (level == SUSPEND_POWER_DOWN) {
struct corgikbd *corgikbd = dev_get_drvdata(dev);
corgikbd->suspended = 1;
}
struct corgikbd *corgikbd = dev_get_drvdata(dev);
corgikbd->suspended = 1;
return 0;
}
static int corgikbd_resume(struct device *dev, uint32_t level)
static int corgikbd_resume(struct device *dev)
{
if (level == RESUME_POWER_ON) {
struct corgikbd *corgikbd = dev_get_drvdata(dev);
struct corgikbd *corgikbd = dev_get_drvdata(dev);
/* Upon resume, ignore the suspend key for a short while */
corgikbd->suspend_jiffies=jiffies;
corgikbd->suspended = 0;
/* Upon resume, ignore the suspend key for a short while */
corgikbd->suspend_jiffies=jiffies;
corgikbd->suspended = 0;
}
return 0;
}
#else

View file

@ -309,34 +309,32 @@ static void spitzkbd_hinge_timer(unsigned long data)
}
#ifdef CONFIG_PM
static int spitzkbd_suspend(struct device *dev, pm_message_t state, uint32_t level)
static int spitzkbd_suspend(struct device *dev, pm_message_t state)
{
if (level == SUSPEND_POWER_DOWN) {
int i;
struct spitzkbd *spitzkbd = dev_get_drvdata(dev);
spitzkbd->suspended = 1;
int i;
struct spitzkbd *spitzkbd = dev_get_drvdata(dev);
spitzkbd->suspended = 1;
/* Set Strobe lines as inputs - *except* strobe line 0 leave this
enabled so we can detect a power button press for resume */
for (i = 1; i < SPITZ_KEY_STROBE_NUM; i++)
pxa_gpio_mode(spitz_strobes[i] | GPIO_IN);
/* Set Strobe lines as inputs - *except* strobe line 0 leave this
enabled so we can detect a power button press for resume */
for (i = 1; i < SPITZ_KEY_STROBE_NUM; i++)
pxa_gpio_mode(spitz_strobes[i] | GPIO_IN);
}
return 0;
}
static int spitzkbd_resume(struct device *dev, uint32_t level)
static int spitzkbd_resume(struct device *dev)
{
if (level == RESUME_POWER_ON) {
int i;
struct spitzkbd *spitzkbd = dev_get_drvdata(dev);
int i;
struct spitzkbd *spitzkbd = dev_get_drvdata(dev);
for (i = 0; i < SPITZ_KEY_STROBE_NUM; i++)
pxa_gpio_mode(spitz_strobes[i] | GPIO_OUT | GPIO_DFLT_HIGH);
for (i = 0; i < SPITZ_KEY_STROBE_NUM; i++)
pxa_gpio_mode(spitz_strobes[i] | GPIO_OUT | GPIO_DFLT_HIGH);
/* Upon resume, ignore the suspend key for a short while */
spitzkbd->suspend_jiffies = jiffies;
spitzkbd->suspended = 0;
/* Upon resume, ignore the suspend key for a short while */
spitzkbd->suspend_jiffies = jiffies;
spitzkbd->suspended = 0;
}
return 0;
}
#else

View file

@ -911,12 +911,10 @@ static long i8042_panic_blink(long count)
* Here we try to restore the original BIOS settings
*/
static int i8042_suspend(struct device *dev, pm_message_t state, u32 level)
static int i8042_suspend(struct device *dev, pm_message_t state)
{
if (level == SUSPEND_DISABLE) {
del_timer_sync(&i8042_timer);
i8042_controller_reset();
}
del_timer_sync(&i8042_timer);
i8042_controller_reset();
return 0;
}
@ -926,13 +924,10 @@ static int i8042_suspend(struct device *dev, pm_message_t state, u32 level)
* Here we try to reset everything back to a state in which suspended
*/
static int i8042_resume(struct device *dev, u32 level)
static int i8042_resume(struct device *dev)
{
int i;
if (level != RESUME_ENABLE)
return 0;
if (i8042_ctl_test())
return -1;

View file

@ -231,34 +231,32 @@ static irqreturn_t ts_interrupt(int irq, void *dev_id, struct pt_regs *regs)
}
#ifdef CONFIG_PM
static int corgits_suspend(struct device *dev, pm_message_t state, uint32_t level)
static int corgits_suspend(struct device *dev, pm_message_t state)
{
if (level == SUSPEND_POWER_DOWN) {
struct corgi_ts *corgi_ts = dev_get_drvdata(dev);
struct corgi_ts *corgi_ts = dev_get_drvdata(dev);
if (corgi_ts->pendown) {
del_timer_sync(&corgi_ts->timer);
corgi_ts->tc.pressure = 0;
new_data(corgi_ts, NULL);
corgi_ts->pendown = 0;
}
corgi_ts->power_mode = PWR_MODE_SUSPEND;
corgi_ssp_ads7846_putget((1u << ADSCTRL_ADR_SH) | ADSCTRL_STS);
if (corgi_ts->pendown) {
del_timer_sync(&corgi_ts->timer);
corgi_ts->tc.pressure = 0;
new_data(corgi_ts, NULL);
corgi_ts->pendown = 0;
}
corgi_ts->power_mode = PWR_MODE_SUSPEND;
corgi_ssp_ads7846_putget((1u << ADSCTRL_ADR_SH) | ADSCTRL_STS);
return 0;
}
static int corgits_resume(struct device *dev, uint32_t level)
static int corgits_resume(struct device *dev)
{
if (level == RESUME_POWER_ON) {
struct corgi_ts *corgi_ts = dev_get_drvdata(dev);
struct corgi_ts *corgi_ts = dev_get_drvdata(dev);
corgi_ssp_ads7846_putget((4u << ADSCTRL_ADR_SH) | ADSCTRL_STS);
/* Enable Falling Edge */
set_irq_type(corgi_ts->irq_gpio, IRQT_FALLING);
corgi_ts->power_mode = PWR_MODE_ACTIVE;
corgi_ssp_ads7846_putget((4u << ADSCTRL_ADR_SH) | ADSCTRL_STS);
/* Enable Falling Edge */
set_irq_type(corgi_ts->irq_gpio, IRQT_FALLING);
corgi_ts->power_mode = PWR_MODE_ACTIVE;
}
return 0;
}
#else

View file

@ -1420,8 +1420,8 @@ static int msp_detach(struct i2c_client *client);
static int msp_probe(struct i2c_adapter *adap);
static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg);
static int msp_suspend(struct device * dev, pm_message_t state, u32 level);
static int msp_resume(struct device * dev, u32 level);
static int msp_suspend(struct device * dev, pm_message_t state);
static int msp_resume(struct device * dev);
static void msp_wake_thread(struct i2c_client *client);
@ -1821,7 +1821,7 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg)
return 0;
}
static int msp_suspend(struct device * dev, pm_message_t state, u32 level)
static int msp_suspend(struct device * dev, pm_message_t state)
{
struct i2c_client *c = container_of(dev, struct i2c_client, dev);
@ -1830,7 +1830,7 @@ static int msp_suspend(struct device * dev, pm_message_t state, u32 level)
return 0;
}
static int msp_resume(struct device * dev, u32 level)
static int msp_resume(struct device * dev)
{
struct i2c_client *c = container_of(dev, struct i2c_client, dev);

View file

@ -784,13 +784,13 @@ tda9887_command(struct i2c_client *client, unsigned int cmd, void *arg)
return 0;
}
static int tda9887_suspend(struct device * dev, pm_message_t state, u32 level)
static int tda9887_suspend(struct device * dev, pm_message_t state)
{
dprintk("tda9887: suspend\n");
return 0;
}
static int tda9887_resume(struct device * dev, u32 level)
static int tda9887_resume(struct device * dev)
{
struct i2c_client *c = container_of(dev, struct i2c_client, dev);
struct tda9887 *t = i2c_get_clientdata(c);

View file

@ -697,7 +697,7 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
return 0;
}
static int tuner_suspend(struct device *dev, pm_message_t state, u32 level)
static int tuner_suspend(struct device *dev, pm_message_t state)
{
struct i2c_client *c = container_of (dev, struct i2c_client, dev);
struct tuner *t = i2c_get_clientdata (c);
@ -707,7 +707,7 @@ static int tuner_suspend(struct device *dev, pm_message_t state, u32 level)
return 0;
}
static int tuner_resume(struct device *dev, u32 level)
static int tuner_resume(struct device *dev)
{
struct i2c_client *c = container_of (dev, struct i2c_client, dev);
struct tuner *t = i2c_get_clientdata (c);

View file

@ -219,26 +219,24 @@ static int mcp_sa11x0_remove(struct device *dev)
return 0;
}
static int mcp_sa11x0_suspend(struct device *dev, pm_message_t state, u32 level)
static int mcp_sa11x0_suspend(struct device *dev, pm_message_t state)
{
struct mcp *mcp = dev_get_drvdata(dev);
if (level == SUSPEND_DISABLE) {
priv(mcp)->mccr0 = Ser4MCCR0;
priv(mcp)->mccr1 = Ser4MCCR1;
Ser4MCCR0 &= ~MCCR0_MCE;
}
priv(mcp)->mccr0 = Ser4MCCR0;
priv(mcp)->mccr1 = Ser4MCCR1;
Ser4MCCR0 &= ~MCCR0_MCE;
return 0;
}
static int mcp_sa11x0_resume(struct device *dev, u32 level)
static int mcp_sa11x0_resume(struct device *dev)
{
struct mcp *mcp = dev_get_drvdata(dev);
if (level == RESUME_RESTORE_STATE) {
Ser4MCCR1 = priv(mcp)->mccr1;
Ser4MCCR0 = priv(mcp)->mccr0;
}
Ser4MCCR1 = priv(mcp)->mccr1;
Ser4MCCR0 = priv(mcp)->mccr0;
return 0;
}

View file

@ -571,23 +571,23 @@ static int pxamci_remove(struct device *dev)
}
#ifdef CONFIG_PM
static int pxamci_suspend(struct device *dev, pm_message_t state, u32 level)
static int pxamci_suspend(struct device *dev, pm_message_t state)
{
struct mmc_host *mmc = dev_get_drvdata(dev);
int ret = 0;
if (mmc && level == SUSPEND_DISABLE)
if (mmc)
ret = mmc_suspend_host(mmc, state);
return ret;
}
static int pxamci_resume(struct device *dev, u32 level)
static int pxamci_resume(struct device *dev)
{
struct mmc_host *mmc = dev_get_drvdata(dev);
int ret = 0;
if (mmc && level == RESUME_ENABLE)
if (mmc)
ret = mmc_resume_host(mmc);
return ret;

View file

@ -1955,14 +1955,14 @@ static void __devexit wbsd_pnp_remove(struct pnp_dev * dev)
*/
#ifdef CONFIG_PM
static int wbsd_suspend(struct device *dev, pm_message_t state, u32 level)
static int wbsd_suspend(struct device *dev, pm_message_t state)
{
DBGF("Not yet supported\n");
return 0;
}
static int wbsd_resume(struct device *dev, u32 level)
static int wbsd_resume(struct device *dev)
{
DBGF("Not yet supported\n");

View file

@ -402,21 +402,21 @@ static int __exit sa1100_mtd_remove(struct device *dev)
}
#ifdef CONFIG_PM
static int sa1100_mtd_suspend(struct device *dev, pm_message_t state, u32 level)
static int sa1100_mtd_suspend(struct device *dev, pm_message_t state)
{
struct sa_info *info = dev_get_drvdata(dev);
int ret = 0;
if (info && level == SUSPEND_SAVE_STATE)
if (info)
ret = info->mtd->suspend(info->mtd);
return ret;
}
static int sa1100_mtd_resume(struct device *dev, u32 level)
static int sa1100_mtd_resume(struct device *dev)
{
struct sa_info *info = dev_get_drvdata(dev);
if (info && level == RESUME_RESTORE_STATE)
if (info)
info->mtd->resume(info->mtd);
return 0;
}

View file

@ -1140,11 +1140,11 @@ dm9000_phy_write(struct net_device *dev, int phyaddr_unused, int reg, int value)
}
static int
dm9000_drv_suspend(struct device *dev, pm_message_t state, u32 level)
dm9000_drv_suspend(struct device *dev, pm_message_t state)
{
struct net_device *ndev = dev_get_drvdata(dev);
if (ndev && level == SUSPEND_DISABLE) {
if (ndev) {
if (netif_running(ndev)) {
netif_device_detach(ndev);
dm9000_shutdown(ndev);
@ -1154,12 +1154,12 @@ dm9000_drv_suspend(struct device *dev, pm_message_t state, u32 level)
}
static int
dm9000_drv_resume(struct device *dev, u32 level)
dm9000_drv_resume(struct device *dev)
{
struct net_device *ndev = dev_get_drvdata(dev);
board_info_t *db = (board_info_t *) ndev->priv;
if (ndev && level == RESUME_ENABLE) {
if (ndev) {
if (netif_running(ndev)) {
dm9000_reset(db);

View file

@ -291,12 +291,12 @@ static void sa1100_irda_shutdown(struct sa1100_irda *si)
/*
* Suspend the IrDA interface.
*/
static int sa1100_irda_suspend(struct device *_dev, pm_message_t state, u32 level)
static int sa1100_irda_suspend(struct device *_dev, pm_message_t state)
{
struct net_device *dev = dev_get_drvdata(_dev);
struct sa1100_irda *si;
if (!dev || level != SUSPEND_DISABLE)
if (!dev)
return 0;
si = dev->priv;
@ -316,12 +316,12 @@ static int sa1100_irda_suspend(struct device *_dev, pm_message_t state, u32 leve
/*
* Resume the IrDA interface.
*/
static int sa1100_irda_resume(struct device *_dev, u32 level)
static int sa1100_irda_resume(struct device *_dev)
{
struct net_device *dev = dev_get_drvdata(_dev);
struct sa1100_irda *si;
if (!dev || level != RESUME_ENABLE)
if (!dev)
return 0;
si = dev->priv;

View file

@ -213,8 +213,8 @@ static int smsc_ircc_probe_transceiver_smsc_ircc_atc(int fir_base);
/* Power Management */
static int smsc_ircc_suspend(struct device *dev, pm_message_t state, u32 level);
static int smsc_ircc_resume(struct device *dev, u32 level);
static int smsc_ircc_suspend(struct device *dev, pm_message_t state);
static int smsc_ircc_resume(struct device *dev);
static struct device_driver smsc_ircc_driver = {
.name = SMSC_IRCC2_DRIVER_NAME,
@ -1646,13 +1646,13 @@ static int smsc_ircc_net_close(struct net_device *dev)
return 0;
}
static int smsc_ircc_suspend(struct device *dev, pm_message_t state, u32 level)
static int smsc_ircc_suspend(struct device *dev, pm_message_t state)
{
struct smsc_ircc_cb *self = dev_get_drvdata(dev);
IRDA_MESSAGE("%s, Suspending\n", driver_name);
if (level == SUSPEND_DISABLE && !self->io.suspended) {
if (!self->io.suspended) {
smsc_ircc_net_close(self->netdev);
self->io.suspended = 1;
}
@ -1660,11 +1660,11 @@ static int smsc_ircc_suspend(struct device *dev, pm_message_t state, u32 level)
return 0;
}
static int smsc_ircc_resume(struct device *dev, u32 level)
static int smsc_ircc_resume(struct device *dev)
{
struct smsc_ircc_cb *self = dev_get_drvdata(dev);
if (level == RESUME_ENABLE && self->io.suspended) {
if (self->io.suspended) {
smsc_ircc_net_open(self->netdev);
self->io.suspended = 0;

View file

@ -133,13 +133,9 @@ static int mdio_bus_suspend(struct device * dev, pm_message_t state)
int ret = 0;
struct device_driver *drv = dev->driver;
if (drv && drv->suspend) {
ret = drv->suspend(dev, state, SUSPEND_DISABLE);
if (ret == 0)
ret = drv->suspend(dev, state, SUSPEND_SAVE_STATE);
if (ret == 0)
ret = drv->suspend(dev, state, SUSPEND_POWER_DOWN);
}
if (drv && drv->suspend)
ret = drv->suspend(dev, state);
return ret;
}
@ -148,13 +144,9 @@ static int mdio_bus_resume(struct device * dev)
int ret = 0;
struct device_driver *drv = dev->driver;
if (drv && drv->resume) {
ret = drv->resume(dev, RESUME_POWER_ON);
if (ret == 0)
ret = drv->resume(dev, RESUME_RESTORE_STATE);
if (ret == 0)
ret = drv->resume(dev, RESUME_ENABLE);
}
if (drv && drv->resume)
ret = drv->resume(dev);
return ret;
}

View file

@ -2291,11 +2291,11 @@ static int smc_drv_remove(struct device *dev)
return 0;
}
static int smc_drv_suspend(struct device *dev, pm_message_t state, u32 level)
static int smc_drv_suspend(struct device *dev, pm_message_t state)
{
struct net_device *ndev = dev_get_drvdata(dev);
if (ndev && level == SUSPEND_DISABLE) {
if (ndev) {
if (netif_running(ndev)) {
netif_device_detach(ndev);
smc_shutdown(ndev);
@ -2305,12 +2305,12 @@ static int smc_drv_suspend(struct device *dev, pm_message_t state, u32 level)
return 0;
}
static int smc_drv_resume(struct device *dev, u32 level)
static int smc_drv_resume(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
struct net_device *ndev = dev_get_drvdata(dev);
if (ndev && level == RESUME_ENABLE) {
if (ndev) {
struct smc_local *lp = netdev_priv(ndev);
smc_enable_device(pdev);
if (netif_running(ndev)) {

View file

@ -61,7 +61,7 @@ static int pcie_port_remove_service(struct device *dev)
static void pcie_port_shutdown_service(struct device *dev) {}
static int pcie_port_suspend_service(struct device *dev, pm_message_t state, u32 level)
static int pcie_port_suspend_service(struct device *dev, pm_message_t state)
{
struct pcie_device *pciedev;
struct pcie_port_service_driver *driver;
@ -76,7 +76,7 @@ static int pcie_port_suspend_service(struct device *dev, pm_message_t state, u32
return 0;
}
static int pcie_port_resume_service(struct device *dev, u32 level)
static int pcie_port_resume_service(struct device *dev)
{
struct pcie_device *pciedev;
struct pcie_port_service_driver *driver;

View file

@ -519,30 +519,13 @@ static int au1x00_drv_pcmcia_probe(struct device *dev)
}
static int au1x00_drv_pcmcia_suspend(struct device *dev, pm_message_t state, u32 level)
{
int ret = 0;
if (level == SUSPEND_SAVE_STATE)
ret = pcmcia_socket_dev_suspend(dev, state);
return ret;
}
static int au1x00_drv_pcmcia_resume(struct device *dev, u32 level)
{
int ret = 0;
if (level == RESUME_RESTORE_STATE)
ret = pcmcia_socket_dev_resume(dev);
return ret;
}
static struct device_driver au1x00_pcmcia_driver = {
.probe = au1x00_drv_pcmcia_probe,
.remove = au1x00_drv_pcmcia_remove,
.name = "au1x00-pcmcia",
.bus = &platform_bus_type,
.suspend = au1x00_drv_pcmcia_suspend,
.resume = au1x00_drv_pcmcia_resume
.suspend = pcmcia_socket_dev_suspend,
.resume = pcmcia_socket_dev_resume,
};
static struct platform_device au1x00_device = {

View file

@ -844,27 +844,11 @@ static void hs_exit_socket(hs_socket_t *sp)
local_irq_restore(flags);
}
static int hd64465_suspend(struct device *dev, pm_message_t state, u32 level)
{
int ret = 0;
if (level == SUSPEND_SAVE_STATE)
ret = pcmcia_socket_dev_suspend(dev, state);
return ret;
}
static int hd64465_resume(struct device *dev, u32 level)
{
int ret = 0;
if (level == RESUME_RESTORE_STATE)
ret = pcmcia_socket_dev_resume(dev);
return ret;
}
static struct device_driver hd64465_driver = {
.name = "hd64465-pcmcia",
.bus = &platform_bus_type,
.suspend = hd64465_suspend,
.resume = hd64465_resume,
.suspend = pcmcia_socket_dev_suspend,
.resume = pcmcia_socket_dev_resume,
};
static struct platform_device hd64465_device = {

View file

@ -1332,27 +1332,11 @@ static struct pccard_operations pcic_operations = {
/*====================================================================*/
static int i82365_suspend(struct device *dev, pm_message_t state, u32 level)
{
int ret = 0;
if (level == SUSPEND_SAVE_STATE)
ret = pcmcia_socket_dev_suspend(dev, state);
return ret;
}
static int i82365_resume(struct device *dev, u32 level)
{
int ret = 0;
if (level == RESUME_RESTORE_STATE)
ret = pcmcia_socket_dev_resume(dev);
return ret;
}
static struct device_driver i82365_driver = {
.name = "i82365",
.bus = &platform_bus_type,
.suspend = i82365_suspend,
.resume = i82365_resume,
.suspend = pcmcia_socket_dev_suspend,
.resume = pcmcia_socket_dev_resume,
};
static struct platform_device i82365_device = {

View file

@ -731,28 +731,11 @@ static struct pccard_operations pcc_operations = {
/*====================================================================*/
static int m32r_pcc_suspend(struct device *dev, pm_message_t state, u32 level)
{
int ret = 0;
if (level == SUSPEND_SAVE_STATE)
ret = pcmcia_socket_dev_suspend(dev, state);
return ret;
}
static int m32r_pcc_resume(struct device *dev, u32 level)
{
int ret = 0;
if (level == RESUME_RESTORE_STATE)
ret = pcmcia_socket_dev_resume(dev);
return ret;
}
static struct device_driver pcc_driver = {
.name = "cfc",
.bus = &platform_bus_type,
.suspend = m32r_pcc_suspend,
.resume = m32r_pcc_resume,
.suspend = pcmcia_socket_dev_suspend,
.resume = pcmcia_socket_dev_resume,
};
static struct platform_device pcc_device = {

View file

@ -695,28 +695,11 @@ static struct pccard_operations pcc_operations = {
/*====================================================================*/
static int m32r_pcc_suspend(struct device *dev, pm_message_t state, u32 level)
{
int ret = 0;
if (level == SUSPEND_SAVE_STATE)
ret = pcmcia_socket_dev_suspend(dev, state);
return ret;
}
static int m32r_pcc_resume(struct device *dev, u32 level)
{
int ret = 0;
if (level == RESUME_RESTORE_STATE)
ret = pcmcia_socket_dev_resume(dev);
return ret;
}
static struct device_driver pcc_driver = {
.name = "pcc",
.bus = &platform_bus_type,
.suspend = m32r_pcc_suspend,
.resume = m32r_pcc_resume,
.suspend = pcmcia_socket_dev_suspend,
.resume = pcmcia_socket_dev_resume,
};
static struct platform_device pcc_device = {

View file

@ -329,27 +329,13 @@ static int __devexit omap_cf_remove(struct device *dev)
return 0;
}
static int omap_cf_suspend(struct device *dev, pm_message_t mesg, u32 level)
{
if (level != SUSPEND_SAVE_STATE)
return 0;
return pcmcia_socket_dev_suspend(dev, mesg);
}
static int omap_cf_resume(struct device *dev, u32 level)
{
if (level != RESUME_RESTORE_STATE)
return 0;
return pcmcia_socket_dev_resume(dev);
}
static struct device_driver omap_cf_driver = {
.name = (char *) driver_name,
.bus = &platform_bus_type,
.probe = omap_cf_probe,
.remove = __devexit_p(omap_cf_remove),
.suspend = omap_cf_suspend,
.resume = omap_cf_resume,
.suspend = pcmcia_socket_dev_suspend,
.resume = pcmcia_socket_dev_resume,
};
static int __init omap_cf_init(void)

View file

@ -205,32 +205,20 @@ int pxa2xx_drv_pcmcia_probe(struct device *dev)
}
EXPORT_SYMBOL(pxa2xx_drv_pcmcia_probe);
static int pxa2xx_drv_pcmcia_suspend(struct device *dev, pm_message_t state, u32 level)
static int pxa2xx_drv_pcmcia_resume(struct device *dev)
{
int ret = 0;
if (level == SUSPEND_SAVE_STATE)
ret = pcmcia_socket_dev_suspend(dev, state);
return ret;
}
struct pcmcia_low_level *ops = dev->platform_data;
int nr = ops ? ops->nr : 0;
static int pxa2xx_drv_pcmcia_resume(struct device *dev, u32 level)
{
int ret = 0;
if (level == RESUME_RESTORE_STATE)
{
struct pcmcia_low_level *ops = dev->platform_data;
int nr = ops ? ops->nr : 0;
MECR = nr > 1 ? MECR_CIT | MECR_NOS : (nr > 0 ? MECR_CIT : 0);
MECR = nr > 1 ? MECR_CIT | MECR_NOS : (nr > 0 ? MECR_CIT : 0);
ret = pcmcia_socket_dev_resume(dev);
}
return ret;
return pcmcia_socket_dev_resume(dev);
}
static struct device_driver pxa2xx_pcmcia_driver = {
.probe = pxa2xx_drv_pcmcia_probe,
.remove = soc_common_drv_pcmcia_remove,
.suspend = pxa2xx_drv_pcmcia_suspend,
.suspend = pcmcia_socket_dev_suspend,
.resume = pxa2xx_drv_pcmcia_resume,
.name = "pxa2xx-pcmcia",
.bus = &platform_bus_type,

View file

@ -74,29 +74,13 @@ static int sa11x0_drv_pcmcia_probe(struct device *dev)
return ret;
}
static int sa11x0_drv_pcmcia_suspend(struct device *dev, pm_message_t state, u32 level)
{
int ret = 0;
if (level == SUSPEND_SAVE_STATE)
ret = pcmcia_socket_dev_suspend(dev, state);
return ret;
}
static int sa11x0_drv_pcmcia_resume(struct device *dev, u32 level)
{
int ret = 0;
if (level == RESUME_RESTORE_STATE)
ret = pcmcia_socket_dev_resume(dev);
return ret;
}
static struct device_driver sa11x0_pcmcia_driver = {
.probe = sa11x0_drv_pcmcia_probe,
.remove = soc_common_drv_pcmcia_remove,
.name = "sa11x0-pcmcia",
.bus = &platform_bus_type,
.suspend = sa11x0_drv_pcmcia_suspend,
.resume = sa11x0_drv_pcmcia_resume,
.suspend = pcmcia_socket_dev_suspend,
.resume = pcmcia_socket_dev_resume,
};
/* sa11x0_pcmcia_init()

View file

@ -372,27 +372,11 @@ static int __init get_tcic_id(void)
/*====================================================================*/
static int tcic_drv_suspend(struct device *dev, pm_message_t state, u32 level)
{
int ret = 0;
if (level == SUSPEND_SAVE_STATE)
ret = pcmcia_socket_dev_suspend(dev, state);
return ret;
}
static int tcic_drv_resume(struct device *dev, u32 level)
{
int ret = 0;
if (level == RESUME_RESTORE_STATE)
ret = pcmcia_socket_dev_resume(dev);
return ret;
}
static struct device_driver tcic_driver = {
.name = "tcic-pcmcia",
.bus = &platform_bus_type,
.suspend = tcic_drv_suspend,
.resume = tcic_drv_resume,
.suspend = pcmcia_socket_dev_suspend,
.resume = pcmcia_socket_dev_resume,
};
static struct platform_device tcic_device = {

View file

@ -774,31 +774,11 @@ static int __devinit vrc4171_card_setup(char *options)
__setup("vrc4171_card=", vrc4171_card_setup);
static int vrc4171_card_suspend(struct device *dev, pm_message_t state, u32 level)
{
int retval = 0;
if (level == SUSPEND_SAVE_STATE)
retval = pcmcia_socket_dev_suspend(dev, state);
return retval;
}
static int vrc4171_card_resume(struct device *dev, u32 level)
{
int retval = 0;
if (level == RESUME_RESTORE_STATE)
retval = pcmcia_socket_dev_resume(dev);
return retval;
}
static struct device_driver vrc4171_card_driver = {
.name = vrc4171_card_name,
.bus = &platform_bus_type,
.suspend = vrc4171_card_suspend,
.resume = vrc4171_card_resume,
.suspend = pcmcia_socket_dev_suspend,
.resume = pcmcia_socket_dev_resume,
};
static int __devinit vrc4171_card_init(void)

View file

@ -2358,13 +2358,10 @@ static int __devexit serial8250_remove(struct device *dev)
return 0;
}
static int serial8250_suspend(struct device *dev, pm_message_t state, u32 level)
static int serial8250_suspend(struct device *dev, pm_message_t state)
{
int i;
if (level != SUSPEND_DISABLE)
return 0;
for (i = 0; i < UART_NR; i++) {
struct uart_8250_port *up = &serial8250_ports[i];
@ -2375,13 +2372,10 @@ static int serial8250_suspend(struct device *dev, pm_message_t state, u32 level)
return 0;
}
static int serial8250_resume(struct device *dev, u32 level)
static int serial8250_resume(struct device *dev)
{
int i;
if (level != RESUME_ENABLE)
return 0;
for (i = 0; i < UART_NR; i++) {
struct uart_8250_port *up = &serial8250_ports[i];

View file

@ -921,21 +921,21 @@ static struct uart_driver imx_reg = {
.cons = IMX_CONSOLE,
};
static int serial_imx_suspend(struct device *_dev, pm_message_t state, u32 level)
static int serial_imx_suspend(struct device *_dev, pm_message_t state)
{
struct imx_port *sport = dev_get_drvdata(_dev);
if (sport && level == SUSPEND_DISABLE)
if (sport)
uart_suspend_port(&imx_reg, &sport->port);
return 0;
}
static int serial_imx_resume(struct device *_dev, u32 level)
static int serial_imx_resume(struct device *_dev)
{
struct imx_port *sport = dev_get_drvdata(_dev);
if (sport && level == RESUME_ENABLE)
if (sport)
uart_resume_port(&imx_reg, &sport->port);
return 0;

View file

@ -781,22 +781,22 @@ mpc52xx_uart_remove(struct device *dev)
#ifdef CONFIG_PM
static int
mpc52xx_uart_suspend(struct device *dev, pm_message_t state, u32 level)
mpc52xx_uart_suspend(struct device *dev, pm_message_t state)
{
struct uart_port *port = (struct uart_port *) dev_get_drvdata(dev);
if (sport && level == SUSPEND_DISABLE)
if (sport)
uart_suspend_port(&mpc52xx_uart_driver, port);
return 0;
}
static int
mpc52xx_uart_resume(struct device *dev, u32 level)
mpc52xx_uart_resume(struct device *dev)
{
struct uart_port *port = (struct uart_port *) dev_get_drvdata(dev);
if (port && level == RESUME_ENABLE)
if (port)
uart_resume_port(&mpc52xx_uart_driver, port);
return 0;

View file

@ -786,21 +786,21 @@ static struct uart_driver serial_pxa_reg = {
.cons = PXA_CONSOLE,
};
static int serial_pxa_suspend(struct device *_dev, pm_message_t state, u32 level)
static int serial_pxa_suspend(struct device *_dev, pm_message_t state)
{
struct uart_pxa_port *sport = dev_get_drvdata(_dev);
if (sport && level == SUSPEND_DISABLE)
if (sport)
uart_suspend_port(&serial_pxa_reg, &sport->port);
return 0;
}
static int serial_pxa_resume(struct device *_dev, u32 level)
static int serial_pxa_resume(struct device *_dev)
{
struct uart_pxa_port *sport = dev_get_drvdata(_dev);
if (sport && level == RESUME_ENABLE)
if (sport)
uart_resume_port(&serial_pxa_reg, &sport->port);
return 0;

View file

@ -1134,23 +1134,22 @@ static int s3c24xx_serial_remove(struct device *_dev)
#ifdef CONFIG_PM
static int s3c24xx_serial_suspend(struct device *dev, pm_message_t state,
u32 level)
static int s3c24xx_serial_suspend(struct device *dev, pm_message_t state)
{
struct uart_port *port = s3c24xx_dev_to_port(dev);
if (port && level == SUSPEND_DISABLE)
if (port)
uart_suspend_port(&s3c24xx_uart_drv, port);
return 0;
}
static int s3c24xx_serial_resume(struct device *dev, u32 level)
static int s3c24xx_serial_resume(struct device *dev)
{
struct uart_port *port = s3c24xx_dev_to_port(dev);
struct s3c24xx_uart_port *ourport = to_ourport(port);
if (port && level == RESUME_ENABLE) {
if (port) {
clk_enable(ourport->clk);
s3c24xx_serial_resetport(port, s3c24xx_port_to_cfg(port));
clk_disable(ourport->clk);

View file

@ -834,21 +834,21 @@ static struct uart_driver sa1100_reg = {
.cons = SA1100_CONSOLE,
};
static int sa1100_serial_suspend(struct device *_dev, pm_message_t state, u32 level)
static int sa1100_serial_suspend(struct device *_dev, pm_message_t state)
{
struct sa1100_port *sport = dev_get_drvdata(_dev);
if (sport && level == SUSPEND_DISABLE)
if (sport)
uart_suspend_port(&sa1100_reg, &sport->port);
return 0;
}
static int sa1100_serial_resume(struct device *_dev, u32 level)
static int sa1100_serial_resume(struct device *_dev)
{
struct sa1100_port *sport = dev_get_drvdata(_dev);
if (sport && level == RESUME_ENABLE)
if (sport)
uart_resume_port(&sa1100_reg, &sport->port);
return 0;

View file

@ -976,14 +976,11 @@ static int siu_remove(struct device *dev)
return 0;
}
static int siu_suspend(struct device *dev, pm_message_t state, u32 level)
static int siu_suspend(struct device *dev, pm_message_t state)
{
struct uart_port *port;
int i;
if (level != SUSPEND_DISABLE)
return 0;
for (i = 0; i < siu_uart_driver.nr; i++) {
port = &siu_uart_ports[i];
if ((port->type == PORT_VR41XX_SIU ||
@ -995,14 +992,11 @@ static int siu_suspend(struct device *dev, pm_message_t state, u32 level)
return 0;
}
static int siu_resume(struct device *dev, u32 level)
static int siu_resume(struct device *dev)
{
struct uart_port *port;
int i;
if (level != RESUME_ENABLE)
return 0;
for (i = 0; i < siu_uart_driver.nr; i++) {
port = &siu_uart_ports[i];
if ((port->type == PORT_VR41XX_SIU ||

View file

@ -935,14 +935,10 @@ static int dummy_udc_remove (struct device *dev)
return 0;
}
static int dummy_udc_suspend (struct device *dev, pm_message_t state,
u32 level)
static int dummy_udc_suspend (struct device *dev, pm_message_t state)
{
struct dummy *dum = dev_get_drvdata(dev);
if (level != SUSPEND_DISABLE)
return 0;
dev_dbg (dev, "%s\n", __FUNCTION__);
spin_lock_irq (&dum->lock);
dum->udc_suspended = 1;
@ -954,13 +950,10 @@ static int dummy_udc_suspend (struct device *dev, pm_message_t state,
return 0;
}
static int dummy_udc_resume (struct device *dev, u32 level)
static int dummy_udc_resume (struct device *dev)
{
struct dummy *dum = dev_get_drvdata(dev);
if (level != RESUME_ENABLE)
return 0;
dev_dbg (dev, "%s\n", __FUNCTION__);
spin_lock_irq (&dum->lock);
dum->udc_suspended = 0;
@ -1936,14 +1929,10 @@ static int dummy_hcd_remove (struct device *dev)
return 0;
}
static int dummy_hcd_suspend (struct device *dev, pm_message_t state,
u32 level)
static int dummy_hcd_suspend (struct device *dev, pm_message_t state)
{
struct usb_hcd *hcd;
if (level != SUSPEND_DISABLE)
return 0;
dev_dbg (dev, "%s\n", __FUNCTION__);
hcd = dev_get_drvdata (dev);
@ -1958,13 +1947,10 @@ static int dummy_hcd_suspend (struct device *dev, pm_message_t state,
return 0;
}
static int dummy_hcd_resume (struct device *dev, u32 level)
static int dummy_hcd_resume (struct device *dev)
{
struct usb_hcd *hcd;
if (level != RESUME_ENABLE)
return 0;
dev_dbg (dev, "%s\n", __FUNCTION__);
hcd = dev_get_drvdata (dev);
hcd->state = HC_STATE_RUNNING;

View file

@ -2909,12 +2909,10 @@ static int __exit omap_udc_remove(struct device *dev)
* may involve talking to an external transceiver (e.g. isp1301).
*/
static int omap_udc_suspend(struct device *dev, pm_message_t message, u32 level)
static int omap_udc_suspend(struct device *dev, pm_message_t message)
{
u32 devstat;
if (level != SUSPEND_POWER_DOWN)
return 0;
devstat = UDC_DEVSTAT_REG;
/* we're requesting 48 MHz clock if the pullup is enabled
@ -2931,11 +2929,8 @@ static int omap_udc_suspend(struct device *dev, pm_message_t message, u32 level)
return 0;
}
static int omap_udc_resume(struct device *dev, u32 level)
static int omap_udc_resume(struct device *dev)
{
if (level != RESUME_POWER_ON)
return 0;
DBG("resume + wakeup/SRP\n");
omap_pullup(&udc->gadget, 1);

View file

@ -2602,24 +2602,23 @@ static int __exit pxa2xx_udc_remove(struct device *_dev)
* VBUS IRQs should probably be ignored so that the PXA device just acts
* "dead" to USB hosts until system resume.
*/
static int pxa2xx_udc_suspend(struct device *dev, pm_message_t state, u32 level)
static int pxa2xx_udc_suspend(struct device *dev, pm_message_t state)
{
struct pxa2xx_udc *udc = dev_get_drvdata(dev);
if (level == SUSPEND_POWER_DOWN) {
if (!udc->mach->udc_command)
WARN("USB host won't detect disconnect!\n");
pullup(udc, 0);
}
if (!udc->mach->udc_command)
WARN("USB host won't detect disconnect!\n");
pullup(udc, 0);
return 0;
}
static int pxa2xx_udc_resume(struct device *dev, u32 level)
static int pxa2xx_udc_resume(struct device *dev)
{
struct pxa2xx_udc *udc = dev_get_drvdata(dev);
if (level == RESUME_POWER_ON)
pullup(udc, 1);
pullup(udc, 1);
return 0;
}

View file

@ -1774,15 +1774,12 @@ static int __init isp116x_probe(struct device *dev)
/*
Suspend of platform device
*/
static int isp116x_suspend(struct device *dev, pm_message_t state, u32 phase)
static int isp116x_suspend(struct device *dev, pm_message_t state)
{
int ret = 0;
struct usb_hcd *hcd = dev_get_drvdata(dev);
VDBG("%s: state %x, phase %x\n", __func__, state, phase);
if (phase != SUSPEND_DISABLE && phase != SUSPEND_POWER_DOWN)
return 0;
VDBG("%s: state %x\n", __func__, state);
ret = usb_suspend_device(hcd->self.root_hub, state);
if (!ret) {
@ -1797,15 +1794,12 @@ static int isp116x_suspend(struct device *dev, pm_message_t state, u32 phase)
/*
Resume platform device
*/
static int isp116x_resume(struct device *dev, u32 phase)
static int isp116x_resume(struct device *dev)
{
int ret = 0;
struct usb_hcd *hcd = dev_get_drvdata(dev);
VDBG("%s: state %x, phase %x\n", __func__, dev->power.power_state,
phase);
if (phase != RESUME_POWER_ON)
return 0;
VDBG("%s: state %x\n", __func__, dev->power.power_state);
ret = usb_resume_device(hcd->self.root_hub);
if (!ret) {

View file

@ -455,14 +455,11 @@ static int ohci_hcd_omap_drv_remove(struct device *dev)
#ifdef CONFIG_PM
static int ohci_omap_suspend(struct device *dev, pm_message_t message, u32 level)
static int ohci_omap_suspend(struct device *dev, pm_message_t message)
{
struct ohci_hcd *ohci = hcd_to_ohci(dev_get_drvdata(dev));
int status = -EINVAL;
if (level != SUSPEND_POWER_DOWN)
return 0;
down(&ohci_to_hcd(ohci)->self.root_hub->serialize);
status = ohci_hub_suspend(ohci_to_hcd(ohci));
if (status == 0) {
@ -476,14 +473,11 @@ static int ohci_omap_suspend(struct device *dev, pm_message_t message, u32 level
return status;
}
static int ohci_omap_resume(struct device *dev, u32 level)
static int ohci_omap_resume(struct device *dev)
{
struct ohci_hcd *ohci = hcd_to_ohci(dev_get_drvdata(dev));
int status = 0;
if (level != RESUME_POWER_ON)
return 0;
if (time_before(jiffies, ohci->next_statechange))
msleep(5);
ohci->next_statechange = jiffies;

View file

@ -309,7 +309,7 @@ static int ohci_hcd_pxa27x_drv_remove(struct device *dev)
return 0;
}
static int ohci_hcd_pxa27x_drv_suspend(struct device *dev, pm_message_t state, u32 level)
static int ohci_hcd_pxa27x_drv_suspend(struct device *dev, pm_message_t state)
{
// struct platform_device *pdev = to_platform_device(dev);
// struct usb_hcd *hcd = dev_get_drvdata(dev);
@ -318,7 +318,7 @@ static int ohci_hcd_pxa27x_drv_suspend(struct device *dev, pm_message_t state, u
return 0;
}
static int ohci_hcd_pxa27x_drv_resume(struct device *dev, u32 level)
static int ohci_hcd_pxa27x_drv_resume(struct device *dev)
{
// struct platform_device *pdev = to_platform_device(dev);
// struct usb_hcd *hcd = dev_get_drvdata(dev);

View file

@ -1784,15 +1784,12 @@ sl811h_probe(struct device *dev)
*/
static int
sl811h_suspend(struct device *dev, pm_message_t state, u32 phase)
sl811h_suspend(struct device *dev, pm_message_t state)
{
struct usb_hcd *hcd = dev_get_drvdata(dev);
struct sl811 *sl811 = hcd_to_sl811(hcd);
int retval = 0;
if (phase != SUSPEND_POWER_DOWN)
return retval;
if (state.event == PM_EVENT_FREEZE)
retval = sl811h_hub_suspend(hcd);
else if (state.event == PM_EVENT_SUSPEND)
@ -1803,14 +1800,11 @@ sl811h_suspend(struct device *dev, pm_message_t state, u32 phase)
}
static int
sl811h_resume(struct device *dev, u32 phase)
sl811h_resume(struct device *dev)
{
struct usb_hcd *hcd = dev_get_drvdata(dev);
struct sl811 *sl811 = hcd_to_sl811(hcd);
if (phase != RESUME_POWER_ON)
return 0;
/* with no "check to see if VBUS is still powered" board hook,
* let's assume it'd only be powered to enable remote wakeup.
*/

View file

@ -73,17 +73,15 @@ static void corgibl_blank(int blank)
}
#ifdef CONFIG_PM
static int corgibl_suspend(struct device *dev, pm_message_t state, u32 level)
static int corgibl_suspend(struct device *dev, pm_message_t state)
{
if (level == SUSPEND_POWER_DOWN)
corgibl_blank(FB_BLANK_POWERDOWN);
corgibl_blank(FB_BLANK_POWERDOWN);
return 0;
}
static int corgibl_resume(struct device *dev, u32 level)
static int corgibl_resume(struct device *dev)
{
if (level == RESUME_POWER_ON)
corgibl_blank(FB_BLANK_UNBLANK);
corgibl_blank(FB_BLANK_UNBLANK);
return 0;
}
#else

View file

@ -424,23 +424,21 @@ static void imxfb_setup_gpio(struct imxfb_info *fbi)
* Power management hooks. Note that we won't be called from IRQ context,
* unlike the blank functions above, so we may sleep.
*/
static int imxfb_suspend(struct device *dev, pm_message_t state, u32 level)
static int imxfb_suspend(struct device *dev, pm_message_t state)
{
struct imxfb_info *fbi = dev_get_drvdata(dev);
pr_debug("%s\n",__FUNCTION__);
if (level == SUSPEND_DISABLE || level == SUSPEND_POWER_DOWN)
imxfb_disable_controller(fbi);
imxfb_disable_controller(fbi);
return 0;
}
static int imxfb_resume(struct device *dev, u32 level)
static int imxfb_resume(struct device *dev)
{
struct imxfb_info *fbi = dev_get_drvdata(dev);
pr_debug("%s\n",__FUNCTION__);
if (level == RESUME_ENABLE)
imxfb_enable_controller(fbi);
imxfb_enable_controller(fbi);
return 0;
}
#else

View file

@ -981,21 +981,19 @@ pxafb_freq_policy(struct notifier_block *nb, unsigned long val, void *data)
* Power management hooks. Note that we won't be called from IRQ context,
* unlike the blank functions above, so we may sleep.
*/
static int pxafb_suspend(struct device *dev, pm_message_t state, u32 level)
static int pxafb_suspend(struct device *dev, pm_message_t state)
{
struct pxafb_info *fbi = dev_get_drvdata(dev);
if (level == SUSPEND_DISABLE || level == SUSPEND_POWER_DOWN)
set_ctrlr_state(fbi, C_DISABLE_PM);
set_ctrlr_state(fbi, C_DISABLE_PM);
return 0;
}
static int pxafb_resume(struct device *dev, u32 level)
static int pxafb_resume(struct device *dev)
{
struct pxafb_info *fbi = dev_get_drvdata(dev);
if (level == RESUME_ENABLE)
set_ctrlr_state(fbi, C_ENABLE_PM);
set_ctrlr_state(fbi, C_ENABLE_PM);
return 0;
}
#else

View file

@ -655,7 +655,7 @@ bail:
}
#ifdef CONFIG_PM
static int s1d13xxxfb_suspend(struct device *dev, pm_message_t state, u32 level)
static int s1d13xxxfb_suspend(struct device *dev, pm_message_t state)
{
struct fb_info *info = dev_get_drvdata(dev);
struct s1d13xxxfb_par *s1dfb = info->par;
@ -702,15 +702,12 @@ static int s1d13xxxfb_suspend(struct device *dev, pm_message_t state, u32 level)
return 0;
}
static int s1d13xxxfb_resume(struct device *dev, u32 level)
static int s1d13xxxfb_resume(struct device *dev)
{
struct fb_info *info = dev_get_drvdata(dev);
struct s1d13xxxfb_par *s1dfb = info->par;
struct s1d13xxxfb_pdata *pdata = NULL;
if (level != RESUME_ENABLE)
return 0;
/* awaken the chip */
s1d13xxxfb_writereg(s1dfb, S1DREG_PS_CNF, 0x10);

View file

@ -847,37 +847,32 @@ static int s3c2410fb_remove(struct device *dev)
/* suspend and resume support for the lcd controller */
static int s3c2410fb_suspend(struct device *dev, pm_message_t state, u32 level)
static int s3c2410fb_suspend(struct device *dev, pm_message_t state)
{
struct fb_info *fbinfo = dev_get_drvdata(dev);
struct s3c2410fb_info *info = fbinfo->par;
if (level == SUSPEND_DISABLE || level == SUSPEND_POWER_DOWN) {
s3c2410fb_stop_lcd();
s3c2410fb_stop_lcd();
/* sleep before disabling the clock, we need to ensure
* the LCD DMA engine is not going to get back on the bus
* before the clock goes off again (bjd) */
/* sleep before disabling the clock, we need to ensure
* the LCD DMA engine is not going to get back on the bus
* before the clock goes off again (bjd) */
msleep(1);
clk_disable(info->clk);
}
msleep(1);
clk_disable(info->clk);
return 0;
}
static int s3c2410fb_resume(struct device *dev, u32 level)
static int s3c2410fb_resume(struct device *dev)
{
struct fb_info *fbinfo = dev_get_drvdata(dev);
struct s3c2410fb_info *info = fbinfo->par;
if (level == RESUME_ENABLE) {
clk_enable(info->clk);
msleep(1);
clk_enable(info->clk);
msleep(1);
s3c2410fb_init_registers(info);
}
s3c2410fb_init_registers(info);
return 0;
}

View file

@ -1309,21 +1309,19 @@ sa1100fb_freq_policy(struct notifier_block *nb, unsigned long val,
* Power management hooks. Note that we won't be called from IRQ context,
* unlike the blank functions above, so we may sleep.
*/
static int sa1100fb_suspend(struct device *dev, pm_message_t state, u32 level)
static int sa1100fb_suspend(struct device *dev, pm_message_t state)
{
struct sa1100fb_info *fbi = dev_get_drvdata(dev);
if (level == SUSPEND_DISABLE || level == SUSPEND_POWER_DOWN)
set_ctrlr_state(fbi, C_DISABLE_PM);
set_ctrlr_state(fbi, C_DISABLE_PM);
return 0;
}
static int sa1100fb_resume(struct device *dev, u32 level)
static int sa1100fb_resume(struct device *dev)
{
struct sa1100fb_info *fbi = dev_get_drvdata(dev);
if (level == RESUME_ENABLE)
set_ctrlr_state(fbi, C_ENABLE_PM);
set_ctrlr_state(fbi, C_ENABLE_PM);
return 0;
}
#else

View file

@ -438,36 +438,34 @@ static void w100fb_restore_vidmem(struct w100fb_par *par)
}
}
static int w100fb_suspend(struct device *dev, pm_message_t state, uint32_t level)
static int w100fb_suspend(struct device *dev, pm_message_t state)
{
if (level == SUSPEND_POWER_DOWN) {
struct fb_info *info = dev_get_drvdata(dev);
struct w100fb_par *par=info->par;
struct w100_tg_info *tg = par->mach->tg;
struct fb_info *info = dev_get_drvdata(dev);
struct w100fb_par *par=info->par;
struct w100_tg_info *tg = par->mach->tg;
w100fb_save_vidmem(par);
if(tg && tg->suspend)
tg->suspend(par);
w100_suspend(W100_SUSPEND_ALL);
par->blanked = 1;
w100fb_save_vidmem(par);
if(tg && tg->suspend)
tg->suspend(par);
w100_suspend(W100_SUSPEND_ALL);
par->blanked = 1;
}
return 0;
}
static int w100fb_resume(struct device *dev, uint32_t level)
static int w100fb_resume(struct device *dev)
{
if (level == RESUME_POWER_ON) {
struct fb_info *info = dev_get_drvdata(dev);
struct w100fb_par *par=info->par;
struct w100_tg_info *tg = par->mach->tg;
struct fb_info *info = dev_get_drvdata(dev);
struct w100fb_par *par=info->par;
struct w100_tg_info *tg = par->mach->tg;
w100_hw_init(par);
w100fb_activate_var(par);
w100fb_restore_vidmem(par);
if(tg && tg->resume)
tg->resume(par);
par->blanked = 0;
w100_hw_init(par);
w100fb_activate_var(par);
w100fb_restore_vidmem(par);
if(tg && tg->resume)
tg->resume(par);
par->blanked = 0;
}
return 0;
}
#else

View file

@ -28,19 +28,6 @@
#define BUS_ID_SIZE KOBJ_NAME_LEN
enum {
SUSPEND_NOTIFY,
SUSPEND_SAVE_STATE,
SUSPEND_DISABLE,
SUSPEND_POWER_DOWN,
};
enum {
RESUME_POWER_ON,
RESUME_RESTORE_STATE,
RESUME_ENABLE,
};
struct device;
struct device_driver;
struct class;
@ -115,8 +102,8 @@ struct device_driver {
int (*probe) (struct device * dev);
int (*remove) (struct device * dev);
void (*shutdown) (struct device * dev);
int (*suspend) (struct device * dev, pm_message_t state, u32 level);
int (*resume) (struct device * dev, u32 level);
int (*suspend) (struct device * dev, pm_message_t state);
int (*resume) (struct device * dev);
};

View file

@ -275,23 +275,23 @@ static int pxa2xx_ac97_do_resume(snd_card_t *card)
return 0;
}
static int pxa2xx_ac97_suspend(struct device *_dev, pm_message_t state, u32 level)
static int pxa2xx_ac97_suspend(struct device *_dev, pm_message_t state)
{
snd_card_t *card = dev_get_drvdata(_dev);
int ret = 0;
if (card && level == SUSPEND_DISABLE)
if (card)
ret = pxa2xx_ac97_do_suspend(card, PMSG_SUSPEND);
return ret;
}
static int pxa2xx_ac97_resume(struct device *_dev, u32 level)
static int pxa2xx_ac97_resume(struct device *_dev)
{
snd_card_t *card = dev_get_drvdata(_dev);
int ret = 0;
if (card && level == RESUME_ENABLE)
if (card)
ret = pxa2xx_ac97_do_resume(card);
return ret;

View file

@ -676,8 +676,8 @@ struct snd_generic_device {
#define SND_GENERIC_NAME "snd_generic"
#ifdef CONFIG_PM
static int snd_generic_suspend(struct device *dev, pm_message_t state, u32 level);
static int snd_generic_resume(struct device *dev, u32 level);
static int snd_generic_suspend(struct device *dev, pm_message_t state);
static int snd_generic_resume(struct device *dev);
#endif
/* initialized in sound.c */
@ -818,13 +818,10 @@ int snd_card_set_pm_callback(snd_card_t *card,
#ifdef CONFIG_SND_GENERIC_DRIVER
/* suspend/resume callbacks for snd_generic platform device */
static int snd_generic_suspend(struct device *dev, pm_message_t state, u32 level)
static int snd_generic_suspend(struct device *dev, pm_message_t state)
{
snd_card_t *card;
if (level != SUSPEND_DISABLE)
return 0;
card = get_snd_generic_card(dev);
if (card->power_state == SNDRV_CTL_POWER_D3hot)
return 0;
@ -834,13 +831,10 @@ static int snd_generic_suspend(struct device *dev, pm_message_t state, u32 level
return 0;
}
static int snd_generic_resume(struct device *dev, u32 level)
static int snd_generic_resume(struct device *dev)
{
snd_card_t *card;
if (level != RESUME_ENABLE)
return 0;
card = get_snd_generic_card(dev);
if (card->power_state == SNDRV_CTL_POWER_D0)
return 0;

View file

@ -31,7 +31,8 @@ static int ac97_bus_suspend(struct device *dev, pm_message_t state)
int ret = 0;
if (dev->driver && dev->driver->suspend)
ret = dev->driver->suspend(dev, state, SUSPEND_POWER_DOWN);
ret = dev->driver->suspend(dev, state);
return ret;
}
@ -40,7 +41,8 @@ static int ac97_bus_resume(struct device *dev)
int ret = 0;
if (dev->driver && dev->driver->resume)
ret = dev->driver->resume(dev, RESUME_POWER_ON);
ret = dev->driver->resume(dev);
return ret;
}