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>

+14 -29
+14 -29
arch/sh/mm/pmb.c
··· 3 3 * 4 4 * Privileged Space Mapping Buffer (PMB) Support. 5 5 * 6 - * Copyright (C) 2005 - 2010 Paul Mundt 6 + * Copyright (C) 2005 - 2011 Paul Mundt 7 7 * Copyright (C) 2010 Matt Fleming 8 8 * 9 9 * This file is subject to the terms and conditions of the GNU General Public ··· 12 12 */ 13 13 #include <linux/init.h> 14 14 #include <linux/kernel.h> 15 - #include <linux/sysdev.h> 15 + #include <linux/syscore_ops.h> 16 16 #include <linux/cpu.h> 17 17 #include <linux/module.h> 18 18 #include <linux/bitops.h> ··· 874 874 subsys_initcall(pmb_debugfs_init); 875 875 876 876 #ifdef CONFIG_PM 877 - static int pmb_sysdev_suspend(struct sys_device *dev, pm_message_t state) 877 + static void pmb_syscore_resume(void) 878 878 { 879 - static pm_message_t prev_state; 879 + struct pmb_entry *pmbe; 880 880 int i; 881 881 882 - /* Restore the PMB after a resume from hibernation */ 883 - if (state.event == PM_EVENT_ON && 884 - prev_state.event == PM_EVENT_FREEZE) { 885 - struct pmb_entry *pmbe; 882 + read_lock(&pmb_rwlock); 886 883 887 - read_lock(&pmb_rwlock); 888 - 889 - for (i = 0; i < ARRAY_SIZE(pmb_entry_list); i++) { 890 - if (test_bit(i, pmb_map)) { 891 - pmbe = &pmb_entry_list[i]; 892 - set_pmb_entry(pmbe); 893 - } 884 + for (i = 0; i < ARRAY_SIZE(pmb_entry_list); i++) { 885 + if (test_bit(i, pmb_map)) { 886 + pmbe = &pmb_entry_list[i]; 887 + set_pmb_entry(pmbe); 894 888 } 895 - 896 - read_unlock(&pmb_rwlock); 897 889 } 898 890 899 - prev_state = state; 900 - 901 - return 0; 891 + read_unlock(&pmb_rwlock); 902 892 } 903 893 904 - static int pmb_sysdev_resume(struct sys_device *dev) 905 - { 906 - return pmb_sysdev_suspend(dev, PMSG_ON); 907 - } 908 - 909 - static struct sysdev_driver pmb_sysdev_driver = { 910 - .suspend = pmb_sysdev_suspend, 911 - .resume = pmb_sysdev_resume, 894 + static struct syscore_ops pmb_syscore_ops = { 895 + .resume = pmb_syscore_resume, 912 896 }; 913 897 914 898 static 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 } 918 903 subsys_initcall(pmb_sysdev_init); 919 904 #endif