aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/mm/pmb.c
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2011-03-23 06:05:18 -0400
committerPaul Mundt <lethal@linux-sh.org>2011-03-23 06:05:18 -0400
commitd4cc183f7b9f639a048291e9cd95f0c255664b98 (patch)
tree6d24821767095940196d3e1c37b2ea4b76ec7d54 /arch/sh/mm/pmb.c
parenta696b89c582e3201ef10bfb0d0b3594e29b75e0f (diff)
sh: pmb: Use struct syscore_ops instead of sysdevs
This converts the PMB code over to use the new syscore_ops and kills off the old sysdev utilization, as per Rafael's example. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/mm/pmb.c')
-rw-r--r--arch/sh/mm/pmb.c43
1 files changed, 14 insertions, 29 deletions
diff --git a/arch/sh/mm/pmb.c b/arch/sh/mm/pmb.c
index b20b1b3eee4b..fad52f1f6812 100644
--- a/arch/sh/mm/pmb.c
+++ b/arch/sh/mm/pmb.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Privileged Space Mapping Buffer (PMB) Support. 4 * Privileged Space Mapping Buffer (PMB) Support.
5 * 5 *
6 * Copyright (C) 2005 - 2010 Paul Mundt 6 * Copyright (C) 2005 - 2011 Paul Mundt
7 * Copyright (C) 2010 Matt Fleming 7 * Copyright (C) 2010 Matt Fleming
8 * 8 *
9 * This file is subject to the terms and conditions of the GNU General Public 9 * This file is subject to the terms and conditions of the GNU General Public
@@ -12,7 +12,7 @@
12 */ 12 */
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/sysdev.h> 15#include <linux/syscore_ops.h>
16#include <linux/cpu.h> 16#include <linux/cpu.h>
17#include <linux/module.h> 17#include <linux/module.h>
18#include <linux/bitops.h> 18#include <linux/bitops.h>
@@ -874,46 +874,31 @@ static int __init pmb_debugfs_init(void)
874subsys_initcall(pmb_debugfs_init); 874subsys_initcall(pmb_debugfs_init);
875 875
876#ifdef CONFIG_PM 876#ifdef CONFIG_PM
877static int pmb_sysdev_suspend(struct sys_device *dev, pm_message_t state) 877static void pmb_syscore_resume(void)
878{ 878{
879 static pm_message_t prev_state; 879 struct pmb_entry *pmbe;
880 int i; 880 int i;
881 881
882 /* Restore the PMB after a resume from hibernation */ 882 read_lock(&pmb_rwlock);
883 if (state.event == PM_EVENT_ON &&
884 prev_state.event == PM_EVENT_FREEZE) {
885 struct pmb_entry *pmbe;
886
887 read_lock(&pmb_rwlock);
888 883
889 for (i = 0; i < ARRAY_SIZE(pmb_entry_list); i++) { 884 for (i = 0; i < ARRAY_SIZE(pmb_entry_list); i++) {
890 if (test_bit(i, pmb_map)) { 885 if (test_bit(i, pmb_map)) {
891 pmbe = &pmb_entry_list[i]; 886 pmbe = &pmb_entry_list[i];
892 set_pmb_entry(pmbe); 887 set_pmb_entry(pmbe);
893 }
894 } 888 }
895
896 read_unlock(&pmb_rwlock);
897 } 889 }
898 890
899 prev_state = state; 891 read_unlock(&pmb_rwlock);
900
901 return 0;
902}
903
904static int pmb_sysdev_resume(struct sys_device *dev)
905{
906 return pmb_sysdev_suspend(dev, PMSG_ON);
907} 892}
908 893
909static struct sysdev_driver pmb_sysdev_driver = { 894static struct syscore_ops pmb_syscore_ops = {
910 .suspend = pmb_sysdev_suspend, 895 .resume = pmb_syscore_resume,
911 .resume = pmb_sysdev_resume,
912}; 896};
913 897
914static int __init pmb_sysdev_init(void) 898static int __init pmb_sysdev_init(void)
915{ 899{
916 return sysdev_driver_register(&cpu_sysdev_class, &pmb_sysdev_driver); 900 register_syscore_ops(&pmb_syscore_ops);
901 return 0;
917} 902}
918subsys_initcall(pmb_sysdev_init); 903subsys_initcall(pmb_sysdev_init);
919#endif 904#endif