aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorHidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>2011-06-07 22:02:03 -0400
committerBorislav Petkov <borislav.petkov@amd.com>2011-06-16 06:10:16 -0400
commitc7cece89f1b00b56276303942f96ec67cf206e1e (patch)
tree07b5c87818635ea49dbefb4ef4f6447e9d941faf /arch/x86
parent93b62c3cf59d44850cbe9f04d58da08930e3fb0b (diff)
x86, mce: Use mce_sysdev_ prefix to group functions
There are many functions named mce_* so use a new prefix for the subset of functions related to sysfs support. And since f3c6ea1b06c71b43f751b36bd99345369fe911af introduces syscore_ops, use the prefix mce_syscore for some functions related to power management which were in sysdev_class before. Before: After: mce_device mce_sysdev mce_sysclass mce_sysdev_class mce_attrs mce_sysdev_attrs mce_dev_initialized mce_sysdev_initialized mce_create_device mce_sysdev_create mce_remove_device mce_sysdev_remove mce_suspend mce_syscore_suspend mce_shutdown mce_syscore_shutdown mce_resume mce_syscore_resume Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com> Acked-by: Tony Luck <tony.luck@intel.com> Link: http://lkml.kernel.org/r/4DEED81B.8020506@jp.fujitsu.com Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/include/asm/mce.h2
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce.c62
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce_amd.c10
3 files changed, 39 insertions, 35 deletions
diff --git a/arch/x86/include/asm/mce.h b/arch/x86/include/asm/mce.h
index bbb328fd117b..716b48af7863 100644
--- a/arch/x86/include/asm/mce.h
+++ b/arch/x86/include/asm/mce.h
@@ -149,7 +149,7 @@ static inline void enable_p5_mce(void) {}
149 149
150void mce_setup(struct mce *m); 150void mce_setup(struct mce *m);
151void mce_log(struct mce *m); 151void mce_log(struct mce *m);
152DECLARE_PER_CPU(struct sys_device, mce_dev); 152DECLARE_PER_CPU(struct sys_device, mce_sysdev);
153 153
154/* 154/*
155 * Maximum banks number. 155 * Maximum banks number.
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index 9a735168e40f..08363b042122 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -1697,7 +1697,7 @@ int __init mcheck_init(void)
1697} 1697}
1698 1698
1699/* 1699/*
1700 * Sysfs support 1700 * mce_syscore: PM support
1701 */ 1701 */
1702 1702
1703/* 1703/*
@@ -1717,12 +1717,12 @@ static int mce_disable_error_reporting(void)
1717 return 0; 1717 return 0;
1718} 1718}
1719 1719
1720static int mce_suspend(void) 1720static int mce_syscore_suspend(void)
1721{ 1721{
1722 return mce_disable_error_reporting(); 1722 return mce_disable_error_reporting();
1723} 1723}
1724 1724
1725static void mce_shutdown(void) 1725static void mce_syscore_shutdown(void)
1726{ 1726{
1727 mce_disable_error_reporting(); 1727 mce_disable_error_reporting();
1728} 1728}
@@ -1732,18 +1732,22 @@ static void mce_shutdown(void)
1732 * Only one CPU is active at this time, the others get re-added later using 1732 * Only one CPU is active at this time, the others get re-added later using
1733 * CPU hotplug: 1733 * CPU hotplug:
1734 */ 1734 */
1735static void mce_resume(void) 1735static void mce_syscore_resume(void)
1736{ 1736{
1737 __mcheck_cpu_init_generic(); 1737 __mcheck_cpu_init_generic();
1738 __mcheck_cpu_init_vendor(__this_cpu_ptr(&cpu_info)); 1738 __mcheck_cpu_init_vendor(__this_cpu_ptr(&cpu_info));
1739} 1739}
1740 1740
1741static struct syscore_ops mce_syscore_ops = { 1741static struct syscore_ops mce_syscore_ops = {
1742 .suspend = mce_suspend, 1742 .suspend = mce_syscore_suspend,
1743 .shutdown = mce_shutdown, 1743 .shutdown = mce_syscore_shutdown,
1744 .resume = mce_resume, 1744 .resume = mce_syscore_resume,
1745}; 1745};
1746 1746
1747/*
1748 * mce_sysdev: Sysfs support
1749 */
1750
1747static void mce_cpu_restart(void *data) 1751static void mce_cpu_restart(void *data)
1748{ 1752{
1749 del_timer_sync(&__get_cpu_var(mce_timer)); 1753 del_timer_sync(&__get_cpu_var(mce_timer));
@@ -1779,11 +1783,11 @@ static void mce_enable_ce(void *all)
1779 __mcheck_cpu_init_timer(); 1783 __mcheck_cpu_init_timer();
1780} 1784}
1781 1785
1782static struct sysdev_class mce_sysclass = { 1786static struct sysdev_class mce_sysdev_class = {
1783 .name = "machinecheck", 1787 .name = "machinecheck",
1784}; 1788};
1785 1789
1786DEFINE_PER_CPU(struct sys_device, mce_dev); 1790DEFINE_PER_CPU(struct sys_device, mce_sysdev);
1787 1791
1788__cpuinitdata 1792__cpuinitdata
1789void (*threshold_cpu_callback)(unsigned long action, unsigned int cpu); 1793void (*threshold_cpu_callback)(unsigned long action, unsigned int cpu);
@@ -1912,7 +1916,7 @@ static struct sysdev_ext_attribute attr_cmci_disabled = {
1912 &mce_cmci_disabled 1916 &mce_cmci_disabled
1913}; 1917};
1914 1918
1915static struct sysdev_attribute *mce_attrs[] = { 1919static struct sysdev_attribute *mce_sysdev_attrs[] = {
1916 &attr_tolerant.attr, 1920 &attr_tolerant.attr,
1917 &attr_check_interval.attr, 1921 &attr_check_interval.attr,
1918 &attr_trigger, 1922 &attr_trigger,
@@ -1923,12 +1927,12 @@ static struct sysdev_attribute *mce_attrs[] = {
1923 NULL 1927 NULL
1924}; 1928};
1925 1929
1926static cpumask_var_t mce_dev_initialized; 1930static cpumask_var_t mce_sysdev_initialized;
1927 1931
1928/* Per cpu sysdev init. All of the cpus still share the same ctrl bank: */ 1932/* Per cpu sysdev init. All of the cpus still share the same ctrl bank: */
1929static __cpuinit int mce_create_device(unsigned int cpu) 1933static __cpuinit int mce_sysdev_create(unsigned int cpu)
1930{ 1934{
1931 struct sys_device *sysdev = &per_cpu(mce_dev, cpu); 1935 struct sys_device *sysdev = &per_cpu(mce_sysdev, cpu);
1932 int err; 1936 int err;
1933 int i, j; 1937 int i, j;
1934 1938
@@ -1937,14 +1941,14 @@ static __cpuinit int mce_create_device(unsigned int cpu)
1937 1941
1938 memset(&sysdev->kobj, 0, sizeof(struct kobject)); 1942 memset(&sysdev->kobj, 0, sizeof(struct kobject));
1939 sysdev->id = cpu; 1943 sysdev->id = cpu;
1940 sysdev->cls = &mce_sysclass; 1944 sysdev->cls = &mce_sysdev_class;
1941 1945
1942 err = sysdev_register(sysdev); 1946 err = sysdev_register(sysdev);
1943 if (err) 1947 if (err)
1944 return err; 1948 return err;
1945 1949
1946 for (i = 0; mce_attrs[i]; i++) { 1950 for (i = 0; mce_sysdev_attrs[i]; i++) {
1947 err = sysdev_create_file(sysdev, mce_attrs[i]); 1951 err = sysdev_create_file(sysdev, mce_sysdev_attrs[i]);
1948 if (err) 1952 if (err)
1949 goto error; 1953 goto error;
1950 } 1954 }
@@ -1953,7 +1957,7 @@ static __cpuinit int mce_create_device(unsigned int cpu)
1953 if (err) 1957 if (err)
1954 goto error2; 1958 goto error2;
1955 } 1959 }
1956 cpumask_set_cpu(cpu, mce_dev_initialized); 1960 cpumask_set_cpu(cpu, mce_sysdev_initialized);
1957 1961
1958 return 0; 1962 return 0;
1959error2: 1963error2:
@@ -1961,29 +1965,29 @@ error2:
1961 sysdev_remove_file(sysdev, &mce_banks[j].attr); 1965 sysdev_remove_file(sysdev, &mce_banks[j].attr);
1962error: 1966error:
1963 while (--i >= 0) 1967 while (--i >= 0)
1964 sysdev_remove_file(sysdev, mce_attrs[i]); 1968 sysdev_remove_file(sysdev, mce_sysdev_attrs[i]);
1965 1969
1966 sysdev_unregister(sysdev); 1970 sysdev_unregister(sysdev);
1967 1971
1968 return err; 1972 return err;
1969} 1973}
1970 1974
1971static __cpuinit void mce_remove_device(unsigned int cpu) 1975static __cpuinit void mce_sysdev_remove(unsigned int cpu)
1972{ 1976{
1973 struct sys_device *sysdev = &per_cpu(mce_dev, cpu); 1977 struct sys_device *sysdev = &per_cpu(mce_sysdev, cpu);
1974 int i; 1978 int i;
1975 1979
1976 if (!cpumask_test_cpu(cpu, mce_dev_initialized)) 1980 if (!cpumask_test_cpu(cpu, mce_sysdev_initialized))
1977 return; 1981 return;
1978 1982
1979 for (i = 0; mce_attrs[i]; i++) 1983 for (i = 0; mce_sysdev_attrs[i]; i++)
1980 sysdev_remove_file(sysdev, mce_attrs[i]); 1984 sysdev_remove_file(sysdev, mce_sysdev_attrs[i]);
1981 1985
1982 for (i = 0; i < banks; i++) 1986 for (i = 0; i < banks; i++)
1983 sysdev_remove_file(sysdev, &mce_banks[i].attr); 1987 sysdev_remove_file(sysdev, &mce_banks[i].attr);
1984 1988
1985 sysdev_unregister(sysdev); 1989 sysdev_unregister(sysdev);
1986 cpumask_clear_cpu(cpu, mce_dev_initialized); 1990 cpumask_clear_cpu(cpu, mce_sysdev_initialized);
1987} 1991}
1988 1992
1989/* Make sure there are no machine checks on offlined CPUs. */ 1993/* Make sure there are no machine checks on offlined CPUs. */
@@ -2033,7 +2037,7 @@ mce_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
2033 switch (action) { 2037 switch (action) {
2034 case CPU_ONLINE: 2038 case CPU_ONLINE:
2035 case CPU_ONLINE_FROZEN: 2039 case CPU_ONLINE_FROZEN:
2036 mce_create_device(cpu); 2040 mce_sysdev_create(cpu);
2037 if (threshold_cpu_callback) 2041 if (threshold_cpu_callback)
2038 threshold_cpu_callback(action, cpu); 2042 threshold_cpu_callback(action, cpu);
2039 break; 2043 break;
@@ -2041,7 +2045,7 @@ mce_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
2041 case CPU_DEAD_FROZEN: 2045 case CPU_DEAD_FROZEN:
2042 if (threshold_cpu_callback) 2046 if (threshold_cpu_callback)
2043 threshold_cpu_callback(action, cpu); 2047 threshold_cpu_callback(action, cpu);
2044 mce_remove_device(cpu); 2048 mce_sysdev_remove(cpu);
2045 break; 2049 break;
2046 case CPU_DOWN_PREPARE: 2050 case CPU_DOWN_PREPARE:
2047 case CPU_DOWN_PREPARE_FROZEN: 2051 case CPU_DOWN_PREPARE_FROZEN:
@@ -2095,16 +2099,16 @@ static __init int mcheck_init_device(void)
2095 if (!mce_available(&boot_cpu_data)) 2099 if (!mce_available(&boot_cpu_data))
2096 return -EIO; 2100 return -EIO;
2097 2101
2098 zalloc_cpumask_var(&mce_dev_initialized, GFP_KERNEL); 2102 zalloc_cpumask_var(&mce_sysdev_initialized, GFP_KERNEL);
2099 2103
2100 mce_init_banks(); 2104 mce_init_banks();
2101 2105
2102 err = sysdev_class_register(&mce_sysclass); 2106 err = sysdev_class_register(&mce_sysdev_class);
2103 if (err) 2107 if (err)
2104 return err; 2108 return err;
2105 2109
2106 for_each_online_cpu(i) { 2110 for_each_online_cpu(i) {
2107 err = mce_create_device(i); 2111 err = mce_sysdev_create(i);
2108 if (err) 2112 if (err)
2109 return err; 2113 return err;
2110 } 2114 }
diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd.c b/arch/x86/kernel/cpu/mcheck/mce_amd.c
index bb0adad35143..f5474218cffe 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_amd.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_amd.c
@@ -548,7 +548,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
548 if (!b) 548 if (!b)
549 goto out; 549 goto out;
550 550
551 err = sysfs_create_link(&per_cpu(mce_dev, cpu).kobj, 551 err = sysfs_create_link(&per_cpu(mce_sysdev, cpu).kobj,
552 b->kobj, name); 552 b->kobj, name);
553 if (err) 553 if (err)
554 goto out; 554 goto out;
@@ -571,7 +571,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
571 goto out; 571 goto out;
572 } 572 }
573 573
574 b->kobj = kobject_create_and_add(name, &per_cpu(mce_dev, cpu).kobj); 574 b->kobj = kobject_create_and_add(name, &per_cpu(mce_sysdev, cpu).kobj);
575 if (!b->kobj) 575 if (!b->kobj)
576 goto out_free; 576 goto out_free;
577 577
@@ -591,7 +591,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
591 if (i == cpu) 591 if (i == cpu)
592 continue; 592 continue;
593 593
594 err = sysfs_create_link(&per_cpu(mce_dev, i).kobj, 594 err = sysfs_create_link(&per_cpu(mce_sysdev, i).kobj,
595 b->kobj, name); 595 b->kobj, name);
596 if (err) 596 if (err)
597 goto out; 597 goto out;
@@ -669,7 +669,7 @@ static void threshold_remove_bank(unsigned int cpu, int bank)
669#ifdef CONFIG_SMP 669#ifdef CONFIG_SMP
670 /* sibling symlink */ 670 /* sibling symlink */
671 if (shared_bank[bank] && b->blocks->cpu != cpu) { 671 if (shared_bank[bank] && b->blocks->cpu != cpu) {
672 sysfs_remove_link(&per_cpu(mce_dev, cpu).kobj, name); 672 sysfs_remove_link(&per_cpu(mce_sysdev, cpu).kobj, name);
673 per_cpu(threshold_banks, cpu)[bank] = NULL; 673 per_cpu(threshold_banks, cpu)[bank] = NULL;
674 674
675 return; 675 return;
@@ -681,7 +681,7 @@ static void threshold_remove_bank(unsigned int cpu, int bank)
681 if (i == cpu) 681 if (i == cpu)
682 continue; 682 continue;
683 683
684 sysfs_remove_link(&per_cpu(mce_dev, i).kobj, name); 684 sysfs_remove_link(&per_cpu(mce_sysdev, i).kobj, name);
685 per_cpu(threshold_banks, i)[bank] = NULL; 685 per_cpu(threshold_banks, i)[bank] = NULL;
686 } 686 }
687 687