aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2012-01-06 14:42:52 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2012-01-06 14:42:52 -0500
commitff4b8a57f0aaa2882d444ca44b2b9b333d22a4df (patch)
treed851c923f85566572112d4c0f884cff388a3cc05 /arch/x86/kernel
parent805a6af8dba5dfdd35ec35dc52ec0122400b2610 (diff)
parentea04018e6bc5ddb2f0466c0e5b986bd4901b7e8e (diff)
Merge branch 'driver-core-next' into Linux 3.2
This resolves the conflict in the arch/arm/mach-s3c64xx/s3c6400.c file, and it fixes the build error in the arch/x86/kernel/microcode_core.c file, that the merge did not catch. The microcode_core.c patch was provided by Stephen Rothwell <sfr@canb.auug.org.au> who was invaluable in the merge issues involved with the large sysdev removal process in the driver-core tree. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'arch/x86/kernel')
-rw-r--r--arch/x86/kernel/cpu/intel_cacheinfo.c25
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce-internal.h4
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce.c128
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce_amd.c11
-rw-r--r--arch/x86/kernel/cpu/mcheck/therm_throt.c63
-rw-r--r--arch/x86/kernel/hpet.c1
-rw-r--r--arch/x86/kernel/irqinit.c2
-rw-r--r--arch/x86/kernel/microcode_core.c64
8 files changed, 148 insertions, 150 deletions
diff --git a/arch/x86/kernel/cpu/intel_cacheinfo.c b/arch/x86/kernel/cpu/intel_cacheinfo.c
index a3b0811693c9..6b45e5e7a901 100644
--- a/arch/x86/kernel/cpu/intel_cacheinfo.c
+++ b/arch/x86/kernel/cpu/intel_cacheinfo.c
@@ -844,8 +844,7 @@ static int __cpuinit detect_cache_attributes(unsigned int cpu)
844 844
845#include <linux/kobject.h> 845#include <linux/kobject.h>
846#include <linux/sysfs.h> 846#include <linux/sysfs.h>
847 847#include <linux/cpu.h>
848extern struct sysdev_class cpu_sysdev_class; /* from drivers/base/cpu.c */
849 848
850/* pointer to kobject for cpuX/cache */ 849/* pointer to kobject for cpuX/cache */
851static DEFINE_PER_CPU(struct kobject *, ici_cache_kobject); 850static DEFINE_PER_CPU(struct kobject *, ici_cache_kobject);
@@ -1073,9 +1072,9 @@ err_out:
1073static DECLARE_BITMAP(cache_dev_map, NR_CPUS); 1072static DECLARE_BITMAP(cache_dev_map, NR_CPUS);
1074 1073
1075/* Add/Remove cache interface for CPU device */ 1074/* Add/Remove cache interface for CPU device */
1076static int __cpuinit cache_add_dev(struct sys_device * sys_dev) 1075static int __cpuinit cache_add_dev(struct device *dev)
1077{ 1076{
1078 unsigned int cpu = sys_dev->id; 1077 unsigned int cpu = dev->id;
1079 unsigned long i, j; 1078 unsigned long i, j;
1080 struct _index_kobject *this_object; 1079 struct _index_kobject *this_object;
1081 struct _cpuid4_info *this_leaf; 1080 struct _cpuid4_info *this_leaf;
@@ -1087,7 +1086,7 @@ static int __cpuinit cache_add_dev(struct sys_device * sys_dev)
1087 1086
1088 retval = kobject_init_and_add(per_cpu(ici_cache_kobject, cpu), 1087 retval = kobject_init_and_add(per_cpu(ici_cache_kobject, cpu),
1089 &ktype_percpu_entry, 1088 &ktype_percpu_entry,
1090 &sys_dev->kobj, "%s", "cache"); 1089 &dev->kobj, "%s", "cache");
1091 if (retval < 0) { 1090 if (retval < 0) {
1092 cpuid4_cache_sysfs_exit(cpu); 1091 cpuid4_cache_sysfs_exit(cpu);
1093 return retval; 1092 return retval;
@@ -1124,9 +1123,9 @@ static int __cpuinit cache_add_dev(struct sys_device * sys_dev)
1124 return 0; 1123 return 0;
1125} 1124}
1126 1125
1127static void __cpuinit cache_remove_dev(struct sys_device * sys_dev) 1126static void __cpuinit cache_remove_dev(struct device *dev)
1128{ 1127{
1129 unsigned int cpu = sys_dev->id; 1128 unsigned int cpu = dev->id;
1130 unsigned long i; 1129 unsigned long i;
1131 1130
1132 if (per_cpu(ici_cpuid4_info, cpu) == NULL) 1131 if (per_cpu(ici_cpuid4_info, cpu) == NULL)
@@ -1145,17 +1144,17 @@ static int __cpuinit cacheinfo_cpu_callback(struct notifier_block *nfb,
1145 unsigned long action, void *hcpu) 1144 unsigned long action, void *hcpu)
1146{ 1145{
1147 unsigned int cpu = (unsigned long)hcpu; 1146 unsigned int cpu = (unsigned long)hcpu;
1148 struct sys_device *sys_dev; 1147 struct device *dev;
1149 1148
1150 sys_dev = get_cpu_sysdev(cpu); 1149 dev = get_cpu_device(cpu);
1151 switch (action) { 1150 switch (action) {
1152 case CPU_ONLINE: 1151 case CPU_ONLINE:
1153 case CPU_ONLINE_FROZEN: 1152 case CPU_ONLINE_FROZEN:
1154 cache_add_dev(sys_dev); 1153 cache_add_dev(dev);
1155 break; 1154 break;
1156 case CPU_DEAD: 1155 case CPU_DEAD:
1157 case CPU_DEAD_FROZEN: 1156 case CPU_DEAD_FROZEN:
1158 cache_remove_dev(sys_dev); 1157 cache_remove_dev(dev);
1159 break; 1158 break;
1160 } 1159 }
1161 return NOTIFY_OK; 1160 return NOTIFY_OK;
@@ -1174,9 +1173,9 @@ static int __cpuinit cache_sysfs_init(void)
1174 1173
1175 for_each_online_cpu(i) { 1174 for_each_online_cpu(i) {
1176 int err; 1175 int err;
1177 struct sys_device *sys_dev = get_cpu_sysdev(i); 1176 struct device *dev = get_cpu_device(i);
1178 1177
1179 err = cache_add_dev(sys_dev); 1178 err = cache_add_dev(dev);
1180 if (err) 1179 if (err)
1181 return err; 1180 return err;
1182 } 1181 }
diff --git a/arch/x86/kernel/cpu/mcheck/mce-internal.h b/arch/x86/kernel/cpu/mcheck/mce-internal.h
index fefcc69ee8b5..ed44c8a65858 100644
--- a/arch/x86/kernel/cpu/mcheck/mce-internal.h
+++ b/arch/x86/kernel/cpu/mcheck/mce-internal.h
@@ -1,4 +1,4 @@
1#include <linux/sysdev.h> 1#include <linux/device.h>
2#include <asm/mce.h> 2#include <asm/mce.h>
3 3
4enum severity_level { 4enum severity_level {
@@ -17,7 +17,7 @@ enum severity_level {
17struct mce_bank { 17struct mce_bank {
18 u64 ctl; /* subevents to enable */ 18 u64 ctl; /* subevents to enable */
19 unsigned char init; /* initialise bank? */ 19 unsigned char init; /* initialise bank? */
20 struct sysdev_attribute attr; /* sysdev attribute */ 20 struct device_attribute attr; /* device attribute */
21 char attrname[ATTR_LEN]; /* attribute name */ 21 char attrname[ATTR_LEN]; /* attribute name */
22}; 22};
23 23
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index 2af127d4c3d1..c83e3736ce28 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -19,7 +19,7 @@
19#include <linux/kernel.h> 19#include <linux/kernel.h>
20#include <linux/percpu.h> 20#include <linux/percpu.h>
21#include <linux/string.h> 21#include <linux/string.h>
22#include <linux/sysdev.h> 22#include <linux/device.h>
23#include <linux/syscore_ops.h> 23#include <linux/syscore_ops.h>
24#include <linux/delay.h> 24#include <linux/delay.h>
25#include <linux/ctype.h> 25#include <linux/ctype.h>
@@ -1770,7 +1770,7 @@ static struct syscore_ops mce_syscore_ops = {
1770}; 1770};
1771 1771
1772/* 1772/*
1773 * mce_sysdev: Sysfs support 1773 * mce_device: Sysfs support
1774 */ 1774 */
1775 1775
1776static void mce_cpu_restart(void *data) 1776static void mce_cpu_restart(void *data)
@@ -1806,27 +1806,28 @@ static void mce_enable_ce(void *all)
1806 __mcheck_cpu_init_timer(); 1806 __mcheck_cpu_init_timer();
1807} 1807}
1808 1808
1809static struct sysdev_class mce_sysdev_class = { 1809static struct bus_type mce_subsys = {
1810 .name = "machinecheck", 1810 .name = "machinecheck",
1811 .dev_name = "machinecheck",
1811}; 1812};
1812 1813
1813DEFINE_PER_CPU(struct sys_device, mce_sysdev); 1814DEFINE_PER_CPU(struct device, mce_device);
1814 1815
1815__cpuinitdata 1816__cpuinitdata
1816void (*threshold_cpu_callback)(unsigned long action, unsigned int cpu); 1817void (*threshold_cpu_callback)(unsigned long action, unsigned int cpu);
1817 1818
1818static inline struct mce_bank *attr_to_bank(struct sysdev_attribute *attr) 1819static inline struct mce_bank *attr_to_bank(struct device_attribute *attr)
1819{ 1820{
1820 return container_of(attr, struct mce_bank, attr); 1821 return container_of(attr, struct mce_bank, attr);
1821} 1822}
1822 1823
1823static ssize_t show_bank(struct sys_device *s, struct sysdev_attribute *attr, 1824static ssize_t show_bank(struct device *s, struct device_attribute *attr,
1824 char *buf) 1825 char *buf)
1825{ 1826{
1826 return sprintf(buf, "%llx\n", attr_to_bank(attr)->ctl); 1827 return sprintf(buf, "%llx\n", attr_to_bank(attr)->ctl);
1827} 1828}
1828 1829
1829static ssize_t set_bank(struct sys_device *s, struct sysdev_attribute *attr, 1830static ssize_t set_bank(struct device *s, struct device_attribute *attr,
1830 const char *buf, size_t size) 1831 const char *buf, size_t size)
1831{ 1832{
1832 u64 new; 1833 u64 new;
@@ -1841,14 +1842,14 @@ static ssize_t set_bank(struct sys_device *s, struct sysdev_attribute *attr,
1841} 1842}
1842 1843
1843static ssize_t 1844static ssize_t
1844show_trigger(struct sys_device *s, struct sysdev_attribute *attr, char *buf) 1845show_trigger(struct device *s, struct device_attribute *attr, char *buf)
1845{ 1846{
1846 strcpy(buf, mce_helper); 1847 strcpy(buf, mce_helper);
1847 strcat(buf, "\n"); 1848 strcat(buf, "\n");
1848 return strlen(mce_helper) + 1; 1849 return strlen(mce_helper) + 1;
1849} 1850}
1850 1851
1851static ssize_t set_trigger(struct sys_device *s, struct sysdev_attribute *attr, 1852static ssize_t set_trigger(struct device *s, struct device_attribute *attr,
1852 const char *buf, size_t siz) 1853 const char *buf, size_t siz)
1853{ 1854{
1854 char *p; 1855 char *p;
@@ -1863,8 +1864,8 @@ static ssize_t set_trigger(struct sys_device *s, struct sysdev_attribute *attr,
1863 return strlen(mce_helper) + !!p; 1864 return strlen(mce_helper) + !!p;
1864} 1865}
1865 1866
1866static ssize_t set_ignore_ce(struct sys_device *s, 1867static ssize_t set_ignore_ce(struct device *s,
1867 struct sysdev_attribute *attr, 1868 struct device_attribute *attr,
1868 const char *buf, size_t size) 1869 const char *buf, size_t size)
1869{ 1870{
1870 u64 new; 1871 u64 new;
@@ -1887,8 +1888,8 @@ static ssize_t set_ignore_ce(struct sys_device *s,
1887 return size; 1888 return size;
1888} 1889}
1889 1890
1890static ssize_t set_cmci_disabled(struct sys_device *s, 1891static ssize_t set_cmci_disabled(struct device *s,
1891 struct sysdev_attribute *attr, 1892 struct device_attribute *attr,
1892 const char *buf, size_t size) 1893 const char *buf, size_t size)
1893{ 1894{
1894 u64 new; 1895 u64 new;
@@ -1910,108 +1911,107 @@ static ssize_t set_cmci_disabled(struct sys_device *s,
1910 return size; 1911 return size;
1911} 1912}
1912 1913
1913static ssize_t store_int_with_restart(struct sys_device *s, 1914static ssize_t store_int_with_restart(struct device *s,
1914 struct sysdev_attribute *attr, 1915 struct device_attribute *attr,
1915 const char *buf, size_t size) 1916 const char *buf, size_t size)
1916{ 1917{
1917 ssize_t ret = sysdev_store_int(s, attr, buf, size); 1918 ssize_t ret = device_store_int(s, attr, buf, size);
1918 mce_restart(); 1919 mce_restart();
1919 return ret; 1920 return ret;
1920} 1921}
1921 1922
1922static SYSDEV_ATTR(trigger, 0644, show_trigger, set_trigger); 1923static DEVICE_ATTR(trigger, 0644, show_trigger, set_trigger);
1923static SYSDEV_INT_ATTR(tolerant, 0644, tolerant); 1924static DEVICE_INT_ATTR(tolerant, 0644, tolerant);
1924static SYSDEV_INT_ATTR(monarch_timeout, 0644, monarch_timeout); 1925static DEVICE_INT_ATTR(monarch_timeout, 0644, monarch_timeout);
1925static SYSDEV_INT_ATTR(dont_log_ce, 0644, mce_dont_log_ce); 1926static DEVICE_INT_ATTR(dont_log_ce, 0644, mce_dont_log_ce);
1926 1927
1927static struct sysdev_ext_attribute attr_check_interval = { 1928static struct dev_ext_attribute dev_attr_check_interval = {
1928 _SYSDEV_ATTR(check_interval, 0644, sysdev_show_int, 1929 __ATTR(check_interval, 0644, device_show_int, store_int_with_restart),
1929 store_int_with_restart),
1930 &check_interval 1930 &check_interval
1931}; 1931};
1932 1932
1933static struct sysdev_ext_attribute attr_ignore_ce = { 1933static struct dev_ext_attribute dev_attr_ignore_ce = {
1934 _SYSDEV_ATTR(ignore_ce, 0644, sysdev_show_int, set_ignore_ce), 1934 __ATTR(ignore_ce, 0644, device_show_int, set_ignore_ce),
1935 &mce_ignore_ce 1935 &mce_ignore_ce
1936}; 1936};
1937 1937
1938static struct sysdev_ext_attribute attr_cmci_disabled = { 1938static struct dev_ext_attribute dev_attr_cmci_disabled = {
1939 _SYSDEV_ATTR(cmci_disabled, 0644, sysdev_show_int, set_cmci_disabled), 1939 __ATTR(cmci_disabled, 0644, device_show_int, set_cmci_disabled),
1940 &mce_cmci_disabled 1940 &mce_cmci_disabled
1941}; 1941};
1942 1942
1943static struct sysdev_attribute *mce_sysdev_attrs[] = { 1943static struct device_attribute *mce_device_attrs[] = {
1944 &attr_tolerant.attr, 1944 &dev_attr_tolerant.attr,
1945 &attr_check_interval.attr, 1945 &dev_attr_check_interval.attr,
1946 &attr_trigger, 1946 &dev_attr_trigger,
1947 &attr_monarch_timeout.attr, 1947 &dev_attr_monarch_timeout.attr,
1948 &attr_dont_log_ce.attr, 1948 &dev_attr_dont_log_ce.attr,
1949 &attr_ignore_ce.attr, 1949 &dev_attr_ignore_ce.attr,
1950 &attr_cmci_disabled.attr, 1950 &dev_attr_cmci_disabled.attr,
1951 NULL 1951 NULL
1952}; 1952};
1953 1953
1954static cpumask_var_t mce_sysdev_initialized; 1954static cpumask_var_t mce_device_initialized;
1955 1955
1956/* Per cpu sysdev init. All of the cpus still share the same ctrl bank: */ 1956/* Per cpu device init. All of the cpus still share the same ctrl bank: */
1957static __cpuinit int mce_sysdev_create(unsigned int cpu) 1957static __cpuinit int mce_device_create(unsigned int cpu)
1958{ 1958{
1959 struct sys_device *sysdev = &per_cpu(mce_sysdev, cpu); 1959 struct device *dev = &per_cpu(mce_device, cpu);
1960 int err; 1960 int err;
1961 int i, j; 1961 int i, j;
1962 1962
1963 if (!mce_available(&boot_cpu_data)) 1963 if (!mce_available(&boot_cpu_data))
1964 return -EIO; 1964 return -EIO;
1965 1965
1966 memset(&sysdev->kobj, 0, sizeof(struct kobject)); 1966 memset(&dev->kobj, 0, sizeof(struct kobject));
1967 sysdev->id = cpu; 1967 dev->id = cpu;
1968 sysdev->cls = &mce_sysdev_class; 1968 dev->bus = &mce_subsys;
1969 1969
1970 err = sysdev_register(sysdev); 1970 err = device_register(dev);
1971 if (err) 1971 if (err)
1972 return err; 1972 return err;
1973 1973
1974 for (i = 0; mce_sysdev_attrs[i]; i++) { 1974 for (i = 0; mce_device_attrs[i]; i++) {
1975 err = sysdev_create_file(sysdev, mce_sysdev_attrs[i]); 1975 err = device_create_file(dev, mce_device_attrs[i]);
1976 if (err) 1976 if (err)
1977 goto error; 1977 goto error;
1978 } 1978 }
1979 for (j = 0; j < banks; j++) { 1979 for (j = 0; j < banks; j++) {
1980 err = sysdev_create_file(sysdev, &mce_banks[j].attr); 1980 err = device_create_file(dev, &mce_banks[j].attr);
1981 if (err) 1981 if (err)
1982 goto error2; 1982 goto error2;
1983 } 1983 }
1984 cpumask_set_cpu(cpu, mce_sysdev_initialized); 1984 cpumask_set_cpu(cpu, mce_device_initialized);
1985 1985
1986 return 0; 1986 return 0;
1987error2: 1987error2:
1988 while (--j >= 0) 1988 while (--j >= 0)
1989 sysdev_remove_file(sysdev, &mce_banks[j].attr); 1989 device_remove_file(dev, &mce_banks[j].attr);
1990error: 1990error:
1991 while (--i >= 0) 1991 while (--i >= 0)
1992 sysdev_remove_file(sysdev, mce_sysdev_attrs[i]); 1992 device_remove_file(dev, mce_device_attrs[i]);
1993 1993
1994 sysdev_unregister(sysdev); 1994 device_unregister(dev);
1995 1995
1996 return err; 1996 return err;
1997} 1997}
1998 1998
1999static __cpuinit void mce_sysdev_remove(unsigned int cpu) 1999static __cpuinit void mce_device_remove(unsigned int cpu)
2000{ 2000{
2001 struct sys_device *sysdev = &per_cpu(mce_sysdev, cpu); 2001 struct device *dev = &per_cpu(mce_device, cpu);
2002 int i; 2002 int i;
2003 2003
2004 if (!cpumask_test_cpu(cpu, mce_sysdev_initialized)) 2004 if (!cpumask_test_cpu(cpu, mce_device_initialized))
2005 return; 2005 return;
2006 2006
2007 for (i = 0; mce_sysdev_attrs[i]; i++) 2007 for (i = 0; mce_device_attrs[i]; i++)
2008 sysdev_remove_file(sysdev, mce_sysdev_attrs[i]); 2008 device_remove_file(dev, mce_device_attrs[i]);
2009 2009
2010 for (i = 0; i < banks; i++) 2010 for (i = 0; i < banks; i++)
2011 sysdev_remove_file(sysdev, &mce_banks[i].attr); 2011 device_remove_file(dev, &mce_banks[i].attr);
2012 2012
2013 sysdev_unregister(sysdev); 2013 device_unregister(dev);
2014 cpumask_clear_cpu(cpu, mce_sysdev_initialized); 2014 cpumask_clear_cpu(cpu, mce_device_initialized);
2015} 2015}
2016 2016
2017/* Make sure there are no machine checks on offlined CPUs. */ 2017/* Make sure there are no machine checks on offlined CPUs. */
@@ -2061,7 +2061,7 @@ mce_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
2061 switch (action) { 2061 switch (action) {
2062 case CPU_ONLINE: 2062 case CPU_ONLINE:
2063 case CPU_ONLINE_FROZEN: 2063 case CPU_ONLINE_FROZEN:
2064 mce_sysdev_create(cpu); 2064 mce_device_create(cpu);
2065 if (threshold_cpu_callback) 2065 if (threshold_cpu_callback)
2066 threshold_cpu_callback(action, cpu); 2066 threshold_cpu_callback(action, cpu);
2067 break; 2067 break;
@@ -2069,7 +2069,7 @@ mce_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
2069 case CPU_DEAD_FROZEN: 2069 case CPU_DEAD_FROZEN:
2070 if (threshold_cpu_callback) 2070 if (threshold_cpu_callback)
2071 threshold_cpu_callback(action, cpu); 2071 threshold_cpu_callback(action, cpu);
2072 mce_sysdev_remove(cpu); 2072 mce_device_remove(cpu);
2073 break; 2073 break;
2074 case CPU_DOWN_PREPARE: 2074 case CPU_DOWN_PREPARE:
2075 case CPU_DOWN_PREPARE_FROZEN: 2075 case CPU_DOWN_PREPARE_FROZEN:
@@ -2103,7 +2103,7 @@ static __init void mce_init_banks(void)
2103 2103
2104 for (i = 0; i < banks; i++) { 2104 for (i = 0; i < banks; i++) {
2105 struct mce_bank *b = &mce_banks[i]; 2105 struct mce_bank *b = &mce_banks[i];
2106 struct sysdev_attribute *a = &b->attr; 2106 struct device_attribute *a = &b->attr;
2107 2107
2108 sysfs_attr_init(&a->attr); 2108 sysfs_attr_init(&a->attr);
2109 a->attr.name = b->attrname; 2109 a->attr.name = b->attrname;
@@ -2123,16 +2123,16 @@ static __init int mcheck_init_device(void)
2123 if (!mce_available(&boot_cpu_data)) 2123 if (!mce_available(&boot_cpu_data))
2124 return -EIO; 2124 return -EIO;
2125 2125
2126 zalloc_cpumask_var(&mce_sysdev_initialized, GFP_KERNEL); 2126 zalloc_cpumask_var(&mce_device_initialized, GFP_KERNEL);
2127 2127
2128 mce_init_banks(); 2128 mce_init_banks();
2129 2129
2130 err = sysdev_class_register(&mce_sysdev_class); 2130 err = subsys_system_register(&mce_subsys, NULL);
2131 if (err) 2131 if (err)
2132 return err; 2132 return err;
2133 2133
2134 for_each_online_cpu(i) { 2134 for_each_online_cpu(i) {
2135 err = mce_sysdev_create(i); 2135 err = mce_device_create(i);
2136 if (err) 2136 if (err)
2137 return err; 2137 return err;
2138 } 2138 }
diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd.c b/arch/x86/kernel/cpu/mcheck/mce_amd.c
index f5474218cffe..56d2aa1acd55 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_amd.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_amd.c
@@ -17,7 +17,6 @@
17#include <linux/notifier.h> 17#include <linux/notifier.h>
18#include <linux/kobject.h> 18#include <linux/kobject.h>
19#include <linux/percpu.h> 19#include <linux/percpu.h>
20#include <linux/sysdev.h>
21#include <linux/errno.h> 20#include <linux/errno.h>
22#include <linux/sched.h> 21#include <linux/sched.h>
23#include <linux/sysfs.h> 22#include <linux/sysfs.h>
@@ -548,7 +547,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
548 if (!b) 547 if (!b)
549 goto out; 548 goto out;
550 549
551 err = sysfs_create_link(&per_cpu(mce_sysdev, cpu).kobj, 550 err = sysfs_create_link(&per_cpu(mce_device, cpu).kobj,
552 b->kobj, name); 551 b->kobj, name);
553 if (err) 552 if (err)
554 goto out; 553 goto out;
@@ -571,7 +570,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
571 goto out; 570 goto out;
572 } 571 }
573 572
574 b->kobj = kobject_create_and_add(name, &per_cpu(mce_sysdev, cpu).kobj); 573 b->kobj = kobject_create_and_add(name, &per_cpu(mce_device, cpu).kobj);
575 if (!b->kobj) 574 if (!b->kobj)
576 goto out_free; 575 goto out_free;
577 576
@@ -591,7 +590,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
591 if (i == cpu) 590 if (i == cpu)
592 continue; 591 continue;
593 592
594 err = sysfs_create_link(&per_cpu(mce_sysdev, i).kobj, 593 err = sysfs_create_link(&per_cpu(mce_device, i).kobj,
595 b->kobj, name); 594 b->kobj, name);
596 if (err) 595 if (err)
597 goto out; 596 goto out;
@@ -669,7 +668,7 @@ static void threshold_remove_bank(unsigned int cpu, int bank)
669#ifdef CONFIG_SMP 668#ifdef CONFIG_SMP
670 /* sibling symlink */ 669 /* sibling symlink */
671 if (shared_bank[bank] && b->blocks->cpu != cpu) { 670 if (shared_bank[bank] && b->blocks->cpu != cpu) {
672 sysfs_remove_link(&per_cpu(mce_sysdev, cpu).kobj, name); 671 sysfs_remove_link(&per_cpu(mce_device, cpu).kobj, name);
673 per_cpu(threshold_banks, cpu)[bank] = NULL; 672 per_cpu(threshold_banks, cpu)[bank] = NULL;
674 673
675 return; 674 return;
@@ -681,7 +680,7 @@ static void threshold_remove_bank(unsigned int cpu, int bank)
681 if (i == cpu) 680 if (i == cpu)
682 continue; 681 continue;
683 682
684 sysfs_remove_link(&per_cpu(mce_sysdev, i).kobj, name); 683 sysfs_remove_link(&per_cpu(mce_device, i).kobj, name);
685 per_cpu(threshold_banks, i)[bank] = NULL; 684 per_cpu(threshold_banks, i)[bank] = NULL;
686 } 685 }
687 686
diff --git a/arch/x86/kernel/cpu/mcheck/therm_throt.c b/arch/x86/kernel/cpu/mcheck/therm_throt.c
index 787e06c84ea6..59e3f6ed265f 100644
--- a/arch/x86/kernel/cpu/mcheck/therm_throt.c
+++ b/arch/x86/kernel/cpu/mcheck/therm_throt.c
@@ -19,7 +19,6 @@
19#include <linux/kernel.h> 19#include <linux/kernel.h>
20#include <linux/percpu.h> 20#include <linux/percpu.h>
21#include <linux/export.h> 21#include <linux/export.h>
22#include <linux/sysdev.h>
23#include <linux/types.h> 22#include <linux/types.h>
24#include <linux/init.h> 23#include <linux/init.h>
25#include <linux/smp.h> 24#include <linux/smp.h>
@@ -69,16 +68,16 @@ static atomic_t therm_throt_en = ATOMIC_INIT(0);
69static u32 lvtthmr_init __read_mostly; 68static u32 lvtthmr_init __read_mostly;
70 69
71#ifdef CONFIG_SYSFS 70#ifdef CONFIG_SYSFS
72#define define_therm_throt_sysdev_one_ro(_name) \ 71#define define_therm_throt_device_one_ro(_name) \
73 static SYSDEV_ATTR(_name, 0444, \ 72 static DEVICE_ATTR(_name, 0444, \
74 therm_throt_sysdev_show_##_name, \ 73 therm_throt_device_show_##_name, \
75 NULL) \ 74 NULL) \
76 75
77#define define_therm_throt_sysdev_show_func(event, name) \ 76#define define_therm_throt_device_show_func(event, name) \
78 \ 77 \
79static ssize_t therm_throt_sysdev_show_##event##_##name( \ 78static ssize_t therm_throt_device_show_##event##_##name( \
80 struct sys_device *dev, \ 79 struct device *dev, \
81 struct sysdev_attribute *attr, \ 80 struct device_attribute *attr, \
82 char *buf) \ 81 char *buf) \
83{ \ 82{ \
84 unsigned int cpu = dev->id; \ 83 unsigned int cpu = dev->id; \
@@ -95,20 +94,20 @@ static ssize_t therm_throt_sysdev_show_##event##_##name( \
95 return ret; \ 94 return ret; \
96} 95}
97 96
98define_therm_throt_sysdev_show_func(core_throttle, count); 97define_therm_throt_device_show_func(core_throttle, count);
99define_therm_throt_sysdev_one_ro(core_throttle_count); 98define_therm_throt_device_one_ro(core_throttle_count);
100 99
101define_therm_throt_sysdev_show_func(core_power_limit, count); 100define_therm_throt_device_show_func(core_power_limit, count);
102define_therm_throt_sysdev_one_ro(core_power_limit_count); 101define_therm_throt_device_one_ro(core_power_limit_count);
103 102
104define_therm_throt_sysdev_show_func(package_throttle, count); 103define_therm_throt_device_show_func(package_throttle, count);
105define_therm_throt_sysdev_one_ro(package_throttle_count); 104define_therm_throt_device_one_ro(package_throttle_count);
106 105
107define_therm_throt_sysdev_show_func(package_power_limit, count); 106define_therm_throt_device_show_func(package_power_limit, count);
108define_therm_throt_sysdev_one_ro(package_power_limit_count); 107define_therm_throt_device_one_ro(package_power_limit_count);
109 108
110static struct attribute *thermal_throttle_attrs[] = { 109static struct attribute *thermal_throttle_attrs[] = {
111 &attr_core_throttle_count.attr, 110 &dev_attr_core_throttle_count.attr,
112 NULL 111 NULL
113}; 112};
114 113
@@ -223,36 +222,36 @@ static int thresh_event_valid(int event)
223 222
224#ifdef CONFIG_SYSFS 223#ifdef CONFIG_SYSFS
225/* Add/Remove thermal_throttle interface for CPU device: */ 224/* Add/Remove thermal_throttle interface for CPU device: */
226static __cpuinit int thermal_throttle_add_dev(struct sys_device *sys_dev, 225static __cpuinit int thermal_throttle_add_dev(struct device *dev,
227 unsigned int cpu) 226 unsigned int cpu)
228{ 227{
229 int err; 228 int err;
230 struct cpuinfo_x86 *c = &cpu_data(cpu); 229 struct cpuinfo_x86 *c = &cpu_data(cpu);
231 230
232 err = sysfs_create_group(&sys_dev->kobj, &thermal_attr_group); 231 err = sysfs_create_group(&dev->kobj, &thermal_attr_group);
233 if (err) 232 if (err)
234 return err; 233 return err;
235 234
236 if (cpu_has(c, X86_FEATURE_PLN)) 235 if (cpu_has(c, X86_FEATURE_PLN))
237 err = sysfs_add_file_to_group(&sys_dev->kobj, 236 err = sysfs_add_file_to_group(&dev->kobj,
238 &attr_core_power_limit_count.attr, 237 &dev_attr_core_power_limit_count.attr,
239 thermal_attr_group.name); 238 thermal_attr_group.name);
240 if (cpu_has(c, X86_FEATURE_PTS)) { 239 if (cpu_has(c, X86_FEATURE_PTS)) {
241 err = sysfs_add_file_to_group(&sys_dev->kobj, 240 err = sysfs_add_file_to_group(&dev->kobj,
242 &attr_package_throttle_count.attr, 241 &dev_attr_package_throttle_count.attr,
243 thermal_attr_group.name); 242 thermal_attr_group.name);
244 if (cpu_has(c, X86_FEATURE_PLN)) 243 if (cpu_has(c, X86_FEATURE_PLN))
245 err = sysfs_add_file_to_group(&sys_dev->kobj, 244 err = sysfs_add_file_to_group(&dev->kobj,
246 &attr_package_power_limit_count.attr, 245 &dev_attr_package_power_limit_count.attr,
247 thermal_attr_group.name); 246 thermal_attr_group.name);
248 } 247 }
249 248
250 return err; 249 return err;
251} 250}
252 251
253static __cpuinit void thermal_throttle_remove_dev(struct sys_device *sys_dev) 252static __cpuinit void thermal_throttle_remove_dev(struct device *dev)
254{ 253{
255 sysfs_remove_group(&sys_dev->kobj, &thermal_attr_group); 254 sysfs_remove_group(&dev->kobj, &thermal_attr_group);
256} 255}
257 256
258/* Mutex protecting device creation against CPU hotplug: */ 257/* Mutex protecting device creation against CPU hotplug: */
@@ -265,16 +264,16 @@ thermal_throttle_cpu_callback(struct notifier_block *nfb,
265 void *hcpu) 264 void *hcpu)
266{ 265{
267 unsigned int cpu = (unsigned long)hcpu; 266 unsigned int cpu = (unsigned long)hcpu;
268 struct sys_device *sys_dev; 267 struct device *dev;
269 int err = 0; 268 int err = 0;
270 269
271 sys_dev = get_cpu_sysdev(cpu); 270 dev = get_cpu_device(cpu);
272 271
273 switch (action) { 272 switch (action) {
274 case CPU_UP_PREPARE: 273 case CPU_UP_PREPARE:
275 case CPU_UP_PREPARE_FROZEN: 274 case CPU_UP_PREPARE_FROZEN:
276 mutex_lock(&therm_cpu_lock); 275 mutex_lock(&therm_cpu_lock);
277 err = thermal_throttle_add_dev(sys_dev, cpu); 276 err = thermal_throttle_add_dev(dev, cpu);
278 mutex_unlock(&therm_cpu_lock); 277 mutex_unlock(&therm_cpu_lock);
279 WARN_ON(err); 278 WARN_ON(err);
280 break; 279 break;
@@ -283,7 +282,7 @@ thermal_throttle_cpu_callback(struct notifier_block *nfb,
283 case CPU_DEAD: 282 case CPU_DEAD:
284 case CPU_DEAD_FROZEN: 283 case CPU_DEAD_FROZEN:
285 mutex_lock(&therm_cpu_lock); 284 mutex_lock(&therm_cpu_lock);
286 thermal_throttle_remove_dev(sys_dev); 285 thermal_throttle_remove_dev(dev);
287 mutex_unlock(&therm_cpu_lock); 286 mutex_unlock(&therm_cpu_lock);
288 break; 287 break;
289 } 288 }
@@ -310,7 +309,7 @@ static __init int thermal_throttle_init_device(void)
310#endif 309#endif
311 /* connect live CPUs to sysfs */ 310 /* connect live CPUs to sysfs */
312 for_each_online_cpu(cpu) { 311 for_each_online_cpu(cpu) {
313 err = thermal_throttle_add_dev(get_cpu_sysdev(cpu), cpu); 312 err = thermal_throttle_add_dev(get_cpu_device(cpu), cpu);
314 WARN_ON(err); 313 WARN_ON(err);
315 } 314 }
316#ifdef CONFIG_HOTPLUG_CPU 315#ifdef CONFIG_HOTPLUG_CPU
diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c
index 1bb0bf4d92cd..56258f1c488e 100644
--- a/arch/x86/kernel/hpet.c
+++ b/arch/x86/kernel/hpet.c
@@ -2,7 +2,6 @@
2#include <linux/clockchips.h> 2#include <linux/clockchips.h>
3#include <linux/interrupt.h> 3#include <linux/interrupt.h>
4#include <linux/export.h> 4#include <linux/export.h>
5#include <linux/sysdev.h>
6#include <linux/delay.h> 5#include <linux/delay.h>
7#include <linux/errno.h> 6#include <linux/errno.h>
8#include <linux/i8253.h> 7#include <linux/i8253.h>
diff --git a/arch/x86/kernel/irqinit.c b/arch/x86/kernel/irqinit.c
index b3300e6bacef..313fb5cddbce 100644
--- a/arch/x86/kernel/irqinit.c
+++ b/arch/x86/kernel/irqinit.c
@@ -9,7 +9,7 @@
9#include <linux/kprobes.h> 9#include <linux/kprobes.h>
10#include <linux/init.h> 10#include <linux/init.h>
11#include <linux/kernel_stat.h> 11#include <linux/kernel_stat.h>
12#include <linux/sysdev.h> 12#include <linux/device.h>
13#include <linux/bitops.h> 13#include <linux/bitops.h>
14#include <linux/acpi.h> 14#include <linux/acpi.h>
15#include <linux/io.h> 15#include <linux/io.h>
diff --git a/arch/x86/kernel/microcode_core.c b/arch/x86/kernel/microcode_core.c
index 9d46f5e43b51..c6aa7eb6cda4 100644
--- a/arch/x86/kernel/microcode_core.c
+++ b/arch/x86/kernel/microcode_core.c
@@ -292,8 +292,8 @@ static int reload_for_cpu(int cpu)
292 return err; 292 return err;
293} 293}
294 294
295static ssize_t reload_store(struct sys_device *dev, 295static ssize_t reload_store(struct device *dev,
296 struct sysdev_attribute *attr, 296 struct device_attribute *attr,
297 const char *buf, size_t size) 297 const char *buf, size_t size)
298{ 298{
299 unsigned long val; 299 unsigned long val;
@@ -318,30 +318,30 @@ static ssize_t reload_store(struct sys_device *dev,
318 return ret; 318 return ret;
319} 319}
320 320
321static ssize_t version_show(struct sys_device *dev, 321static ssize_t version_show(struct device *dev,
322 struct sysdev_attribute *attr, char *buf) 322 struct device_attribute *attr, char *buf)
323{ 323{
324 struct ucode_cpu_info *uci = ucode_cpu_info + dev->id; 324 struct ucode_cpu_info *uci = ucode_cpu_info + dev->id;
325 325
326 return sprintf(buf, "0x%x\n", uci->cpu_sig.rev); 326 return sprintf(buf, "0x%x\n", uci->cpu_sig.rev);
327} 327}
328 328
329static ssize_t pf_show(struct sys_device *dev, 329static ssize_t pf_show(struct device *dev,
330 struct sysdev_attribute *attr, char *buf) 330 struct device_attribute *attr, char *buf)
331{ 331{
332 struct ucode_cpu_info *uci = ucode_cpu_info + dev->id; 332 struct ucode_cpu_info *uci = ucode_cpu_info + dev->id;
333 333
334 return sprintf(buf, "0x%x\n", uci->cpu_sig.pf); 334 return sprintf(buf, "0x%x\n", uci->cpu_sig.pf);
335} 335}
336 336
337static SYSDEV_ATTR(reload, 0200, NULL, reload_store); 337static DEVICE_ATTR(reload, 0200, NULL, reload_store);
338static SYSDEV_ATTR(version, 0400, version_show, NULL); 338static DEVICE_ATTR(version, 0400, version_show, NULL);
339static SYSDEV_ATTR(processor_flags, 0400, pf_show, NULL); 339static DEVICE_ATTR(processor_flags, 0400, pf_show, NULL);
340 340
341static struct attribute *mc_default_attrs[] = { 341static struct attribute *mc_default_attrs[] = {
342 &attr_reload.attr, 342 &dev_attr_reload.attr,
343 &attr_version.attr, 343 &dev_attr_version.attr,
344 &attr_processor_flags.attr, 344 &dev_attr_processor_flags.attr,
345 NULL 345 NULL
346}; 346};
347 347
@@ -405,43 +405,45 @@ static enum ucode_state microcode_update_cpu(int cpu)
405 return ustate; 405 return ustate;
406} 406}
407 407
408static int mc_sysdev_add(struct sys_device *sys_dev) 408static int mc_device_add(struct device *dev, struct subsys_interface *sif)
409{ 409{
410 int err, cpu = sys_dev->id; 410 int err, cpu = dev->id;
411 411
412 if (!cpu_online(cpu)) 412 if (!cpu_online(cpu))
413 return 0; 413 return 0;
414 414
415 pr_debug("CPU%d added\n", cpu); 415 pr_debug("CPU%d added\n", cpu);
416 416
417 err = sysfs_create_group(&sys_dev->kobj, &mc_attr_group); 417 err = sysfs_create_group(&dev->kobj, &mc_attr_group);
418 if (err) 418 if (err)
419 return err; 419 return err;
420 420
421 if (microcode_init_cpu(cpu) == UCODE_ERROR) { 421 if (microcode_init_cpu(cpu) == UCODE_ERROR) {
422 sysfs_remove_group(&sys_dev->kobj, &mc_attr_group); 422 sysfs_remove_group(&dev->kobj, &mc_attr_group);
423 return -EINVAL; 423 return -EINVAL;
424 } 424 }
425 425
426 return err; 426 return err;
427} 427}
428 428
429static int mc_sysdev_remove(struct sys_device *sys_dev) 429static int mc_device_remove(struct device *dev, struct subsys_interface *sif)
430{ 430{
431 int cpu = sys_dev->id; 431 int cpu = dev->id;
432 432
433 if (!cpu_online(cpu)) 433 if (!cpu_online(cpu))
434 return 0; 434 return 0;
435 435
436 pr_debug("CPU%d removed\n", cpu); 436 pr_debug("CPU%d removed\n", cpu);
437 microcode_fini_cpu(cpu); 437 microcode_fini_cpu(cpu);
438 sysfs_remove_group(&sys_dev->kobj, &mc_attr_group); 438 sysfs_remove_group(&dev->kobj, &mc_attr_group);
439 return 0; 439 return 0;
440} 440}
441 441
442static struct sysdev_driver mc_sysdev_driver = { 442static struct subsys_interface mc_cpu_interface = {
443 .add = mc_sysdev_add, 443 .name = "microcode",
444 .remove = mc_sysdev_remove, 444 .subsys = &cpu_subsys,
445 .add_dev = mc_device_add,
446 .remove_dev = mc_device_remove,
445}; 447};
446 448
447/** 449/**
@@ -464,9 +466,9 @@ static __cpuinit int
464mc_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu) 466mc_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu)
465{ 467{
466 unsigned int cpu = (unsigned long)hcpu; 468 unsigned int cpu = (unsigned long)hcpu;
467 struct sys_device *sys_dev; 469 struct device *dev;
468 470
469 sys_dev = get_cpu_sysdev(cpu); 471 dev = get_cpu_device(cpu);
470 switch (action) { 472 switch (action) {
471 case CPU_ONLINE: 473 case CPU_ONLINE:
472 case CPU_ONLINE_FROZEN: 474 case CPU_ONLINE_FROZEN:
@@ -474,13 +476,13 @@ mc_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu)
474 case CPU_DOWN_FAILED: 476 case CPU_DOWN_FAILED:
475 case CPU_DOWN_FAILED_FROZEN: 477 case CPU_DOWN_FAILED_FROZEN:
476 pr_debug("CPU%d added\n", cpu); 478 pr_debug("CPU%d added\n", cpu);
477 if (sysfs_create_group(&sys_dev->kobj, &mc_attr_group)) 479 if (sysfs_create_group(&dev->kobj, &mc_attr_group))
478 pr_err("Failed to create group for CPU%d\n", cpu); 480 pr_err("Failed to create group for CPU%d\n", cpu);
479 break; 481 break;
480 case CPU_DOWN_PREPARE: 482 case CPU_DOWN_PREPARE:
481 case CPU_DOWN_PREPARE_FROZEN: 483 case CPU_DOWN_PREPARE_FROZEN:
482 /* Suspend is in progress, only remove the interface */ 484 /* Suspend is in progress, only remove the interface */
483 sysfs_remove_group(&sys_dev->kobj, &mc_attr_group); 485 sysfs_remove_group(&dev->kobj, &mc_attr_group);
484 pr_debug("CPU%d removed\n", cpu); 486 pr_debug("CPU%d removed\n", cpu);
485 break; 487 break;
486 488
@@ -525,7 +527,7 @@ static int __init microcode_init(void)
525 get_online_cpus(); 527 get_online_cpus();
526 mutex_lock(&microcode_mutex); 528 mutex_lock(&microcode_mutex);
527 529
528 error = sysdev_driver_register(&cpu_sysdev_class, &mc_sysdev_driver); 530 error = subsys_interface_register(&mc_cpu_interface);
529 531
530 mutex_unlock(&microcode_mutex); 532 mutex_unlock(&microcode_mutex);
531 put_online_cpus(); 533 put_online_cpus();
@@ -535,7 +537,7 @@ static int __init microcode_init(void)
535 537
536 error = microcode_dev_init(); 538 error = microcode_dev_init();
537 if (error) 539 if (error)
538 goto out_sysdev_driver; 540 goto out_driver;
539 541
540 register_syscore_ops(&mc_syscore_ops); 542 register_syscore_ops(&mc_syscore_ops);
541 register_hotcpu_notifier(&mc_cpu_notifier); 543 register_hotcpu_notifier(&mc_cpu_notifier);
@@ -545,11 +547,11 @@ static int __init microcode_init(void)
545 547
546 return 0; 548 return 0;
547 549
548out_sysdev_driver: 550out_driver:
549 get_online_cpus(); 551 get_online_cpus();
550 mutex_lock(&microcode_mutex); 552 mutex_lock(&microcode_mutex);
551 553
552 sysdev_driver_unregister(&cpu_sysdev_class, &mc_sysdev_driver); 554 subsys_interface_unregister(&mc_cpu_interface);
553 555
554 mutex_unlock(&microcode_mutex); 556 mutex_unlock(&microcode_mutex);
555 put_online_cpus(); 557 put_online_cpus();
@@ -571,7 +573,7 @@ static void __exit microcode_exit(void)
571 get_online_cpus(); 573 get_online_cpus();
572 mutex_lock(&microcode_mutex); 574 mutex_lock(&microcode_mutex);
573 575
574 sysdev_driver_unregister(&cpu_sysdev_class, &mc_sysdev_driver); 576 subsys_interface_unregister(&mc_cpu_interface);
575 577
576 mutex_unlock(&microcode_mutex); 578 mutex_unlock(&microcode_mutex);
577 put_online_cpus(); 579 put_online_cpus();