aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/common/locomo.c11
-rw-r--r--arch/arm/common/sa1111.c13
-rw-r--r--arch/arm/mach-sa1100/neponset.c15
3 files changed, 20 insertions, 19 deletions
diff --git a/arch/arm/common/locomo.c b/arch/arm/common/locomo.c
index cfe6f4650bc9..ae21755872ed 100644
--- a/arch/arm/common/locomo.c
+++ b/arch/arm/common/locomo.c
@@ -60,6 +60,9 @@ struct locomo {
60 unsigned int irq; 60 unsigned int irq;
61 spinlock_t lock; 61 spinlock_t lock;
62 void __iomem *base; 62 void __iomem *base;
63#ifdef CONFIG_PM
64 void *saved_state;
65#endif
63}; 66};
64 67
65struct locomo_dev_info { 68struct locomo_dev_info {
@@ -565,7 +568,7 @@ static int locomo_suspend(struct platform_device *dev, pm_message_t state)
565 if (!save) 568 if (!save)
566 return -ENOMEM; 569 return -ENOMEM;
567 570
568 dev->dev.power.saved_state = (void *) save; 571 lchip->saved_state = save;
569 572
570 spin_lock_irqsave(&lchip->lock, flags); 573 spin_lock_irqsave(&lchip->lock, flags);
571 574
@@ -605,8 +608,8 @@ static int locomo_resume(struct platform_device *dev)
605 struct locomo_save_data *save; 608 struct locomo_save_data *save;
606 unsigned long r; 609 unsigned long r;
607 unsigned long flags; 610 unsigned long flags;
608 611
609 save = (struct locomo_save_data *) dev->dev.power.saved_state; 612 save = lchip->saved_state;
610 if (!save) 613 if (!save)
611 return 0; 614 return 0;
612 615
@@ -628,6 +631,8 @@ static int locomo_resume(struct platform_device *dev)
628 locomo_writel(0x1, lchip->base + LOCOMO_KEYBOARD + LOCOMO_KCMD); 631 locomo_writel(0x1, lchip->base + LOCOMO_KEYBOARD + LOCOMO_KCMD);
629 632
630 spin_unlock_irqrestore(&lchip->lock, flags); 633 spin_unlock_irqrestore(&lchip->lock, flags);
634
635 lchip->saved_state = NULL;
631 kfree(save); 636 kfree(save);
632 637
633 return 0; 638 return 0;
diff --git a/arch/arm/common/sa1111.c b/arch/arm/common/sa1111.c
index 798bbfccafb7..eb06d0b2cb74 100644
--- a/arch/arm/common/sa1111.c
+++ b/arch/arm/common/sa1111.c
@@ -51,6 +51,9 @@ struct sa1111 {
51 int irq; 51 int irq;
52 spinlock_t lock; 52 spinlock_t lock;
53 void __iomem *base; 53 void __iomem *base;
54#ifdef CONFIG_PM
55 void *saved_state;
56#endif
54}; 57};
55 58
56/* 59/*
@@ -822,7 +825,7 @@ static int sa1111_suspend(struct platform_device *dev, pm_message_t state)
822 save = kmalloc(sizeof(struct sa1111_save_data), GFP_KERNEL); 825 save = kmalloc(sizeof(struct sa1111_save_data), GFP_KERNEL);
823 if (!save) 826 if (!save)
824 return -ENOMEM; 827 return -ENOMEM;
825 dev->dev.power.saved_state = save; 828 sachip->saved_state = save;
826 829
827 spin_lock_irqsave(&sachip->lock, flags); 830 spin_lock_irqsave(&sachip->lock, flags);
828 831
@@ -878,7 +881,7 @@ static int sa1111_resume(struct platform_device *dev)
878 unsigned long flags, id; 881 unsigned long flags, id;
879 void __iomem *base; 882 void __iomem *base;
880 883
881 save = (struct sa1111_save_data *)dev->dev.power.saved_state; 884 save = sachip->saved_state;
882 if (!save) 885 if (!save)
883 return 0; 886 return 0;
884 887
@@ -923,7 +926,7 @@ static int sa1111_resume(struct platform_device *dev)
923 926
924 spin_unlock_irqrestore(&sachip->lock, flags); 927 spin_unlock_irqrestore(&sachip->lock, flags);
925 928
926 dev->dev.power.saved_state = NULL; 929 sachip->saved_state = NULL;
927 kfree(save); 930 kfree(save);
928 931
929 return 0; 932 return 0;
@@ -958,8 +961,8 @@ static int sa1111_remove(struct platform_device *pdev)
958 platform_set_drvdata(pdev, NULL); 961 platform_set_drvdata(pdev, NULL);
959 962
960#ifdef CONFIG_PM 963#ifdef CONFIG_PM
961 kfree(pdev->dev.power.saved_state); 964 kfree(sachip->saved_state);
962 pdev->dev.power.saved_state = NULL; 965 sachip->saved_state = NULL;
963#endif 966#endif
964 } 967 }
965 968
diff --git a/arch/arm/mach-sa1100/neponset.c b/arch/arm/mach-sa1100/neponset.c
index 4cbf9468f654..3a0a1ee2542d 100644
--- a/arch/arm/mach-sa1100/neponset.c
+++ b/arch/arm/mach-sa1100/neponset.c
@@ -185,28 +185,21 @@ static int __devinit neponset_probe(struct platform_device *dev)
185/* 185/*
186 * LDM power management. 186 * LDM power management.
187 */ 187 */
188static unsigned int neponset_saved_state;
189
188static int neponset_suspend(struct platform_device *dev, pm_message_t state) 190static int neponset_suspend(struct platform_device *dev, pm_message_t state)
189{ 191{
190 /* 192 /*
191 * Save state. 193 * Save state.
192 */ 194 */
193 if (!dev->dev.power.saved_state) 195 neponset_saved_state = NCR_0;
194 dev->dev.power.saved_state = kmalloc(sizeof(unsigned int), GFP_KERNEL);
195 if (!dev->dev.power.saved_state)
196 return -ENOMEM;
197
198 *(unsigned int *)dev->dev.power.saved_state = NCR_0;
199 196
200 return 0; 197 return 0;
201} 198}
202 199
203static int neponset_resume(struct platform_device *dev) 200static int neponset_resume(struct platform_device *dev)
204{ 201{
205 if (dev->dev.power.saved_state) { 202 NCR_0 = neponset_saved_state;
206 NCR_0 = *(unsigned int *)dev->dev.power.saved_state;
207 kfree(dev->dev.power.saved_state);
208 dev->dev.power.saved_state = NULL;
209 }
210 203
211 return 0; 204 return 0;
212} 205}