aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/cpu
diff options
context:
space:
mode:
authorHidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>2011-06-07 21:59:19 -0400
committerBorislav Petkov <borislav.petkov@amd.com>2011-06-16 06:10:12 -0400
commitf6783c4234e65bd6f85596d97745ccdbf041cb63 (patch)
tree65397f4c40496ad72f59dfe005122cbb5145d467 /arch/x86/kernel/cpu
parent3a97fc34130326da87b20de5d0259c35406707ce (diff)
x86, mce: Cleanup mce_create()/remove_device()
Use temporary local variable sysdev to simplify the code. No change in logic. Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com> Acked-by: Tony Luck <tony.luck@intel.com> Link: http://lkml.kernel.org/r/4DEED777.7080205@jp.fujitsu.com Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
Diffstat (limited to 'arch/x86/kernel/cpu')
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index 2cc98d517f36..f3f648c8e087 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -1925,28 +1925,28 @@ static cpumask_var_t mce_dev_initialized;
1925/* Per cpu sysdev init. All of the cpus still share the same ctrl bank: */ 1925/* Per cpu sysdev init. All of the cpus still share the same ctrl bank: */
1926static __cpuinit int mce_create_device(unsigned int cpu) 1926static __cpuinit int mce_create_device(unsigned int cpu)
1927{ 1927{
1928 struct sys_device *sysdev = &per_cpu(mce_dev, cpu);
1928 int err; 1929 int err;
1929 int i, j; 1930 int i, j;
1930 1931
1931 if (!mce_available(&boot_cpu_data)) 1932 if (!mce_available(&boot_cpu_data))
1932 return -EIO; 1933 return -EIO;
1933 1934
1934 memset(&per_cpu(mce_dev, cpu).kobj, 0, sizeof(struct kobject)); 1935 memset(&sysdev->kobj, 0, sizeof(struct kobject));
1935 per_cpu(mce_dev, cpu).id = cpu; 1936 sysdev->id = cpu;
1936 per_cpu(mce_dev, cpu).cls = &mce_sysclass; 1937 sysdev->cls = &mce_sysclass;
1937 1938
1938 err = sysdev_register(&per_cpu(mce_dev, cpu)); 1939 err = sysdev_register(sysdev);
1939 if (err) 1940 if (err)
1940 return err; 1941 return err;
1941 1942
1942 for (i = 0; mce_attrs[i]; i++) { 1943 for (i = 0; mce_attrs[i]; i++) {
1943 err = sysdev_create_file(&per_cpu(mce_dev, cpu), mce_attrs[i]); 1944 err = sysdev_create_file(sysdev, mce_attrs[i]);
1944 if (err) 1945 if (err)
1945 goto error; 1946 goto error;
1946 } 1947 }
1947 for (j = 0; j < banks; j++) { 1948 for (j = 0; j < banks; j++) {
1948 err = sysdev_create_file(&per_cpu(mce_dev, cpu), 1949 err = sysdev_create_file(sysdev, &mce_banks[j].attr);
1949 &mce_banks[j].attr);
1950 if (err) 1950 if (err)
1951 goto error2; 1951 goto error2;
1952 } 1952 }
@@ -1955,30 +1955,31 @@ static __cpuinit int mce_create_device(unsigned int cpu)
1955 return 0; 1955 return 0;
1956error2: 1956error2:
1957 while (--j >= 0) 1957 while (--j >= 0)
1958 sysdev_remove_file(&per_cpu(mce_dev, cpu), &mce_banks[j].attr); 1958 sysdev_remove_file(sysdev, &mce_banks[j].attr);
1959error: 1959error:
1960 while (--i >= 0) 1960 while (--i >= 0)
1961 sysdev_remove_file(&per_cpu(mce_dev, cpu), mce_attrs[i]); 1961 sysdev_remove_file(sysdev, mce_attrs[i]);
1962 1962
1963 sysdev_unregister(&per_cpu(mce_dev, cpu)); 1963 sysdev_unregister(sysdev);
1964 1964
1965 return err; 1965 return err;
1966} 1966}
1967 1967
1968static __cpuinit void mce_remove_device(unsigned int cpu) 1968static __cpuinit void mce_remove_device(unsigned int cpu)
1969{ 1969{
1970 struct sys_device *sysdev = &per_cpu(mce_dev, cpu);
1970 int i; 1971 int i;
1971 1972
1972 if (!cpumask_test_cpu(cpu, mce_dev_initialized)) 1973 if (!cpumask_test_cpu(cpu, mce_dev_initialized))
1973 return; 1974 return;
1974 1975
1975 for (i = 0; mce_attrs[i]; i++) 1976 for (i = 0; mce_attrs[i]; i++)
1976 sysdev_remove_file(&per_cpu(mce_dev, cpu), mce_attrs[i]); 1977 sysdev_remove_file(sysdev, mce_attrs[i]);
1977 1978
1978 for (i = 0; i < banks; i++) 1979 for (i = 0; i < banks; i++)
1979 sysdev_remove_file(&per_cpu(mce_dev, cpu), &mce_banks[i].attr); 1980 sysdev_remove_file(sysdev, &mce_banks[i].attr);
1980 1981
1981 sysdev_unregister(&per_cpu(mce_dev, cpu)); 1982 sysdev_unregister(sysdev);
1982 cpumask_clear_cpu(cpu, mce_dev_initialized); 1983 cpumask_clear_cpu(cpu, mce_dev_initialized);
1983} 1984}
1984 1985