PM: do not use saved_state from struct dev_pm_info on ARM

The saved_state member of 'struct dev_pm_info' that's going to be removed
is used in arch/arm/common/locomo.c, arch/arm/common/sa1111.c and
arch/arm/mach-sa1100/neponset.c.  Change the code in there to use local
variables for saving the state of devices during suspend.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Cc: Greg KH <greg@kroah.com>
Cc: David Brownell <david-b@pacbell.net>
Acked-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Rafael J. Wysocki 2007-07-09 11:39:19 -07:00 committed by Greg Kroah-Hartman
parent 43a49f8baa
commit 93160c6397
3 changed files with 20 additions and 19 deletions

View File

@ -60,6 +60,9 @@ struct locomo {
unsigned int irq; unsigned int irq;
spinlock_t lock; spinlock_t lock;
void __iomem *base; void __iomem *base;
#ifdef CONFIG_PM
void *saved_state;
#endif
}; };
struct locomo_dev_info { struct locomo_dev_info {
@ -565,7 +568,7 @@ static int locomo_suspend(struct platform_device *dev, pm_message_t state)
if (!save) if (!save)
return -ENOMEM; return -ENOMEM;
dev->dev.power.saved_state = (void *) save; lchip->saved_state = save;
spin_lock_irqsave(&lchip->lock, flags); spin_lock_irqsave(&lchip->lock, flags);
@ -605,8 +608,8 @@ static int locomo_resume(struct platform_device *dev)
struct locomo_save_data *save; struct locomo_save_data *save;
unsigned long r; unsigned long r;
unsigned long flags; unsigned long flags;
save = (struct locomo_save_data *) dev->dev.power.saved_state; save = lchip->saved_state;
if (!save) if (!save)
return 0; return 0;
@ -628,6 +631,8 @@ static int locomo_resume(struct platform_device *dev)
locomo_writel(0x1, lchip->base + LOCOMO_KEYBOARD + LOCOMO_KCMD); locomo_writel(0x1, lchip->base + LOCOMO_KEYBOARD + LOCOMO_KCMD);
spin_unlock_irqrestore(&lchip->lock, flags); spin_unlock_irqrestore(&lchip->lock, flags);
lchip->saved_state = NULL;
kfree(save); kfree(save);
return 0; return 0;

View File

@ -51,6 +51,9 @@ struct sa1111 {
int irq; int irq;
spinlock_t lock; spinlock_t lock;
void __iomem *base; void __iomem *base;
#ifdef CONFIG_PM
void *saved_state;
#endif
}; };
/* /*
@ -822,7 +825,7 @@ static int sa1111_suspend(struct platform_device *dev, pm_message_t state)
save = kmalloc(sizeof(struct sa1111_save_data), GFP_KERNEL); save = kmalloc(sizeof(struct sa1111_save_data), GFP_KERNEL);
if (!save) if (!save)
return -ENOMEM; return -ENOMEM;
dev->dev.power.saved_state = save; sachip->saved_state = save;
spin_lock_irqsave(&sachip->lock, flags); spin_lock_irqsave(&sachip->lock, flags);
@ -878,7 +881,7 @@ static int sa1111_resume(struct platform_device *dev)
unsigned long flags, id; unsigned long flags, id;
void __iomem *base; void __iomem *base;
save = (struct sa1111_save_data *)dev->dev.power.saved_state; save = sachip->saved_state;
if (!save) if (!save)
return 0; return 0;
@ -923,7 +926,7 @@ static int sa1111_resume(struct platform_device *dev)
spin_unlock_irqrestore(&sachip->lock, flags); spin_unlock_irqrestore(&sachip->lock, flags);
dev->dev.power.saved_state = NULL; sachip->saved_state = NULL;
kfree(save); kfree(save);
return 0; return 0;
@ -958,8 +961,8 @@ static int sa1111_remove(struct platform_device *pdev)
platform_set_drvdata(pdev, NULL); platform_set_drvdata(pdev, NULL);
#ifdef CONFIG_PM #ifdef CONFIG_PM
kfree(pdev->dev.power.saved_state); kfree(sachip->saved_state);
pdev->dev.power.saved_state = NULL; sachip->saved_state = NULL;
#endif #endif
} }

View File

@ -185,28 +185,21 @@ static int __devinit neponset_probe(struct platform_device *dev)
/* /*
* LDM power management. * LDM power management.
*/ */
static unsigned int neponset_saved_state;
static int neponset_suspend(struct platform_device *dev, pm_message_t state) static int neponset_suspend(struct platform_device *dev, pm_message_t state)
{ {
/* /*
* Save state. * Save state.
*/ */
if (!dev->dev.power.saved_state) neponset_saved_state = NCR_0;
dev->dev.power.saved_state = kmalloc(sizeof(unsigned int), GFP_KERNEL);
if (!dev->dev.power.saved_state)
return -ENOMEM;
*(unsigned int *)dev->dev.power.saved_state = NCR_0;
return 0; return 0;
} }
static int neponset_resume(struct platform_device *dev) static int neponset_resume(struct platform_device *dev)
{ {
if (dev->dev.power.saved_state) { NCR_0 = neponset_saved_state;
NCR_0 = *(unsigned int *)dev->dev.power.saved_state;
kfree(dev->dev.power.saved_state);
dev->dev.power.saved_state = NULL;
}
return 0; return 0;
} }