diff options
author | Kay Sievers <kay.sievers@vrfy.org> | 2012-01-07 16:07:18 +0100 |
---|---|---|
committer | Kay Sievers <kay.sievers@vrfy.org> | 2012-01-07 16:07:18 +0100 |
commit | ab8529a54b7ba350855dec6c9beb5307973a643f (patch) | |
tree | 403cfcc1609bcf89eb1472596e4d58de375ffaf4 | |
parent | b99e74a9e05f18a50ac7d320afb90903218939f5 (diff) | |
download | patches-ab8529a54b7ba350855dec6c9beb5307973a643f.tar.gz |
remove sysdev, add modinfo
-rw-r--r-- | 01-core-support.patch | 864 | ||||
-rw-r--r-- | 04-rtmutex.patch | 134 | ||||
-rw-r--r-- | 05-clocksource.patch | 104 | ||||
-rw-r--r-- | 06-ibm-rtl.patch | 98 | ||||
-rw-r--r-- | 07-edac.patch | 393 | ||||
-rw-r--r-- | 08-xen.patch | 425 | ||||
-rw-r--r-- | 09-cpu.patch | 4336 | ||||
-rw-r--r-- | 10-memory.patch | 969 | ||||
-rw-r--r-- | 11-s390-time.patch | 563 | ||||
-rw-r--r-- | 12-power-cmm.patch | 179 | ||||
-rw-r--r-- | 13-power-qe_ic.patch | 54 | ||||
-rw-r--r-- | 14-power-suspend.patch | 99 | ||||
-rw-r--r-- | 15-sh-intc.patch | 165 | ||||
-rw-r--r-- | 16-sh-dma.patch | 210 | ||||
-rw-r--r-- | 17-mips-txx9-7segled.patch | 119 | ||||
-rw-r--r-- | 18-mips-txx9_sram.patch | 104 | ||||
-rw-r--r-- | 19-m68k-gpio.patch | 40 | ||||
-rw-r--r-- | 20-arm.patch | 2038 | ||||
-rw-r--r-- | 99-core-remove.patch | 1412 | ||||
-rw-r--r-- | modinfo.patch | 143 | ||||
-rw-r--r-- | prctl-child_reaper.patch | 10 | ||||
-rw-r--r-- | series | 21 |
22 files changed, 150 insertions, 12330 deletions
diff --git a/01-core-support.patch b/01-core-support.patch deleted file mode 100644 index d5e0a3e..0000000 --- a/01-core-support.patch +++ /dev/null @@ -1,864 +0,0 @@ -From: Kay Sievers <kay.sievers@vrfy.org> -Subject: driver-core: implement 'sysdev' functionality for regular devices and buses - -All sysdev classes and sysdev devices will converted to regular devices -and buses to properly hook userspace into the event processing. - -There is no interesting difference between a 'sysdev' and 'device' which -would justify to roll an entire own subsystem with different userspace -export semantics. Userspace relies on events and generic sysfs subsystem -infrastructure from sysdev devices, which are currently not properly -available. - -Every converted sysdev class will create a regular device with the class -name in /sys/devices/system and all registered devices will becom a children -of theses devices. - -For compatibility reasons, the sysdev class-wide attributes are created -at this parent device. (Do not copy that logic for anything new, subsystem- -wide properties belong to the subsystem, not to some fake parent device -created in /sys/devices.) - -Every sysdev driver is implemented as a simple subsystem interface now, -and no longer called a driver. - -After all sysdev classes are ported to regular driver core entities, the -sysdev implementation will be entirely removed from the kernel. - -Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> ---- - drivers/base/base.h | 12 +- - drivers/base/bus.c | 291 +++++++++++++++++++++++++++++++++++++++++++++---- - drivers/base/class.c | 14 +- - drivers/base/core.c | 85 +++++++++++--- - drivers/base/init.c | 1 - drivers/base/sys.c | 10 - - include/linux/device.h | 78 ++++++++++++- - 7 files changed, 430 insertions(+), 61 deletions(-) - ---- a/drivers/base/base.h -+++ b/drivers/base/base.h -@@ -4,7 +4,9 @@ - * struct subsys_private - structure to hold the private to the driver core portions of the bus_type/class structure. - * - * @subsys - the struct kset that defines this subsystem -- * @devices_kset - the list of devices associated -+ * @devices_kset - the subsystem's 'devices' directory -+ * @interfaces - list of subsystem interfaces associated -+ * @mutex - protect the devices, and interfaces lists. - * - * @drivers_kset - the list of drivers associated - * @klist_devices - the klist to iterate over the @devices_kset -@@ -14,10 +16,8 @@ - * @bus - pointer back to the struct bus_type that this structure is associated - * with. - * -- * @class_interfaces - list of class_interfaces associated - * @glue_dirs - "glue" directory to put in-between the parent device to - * avoid namespace conflicts -- * @class_mutex - mutex to protect the children, devices, and interfaces lists. - * @class - pointer back to the struct class that this structure is associated - * with. - * -@@ -28,6 +28,8 @@ - struct subsys_private { - struct kset subsys; - struct kset *devices_kset; -+ struct list_head interfaces; -+ struct mutex mutex; - - struct kset *drivers_kset; - struct klist klist_devices; -@@ -36,9 +38,7 @@ struct subsys_private { - unsigned int drivers_autoprobe:1; - struct bus_type *bus; - -- struct list_head class_interfaces; - struct kset glue_dirs; -- struct mutex class_mutex; - struct class *class; - }; - #define to_subsys_private(obj) container_of(obj, struct subsys_private, subsys.kobj) -@@ -94,7 +94,6 @@ extern int hypervisor_init(void); - static inline int hypervisor_init(void) { return 0; } - #endif - extern int platform_bus_init(void); --extern int system_bus_init(void); - extern int cpu_dev_init(void); - - extern int bus_add_device(struct device *dev); -@@ -116,6 +115,7 @@ extern char *make_class_name(const char - - extern int devres_release_all(struct device *dev); - -+/* /sys/devices directory */ - extern struct kset *devices_kset; - - #if defined(CONFIG_MODULES) && defined(CONFIG_SYSFS) ---- a/drivers/base/bus.c -+++ b/drivers/base/bus.c -@@ -16,9 +16,14 @@ - #include <linux/slab.h> - #include <linux/init.h> - #include <linux/string.h> -+#include <linux/mutex.h> - #include "base.h" - #include "power/power.h" - -+/* /sys/devices/system */ -+/* FIXME: make static after drivers/base/sys.c is deleted */ -+struct kset *system_kset; -+ - #define to_bus_attr(_attr) container_of(_attr, struct bus_attribute, attr) - - /* -@@ -360,6 +365,47 @@ struct device *bus_find_device_by_name(s - } - EXPORT_SYMBOL_GPL(bus_find_device_by_name); - -+/** -+ * subsys_find_device_by_id - find a device with a specific enumeration number -+ * @subsys: subsystem -+ * @id: index 'id' in struct device -+ * @hint: device to check first -+ * -+ * Check the hint's next object and if it is a match return it directly, -+ * otherwise, fall back to a full list search. Either way a reference for -+ * the returned object is taken. -+ */ -+struct device *subsys_find_device_by_id(struct bus_type *subsys, unsigned int id, -+ struct device *hint) -+{ -+ struct klist_iter i; -+ struct device *dev; -+ -+ if (!subsys) -+ return NULL; -+ -+ if (hint) { -+ klist_iter_init_node(&subsys->p->klist_devices, &i, &hint->p->knode_bus); -+ dev = next_device(&i); -+ if (dev && dev->id == id && get_device(dev)) { -+ klist_iter_exit(&i); -+ return dev; -+ } -+ klist_iter_exit(&i); -+ } -+ -+ klist_iter_init_node(&subsys->p->klist_devices, &i, NULL); -+ while ((dev = next_device(&i))) { -+ if (dev->id == id && get_device(dev)) { -+ klist_iter_exit(&i); -+ return dev; -+ } -+ } -+ klist_iter_exit(&i); -+ return NULL; -+} -+EXPORT_SYMBOL_GPL(subsys_find_device_by_id); -+ - static struct device_driver *next_driver(struct klist_iter *i) - { - struct klist_node *n = klist_next(i); -@@ -487,38 +533,59 @@ out_put: - void bus_probe_device(struct device *dev) - { - struct bus_type *bus = dev->bus; -+ struct subsys_interface *sif; - int ret; - -- if (bus && bus->p->drivers_autoprobe) { -+ if (!bus) -+ return; -+ -+ if (bus->p->drivers_autoprobe) { - ret = device_attach(dev); - WARN_ON(ret < 0); - } -+ -+ mutex_lock(&bus->p->mutex); -+ list_for_each_entry(sif, &bus->p->interfaces, node) -+ if (sif->add_dev) -+ sif->add_dev(dev, sif); -+ mutex_unlock(&bus->p->mutex); - } - - /** - * bus_remove_device - remove device from bus - * @dev: device to be removed - * -- * - Remove symlink from bus's directory. -+ * - Remove device from all interfaces. -+ * - Remove symlink from bus' directory. - * - Delete device from bus's list. - * - Detach from its driver. - * - Drop reference taken in bus_add_device(). - */ - void bus_remove_device(struct device *dev) - { -- if (dev->bus) { -- sysfs_remove_link(&dev->kobj, "subsystem"); -- sysfs_remove_link(&dev->bus->p->devices_kset->kobj, -- dev_name(dev)); -- device_remove_attrs(dev->bus, dev); -- if (klist_node_attached(&dev->p->knode_bus)) -- klist_del(&dev->p->knode_bus); -+ struct bus_type *bus = dev->bus; -+ struct subsys_interface *sif; - -- pr_debug("bus: '%s': remove device %s\n", -- dev->bus->name, dev_name(dev)); -- device_release_driver(dev); -- bus_put(dev->bus); -- } -+ if (!bus) -+ return; -+ -+ mutex_lock(&bus->p->mutex); -+ list_for_each_entry(sif, &bus->p->interfaces, node) -+ if (sif->remove_dev) -+ sif->remove_dev(dev, sif); -+ mutex_unlock(&bus->p->mutex); -+ -+ sysfs_remove_link(&dev->kobj, "subsystem"); -+ sysfs_remove_link(&dev->bus->p->devices_kset->kobj, -+ dev_name(dev)); -+ device_remove_attrs(dev->bus, dev); -+ if (klist_node_attached(&dev->p->knode_bus)) -+ klist_del(&dev->p->knode_bus); -+ -+ pr_debug("bus: '%s': remove device %s\n", -+ dev->bus->name, dev_name(dev)); -+ device_release_driver(dev); -+ bus_put(dev->bus); - } - - static int driver_add_attrs(struct bus_type *bus, struct device_driver *drv) -@@ -847,14 +914,14 @@ static ssize_t bus_uevent_store(struct b - static BUS_ATTR(uevent, S_IWUSR, NULL, bus_uevent_store); - - /** -- * bus_register - register a bus with the system. -+ * __bus_register - register a driver-core subsystem - * @bus: bus. - * - * Once we have that, we registered the bus with the kobject - * infrastructure, then register the children subsystems it has: -- * the devices and drivers that belong to the bus. -+ * the devices and drivers that belong to the subsystem. - */ --int bus_register(struct bus_type *bus) -+int __bus_register(struct bus_type *bus, struct lock_class_key *key) - { - int retval; - struct subsys_private *priv; -@@ -898,6 +965,8 @@ int bus_register(struct bus_type *bus) - goto bus_drivers_fail; - } - -+ INIT_LIST_HEAD(&priv->interfaces); -+ __mutex_init(&priv->mutex, "subsys mutex", key); - klist_init(&priv->klist_devices, klist_devices_get, klist_devices_put); - klist_init(&priv->klist_drivers, NULL, NULL); - -@@ -927,7 +996,7 @@ out: - bus->p = NULL; - return retval; - } --EXPORT_SYMBOL_GPL(bus_register); -+EXPORT_SYMBOL_GPL(__bus_register); - - /** - * bus_unregister - remove a bus from the system -@@ -939,6 +1008,8 @@ EXPORT_SYMBOL_GPL(bus_register); - void bus_unregister(struct bus_type *bus) - { - pr_debug("bus: '%s': unregistering\n", bus->name); -+ if (bus->dev_root) -+ device_unregister(bus->dev_root); - bus_remove_attrs(bus); - remove_probe_files(bus); - kset_unregister(bus->p->drivers_kset); -@@ -1028,10 +1099,194 @@ void bus_sort_breadthfirst(struct bus_ty - } - EXPORT_SYMBOL_GPL(bus_sort_breadthfirst); - -+/** -+ * subsys_dev_iter_init - initialize subsys device iterator -+ * @iter: subsys iterator to initialize -+ * @subsys: the subsys we wanna iterate over -+ * @start: the device to start iterating from, if any -+ * @type: device_type of the devices to iterate over, NULL for all -+ * -+ * Initialize subsys iterator @iter such that it iterates over devices -+ * of @subsys. If @start is set, the list iteration will start there, -+ * otherwise if it is NULL, the iteration starts at the beginning of -+ * the list. -+ */ -+void subsys_dev_iter_init(struct subsys_dev_iter *iter, struct bus_type *subsys, -+ struct device *start, const struct device_type *type) -+{ -+ struct klist_node *start_knode = NULL; -+ -+ if (start) -+ start_knode = &start->p->knode_bus; -+ klist_iter_init_node(&subsys->p->klist_devices, &iter->ki, start_knode); -+ iter->type = type; -+} -+EXPORT_SYMBOL_GPL(subsys_dev_iter_init); -+ -+/** -+ * subsys_dev_iter_next - iterate to the next device -+ * @iter: subsys iterator to proceed -+ * -+ * Proceed @iter to the next device and return it. Returns NULL if -+ * iteration is complete. -+ * -+ * The returned device is referenced and won't be released till -+ * iterator is proceed to the next device or exited. The caller is -+ * free to do whatever it wants to do with the device including -+ * calling back into subsys code. -+ */ -+struct device *subsys_dev_iter_next(struct subsys_dev_iter *iter) -+{ -+ struct klist_node *knode; -+ struct device *dev; -+ -+ for(;;) { -+ knode = klist_next(&iter->ki); -+ if (!knode) -+ return NULL; -+ dev = container_of(knode, struct device_private, knode_bus)->device; -+ if (!iter->type || iter->type == dev->type) -+ return dev; -+ } -+} -+EXPORT_SYMBOL_GPL(subsys_dev_iter_next); -+ -+/** -+ * subsys_dev_iter_exit - finish iteration -+ * @iter: subsys iterator to finish -+ * -+ * Finish an iteration. Always call this function after iteration is -+ * complete whether the iteration ran till the end or not. -+ */ -+void subsys_dev_iter_exit(struct subsys_dev_iter *iter) -+{ -+ klist_iter_exit(&iter->ki); -+} -+EXPORT_SYMBOL_GPL(subsys_dev_iter_exit); -+ -+int subsys_interface_register(struct subsys_interface *sif) -+{ -+ struct bus_type *subsys; -+ struct subsys_dev_iter iter; -+ struct device *dev; -+ -+ if (!sif || !sif->subsys) -+ return -ENODEV; -+ -+ subsys = bus_get(sif->subsys); -+ if (!subsys) -+ return -EINVAL; -+ -+ mutex_lock(&subsys->p->mutex); -+ list_add_tail(&sif->node, &subsys->p->interfaces); -+ if (sif->add_dev) { -+ subsys_dev_iter_init(&iter, subsys, NULL, NULL); -+ while ((dev = subsys_dev_iter_next(&iter))) -+ sif->add_dev(dev, sif); -+ subsys_dev_iter_exit(&iter); -+ } -+ mutex_unlock(&subsys->p->mutex); -+ -+ return 0; -+} -+EXPORT_SYMBOL_GPL(subsys_interface_register); -+ -+void subsys_interface_unregister(struct subsys_interface *sif) -+{ -+ struct bus_type *subsys = sif->subsys; -+ struct subsys_dev_iter iter; -+ struct device *dev; -+ -+ if (!sif) -+ return; -+ -+ mutex_lock(&subsys->p->mutex); -+ list_del_init(&sif->node); -+ if (sif->remove_dev) { -+ subsys_dev_iter_init(&iter, subsys, NULL, NULL); -+ while ((dev = subsys_dev_iter_next(&iter))) -+ sif->remove_dev(dev, sif); -+ subsys_dev_iter_exit(&iter); -+ } -+ mutex_unlock(&subsys->p->mutex); -+ -+ bus_put(subsys); -+} -+EXPORT_SYMBOL_GPL(subsys_interface_unregister); -+ -+static void system_root_device_release(struct device *dev) -+{ -+ kfree(dev); -+} -+/** -+ * subsys_system_register - register a subsystem at /sys/devices/system/ -+ * @subsys - system subsystem -+ * @groups - default attributes for the root device -+ * -+ * All 'system' subsystems have a /sys/devices/system/<name> root device -+ * with the name of the subsystem. The root device can carry subsystem- -+ * wide attributes. All registered devices are below this single root -+ * device and are named after the subsystem with a simple enumeration -+ * number appended. The registered devices are not explicitely named; -+ * only 'id' in the device needs to be set. -+ * -+ * Do not use this interface for anything new, it exists for compatibility -+ * with bad ideas only. New subsystems should use plain subsystems; and -+ * add the subsystem-wide attributes should be added to the subsystem -+ * directory itself and not some create fake root-device placed in -+ * /sys/devices/system/<name>. -+ */ -+int subsys_system_register(struct bus_type *subsys, -+ const struct attribute_group **groups) -+{ -+ struct device *dev; -+ int err; -+ -+ err = bus_register(subsys); -+ if (err < 0) -+ return err; -+ -+ dev = kzalloc(sizeof(struct device), GFP_KERNEL); -+ if (!dev) { -+ err = -ENOMEM; -+ goto err_dev; -+ } -+ -+ err = dev_set_name(dev, "%s", subsys->name); -+ if (err < 0) -+ goto err_name; -+ -+ dev->kobj.parent = &system_kset->kobj; -+ dev->groups = groups; -+ dev->release = system_root_device_release; -+ -+ err = device_register(dev); -+ if (err < 0) -+ goto err_dev_reg; -+ -+ subsys->dev_root = dev; -+ return 0; -+ -+err_dev_reg: -+ put_device(dev); -+ dev = NULL; -+err_name: -+ kfree(dev); -+err_dev: -+ bus_unregister(subsys); -+ return err; -+} -+EXPORT_SYMBOL_GPL(subsys_system_register); -+ - int __init buses_init(void) - { - bus_kset = kset_create_and_add("bus", &bus_uevent_ops, NULL); - if (!bus_kset) - return -ENOMEM; -+ -+ system_kset = kset_create_and_add("system", NULL, &devices_kset->kobj); -+ if (!system_kset) -+ return -ENOMEM; -+ - return 0; - } ---- a/drivers/base/class.c -+++ b/drivers/base/class.c -@@ -184,9 +184,9 @@ int __class_register(struct class *cls, - if (!cp) - return -ENOMEM; - klist_init(&cp->klist_devices, klist_class_dev_get, klist_class_dev_put); -- INIT_LIST_HEAD(&cp->class_interfaces); -+ INIT_LIST_HEAD(&cp->interfaces); - kset_init(&cp->glue_dirs); -- __mutex_init(&cp->class_mutex, "struct class mutex", key); -+ __mutex_init(&cp->mutex, "subsys mutex", key); - error = kobject_set_name(&cp->subsys.kobj, "%s", cls->name); - if (error) { - kfree(cp); -@@ -460,15 +460,15 @@ int class_interface_register(struct clas - if (!parent) - return -EINVAL; - -- mutex_lock(&parent->p->class_mutex); -- list_add_tail(&class_intf->node, &parent->p->class_interfaces); -+ mutex_lock(&parent->p->mutex); -+ list_add_tail(&class_intf->node, &parent->p->interfaces); - if (class_intf->add_dev) { - class_dev_iter_init(&iter, parent, NULL, NULL); - while ((dev = class_dev_iter_next(&iter))) - class_intf->add_dev(dev, class_intf); - class_dev_iter_exit(&iter); - } -- mutex_unlock(&parent->p->class_mutex); -+ mutex_unlock(&parent->p->mutex); - - return 0; - } -@@ -482,7 +482,7 @@ void class_interface_unregister(struct c - if (!parent) - return; - -- mutex_lock(&parent->p->class_mutex); -+ mutex_lock(&parent->p->mutex); - list_del_init(&class_intf->node); - if (class_intf->remove_dev) { - class_dev_iter_init(&iter, parent, NULL, NULL); -@@ -490,7 +490,7 @@ void class_interface_unregister(struct c - class_intf->remove_dev(dev, class_intf); - class_dev_iter_exit(&iter); - } -- mutex_unlock(&parent->p->class_mutex); -+ mutex_unlock(&parent->p->mutex); - - class_put(parent); - } ---- a/drivers/base/core.c -+++ b/drivers/base/core.c -@@ -118,6 +118,56 @@ static const struct sysfs_ops dev_sysfs_ - .store = dev_attr_store, - }; - -+#define to_ext_attr(x) container_of(x, struct dev_ext_attribute, attr) -+ -+ssize_t device_store_ulong(struct device *dev, -+ struct device_attribute *attr, -+ const char *buf, size_t size) -+{ -+ struct dev_ext_attribute *ea = to_ext_attr(attr); -+ char *end; -+ unsigned long new = simple_strtoul(buf, &end, 0); -+ if (end == buf) -+ return -EINVAL; -+ *(unsigned long *)(ea->var) = new; -+ /* Always return full write size even if we didn't consume all */ -+ return size; -+} -+EXPORT_SYMBOL_GPL(device_store_ulong); -+ -+ssize_t device_show_ulong(struct device *dev, -+ struct device_attribute *attr, -+ char *buf) -+{ -+ struct dev_ext_attribute *ea = to_ext_attr(attr); -+ return snprintf(buf, PAGE_SIZE, "%lx\n", *(unsigned long *)(ea->var)); -+} -+EXPORT_SYMBOL_GPL(device_show_ulong); -+ -+ssize_t device_store_int(struct device *dev, -+ struct device_attribute *attr, -+ const char *buf, size_t size) -+{ -+ struct dev_ext_attribute *ea = to_ext_attr(attr); -+ char *end; -+ long new = simple_strtol(buf, &end, 0); -+ if (end == buf || new > INT_MAX || new < INT_MIN) -+ return -EINVAL; -+ *(int *)(ea->var) = new; -+ /* Always return full write size even if we didn't consume all */ -+ return size; -+} -+EXPORT_SYMBOL_GPL(device_store_int); -+ -+ssize_t device_show_int(struct device *dev, -+ struct device_attribute *attr, -+ char *buf) -+{ -+ struct dev_ext_attribute *ea = to_ext_attr(attr); -+ -+ return snprintf(buf, PAGE_SIZE, "%d\n", *(int *)(ea->var)); -+} -+EXPORT_SYMBOL_GPL(device_show_int); - - /** - * device_release - free device structure. -@@ -464,7 +514,7 @@ static ssize_t show_dev(struct device *d - static struct device_attribute devt_attr = - __ATTR(dev, S_IRUGO, show_dev, NULL); - --/* kset to create /sys/devices/ */ -+/* /sys/devices/ */ - struct kset *devices_kset; - - /** -@@ -711,6 +761,10 @@ static struct kobject *get_device_parent - return k; - } - -+ /* subsystems can specify a default root directory for their devices */ -+ if (!parent && dev->bus && dev->bus->dev_root) -+ return &dev->bus->dev_root->kobj; -+ - if (parent) - return &parent->kobj; - return NULL; -@@ -731,14 +785,6 @@ static void cleanup_device_parent(struct - cleanup_glue_dir(dev, dev->kobj.parent); - } - --static void setup_parent(struct device *dev, struct device *parent) --{ -- struct kobject *kobj; -- kobj = get_device_parent(dev, parent); -- if (kobj) -- dev->kobj.parent = kobj; --} -- - static int device_add_class_symlinks(struct device *dev) - { - int error; -@@ -891,6 +937,7 @@ int device_private_init(struct device *d - int device_add(struct device *dev) - { - struct device *parent = NULL; -+ struct kobject *kobj; - struct class_interface *class_intf; - int error = -EINVAL; - -@@ -914,6 +961,10 @@ int device_add(struct device *dev) - dev->init_name = NULL; - } - -+ /* subsystems can specify simple device enumeration */ -+ if (!dev_name(dev) && dev->bus && dev->bus->dev_name) -+ dev_set_name(dev, "%s%u", dev->bus->dev_name, dev->id); -+ - if (!dev_name(dev)) { - error = -EINVAL; - goto name_error; -@@ -922,7 +973,9 @@ int device_add(struct device *dev) - pr_debug("device: '%s': %s\n", dev_name(dev), __func__); - - parent = get_device(dev->parent); -- setup_parent(dev, parent); -+ kobj = get_device_parent(dev, parent); -+ if (kobj) -+ dev->kobj.parent = kobj; - - /* use parent numa_node */ - if (parent) -@@ -982,17 +1035,17 @@ int device_add(struct device *dev) - &parent->p->klist_children); - - if (dev->class) { -- mutex_lock(&dev->class->p->class_mutex); -+ mutex_lock(&dev->class->p->mutex); - /* tie the class to the device */ - klist_add_tail(&dev->knode_class, - &dev->class->p->klist_devices); - - /* notify any interfaces that the device is here */ - list_for_each_entry(class_intf, -- &dev->class->p->class_interfaces, node) -+ &dev->class->p->interfaces, node) - if (class_intf->add_dev) - class_intf->add_dev(dev, class_intf); -- mutex_unlock(&dev->class->p->class_mutex); -+ mutex_unlock(&dev->class->p->mutex); - } - done: - put_device(dev); -@@ -1107,15 +1160,15 @@ void device_del(struct device *dev) - if (dev->class) { - device_remove_class_symlinks(dev); - -- mutex_lock(&dev->class->p->class_mutex); -+ mutex_lock(&dev->class->p->mutex); - /* notify any interfaces that the device is now gone */ - list_for_each_entry(class_intf, -- &dev->class->p->class_interfaces, node) -+ &dev->class->p->interfaces, node) - if (class_intf->remove_dev) - class_intf->remove_dev(dev, class_intf); - /* remove the device from the class list */ - klist_del(&dev->knode_class); -- mutex_unlock(&dev->class->p->class_mutex); -+ mutex_unlock(&dev->class->p->mutex); - } - device_remove_file(dev, &uevent_attr); - device_remove_attrs(dev); ---- a/drivers/base/init.c -+++ b/drivers/base/init.c -@@ -31,7 +31,6 @@ void __init driver_init(void) - * core core pieces. - */ - platform_bus_init(); -- system_bus_init(); - cpu_dev_init(); - memory_dev_init(); - } ---- a/drivers/base/sys.c -+++ b/drivers/base/sys.c -@@ -126,7 +126,7 @@ void sysdev_class_remove_file(struct sys - } - EXPORT_SYMBOL_GPL(sysdev_class_remove_file); - --static struct kset *system_kset; -+extern struct kset *system_kset; - - int sysdev_class_register(struct sysdev_class *cls) - { -@@ -331,14 +331,6 @@ void sysdev_unregister(struct sys_device - EXPORT_SYMBOL_GPL(sysdev_register); - EXPORT_SYMBOL_GPL(sysdev_unregister); - --int __init system_bus_init(void) --{ -- system_kset = kset_create_and_add("system", NULL, &devices_kset->kobj); -- if (!system_kset) -- return -ENOMEM; -- return 0; --} -- - #define to_ext_attr(x) container_of(x, struct sysdev_ext_attribute, attr) - - ssize_t sysdev_store_ulong(struct sys_device *sysdev, ---- a/include/linux/device.h -+++ b/include/linux/device.h -@@ -53,6 +53,8 @@ extern void bus_remove_file(struct bus_t - * struct bus_type - The bus type of the device - * - * @name: The name of the bus. -+ * @dev_name: Used for subsystems to enumerate devices like ("foo%u", dev->id). -+ * @dev_root: Default device to use as the parent. - * @bus_attrs: Default attributes of the bus. - * @dev_attrs: Default attributes of the devices on the bus. - * @drv_attrs: Default attributes of the device drivers on the bus. -@@ -86,6 +88,8 @@ extern void bus_remove_file(struct bus_t - */ - struct bus_type { - const char *name; -+ const char *dev_name; -+ struct device *dev_root; - struct bus_attribute *bus_attrs; - struct device_attribute *dev_attrs; - struct driver_attribute *drv_attrs; -@@ -106,12 +110,30 @@ struct bus_type { - struct subsys_private *p; - }; - --extern int __must_check bus_register(struct bus_type *bus); -+/* This is a #define to keep the compiler from merging different -+ * instances of the __key variable */ -+#define bus_register(subsys) \ -+({ \ -+ static struct lock_class_key __key; \ -+ __bus_register(subsys, &__key); \ -+}) -+extern int __must_check __bus_register(struct bus_type *bus, -+ struct lock_class_key *key); - extern void bus_unregister(struct bus_type *bus); - - extern int __must_check bus_rescan_devices(struct bus_type *bus); - - /* iterator helpers for buses */ -+struct subsys_dev_iter { -+ struct klist_iter ki; -+ const struct device_type *type; -+}; -+void subsys_dev_iter_init(struct subsys_dev_iter *iter, -+ struct bus_type *subsys, -+ struct device *start, -+ const struct device_type *type); -+struct device *subsys_dev_iter_next(struct subsys_dev_iter *iter); -+void subsys_dev_iter_exit(struct subsys_dev_iter *iter); - - int bus_for_each_dev(struct bus_type *bus, struct device *start, void *data, - int (*fn)(struct device *dev, void *data)); -@@ -121,10 +143,10 @@ struct device *bus_find_device(struct bu - struct device *bus_find_device_by_name(struct bus_type *bus, - struct device *start, - const char *name); -- -+struct device *subsys_find_device_by_id(struct bus_type *bus, unsigned int id, -+ struct device *hint); - int bus_for_each_drv(struct bus_type *bus, struct device_driver *start, - void *data, int (*fn)(struct device_driver *, void *)); -- - void bus_sort_breadthfirst(struct bus_type *bus, - int (*compare)(const struct device *a, - const struct device *b)); -@@ -256,6 +278,33 @@ struct device *driver_find_device(struct - int (*match)(struct device *dev, void *data)); - - /** -+ * struct subsys_interface - interfaces to device functions -+ * @name name of the device function -+ * @subsystem subsytem of the devices to attach to -+ * @node the list of functions registered at the subsystem -+ * @add device hookup to device function handler -+ * @remove device hookup to device function handler -+ * -+ * Simple interfaces attached to a subsystem. Multiple interfaces can -+ * attach to a subsystem and its devices. Unlike drivers, they do not -+ * exclusively claim or control devices. Interfaces usually represent -+ * a specific functionality of a subsystem/class of devices. -+ */ -+struct subsys_interface { -+ const char *name; -+ struct bus_type *subsys; -+ struct list_head node; -+ int (*add_dev)(struct device *dev, struct subsys_interface *sif); -+ int (*remove_dev)(struct device *dev, struct subsys_interface *sif); -+}; -+ -+int subsys_interface_register(struct subsys_interface *sif); -+void subsys_interface_unregister(struct subsys_interface *sif); -+ -+int subsys_system_register(struct bus_type *subsys, -+ const struct attribute_group **groups); -+ -+/** - * struct class - device classes - * @name: Name of the class. - * @owner: The module owner. -@@ -438,8 +487,28 @@ struct device_attribute { - const char *buf, size_t count); - }; - -+struct dev_ext_attribute { -+ struct device_attribute attr; -+ void *var; -+}; -+ -+ssize_t device_show_ulong(struct device *dev, struct device_attribute *attr, -+ char *buf); -+ssize_t device_store_ulong(struct device *dev, struct device_attribute *attr, -+ const char *buf, size_t count); -+ssize_t device_show_int(struct device *dev, struct device_attribute *attr, -+ char *buf); -+ssize_t device_store_int(struct device *dev, struct device_attribute *attr, -+ const char *buf, size_t count); -+ - #define DEVICE_ATTR(_name, _mode, _show, _store) \ --struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store) -+ struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store) -+#define DEVICE_ULONG_ATTR(_name, _mode, _var) \ -+ struct dev_ext_attribute dev_attr_##_name = \ -+ { __ATTR(_name, _mode, device_show_ulong, device_store_ulong), &(_var) } -+#define DEVICE_INT_ATTR(_name, _mode, _var) \ -+ struct dev_ext_attribute dev_attr_##_name = \ -+ { __ATTR(_name, _mode, device_show_ulong, device_store_ulong), &(_var) } - - extern int __must_check device_create_file(struct device *device, - const struct device_attribute *entry); -@@ -600,6 +669,7 @@ struct device { - struct device_node *of_node; /* associated device tree node */ - - dev_t devt; /* dev_t, creates the sysfs "dev" */ -+ u32 id; /* device instance */ - - spinlock_t devres_lock; - struct list_head devres_head; diff --git a/04-rtmutex.patch b/04-rtmutex.patch deleted file mode 100644 index 73a21dd..0000000 --- a/04-rtmutex.patch +++ /dev/null @@ -1,134 +0,0 @@ -From: Kay Sievers <kay.sievers@vrfy.org> -Subject: rtmutex-tester: convert sysdev_class to a regular subsystem - -After all sysdev classes are ported to regular driver core entities, the -sysdev implementation will be entirely removed from the kernel. - -Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> ---- - kernel/rtmutex-tester.c | 37 +++++++++++++++++++------------------ - 1 file changed, 19 insertions(+), 18 deletions(-) - ---- a/kernel/rtmutex-tester.c -+++ b/kernel/rtmutex-tester.c -@@ -6,11 +6,11 @@ - * Copyright (C) 2006, Timesys Corp., Thomas Gleixner <tglx@timesys.com> - * - */ -+#include <linux/device.h> - #include <linux/kthread.h> - #include <linux/export.h> - #include <linux/sched.h> - #include <linux/spinlock.h> --#include <linux/sysdev.h> - #include <linux/timer.h> - #include <linux/freezer.h> - -@@ -27,7 +27,7 @@ struct test_thread_data { - int opdata; - int mutexes[MAX_RT_TEST_MUTEXES]; - int event; -- struct sys_device sysdev; -+ struct device dev; - }; - - static struct test_thread_data thread_data[MAX_RT_TEST_THREADS]; -@@ -271,7 +271,7 @@ static int test_func(void *data) - * - * opcode:data - */ --static ssize_t sysfs_test_command(struct sys_device *dev, struct sysdev_attribute *attr, -+static ssize_t sysfs_test_command(struct device *dev, struct device_attribute *attr, - const char *buf, size_t count) - { - struct sched_param schedpar; -@@ -279,8 +279,8 @@ static ssize_t sysfs_test_command(struct - char cmdbuf[32]; - int op, dat, tid, ret; - -- td = container_of(dev, struct test_thread_data, sysdev); -- tid = td->sysdev.id; -+ td = container_of(dev, struct test_thread_data, dev); -+ tid = td->dev.id; - - /* strings from sysfs write are not 0 terminated! */ - if (count >= sizeof(cmdbuf)) -@@ -334,7 +334,7 @@ static ssize_t sysfs_test_command(struct - * @dev: thread to query - * @buf: char buffer to be filled with thread status info - */ --static ssize_t sysfs_test_status(struct sys_device *dev, struct sysdev_attribute *attr, -+static ssize_t sysfs_test_status(struct device *dev, struct device_attribute *attr, - char *buf) - { - struct test_thread_data *td; -@@ -342,8 +342,8 @@ static ssize_t sysfs_test_status(struct - char *curr = buf; - int i; - -- td = container_of(dev, struct test_thread_data, sysdev); -- tsk = threads[td->sysdev.id]; -+ td = container_of(dev, struct test_thread_data, dev); -+ tsk = threads[td->dev.id]; - - spin_lock(&rttest_lock); - -@@ -360,28 +360,29 @@ static ssize_t sysfs_test_status(struct - spin_unlock(&rttest_lock); - - curr += sprintf(curr, ", T: %p, R: %p\n", tsk, -- mutexes[td->sysdev.id].owner); -+ mutexes[td->dev.id].owner); - - return curr - buf; - } - --static SYSDEV_ATTR(status, 0600, sysfs_test_status, NULL); --static SYSDEV_ATTR(command, 0600, NULL, sysfs_test_command); -+static DEVICE_ATTR(status, 0600, sysfs_test_status, NULL); -+static DEVICE_ATTR(command, 0600, NULL, sysfs_test_command); - --static struct sysdev_class rttest_sysclass = { -+static struct bus_type rttest_subsys = { - .name = "rttest", -+ .dev_name = "rttest", - }; - - static int init_test_thread(int id) - { -- thread_data[id].sysdev.cls = &rttest_sysclass; -- thread_data[id].sysdev.id = id; -+ thread_data[id].dev.bus = &rttest_subsys; -+ thread_data[id].dev.id = id; - - threads[id] = kthread_run(test_func, &thread_data[id], "rt-test-%d", id); - if (IS_ERR(threads[id])) - return PTR_ERR(threads[id]); - -- return sysdev_register(&thread_data[id].sysdev); -+ return device_register(&thread_data[id].dev); - } - - static int init_rttest(void) -@@ -393,7 +394,7 @@ static int init_rttest(void) - for (i = 0; i < MAX_RT_TEST_MUTEXES; i++) - rt_mutex_init(&mutexes[i]); - -- ret = sysdev_class_register(&rttest_sysclass); -+ ret = subsys_system_register(&rttest_subsys, NULL); - if (ret) - return ret; - -@@ -401,10 +402,10 @@ static int init_rttest(void) - ret = init_test_thread(i); - if (ret) - break; -- ret = sysdev_create_file(&thread_data[i].sysdev, &attr_status); -+ ret = device_create_file(&thread_data[i].dev, &dev_attr_status); - if (ret) - break; -- ret = sysdev_create_file(&thread_data[i].sysdev, &attr_command); -+ ret = device_create_file(&thread_data[i].dev, &dev_attr_command); - if (ret) - break; - } diff --git a/05-clocksource.patch b/05-clocksource.patch deleted file mode 100644 index 2ef5414..0000000 --- a/05-clocksource.patch +++ /dev/null @@ -1,104 +0,0 @@ -From: Kay Sievers <kay.sievers@vrfy.org> -Subject: clocksource: convert sysdev_class to a regular subsystem - -After all sysdev classes are ported to regular driver core entities, the -sysdev implementation will be entirely removed from the kernel. - -Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> ---- - kernel/time/clocksource.c | 37 +++++++++++++++++++------------------ - 1 file changed, 19 insertions(+), 18 deletions(-) - ---- a/kernel/time/clocksource.c -+++ b/kernel/time/clocksource.c -@@ -23,8 +23,8 @@ - * o Allow clocksource drivers to be unregistered - */ - -+#include <linux/device.h> - #include <linux/clocksource.h> --#include <linux/sysdev.h> - #include <linux/init.h> - #include <linux/module.h> - #include <linux/sched.h> /* for spin_unlock_irq() using preempt_count() m68k */ -@@ -796,8 +796,8 @@ EXPORT_SYMBOL(clocksource_unregister); - * Provides sysfs interface for listing current clocksource. - */ - static ssize_t --sysfs_show_current_clocksources(struct sys_device *dev, -- struct sysdev_attribute *attr, char *buf) -+sysfs_show_current_clocksources(struct device *dev, -+ struct device_attribute *attr, char *buf) - { - ssize_t count = 0; - -@@ -818,8 +818,8 @@ sysfs_show_current_clocksources(struct s - * Takes input from sysfs interface for manually overriding the default - * clocksource selection. - */ --static ssize_t sysfs_override_clocksource(struct sys_device *dev, -- struct sysdev_attribute *attr, -+static ssize_t sysfs_override_clocksource(struct device *dev, -+ struct device_attribute *attr, - const char *buf, size_t count) - { - size_t ret = count; -@@ -853,8 +853,8 @@ static ssize_t sysfs_override_clocksourc - * Provides sysfs interface for listing registered clocksources - */ - static ssize_t --sysfs_show_available_clocksources(struct sys_device *dev, -- struct sysdev_attribute *attr, -+sysfs_show_available_clocksources(struct device *dev, -+ struct device_attribute *attr, - char *buf) - { - struct clocksource *src; -@@ -883,35 +883,36 @@ sysfs_show_available_clocksources(struct - /* - * Sysfs setup bits: - */ --static SYSDEV_ATTR(current_clocksource, 0644, sysfs_show_current_clocksources, -+static DEVICE_ATTR(current_clocksource, 0644, sysfs_show_current_clocksources, - sysfs_override_clocksource); - --static SYSDEV_ATTR(available_clocksource, 0444, -+static DEVICE_ATTR(available_clocksource, 0444, - sysfs_show_available_clocksources, NULL); - --static struct sysdev_class clocksource_sysclass = { -+static struct bus_type clocksource_subsys = { - .name = "clocksource", -+ .dev_name = "clocksource", - }; - --static struct sys_device device_clocksource = { -+static struct device device_clocksource = { - .id = 0, -- .cls = &clocksource_sysclass, -+ .bus = &clocksource_subsys, - }; - - static int __init init_clocksource_sysfs(void) - { -- int error = sysdev_class_register(&clocksource_sysclass); -+ int error = subsys_system_register(&clocksource_subsys, NULL); - - if (!error) -- error = sysdev_register(&device_clocksource); -+ error = device_register(&device_clocksource); - if (!error) -- error = sysdev_create_file( -+ error = device_create_file( - &device_clocksource, -- &attr_current_clocksource); -+ &dev_attr_current_clocksource); - if (!error) -- error = sysdev_create_file( -+ error = device_create_file( - &device_clocksource, -- &attr_available_clocksource); -+ &dev_attr_available_clocksource); - return error; - } - diff --git a/06-ibm-rtl.patch b/06-ibm-rtl.patch deleted file mode 100644 index 2583768..0000000 --- a/06-ibm-rtl.patch +++ /dev/null @@ -1,98 +0,0 @@ -From: Kay Sievers <kay.sievers@vrfy.org> -Subject: ibm_rtl: convert sysdev_class to a regular subsystem - -After all sysdev classes are ported to regular driver core entities, the -sysdev implementation will be entirely removed from the kernel. - -Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> ---- - drivers/platform/x86/ibm_rtl.c | 34 +++++++++++++++++----------------- - 1 file changed, 17 insertions(+), 17 deletions(-) - ---- a/drivers/platform/x86/ibm_rtl.c -+++ b/drivers/platform/x86/ibm_rtl.c -@@ -28,7 +28,6 @@ - #include <linux/delay.h> - #include <linux/module.h> - #include <linux/io.h> --#include <linux/sysdev.h> - #include <linux/dmi.h> - #include <linux/efi.h> - #include <linux/mutex.h> -@@ -165,22 +164,22 @@ static int ibm_rtl_write(u8 value) - return ret; - } - --static ssize_t rtl_show_version(struct sysdev_class * dev, -- struct sysdev_class_attribute *attr, -+static ssize_t rtl_show_version(struct device * dev, -+ struct device_attribute *attr, - char *buf) - { - return sprintf(buf, "%d\n", (int)ioread8(&rtl_table->version)); - } - --static ssize_t rtl_show_state(struct sysdev_class *dev, -- struct sysdev_class_attribute *attr, -+static ssize_t rtl_show_state(struct device *dev, -+ struct device_attribute *attr, - char *buf) - { - return sprintf(buf, "%d\n", ioread8(&rtl_table->rt_status)); - } - --static ssize_t rtl_set_state(struct sysdev_class *dev, -- struct sysdev_class_attribute *attr, -+static ssize_t rtl_set_state(struct device *dev, -+ struct device_attribute *attr, - const char *buf, - size_t count) - { -@@ -205,27 +204,28 @@ static ssize_t rtl_set_state(struct sysd - return ret; - } - --static struct sysdev_class class_rtl = { -+static struct bus_type rtl_subsys = { - .name = "ibm_rtl", -+ .dev_name = "ibm_rtl", - }; - --static SYSDEV_CLASS_ATTR(version, S_IRUGO, rtl_show_version, NULL); --static SYSDEV_CLASS_ATTR(state, 0600, rtl_show_state, rtl_set_state); -+static DEVICE_ATTR(version, S_IRUGO, rtl_show_version, NULL); -+static DEVICE_ATTR(state, 0600, rtl_show_state, rtl_set_state); - --static struct sysdev_class_attribute *rtl_attributes[] = { -- &attr_version, -- &attr_state, -+static struct device_attribute *rtl_attributes[] = { -+ &dev_attr_version, -+ &dev_attr_state, - NULL - }; - - - static int rtl_setup_sysfs(void) { - int ret, i; -- ret = sysdev_class_register(&class_rtl); - -+ ret = subsys_system_register(&rtl_subsys, NULL); - if (!ret) { - for (i = 0; rtl_attributes[i]; i ++) -- sysdev_class_create_file(&class_rtl, rtl_attributes[i]); -+ device_create_file(rtl_subsys.dev_root, rtl_attributes[i]); - } - return ret; - } -@@ -233,8 +233,8 @@ static int rtl_setup_sysfs(void) { - static void rtl_teardown_sysfs(void) { - int i; - for (i = 0; rtl_attributes[i]; i ++) -- sysdev_class_remove_file(&class_rtl, rtl_attributes[i]); -- sysdev_class_unregister(&class_rtl); -+ device_remove_file(rtl_subsys.dev_root, rtl_attributes[i]); -+ bus_unregister(&rtl_subsys); - } - - diff --git a/07-edac.patch b/07-edac.patch deleted file mode 100644 index 9a42764..0000000 --- a/07-edac.patch +++ /dev/null @@ -1,393 +0,0 @@ -From: Kay Sievers <kay.sievers@vrfy.org> -Subject: edac: convert sysdev_class to a regular subsystem - -After all sysdev classes are ported to regular driver core entities, the -sysdev implementation will be entirely removed from the kernel. - -Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> ---- - drivers/edac/edac_core.h | 7 +++---- - drivers/edac/edac_device.c | 1 - - drivers/edac/edac_device_sysfs.c | 20 ++++++++++---------- - drivers/edac/edac_mc.c | 1 - - drivers/edac/edac_mc_sysfs.c | 16 ++++++++-------- - drivers/edac/edac_module.h | 2 -- - drivers/edac/edac_pci.c | 1 - - drivers/edac/edac_pci_sysfs.c | 16 ++++++++-------- - drivers/edac/edac_stub.c | 27 ++++++++++++++------------- - drivers/edac/mce_amd_inj.c | 13 ++++++------- - include/linux/edac.h | 8 ++++---- - 11 files changed, 53 insertions(+), 59 deletions(-) - ---- a/drivers/edac/edac_core.h -+++ b/drivers/edac/edac_core.h -@@ -32,7 +32,6 @@ - #include <linux/completion.h> - #include <linux/kobject.h> - #include <linux/platform_device.h> --#include <linux/sysdev.h> - #include <linux/workqueue.h> - #include <linux/edac.h> - -@@ -243,8 +242,8 @@ struct edac_device_ctl_info { - */ - struct edac_dev_sysfs_attribute *sysfs_attributes; - -- /* pointer to main 'edac' class in sysfs */ -- struct sysdev_class *edac_class; -+ /* pointer to main 'edac' subsys in sysfs */ -+ struct bus_type *edac_subsys; - - /* the internal state of this controller instance */ - int op_state; -@@ -342,7 +341,7 @@ struct edac_pci_ctl_info { - - int pci_idx; - -- struct sysdev_class *edac_class; /* pointer to class */ -+ struct bus_type *edac_subsys; /* pointer to subsystem */ - - /* the internal state of this controller instance */ - int op_state; ---- a/drivers/edac/edac_device.c -+++ b/drivers/edac/edac_device.c -@@ -23,7 +23,6 @@ - #include <linux/jiffies.h> - #include <linux/spinlock.h> - #include <linux/list.h> --#include <linux/sysdev.h> - #include <linux/ctype.h> - #include <linux/workqueue.h> - #include <asm/uaccess.h> ---- a/drivers/edac/edac_device_sysfs.c -+++ b/drivers/edac/edac_device_sysfs.c -@@ -1,5 +1,5 @@ - /* -- * file for managing the edac_device class of devices for EDAC -+ * file for managing the edac_device subsystem of devices for EDAC - * - * (C) 2007 SoftwareBitMaker - * -@@ -230,21 +230,21 @@ static struct kobj_type ktype_device_ctr - */ - int edac_device_register_sysfs_main_kobj(struct edac_device_ctl_info *edac_dev) - { -- struct sysdev_class *edac_class; -+ struct bus_type *edac_subsys; - int err; - - debugf1("%s()\n", __func__); - - /* get the /sys/devices/system/edac reference */ -- edac_class = edac_get_sysfs_class(); -- if (edac_class == NULL) { -- debugf1("%s() no edac_class error\n", __func__); -+ edac_subsys = edac_get_sysfs_subsys(); -+ if (edac_subsys == NULL) { -+ debugf1("%s() no edac_subsys error\n", __func__); - err = -ENODEV; - goto err_out; - } - -- /* Point to the 'edac_class' this instance 'reports' to */ -- edac_dev->edac_class = edac_class; -+ /* Point to the 'edac_subsys' this instance 'reports' to */ -+ edac_dev->edac_subsys = edac_subsys; - - /* Init the devices's kobject */ - memset(&edac_dev->kobj, 0, sizeof(struct kobject)); -@@ -261,7 +261,7 @@ int edac_device_register_sysfs_main_kobj - - /* register */ - err = kobject_init_and_add(&edac_dev->kobj, &ktype_device_ctrl, -- &edac_class->kset.kobj, -+ &edac_subsys->dev_root->kobj, - "%s", edac_dev->name); - if (err) { - debugf1("%s()Failed to register '.../edac/%s'\n", -@@ -284,7 +284,7 @@ err_kobj_reg: - module_put(edac_dev->owner); - - err_mod_get: -- edac_put_sysfs_class(); -+ edac_put_sysfs_subsys(); - - err_out: - return err; -@@ -308,7 +308,7 @@ void edac_device_unregister_sysfs_main_k - * b) 'kfree' the memory - */ - kobject_put(&dev->kobj); -- edac_put_sysfs_class(); -+ edac_put_sysfs_subsys(); - } - - /* edac_dev -> instance information */ ---- a/drivers/edac/edac_mc.c -+++ b/drivers/edac/edac_mc.c -@@ -25,7 +25,6 @@ - #include <linux/jiffies.h> - #include <linux/spinlock.h> - #include <linux/list.h> --#include <linux/sysdev.h> - #include <linux/ctype.h> - #include <linux/edac.h> - #include <asm/uaccess.h> ---- a/drivers/edac/edac_mc_sysfs.c -+++ b/drivers/edac/edac_mc_sysfs.c -@@ -1021,19 +1021,19 @@ void edac_remove_sysfs_mci_device(struct - int edac_sysfs_setup_mc_kset(void) - { - int err = -EINVAL; -- struct sysdev_class *edac_class; -+ struct bus_type *edac_subsys; - - debugf1("%s()\n", __func__); - -- /* get the /sys/devices/system/edac class reference */ -- edac_class = edac_get_sysfs_class(); -- if (edac_class == NULL) { -- debugf1("%s() no edac_class error=%d\n", __func__, err); -+ /* get the /sys/devices/system/edac subsys reference */ -+ edac_subsys = edac_get_sysfs_subsys(); -+ if (edac_subsys == NULL) { -+ debugf1("%s() no edac_subsys error=%d\n", __func__, err); - goto fail_out; - } - - /* Init the MC's kobject */ -- mc_kset = kset_create_and_add("mc", NULL, &edac_class->kset.kobj); -+ mc_kset = kset_create_and_add("mc", NULL, &edac_subsys->dev_root->kobj); - if (!mc_kset) { - err = -ENOMEM; - debugf1("%s() Failed to register '.../edac/mc'\n", __func__); -@@ -1045,7 +1045,7 @@ int edac_sysfs_setup_mc_kset(void) - return 0; - - fail_kset: -- edac_put_sysfs_class(); -+ edac_put_sysfs_subsys(); - - fail_out: - return err; -@@ -1059,6 +1059,6 @@ fail_out: - void edac_sysfs_teardown_mc_kset(void) - { - kset_unregister(mc_kset); -- edac_put_sysfs_class(); -+ edac_put_sysfs_subsys(); - } - ---- a/drivers/edac/edac_module.h -+++ b/drivers/edac/edac_module.h -@@ -10,8 +10,6 @@ - #ifndef __EDAC_MODULE_H__ - #define __EDAC_MODULE_H__ - --#include <linux/sysdev.h> -- - #include "edac_core.h" - - /* ---- a/drivers/edac/edac_pci.c -+++ b/drivers/edac/edac_pci.c -@@ -19,7 +19,6 @@ - #include <linux/slab.h> - #include <linux/spinlock.h> - #include <linux/list.h> --#include <linux/sysdev.h> - #include <linux/ctype.h> - #include <linux/workqueue.h> - #include <asm/uaccess.h> ---- a/drivers/edac/edac_pci_sysfs.c -+++ b/drivers/edac/edac_pci_sysfs.c -@@ -338,12 +338,12 @@ static struct kobj_type ktype_edac_pci_m - * edac_pci_main_kobj_setup() - * - * setup the sysfs for EDAC PCI attributes -- * assumes edac_class has already been initialized -+ * assumes edac_subsys has already been initialized - */ - static int edac_pci_main_kobj_setup(void) - { - int err; -- struct sysdev_class *edac_class; -+ struct bus_type *edac_subsys; - - debugf0("%s()\n", __func__); - -@@ -354,9 +354,9 @@ static int edac_pci_main_kobj_setup(void - /* First time, so create the main kobject and its - * controls and attributes - */ -- edac_class = edac_get_sysfs_class(); -- if (edac_class == NULL) { -- debugf1("%s() no edac_class\n", __func__); -+ edac_subsys = edac_get_sysfs_subsys(); -+ if (edac_subsys == NULL) { -+ debugf1("%s() no edac_subsys\n", __func__); - err = -ENODEV; - goto decrement_count_fail; - } -@@ -381,7 +381,7 @@ static int edac_pci_main_kobj_setup(void - /* Instanstiate the pci object */ - err = kobject_init_and_add(edac_pci_top_main_kobj, - &ktype_edac_pci_main_kobj, -- &edac_class->kset.kobj, "pci"); -+ &edac_subsys->dev_root->kobj, "pci"); - if (err) { - debugf1("Failed to register '.../edac/pci'\n"); - goto kobject_init_and_add_fail; -@@ -404,7 +404,7 @@ kzalloc_fail: - module_put(THIS_MODULE); - - mod_get_fail: -- edac_put_sysfs_class(); -+ edac_put_sysfs_subsys(); - - decrement_count_fail: - /* if are on this error exit, nothing to tear down */ -@@ -432,7 +432,7 @@ static void edac_pci_main_kobj_teardown( - __func__); - kobject_put(edac_pci_top_main_kobj); - } -- edac_put_sysfs_class(); -+ edac_put_sysfs_subsys(); - } - - /* ---- a/drivers/edac/edac_stub.c -+++ b/drivers/edac/edac_stub.c -@@ -26,7 +26,7 @@ EXPORT_SYMBOL_GPL(edac_handlers); - int edac_err_assert = 0; - EXPORT_SYMBOL_GPL(edac_err_assert); - --static atomic_t edac_class_valid = ATOMIC_INIT(0); -+static atomic_t edac_subsys_valid = ATOMIC_INIT(0); - - /* - * called to determine if there is an EDAC driver interested in -@@ -54,36 +54,37 @@ EXPORT_SYMBOL_GPL(edac_atomic_assert_err - * sysfs object: /sys/devices/system/edac - * need to export to other files - */ --struct sysdev_class edac_class = { -+struct bus_type edac_subsys = { - .name = "edac", -+ .dev_name = "edac", - }; --EXPORT_SYMBOL_GPL(edac_class); -+EXPORT_SYMBOL_GPL(edac_subsys); - - /* return pointer to the 'edac' node in sysfs */ --struct sysdev_class *edac_get_sysfs_class(void) -+struct bus_type *edac_get_sysfs_subsys(void) - { - int err = 0; - -- if (atomic_read(&edac_class_valid)) -+ if (atomic_read(&edac_subsys_valid)) - goto out; - - /* create the /sys/devices/system/edac directory */ -- err = sysdev_class_register(&edac_class); -+ err = subsys_system_register(&edac_subsys, NULL); - if (err) { - printk(KERN_ERR "Error registering toplevel EDAC sysfs dir\n"); - return NULL; - } - - out: -- atomic_inc(&edac_class_valid); -- return &edac_class; -+ atomic_inc(&edac_subsys_valid); -+ return &edac_subsys; - } --EXPORT_SYMBOL_GPL(edac_get_sysfs_class); -+EXPORT_SYMBOL_GPL(edac_get_sysfs_subsys); - --void edac_put_sysfs_class(void) -+void edac_put_sysfs_subsys(void) - { - /* last user unregisters it */ -- if (atomic_dec_and_test(&edac_class_valid)) -- sysdev_class_unregister(&edac_class); -+ if (atomic_dec_and_test(&edac_subsys_valid)) -+ bus_unregister(&edac_subsys); - } --EXPORT_SYMBOL_GPL(edac_put_sysfs_class); -+EXPORT_SYMBOL_GPL(edac_put_sysfs_subsys); ---- a/drivers/edac/mce_amd_inj.c -+++ b/drivers/edac/mce_amd_inj.c -@@ -11,7 +11,6 @@ - */ - - #include <linux/kobject.h> --#include <linux/sysdev.h> - #include <linux/edac.h> - #include <linux/module.h> - #include <asm/mce.h> -@@ -116,14 +115,14 @@ static struct edac_mce_attr *sysfs_attrs - - static int __init edac_init_mce_inject(void) - { -- struct sysdev_class *edac_class = NULL; -+ struct bus_type *edac_subsys = NULL; - int i, err = 0; - -- edac_class = edac_get_sysfs_class(); -- if (!edac_class) -+ edac_subsys = edac_get_sysfs_subsys(); -+ if (!edac_subsys) - return -EINVAL; - -- mce_kobj = kobject_create_and_add("mce", &edac_class->kset.kobj); -+ mce_kobj = kobject_create_and_add("mce", &edac_subsys->dev_root->kobj); - if (!mce_kobj) { - printk(KERN_ERR "Error creating a mce kset.\n"); - err = -ENOMEM; -@@ -147,7 +146,7 @@ err_sysfs_create: - kobject_del(mce_kobj); - - err_mce_kobj: -- edac_put_sysfs_class(); -+ edac_put_sysfs_subsys(); - - return err; - } -@@ -161,7 +160,7 @@ static void __exit edac_exit_mce_inject( - - kobject_del(mce_kobj); - -- edac_put_sysfs_class(); -+ edac_put_sysfs_subsys(); - } - - module_init(edac_init_mce_inject); ---- a/include/linux/edac.h -+++ b/include/linux/edac.h -@@ -13,7 +13,7 @@ - #define _LINUX_EDAC_H_ - - #include <linux/atomic.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - - #define EDAC_OPSTATE_INVAL -1 - #define EDAC_OPSTATE_POLL 0 -@@ -23,12 +23,12 @@ - extern int edac_op_state; - extern int edac_err_assert; - extern atomic_t edac_handlers; --extern struct sysdev_class edac_class; -+extern struct bus_type edac_subsys; - - extern int edac_handler_set(void); - extern void edac_atomic_assert_error(void); --extern struct sysdev_class *edac_get_sysfs_class(void); --extern void edac_put_sysfs_class(void); -+extern struct bus_type *edac_get_sysfs_subsys(void); -+extern void edac_put_sysfs_subsys(void); - - static inline void opstate_init(void) - { diff --git a/08-xen.patch b/08-xen.patch deleted file mode 100644 index 56def8d..0000000 --- a/08-xen.patch +++ /dev/null @@ -1,425 +0,0 @@ -From: Kay Sievers <kay.sievers@vrfy.org> -Subject: xen-balloon: convert sysdev_class to a regular subsystem - -After all sysdev classes are ported to regular driver core entities, the -sysdev implementation will be entirely removed from the kernel. - -Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> ---- - drivers/xen/xen-balloon.c | 86 +++++++++++++++++++++--------------------- - drivers/xen/xen-selfballoon.c | 76 ++++++++++++++++++------------------- - include/xen/balloon.h | 6 +- - 3 files changed, 84 insertions(+), 84 deletions(-) - ---- a/drivers/xen/xen-balloon.c -+++ b/drivers/xen/xen-balloon.c -@@ -32,7 +32,6 @@ - - #include <linux/kernel.h> - #include <linux/module.h> --#include <linux/sysdev.h> - #include <linux/capability.h> - - #include <xen/xen.h> -@@ -46,9 +45,9 @@ - - #define BALLOON_CLASS_NAME "xen_memory" - --static struct sys_device balloon_sysdev; -+static struct device balloon_dev; - --static int register_balloon(struct sys_device *sysdev); -+static int register_balloon(struct device *dev); - - /* React to a change in the target key */ - static void watch_target(struct xenbus_watch *watch, -@@ -98,9 +97,9 @@ static int __init balloon_init(void) - - pr_info("xen-balloon: Initialising balloon driver.\n"); - -- register_balloon(&balloon_sysdev); -+ register_balloon(&balloon_dev); - -- register_xen_selfballooning(&balloon_sysdev); -+ register_xen_selfballooning(&balloon_dev); - - register_xenstore_notifier(&xenstore_notifier); - -@@ -117,31 +116,31 @@ static void balloon_exit(void) - module_exit(balloon_exit); - - #define BALLOON_SHOW(name, format, args...) \ -- static ssize_t show_##name(struct sys_device *dev, \ -- struct sysdev_attribute *attr, \ -+ static ssize_t show_##name(struct device *dev, \ -+ struct device_attribute *attr, \ - char *buf) \ - { \ - return sprintf(buf, format, ##args); \ - } \ -- static SYSDEV_ATTR(name, S_IRUGO, show_##name, NULL) -+ static DEVICE_ATTR(name, S_IRUGO, show_##name, NULL) - - BALLOON_SHOW(current_kb, "%lu\n", PAGES2KB(balloon_stats.current_pages)); - BALLOON_SHOW(low_kb, "%lu\n", PAGES2KB(balloon_stats.balloon_low)); - BALLOON_SHOW(high_kb, "%lu\n", PAGES2KB(balloon_stats.balloon_high)); - --static SYSDEV_ULONG_ATTR(schedule_delay, 0444, balloon_stats.schedule_delay); --static SYSDEV_ULONG_ATTR(max_schedule_delay, 0644, balloon_stats.max_schedule_delay); --static SYSDEV_ULONG_ATTR(retry_count, 0444, balloon_stats.retry_count); --static SYSDEV_ULONG_ATTR(max_retry_count, 0644, balloon_stats.max_retry_count); -+static DEVICE_ULONG_ATTR(schedule_delay, 0444, balloon_stats.schedule_delay); -+static DEVICE_ULONG_ATTR(max_schedule_delay, 0644, balloon_stats.max_schedule_delay); -+static DEVICE_ULONG_ATTR(retry_count, 0444, balloon_stats.retry_count); -+static DEVICE_ULONG_ATTR(max_retry_count, 0644, balloon_stats.max_retry_count); - --static ssize_t show_target_kb(struct sys_device *dev, struct sysdev_attribute *attr, -+static ssize_t show_target_kb(struct device *dev, struct device_attribute *attr, - char *buf) - { - return sprintf(buf, "%lu\n", PAGES2KB(balloon_stats.target_pages)); - } - --static ssize_t store_target_kb(struct sys_device *dev, -- struct sysdev_attribute *attr, -+static ssize_t store_target_kb(struct device *dev, -+ struct device_attribute *attr, - const char *buf, - size_t count) - { -@@ -158,11 +157,11 @@ static ssize_t store_target_kb(struct sy - return count; - } - --static SYSDEV_ATTR(target_kb, S_IRUGO | S_IWUSR, -+static DEVICE_ATTR(target_kb, S_IRUGO | S_IWUSR, - show_target_kb, store_target_kb); - - --static ssize_t show_target(struct sys_device *dev, struct sysdev_attribute *attr, -+static ssize_t show_target(struct device *dev, struct device_attribute *attr, - char *buf) - { - return sprintf(buf, "%llu\n", -@@ -170,8 +169,8 @@ static ssize_t show_target(struct sys_de - << PAGE_SHIFT); - } - --static ssize_t store_target(struct sys_device *dev, -- struct sysdev_attribute *attr, -+static ssize_t store_target(struct device *dev, -+ struct device_attribute *attr, - const char *buf, - size_t count) - { -@@ -188,23 +187,23 @@ static ssize_t store_target(struct sys_d - return count; - } - --static SYSDEV_ATTR(target, S_IRUGO | S_IWUSR, -+static DEVICE_ATTR(target, S_IRUGO | S_IWUSR, - show_target, store_target); - - --static struct sysdev_attribute *balloon_attrs[] = { -- &attr_target_kb, -- &attr_target, -- &attr_schedule_delay.attr, -- &attr_max_schedule_delay.attr, -- &attr_retry_count.attr, -- &attr_max_retry_count.attr -+static struct device_attribute *balloon_attrs[] = { -+ &dev_attr_target_kb, -+ &dev_attr_target, -+ &dev_attr_schedule_delay.attr, -+ &dev_attr_max_schedule_delay.attr, -+ &dev_attr_retry_count.attr, -+ &dev_attr_max_retry_count.attr - }; - - static struct attribute *balloon_info_attrs[] = { -- &attr_current_kb.attr, -- &attr_low_kb.attr, -- &attr_high_kb.attr, -+ &dev_attr_current_kb.attr, -+ &dev_attr_low_kb.attr, -+ &dev_attr_high_kb.attr, - NULL - }; - -@@ -213,34 +212,35 @@ static struct attribute_group balloon_in - .attrs = balloon_info_attrs - }; - --static struct sysdev_class balloon_sysdev_class = { -- .name = BALLOON_CLASS_NAME -+static struct bus_type balloon_subsys = { -+ .name = BALLOON_CLASS_NAME, -+ .dev_name = BALLOON_CLASS_NAME, - }; - --static int register_balloon(struct sys_device *sysdev) -+static int register_balloon(struct device *dev) - { - int i, error; - -- error = sysdev_class_register(&balloon_sysdev_class); -+ error = bus_register(&balloon_subsys); - if (error) - return error; - -- sysdev->id = 0; -- sysdev->cls = &balloon_sysdev_class; -+ dev->id = 0; -+ dev->bus = &balloon_subsys; - -- error = sysdev_register(sysdev); -+ error = device_register(dev); - if (error) { -- sysdev_class_unregister(&balloon_sysdev_class); -+ bus_unregister(&balloon_subsys); - return error; - } - - for (i = 0; i < ARRAY_SIZE(balloon_attrs); i++) { -- error = sysdev_create_file(sysdev, balloon_attrs[i]); -+ error = device_create_file(dev, balloon_attrs[i]); - if (error) - goto fail; - } - -- error = sysfs_create_group(&sysdev->kobj, &balloon_info_group); -+ error = sysfs_create_group(&dev->kobj, &balloon_info_group); - if (error) - goto fail; - -@@ -248,9 +248,9 @@ static int register_balloon(struct sys_d - - fail: - while (--i >= 0) -- sysdev_remove_file(sysdev, balloon_attrs[i]); -- sysdev_unregister(sysdev); -- sysdev_class_unregister(&balloon_sysdev_class); -+ device_remove_file(dev, balloon_attrs[i]); -+ device_unregister(dev); -+ bus_unregister(&balloon_subsys); - return error; - } - ---- a/drivers/xen/xen-selfballoon.c -+++ b/drivers/xen/xen-selfballoon.c -@@ -266,21 +266,21 @@ static void selfballoon_process(struct w - - #ifdef CONFIG_SYSFS - --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/capability.h> - - #define SELFBALLOON_SHOW(name, format, args...) \ -- static ssize_t show_##name(struct sys_device *dev, \ -- struct sysdev_attribute *attr, \ -- char *buf) \ -+ static ssize_t show_##name(struct device *dev, \ -+ struct device_attribute *attr, \ -+ char *buf) \ - { \ - return sprintf(buf, format, ##args); \ - } - - SELFBALLOON_SHOW(selfballooning, "%d\n", xen_selfballooning_enabled); - --static ssize_t store_selfballooning(struct sys_device *dev, -- struct sysdev_attribute *attr, -+static ssize_t store_selfballooning(struct device *dev, -+ struct device_attribute *attr, - const char *buf, - size_t count) - { -@@ -303,13 +303,13 @@ static ssize_t store_selfballooning(stru - return count; - } - --static SYSDEV_ATTR(selfballooning, S_IRUGO | S_IWUSR, -+static DEVICE_ATTR(selfballooning, S_IRUGO | S_IWUSR, - show_selfballooning, store_selfballooning); - - SELFBALLOON_SHOW(selfballoon_interval, "%d\n", selfballoon_interval); - --static ssize_t store_selfballoon_interval(struct sys_device *dev, -- struct sysdev_attribute *attr, -+static ssize_t store_selfballoon_interval(struct device *dev, -+ struct device_attribute *attr, - const char *buf, - size_t count) - { -@@ -325,13 +325,13 @@ static ssize_t store_selfballoon_interva - return count; - } - --static SYSDEV_ATTR(selfballoon_interval, S_IRUGO | S_IWUSR, -+static DEVICE_ATTR(selfballoon_interval, S_IRUGO | S_IWUSR, - show_selfballoon_interval, store_selfballoon_interval); - - SELFBALLOON_SHOW(selfballoon_downhys, "%d\n", selfballoon_downhysteresis); - --static ssize_t store_selfballoon_downhys(struct sys_device *dev, -- struct sysdev_attribute *attr, -+static ssize_t store_selfballoon_downhys(struct device *dev, -+ struct device_attribute *attr, - const char *buf, - size_t count) - { -@@ -347,14 +347,14 @@ static ssize_t store_selfballoon_downhys - return count; - } - --static SYSDEV_ATTR(selfballoon_downhysteresis, S_IRUGO | S_IWUSR, -+static DEVICE_ATTR(selfballoon_downhysteresis, S_IRUGO | S_IWUSR, - show_selfballoon_downhys, store_selfballoon_downhys); - - - SELFBALLOON_SHOW(selfballoon_uphys, "%d\n", selfballoon_uphysteresis); - --static ssize_t store_selfballoon_uphys(struct sys_device *dev, -- struct sysdev_attribute *attr, -+static ssize_t store_selfballoon_uphys(struct device *dev, -+ struct device_attribute *attr, - const char *buf, - size_t count) - { -@@ -370,14 +370,14 @@ static ssize_t store_selfballoon_uphys(s - return count; - } - --static SYSDEV_ATTR(selfballoon_uphysteresis, S_IRUGO | S_IWUSR, -+static DEVICE_ATTR(selfballoon_uphysteresis, S_IRUGO | S_IWUSR, - show_selfballoon_uphys, store_selfballoon_uphys); - - SELFBALLOON_SHOW(selfballoon_min_usable_mb, "%d\n", - selfballoon_min_usable_mb); - --static ssize_t store_selfballoon_min_usable_mb(struct sys_device *dev, -- struct sysdev_attribute *attr, -+static ssize_t store_selfballoon_min_usable_mb(struct device *dev, -+ struct device_attribute *attr, - const char *buf, - size_t count) - { -@@ -393,7 +393,7 @@ static ssize_t store_selfballoon_min_usa - return count; - } - --static SYSDEV_ATTR(selfballoon_min_usable_mb, S_IRUGO | S_IWUSR, -+static DEVICE_ATTR(selfballoon_min_usable_mb, S_IRUGO | S_IWUSR, - show_selfballoon_min_usable_mb, - store_selfballoon_min_usable_mb); - -@@ -401,8 +401,8 @@ static SYSDEV_ATTR(selfballoon_min_usabl - #ifdef CONFIG_FRONTSWAP - SELFBALLOON_SHOW(frontswap_selfshrinking, "%d\n", frontswap_selfshrinking); - --static ssize_t store_frontswap_selfshrinking(struct sys_device *dev, -- struct sysdev_attribute *attr, -+static ssize_t store_frontswap_selfshrinking(struct device *dev, -+ struct device_attribute *attr, - const char *buf, - size_t count) - { -@@ -424,13 +424,13 @@ static ssize_t store_frontswap_selfshrin - return count; - } - --static SYSDEV_ATTR(frontswap_selfshrinking, S_IRUGO | S_IWUSR, -+static DEVICE_ATTR(frontswap_selfshrinking, S_IRUGO | S_IWUSR, - show_frontswap_selfshrinking, store_frontswap_selfshrinking); - - SELFBALLOON_SHOW(frontswap_inertia, "%d\n", frontswap_inertia); - --static ssize_t store_frontswap_inertia(struct sys_device *dev, -- struct sysdev_attribute *attr, -+static ssize_t store_frontswap_inertia(struct device *dev, -+ struct device_attribute *attr, - const char *buf, - size_t count) - { -@@ -447,13 +447,13 @@ static ssize_t store_frontswap_inertia(s - return count; - } - --static SYSDEV_ATTR(frontswap_inertia, S_IRUGO | S_IWUSR, -+static DEVICE_ATTR(frontswap_inertia, S_IRUGO | S_IWUSR, - show_frontswap_inertia, store_frontswap_inertia); - - SELFBALLOON_SHOW(frontswap_hysteresis, "%d\n", frontswap_hysteresis); - --static ssize_t store_frontswap_hysteresis(struct sys_device *dev, -- struct sysdev_attribute *attr, -+static ssize_t store_frontswap_hysteresis(struct device *dev, -+ struct device_attribute *attr, - const char *buf, - size_t count) - { -@@ -469,21 +469,21 @@ static ssize_t store_frontswap_hysteresi - return count; - } - --static SYSDEV_ATTR(frontswap_hysteresis, S_IRUGO | S_IWUSR, -+static DEVICE_ATTR(frontswap_hysteresis, S_IRUGO | S_IWUSR, - show_frontswap_hysteresis, store_frontswap_hysteresis); - - #endif /* CONFIG_FRONTSWAP */ - - static struct attribute *selfballoon_attrs[] = { -- &attr_selfballooning.attr, -- &attr_selfballoon_interval.attr, -- &attr_selfballoon_downhysteresis.attr, -- &attr_selfballoon_uphysteresis.attr, -- &attr_selfballoon_min_usable_mb.attr, -+ &dev_attr_selfballooning.attr, -+ &dev_attr_selfballoon_interval.attr, -+ &dev_attr_selfballoon_downhysteresis.attr, -+ &dev_attr_selfballoon_uphysteresis.attr, -+ &dev_attr_selfballoon_min_usable_mb.attr, - #ifdef CONFIG_FRONTSWAP -- &attr_frontswap_selfshrinking.attr, -- &attr_frontswap_hysteresis.attr, -- &attr_frontswap_inertia.attr, -+ &dev_attr_frontswap_selfshrinking.attr, -+ &dev_attr_frontswap_hysteresis.attr, -+ &dev_attr_frontswap_inertia.attr, - #endif - NULL - }; -@@ -494,12 +494,12 @@ static struct attribute_group selfballoo - }; - #endif - --int register_xen_selfballooning(struct sys_device *sysdev) -+int register_xen_selfballooning(struct device *dev) - { - int error = -1; - - #ifdef CONFIG_SYSFS -- error = sysfs_create_group(&sysdev->kobj, &selfballoon_group); -+ error = sysfs_create_group(&dev->kobj, &selfballoon_group); - #endif - return error; - } ---- a/include/xen/balloon.h -+++ b/include/xen/balloon.h -@@ -29,11 +29,11 @@ int alloc_xenballooned_pages(int nr_page - bool highmem); - void free_xenballooned_pages(int nr_pages, struct page **pages); - --struct sys_device; -+struct device; - #ifdef CONFIG_XEN_SELFBALLOONING --extern int register_xen_selfballooning(struct sys_device *sysdev); -+extern int register_xen_selfballooning(struct device *dev); - #else --static inline int register_xen_selfballooning(struct sys_device *sysdev) -+static inline int register_xen_selfballooning(struct device *dev) - { - return -ENOSYS; - } diff --git a/09-cpu.patch b/09-cpu.patch deleted file mode 100644 index 8c2866b..0000000 --- a/09-cpu.patch +++ /dev/null @@ -1,4336 +0,0 @@ -From: Kay Sievers <kay.sievers@vrfy.org> -Subject: convert 'cpu' and 'machinecheck' sysdev_class to a regular subsystem - -This moves the 'cpu sysdev_class' over to a regular 'cpu' subsystem -and converts the devices to regular devices. The sysdev drivers are -implemented as subsystem interfaces now. - -After all sysdev classes are ported to regular driver core entities, the -sysdev implementation will be entirely removed from the kernel. - -Userspace relies on events and generic sysfs subsystem infrastructure -from sysdev devices, which are made available with this conversion. - -Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> ---- - arch/avr32/kernel/cpu.c | 74 +++--- - arch/ia64/kernel/err_inject.c | 52 ++-- - arch/ia64/kernel/topology.c | 10 - arch/powerpc/include/asm/spu.h | 12 - - arch/powerpc/include/asm/topology.h | 10 - arch/powerpc/kernel/cacheinfo.c | 10 - arch/powerpc/kernel/smp.c | 2 - arch/powerpc/kernel/sysfs.c | 257 +++++++++++------------- - arch/powerpc/mm/numa.c | 8 - arch/powerpc/platforms/cell/cbe_thermal.c | 144 ++++++------- - arch/powerpc/platforms/cell/spu_base.c | 61 ++--- - arch/powerpc/platforms/pseries/pseries_energy.c | 71 +++--- - arch/powerpc/sysdev/ppc4xx_cpm.c | 6 - arch/s390/kernel/smp.c | 76 +++---- - arch/s390/kernel/topology.c | 6 - arch/sh/kernel/cpu/sh4/sq.c | 24 +- - arch/sparc/kernel/sysfs.c | 122 +++++------ - arch/tile/kernel/sysfs.c | 61 ++--- - arch/x86/include/asm/mce.h | 2 - arch/x86/kernel/cpu/intel_cacheinfo.c | 25 +- - arch/x86/kernel/cpu/mcheck/mce-internal.h | 4 - arch/x86/kernel/cpu/mcheck/mce.c | 130 ++++++------ - arch/x86/kernel/cpu/mcheck/mce_amd.c | 11 - - arch/x86/kernel/cpu/mcheck/therm_throt.c | 63 ++--- - arch/x86/kernel/microcode_core.c | 64 +++-- - drivers/acpi/processor_driver.c | 6 - drivers/acpi/processor_thermal.c | 1 - drivers/base/cpu.c | 146 +++++++------ - drivers/base/node.c | 8 - drivers/base/topology.c | 51 ++-- - drivers/cpufreq/cpufreq.c | 79 +++---- - drivers/cpufreq/cpufreq_stats.c | 1 - drivers/cpuidle/cpuidle.c | 12 - - drivers/cpuidle/cpuidle.h | 10 - drivers/cpuidle/sysfs.c | 78 +++---- - drivers/s390/char/sclp_config.c | 8 - include/linux/cpu.h | 18 - - kernel/sched.c | 40 +-- - 38 files changed, 880 insertions(+), 883 deletions(-) - ---- a/arch/avr32/kernel/cpu.c -+++ b/arch/avr32/kernel/cpu.c -@@ -6,7 +6,7 @@ - * published by the Free Software Foundation. - */ - #include <linux/init.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/seq_file.h> - #include <linux/cpu.h> - #include <linux/module.h> -@@ -26,16 +26,16 @@ static DEFINE_PER_CPU(struct cpu, cpu_de - * XXX: If/when a SMP-capable implementation of AVR32 will ever be - * made, we must make sure that the code executes on the correct CPU. - */ --static ssize_t show_pc0event(struct sys_device *dev, -- struct sysdev_attribute *attr, char *buf) -+static ssize_t show_pc0event(struct device *dev, -+ struct device_attribute *attr, char *buf) - { - unsigned long pccr; - - pccr = sysreg_read(PCCR); - return sprintf(buf, "0x%lx\n", (pccr >> 12) & 0x3f); - } --static ssize_t store_pc0event(struct sys_device *dev, -- struct sysdev_attribute *attr, const char *buf, -+static ssize_t store_pc0event(struct device *dev, -+ struct device_attribute *attr, const char *buf, - size_t count) - { - unsigned long val; -@@ -48,16 +48,16 @@ static ssize_t store_pc0event(struct sys - sysreg_write(PCCR, val); - return count; - } --static ssize_t show_pc0count(struct sys_device *dev, -- struct sysdev_attribute *attr, char *buf) -+static ssize_t show_pc0count(struct device *dev, -+ struct device_attribute *attr, char *buf) - { - unsigned long pcnt0; - - pcnt0 = sysreg_read(PCNT0); - return sprintf(buf, "%lu\n", pcnt0); - } --static ssize_t store_pc0count(struct sys_device *dev, -- struct sysdev_attribute *attr, -+static ssize_t store_pc0count(struct device *dev, -+ struct device_attribute *attr, - const char *buf, size_t count) - { - unsigned long val; -@@ -71,16 +71,16 @@ static ssize_t store_pc0count(struct sys - return count; - } - --static ssize_t show_pc1event(struct sys_device *dev, -- struct sysdev_attribute *attr, char *buf) -+static ssize_t show_pc1event(struct device *dev, -+ struct device_attribute *attr, char *buf) - { - unsigned long pccr; - - pccr = sysreg_read(PCCR); - return sprintf(buf, "0x%lx\n", (pccr >> 18) & 0x3f); - } --static ssize_t store_pc1event(struct sys_device *dev, -- struct sysdev_attribute *attr, const char *buf, -+static ssize_t store_pc1event(struct device *dev, -+ struct device_attribute *attr, const char *buf, - size_t count) - { - unsigned long val; -@@ -93,16 +93,16 @@ static ssize_t store_pc1event(struct sys - sysreg_write(PCCR, val); - return count; - } --static ssize_t show_pc1count(struct sys_device *dev, -- struct sysdev_attribute *attr, char *buf) -+static ssize_t show_pc1count(struct device *dev, -+ struct device_attribute *attr, char *buf) - { - unsigned long pcnt1; - - pcnt1 = sysreg_read(PCNT1); - return sprintf(buf, "%lu\n", pcnt1); - } --static ssize_t store_pc1count(struct sys_device *dev, -- struct sysdev_attribute *attr, const char *buf, -+static ssize_t store_pc1count(struct device *dev, -+ struct device_attribute *attr, const char *buf, - size_t count) - { - unsigned long val; -@@ -116,16 +116,16 @@ static ssize_t store_pc1count(struct sys - return count; - } - --static ssize_t show_pccycles(struct sys_device *dev, -- struct sysdev_attribute *attr, char *buf) -+static ssize_t show_pccycles(struct device *dev, -+ struct device_attribute *attr, char *buf) - { - unsigned long pccnt; - - pccnt = sysreg_read(PCCNT); - return sprintf(buf, "%lu\n", pccnt); - } --static ssize_t store_pccycles(struct sys_device *dev, -- struct sysdev_attribute *attr, const char *buf, -+static ssize_t store_pccycles(struct device *dev, -+ struct device_attribute *attr, const char *buf, - size_t count) - { - unsigned long val; -@@ -139,16 +139,16 @@ static ssize_t store_pccycles(struct sys - return count; - } - --static ssize_t show_pcenable(struct sys_device *dev, -- struct sysdev_attribute *attr, char *buf) -+static ssize_t show_pcenable(struct device *dev, -+ struct device_attribute *attr, char *buf) - { - unsigned long pccr; - - pccr = sysreg_read(PCCR); - return sprintf(buf, "%c\n", (pccr & 1)?'1':'0'); - } --static ssize_t store_pcenable(struct sys_device *dev, -- struct sysdev_attribute *attr, const char *buf, -+static ssize_t store_pcenable(struct device *dev, -+ struct device_attribute *attr, const char *buf, - size_t count) - { - unsigned long pccr, val; -@@ -167,12 +167,12 @@ static ssize_t store_pcenable(struct sys - return count; - } - --static SYSDEV_ATTR(pc0event, 0600, show_pc0event, store_pc0event); --static SYSDEV_ATTR(pc0count, 0600, show_pc0count, store_pc0count); --static SYSDEV_ATTR(pc1event, 0600, show_pc1event, store_pc1event); --static SYSDEV_ATTR(pc1count, 0600, show_pc1count, store_pc1count); --static SYSDEV_ATTR(pccycles, 0600, show_pccycles, store_pccycles); --static SYSDEV_ATTR(pcenable, 0600, show_pcenable, store_pcenable); -+static DEVICE_ATTR(pc0event, 0600, show_pc0event, store_pc0event); -+static DEVICE_ATTR(pc0count, 0600, show_pc0count, store_pc0count); -+static DEVICE_ATTR(pc1event, 0600, show_pc1event, store_pc1event); -+static DEVICE_ATTR(pc1count, 0600, show_pc1count, store_pc1count); -+static DEVICE_ATTR(pccycles, 0600, show_pccycles, store_pccycles); -+static DEVICE_ATTR(pcenable, 0600, show_pcenable, store_pcenable); - - #endif /* CONFIG_PERFORMANCE_COUNTERS */ - -@@ -186,12 +186,12 @@ static int __init topology_init(void) - register_cpu(c, cpu); - - #ifdef CONFIG_PERFORMANCE_COUNTERS -- sysdev_create_file(&c->sysdev, &attr_pc0event); -- sysdev_create_file(&c->sysdev, &attr_pc0count); -- sysdev_create_file(&c->sysdev, &attr_pc1event); -- sysdev_create_file(&c->sysdev, &attr_pc1count); -- sysdev_create_file(&c->sysdev, &attr_pccycles); -- sysdev_create_file(&c->sysdev, &attr_pcenable); -+ device_create_file(&c->dev, &dev_attr_pc0event); -+ device_create_file(&c->dev, &dev_attr_pc0count); -+ device_create_file(&c->dev, &dev_attr_pc1event); -+ device_create_file(&c->dev, &dev_attr_pc1count); -+ device_create_file(&c->dev, &dev_attr_pccycles); -+ device_create_file(&c->dev, &dev_attr_pcenable); - #endif - } - ---- a/arch/ia64/kernel/err_inject.c -+++ b/arch/ia64/kernel/err_inject.c -@@ -24,7 +24,7 @@ - * Copyright (C) 2006, Intel Corp. All rights reserved. - * - */ --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/init.h> - #include <linux/mm.h> - #include <linux/cpu.h> -@@ -35,10 +35,10 @@ - #define ERR_DATA_BUFFER_SIZE 3 // Three 8-byte; - - #define define_one_ro(name) \ --static SYSDEV_ATTR(name, 0444, show_##name, NULL) -+static DEVICE_ATTR(name, 0444, show_##name, NULL) - - #define define_one_rw(name) \ --static SYSDEV_ATTR(name, 0644, show_##name, store_##name) -+static DEVICE_ATTR(name, 0644, show_##name, store_##name) - - static u64 call_start[NR_CPUS]; - static u64 phys_addr[NR_CPUS]; -@@ -55,7 +55,7 @@ static u64 resources[NR_CPUS]; - - #define show(name) \ - static ssize_t \ --show_##name(struct sys_device *dev, struct sysdev_attribute *attr, \ -+show_##name(struct device *dev, struct device_attribute *attr, \ - char *buf) \ - { \ - u32 cpu=dev->id; \ -@@ -64,7 +64,7 @@ show_##name(struct sys_device *dev, stru - - #define store(name) \ - static ssize_t \ --store_##name(struct sys_device *dev, struct sysdev_attribute *attr, \ -+store_##name(struct device *dev, struct device_attribute *attr, \ - const char *buf, size_t size) \ - { \ - unsigned int cpu=dev->id; \ -@@ -78,7 +78,7 @@ show(call_start) - * processor. The cpu number in driver is only used for storing data. - */ - static ssize_t --store_call_start(struct sys_device *dev, struct sysdev_attribute *attr, -+store_call_start(struct device *dev, struct device_attribute *attr, - const char *buf, size_t size) - { - unsigned int cpu=dev->id; -@@ -127,7 +127,7 @@ show(err_type_info) - store(err_type_info) - - static ssize_t --show_virtual_to_phys(struct sys_device *dev, struct sysdev_attribute *attr, -+show_virtual_to_phys(struct device *dev, struct device_attribute *attr, - char *buf) - { - unsigned int cpu=dev->id; -@@ -135,7 +135,7 @@ show_virtual_to_phys(struct sys_device * - } - - static ssize_t --store_virtual_to_phys(struct sys_device *dev, struct sysdev_attribute *attr, -+store_virtual_to_phys(struct device *dev, struct device_attribute *attr, - const char *buf, size_t size) - { - unsigned int cpu=dev->id; -@@ -159,8 +159,8 @@ show(err_struct_info) - store(err_struct_info) - - static ssize_t --show_err_data_buffer(struct sys_device *dev, -- struct sysdev_attribute *attr, char *buf) -+show_err_data_buffer(struct device *dev, -+ struct device_attribute *attr, char *buf) - { - unsigned int cpu=dev->id; - -@@ -171,8 +171,8 @@ show_err_data_buffer(struct sys_device * - } - - static ssize_t --store_err_data_buffer(struct sys_device *dev, -- struct sysdev_attribute *attr, -+store_err_data_buffer(struct device *dev, -+ struct device_attribute *attr, - const char *buf, size_t size) - { - unsigned int cpu=dev->id; -@@ -209,14 +209,14 @@ define_one_ro(capabilities); - define_one_ro(resources); - - static struct attribute *default_attrs[] = { -- &attr_call_start.attr, -- &attr_virtual_to_phys.attr, -- &attr_err_type_info.attr, -- &attr_err_struct_info.attr, -- &attr_err_data_buffer.attr, -- &attr_status.attr, -- &attr_capabilities.attr, -- &attr_resources.attr, -+ &dev_attr_call_start.attr, -+ &dev_attr_virtual_to_phys.attr, -+ &dev_attr_err_type_info.attr, -+ &dev_attr_err_struct_info.attr, -+ &dev_attr_err_data_buffer.attr, -+ &dev_attr_status.attr, -+ &dev_attr_capabilities.attr, -+ &dev_attr_resources.attr, - NULL - }; - -@@ -225,12 +225,12 @@ static struct attribute_group err_inject - .name = "err_inject" - }; - /* Add/Remove err_inject interface for CPU device */ --static int __cpuinit err_inject_add_dev(struct sys_device * sys_dev) -+static int __cpuinit err_inject_add_dev(struct device * sys_dev) - { - return sysfs_create_group(&sys_dev->kobj, &err_inject_attr_group); - } - --static int __cpuinit err_inject_remove_dev(struct sys_device * sys_dev) -+static int __cpuinit err_inject_remove_dev(struct device * sys_dev) - { - sysfs_remove_group(&sys_dev->kobj, &err_inject_attr_group); - return 0; -@@ -239,9 +239,9 @@ static int __cpuinit err_inject_cpu_call - unsigned long action, void *hcpu) - { - unsigned int cpu = (unsigned long)hcpu; -- struct sys_device *sys_dev; -+ struct device *sys_dev; - -- sys_dev = get_cpu_sysdev(cpu); -+ sys_dev = get_cpu_device(cpu); - switch (action) { - case CPU_ONLINE: - case CPU_ONLINE_FROZEN: -@@ -283,13 +283,13 @@ static void __exit - err_inject_exit(void) - { - int i; -- struct sys_device *sys_dev; -+ struct device *sys_dev; - - #ifdef ERR_INJ_DEBUG - printk(KERN_INFO "Exit error injection driver.\n"); - #endif - for_each_online_cpu(i) { -- sys_dev = get_cpu_sysdev(i); -+ sys_dev = get_cpu_device(i); - sysfs_remove_group(&sys_dev->kobj, &err_inject_attr_group); - } - unregister_hotcpu_notifier(&err_inject_cpu_notifier); ---- a/arch/ia64/kernel/topology.c -+++ b/arch/ia64/kernel/topology.c -@@ -350,7 +350,7 @@ static int __cpuinit cpu_cache_sysfs_ini - } - - /* Add cache interface for CPU device */ --static int __cpuinit cache_add_dev(struct sys_device * sys_dev) -+static int __cpuinit cache_add_dev(struct device * sys_dev) - { - unsigned int cpu = sys_dev->id; - unsigned long i, j; -@@ -400,7 +400,7 @@ static int __cpuinit cache_add_dev(struc - } - - /* Remove cache interface for CPU device */ --static int __cpuinit cache_remove_dev(struct sys_device * sys_dev) -+static int __cpuinit cache_remove_dev(struct device * sys_dev) - { - unsigned int cpu = sys_dev->id; - unsigned long i; -@@ -428,9 +428,9 @@ static int __cpuinit cache_cpu_callback( - unsigned long action, void *hcpu) - { - unsigned int cpu = (unsigned long)hcpu; -- struct sys_device *sys_dev; -+ struct device *sys_dev; - -- sys_dev = get_cpu_sysdev(cpu); -+ sys_dev = get_cpu_device(cpu); - switch (action) { - case CPU_ONLINE: - case CPU_ONLINE_FROZEN: -@@ -454,7 +454,7 @@ static int __init cache_sysfs_init(void) - int i; - - for_each_online_cpu(i) { -- struct sys_device *sys_dev = get_cpu_sysdev((unsigned int)i); -+ struct device *sys_dev = get_cpu_device((unsigned int)i); - cache_add_dev(sys_dev); - } - ---- a/arch/powerpc/include/asm/spu.h -+++ b/arch/powerpc/include/asm/spu.h -@@ -25,7 +25,7 @@ - #ifdef __KERNEL__ - - #include <linux/workqueue.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/mutex.h> - - #define LS_SIZE (256 * 1024) -@@ -166,7 +166,7 @@ struct spu { - /* beat only */ - u64 shadow_int_mask_RW[3]; - -- struct sys_device sysdev; -+ struct device dev; - - int has_mem_affinity; - struct list_head aff_list; -@@ -270,11 +270,11 @@ struct spufs_calls { - int register_spu_syscalls(struct spufs_calls *calls); - void unregister_spu_syscalls(struct spufs_calls *calls); - --int spu_add_sysdev_attr(struct sysdev_attribute *attr); --void spu_remove_sysdev_attr(struct sysdev_attribute *attr); -+int spu_add_dev_attr(struct device_attribute *attr); -+void spu_remove_dev_attr(struct device_attribute *attr); - --int spu_add_sysdev_attr_group(struct attribute_group *attrs); --void spu_remove_sysdev_attr_group(struct attribute_group *attrs); -+int spu_add_dev_attr_group(struct attribute_group *attrs); -+void spu_remove_dev_attr_group(struct attribute_group *attrs); - - int spu_handle_mm_fault(struct mm_struct *mm, unsigned long ea, - unsigned long dsisr, unsigned *flt); ---- a/arch/powerpc/include/asm/topology.h -+++ b/arch/powerpc/include/asm/topology.h -@@ -3,7 +3,7 @@ - #ifdef __KERNEL__ - - --struct sys_device; -+struct device; - struct device_node; - - #ifdef CONFIG_NUMA -@@ -86,19 +86,19 @@ extern int __node_distance(int, int); - - extern void __init dump_numa_cpu_topology(void); - --extern int sysfs_add_device_to_node(struct sys_device *dev, int nid); --extern void sysfs_remove_device_from_node(struct sys_device *dev, int nid); -+extern int sysfs_add_device_to_node(struct device *dev, int nid); -+extern void sysfs_remove_device_from_node(struct device *dev, int nid); - - #else - - static inline void dump_numa_cpu_topology(void) {} - --static inline int sysfs_add_device_to_node(struct sys_device *dev, int nid) -+static inline int sysfs_add_device_to_node(struct device *dev, int nid) - { - return 0; - } - --static inline void sysfs_remove_device_from_node(struct sys_device *dev, -+static inline void sysfs_remove_device_from_node(struct device *dev, - int nid) - { - } ---- a/arch/powerpc/kernel/cacheinfo.c -+++ b/arch/powerpc/kernel/cacheinfo.c -@@ -451,15 +451,15 @@ out: - static struct cache_dir *__cpuinit cacheinfo_create_cache_dir(unsigned int cpu_id) - { - struct cache_dir *cache_dir; -- struct sys_device *sysdev; -+ struct device *dev; - struct kobject *kobj = NULL; - -- sysdev = get_cpu_sysdev(cpu_id); -- WARN_ONCE(!sysdev, "no sysdev for CPU %i\n", cpu_id); -- if (!sysdev) -+ dev = get_cpu_device(cpu_id); -+ WARN_ONCE(!dev, "no dev for CPU %i\n", cpu_id); -+ if (!dev) - goto err; - -- kobj = kobject_create_and_add("cache", &sysdev->kobj); -+ kobj = kobject_create_and_add("cache", &dev->kobj); - if (!kobj) - goto err; - ---- a/arch/powerpc/kernel/smp.c -+++ b/arch/powerpc/kernel/smp.c -@@ -27,7 +27,7 @@ - #include <linux/spinlock.h> - #include <linux/cache.h> - #include <linux/err.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/cpu.h> - #include <linux/notifier.h> - #include <linux/topology.h> ---- a/arch/powerpc/kernel/sysfs.c -+++ b/arch/powerpc/kernel/sysfs.c -@@ -1,4 +1,4 @@ --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/cpu.h> - #include <linux/smp.h> - #include <linux/percpu.h> -@@ -37,12 +37,12 @@ static DEFINE_PER_CPU(struct cpu, cpu_de - /* Time in microseconds we delay before sleeping in the idle loop */ - DEFINE_PER_CPU(long, smt_snooze_delay) = { 100 }; - --static ssize_t store_smt_snooze_delay(struct sys_device *dev, -- struct sysdev_attribute *attr, -+static ssize_t store_smt_snooze_delay(struct device *dev, -+ struct device_attribute *attr, - const char *buf, - size_t count) - { -- struct cpu *cpu = container_of(dev, struct cpu, sysdev); -+ struct cpu *cpu = container_of(dev, struct cpu, dev); - ssize_t ret; - long snooze; - -@@ -50,21 +50,21 @@ static ssize_t store_smt_snooze_delay(st - if (ret != 1) - return -EINVAL; - -- per_cpu(smt_snooze_delay, cpu->sysdev.id) = snooze; -+ per_cpu(smt_snooze_delay, cpu->dev.id) = snooze; - - return count; - } - --static ssize_t show_smt_snooze_delay(struct sys_device *dev, -- struct sysdev_attribute *attr, -+static ssize_t show_smt_snooze_delay(struct device *dev, -+ struct device_attribute *attr, - char *buf) - { -- struct cpu *cpu = container_of(dev, struct cpu, sysdev); -+ struct cpu *cpu = container_of(dev, struct cpu, dev); - -- return sprintf(buf, "%ld\n", per_cpu(smt_snooze_delay, cpu->sysdev.id)); -+ return sprintf(buf, "%ld\n", per_cpu(smt_snooze_delay, cpu->dev.id)); - } - --static SYSDEV_ATTR(smt_snooze_delay, 0644, show_smt_snooze_delay, -+static DEVICE_ATTR(smt_snooze_delay, 0644, show_smt_snooze_delay, - store_smt_snooze_delay); - - static int __init setup_smt_snooze_delay(char *str) -@@ -117,25 +117,25 @@ static void write_##NAME(void *val) \ - ppc_enable_pmcs(); \ - mtspr(ADDRESS, *(unsigned long *)val); \ - } \ --static ssize_t show_##NAME(struct sys_device *dev, \ -- struct sysdev_attribute *attr, \ -+static ssize_t show_##NAME(struct device *dev, \ -+ struct device_attribute *attr, \ - char *buf) \ - { \ -- struct cpu *cpu = container_of(dev, struct cpu, sysdev); \ -+ struct cpu *cpu = container_of(dev, struct cpu, dev); \ - unsigned long val; \ -- smp_call_function_single(cpu->sysdev.id, read_##NAME, &val, 1); \ -+ smp_call_function_single(cpu->dev.id, read_##NAME, &val, 1); \ - return sprintf(buf, "%lx\n", val); \ - } \ - static ssize_t __used \ -- store_##NAME(struct sys_device *dev, struct sysdev_attribute *attr, \ -+ store_##NAME(struct device *dev, struct device_attribute *attr, \ - const char *buf, size_t count) \ - { \ -- struct cpu *cpu = container_of(dev, struct cpu, sysdev); \ -+ struct cpu *cpu = container_of(dev, struct cpu, dev); \ - unsigned long val; \ - int ret = sscanf(buf, "%lx", &val); \ - if (ret != 1) \ - return -EINVAL; \ -- smp_call_function_single(cpu->sysdev.id, write_##NAME, &val, 1); \ -+ smp_call_function_single(cpu->dev.id, write_##NAME, &val, 1); \ - return count; \ - } - -@@ -178,22 +178,22 @@ SYSFS_PMCSETUP(purr, SPRN_PURR); - SYSFS_PMCSETUP(spurr, SPRN_SPURR); - SYSFS_PMCSETUP(dscr, SPRN_DSCR); - --static SYSDEV_ATTR(mmcra, 0600, show_mmcra, store_mmcra); --static SYSDEV_ATTR(spurr, 0600, show_spurr, NULL); --static SYSDEV_ATTR(dscr, 0600, show_dscr, store_dscr); --static SYSDEV_ATTR(purr, 0600, show_purr, store_purr); -+static DEVICE_ATTR(mmcra, 0600, show_mmcra, store_mmcra); -+static DEVICE_ATTR(spurr, 0600, show_spurr, NULL); -+static DEVICE_ATTR(dscr, 0600, show_dscr, store_dscr); -+static DEVICE_ATTR(purr, 0600, show_purr, store_purr); - - unsigned long dscr_default = 0; - EXPORT_SYMBOL(dscr_default); - --static ssize_t show_dscr_default(struct sysdev_class *class, -- struct sysdev_class_attribute *attr, char *buf) -+static ssize_t show_dscr_default(struct device *dev, -+ struct device_attribute *attr, char *buf) - { - return sprintf(buf, "%lx\n", dscr_default); - } - --static ssize_t __used store_dscr_default(struct sysdev_class *class, -- struct sysdev_class_attribute *attr, const char *buf, -+static ssize_t __used store_dscr_default(struct device *dev, -+ struct device_attribute *attr, const char *buf, - size_t count) - { - unsigned long val; -@@ -207,15 +207,14 @@ static ssize_t __used store_dscr_default - return count; - } - --static SYSDEV_CLASS_ATTR(dscr_default, 0600, -+static DEVICE_ATTR(dscr_default, 0600, - show_dscr_default, store_dscr_default); - - static void sysfs_create_dscr_default(void) - { - int err = 0; - if (cpu_has_feature(CPU_FTR_DSCR)) -- err = sysfs_create_file(&cpu_sysdev_class.kset.kobj, -- &attr_dscr_default.attr); -+ err = device_create_file(cpu_subsys.dev_root, &dev_attr_dscr_default); - } - #endif /* CONFIG_PPC64 */ - -@@ -259,72 +258,72 @@ SYSFS_PMCSETUP(tsr3, SPRN_PA6T_TSR3); - #endif /* HAS_PPC_PMC_PA6T */ - - #ifdef HAS_PPC_PMC_IBM --static struct sysdev_attribute ibm_common_attrs[] = { -- _SYSDEV_ATTR(mmcr0, 0600, show_mmcr0, store_mmcr0), -- _SYSDEV_ATTR(mmcr1, 0600, show_mmcr1, store_mmcr1), -+static struct device_attribute ibm_common_attrs[] = { -+ __ATTR(mmcr0, 0600, show_mmcr0, store_mmcr0), -+ __ATTR(mmcr1, 0600, show_mmcr1, store_mmcr1), - }; - #endif /* HAS_PPC_PMC_G4 */ - - #ifdef HAS_PPC_PMC_G4 --static struct sysdev_attribute g4_common_attrs[] = { -- _SYSDEV_ATTR(mmcr0, 0600, show_mmcr0, store_mmcr0), -- _SYSDEV_ATTR(mmcr1, 0600, show_mmcr1, store_mmcr1), -- _SYSDEV_ATTR(mmcr2, 0600, show_mmcr2, store_mmcr2), -+static struct device_attribute g4_common_attrs[] = { -+ __ATTR(mmcr0, 0600, show_mmcr0, store_mmcr0), -+ __ATTR(mmcr1, 0600, show_mmcr1, store_mmcr1), -+ __ATTR(mmcr2, 0600, show_mmcr2, store_mmcr2), - }; - #endif /* HAS_PPC_PMC_G4 */ - --static struct sysdev_attribute classic_pmc_attrs[] = { -- _SYSDEV_ATTR(pmc1, 0600, show_pmc1, store_pmc1), -- _SYSDEV_ATTR(pmc2, 0600, show_pmc2, store_pmc2), -- _SYSDEV_ATTR(pmc3, 0600, show_pmc3, store_pmc3), -- _SYSDEV_ATTR(pmc4, 0600, show_pmc4, store_pmc4), -- _SYSDEV_ATTR(pmc5, 0600, show_pmc5, store_pmc5), -- _SYSDEV_ATTR(pmc6, 0600, show_pmc6, store_pmc6), -+static struct device_attribute classic_pmc_attrs[] = { -+ __ATTR(pmc1, 0600, show_pmc1, store_pmc1), -+ __ATTR(pmc2, 0600, show_pmc2, store_pmc2), -+ __ATTR(pmc3, 0600, show_pmc3, store_pmc3), -+ __ATTR(pmc4, 0600, show_pmc4, store_pmc4), -+ __ATTR(pmc5, 0600, show_pmc5, store_pmc5), -+ __ATTR(pmc6, 0600, show_pmc6, store_pmc6), - #ifdef CONFIG_PPC64 -- _SYSDEV_ATTR(pmc7, 0600, show_pmc7, store_pmc7), -- _SYSDEV_ATTR(pmc8, 0600, show_pmc8, store_pmc8), -+ __ATTR(pmc7, 0600, show_pmc7, store_pmc7), -+ __ATTR(pmc8, 0600, show_pmc8, store_pmc8), - #endif - }; - - #ifdef HAS_PPC_PMC_PA6T --static struct sysdev_attribute pa6t_attrs[] = { -- _SYSDEV_ATTR(mmcr0, 0600, show_mmcr0, store_mmcr0), -- _SYSDEV_ATTR(mmcr1, 0600, show_mmcr1, store_mmcr1), -- _SYSDEV_ATTR(pmc0, 0600, show_pa6t_pmc0, store_pa6t_pmc0), -- _SYSDEV_ATTR(pmc1, 0600, show_pa6t_pmc1, store_pa6t_pmc1), -- _SYSDEV_ATTR(pmc2, 0600, show_pa6t_pmc2, store_pa6t_pmc2), -- _SYSDEV_ATTR(pmc3, 0600, show_pa6t_pmc3, store_pa6t_pmc3), -- _SYSDEV_ATTR(pmc4, 0600, show_pa6t_pmc4, store_pa6t_pmc4), -- _SYSDEV_ATTR(pmc5, 0600, show_pa6t_pmc5, store_pa6t_pmc5), -+static struct device_attribute pa6t_attrs[] = { -+ __ATTR(mmcr0, 0600, show_mmcr0, store_mmcr0), -+ __ATTR(mmcr1, 0600, show_mmcr1, store_mmcr1), -+ __ATTR(pmc0, 0600, show_pa6t_pmc0, store_pa6t_pmc0), -+ __ATTR(pmc1, 0600, show_pa6t_pmc1, store_pa6t_pmc1), -+ __ATTR(pmc2, 0600, show_pa6t_pmc2, store_pa6t_pmc2), -+ __ATTR(pmc3, 0600, show_pa6t_pmc3, store_pa6t_pmc3), -+ __ATTR(pmc4, 0600, show_pa6t_pmc4, store_pa6t_pmc4), -+ __ATTR(pmc5, 0600, show_pa6t_pmc5, store_pa6t_pmc5), - #ifdef CONFIG_DEBUG_KERNEL -- _SYSDEV_ATTR(hid0, 0600, show_hid0, store_hid0), -- _SYSDEV_ATTR(hid1, 0600, show_hid1, store_hid1), -- _SYSDEV_ATTR(hid4, 0600, show_hid4, store_hid4), -- _SYSDEV_ATTR(hid5, 0600, show_hid5, store_hid5), -- _SYSDEV_ATTR(ima0, 0600, show_ima0, store_ima0), -- _SYSDEV_ATTR(ima1, 0600, show_ima1, store_ima1), -- _SYSDEV_ATTR(ima2, 0600, show_ima2, store_ima2), -- _SYSDEV_ATTR(ima3, 0600, show_ima3, store_ima3), -- _SYSDEV_ATTR(ima4, 0600, show_ima4, store_ima4), -- _SYSDEV_ATTR(ima5, 0600, show_ima5, store_ima5), -- _SYSDEV_ATTR(ima6, 0600, show_ima6, store_ima6), -- _SYSDEV_ATTR(ima7, 0600, show_ima7, store_ima7), -- _SYSDEV_ATTR(ima8, 0600, show_ima8, store_ima8), -- _SYSDEV_ATTR(ima9, 0600, show_ima9, store_ima9), -- _SYSDEV_ATTR(imaat, 0600, show_imaat, store_imaat), -- _SYSDEV_ATTR(btcr, 0600, show_btcr, store_btcr), -- _SYSDEV_ATTR(pccr, 0600, show_pccr, store_pccr), -- _SYSDEV_ATTR(rpccr, 0600, show_rpccr, store_rpccr), -- _SYSDEV_ATTR(der, 0600, show_der, store_der), -- _SYSDEV_ATTR(mer, 0600, show_mer, store_mer), -- _SYSDEV_ATTR(ber, 0600, show_ber, store_ber), -- _SYSDEV_ATTR(ier, 0600, show_ier, store_ier), -- _SYSDEV_ATTR(sier, 0600, show_sier, store_sier), -- _SYSDEV_ATTR(siar, 0600, show_siar, store_siar), -- _SYSDEV_ATTR(tsr0, 0600, show_tsr0, store_tsr0), -- _SYSDEV_ATTR(tsr1, 0600, show_tsr1, store_tsr1), -- _SYSDEV_ATTR(tsr2, 0600, show_tsr2, store_tsr2), -- _SYSDEV_ATTR(tsr3, 0600, show_tsr3, store_tsr3), -+ __ATTR(hid0, 0600, show_hid0, store_hid0), -+ __ATTR(hid1, 0600, show_hid1, store_hid1), -+ __ATTR(hid4, 0600, show_hid4, store_hid4), -+ __ATTR(hid5, 0600, show_hid5, store_hid5), -+ __ATTR(ima0, 0600, show_ima0, store_ima0), -+ __ATTR(ima1, 0600, show_ima1, store_ima1), -+ __ATTR(ima2, 0600, show_ima2, store_ima2), -+ __ATTR(ima3, 0600, show_ima3, store_ima3), -+ __ATTR(ima4, 0600, show_ima4, store_ima4), -+ __ATTR(ima5, 0600, show_ima5, store_ima5), -+ __ATTR(ima6, 0600, show_ima6, store_ima6), -+ __ATTR(ima7, 0600, show_ima7, store_ima7), -+ __ATTR(ima8, 0600, show_ima8, store_ima8), -+ __ATTR(ima9, 0600, show_ima9, store_ima9), -+ __ATTR(imaat, 0600, show_imaat, store_imaat), -+ __ATTR(btcr, 0600, show_btcr, store_btcr), -+ __ATTR(pccr, 0600, show_pccr, store_pccr), -+ __ATTR(rpccr, 0600, show_rpccr, store_rpccr), -+ __ATTR(der, 0600, show_der, store_der), -+ __ATTR(mer, 0600, show_mer, store_mer), -+ __ATTR(ber, 0600, show_ber, store_ber), -+ __ATTR(ier, 0600, show_ier, store_ier), -+ __ATTR(sier, 0600, show_sier, store_sier), -+ __ATTR(siar, 0600, show_siar, store_siar), -+ __ATTR(tsr0, 0600, show_tsr0, store_tsr0), -+ __ATTR(tsr1, 0600, show_tsr1, store_tsr1), -+ __ATTR(tsr2, 0600, show_tsr2, store_tsr2), -+ __ATTR(tsr3, 0600, show_tsr3, store_tsr3), - #endif /* CONFIG_DEBUG_KERNEL */ - }; - #endif /* HAS_PPC_PMC_PA6T */ -@@ -333,14 +332,14 @@ static struct sysdev_attribute pa6t_attr - static void __cpuinit register_cpu_online(unsigned int cpu) - { - struct cpu *c = &per_cpu(cpu_devices, cpu); -- struct sys_device *s = &c->sysdev; -- struct sysdev_attribute *attrs, *pmc_attrs; -+ struct device *s = &c->dev; -+ struct device_attribute *attrs, *pmc_attrs; - int i, nattrs; - - #ifdef CONFIG_PPC64 - if (!firmware_has_feature(FW_FEATURE_ISERIES) && - cpu_has_feature(CPU_FTR_SMT)) -- sysdev_create_file(s, &attr_smt_snooze_delay); -+ device_create_file(s, &dev_attr_smt_snooze_delay); - #endif - - /* PMC stuff */ -@@ -348,14 +347,14 @@ static void __cpuinit register_cpu_onlin - #ifdef HAS_PPC_PMC_IBM - case PPC_PMC_IBM: - attrs = ibm_common_attrs; -- nattrs = sizeof(ibm_common_attrs) / sizeof(struct sysdev_attribute); -+ nattrs = sizeof(ibm_common_attrs) / sizeof(struct device_attribute); - pmc_attrs = classic_pmc_attrs; - break; - #endif /* HAS_PPC_PMC_IBM */ - #ifdef HAS_PPC_PMC_G4 - case PPC_PMC_G4: - attrs = g4_common_attrs; -- nattrs = sizeof(g4_common_attrs) / sizeof(struct sysdev_attribute); -+ nattrs = sizeof(g4_common_attrs) / sizeof(struct device_attribute); - pmc_attrs = classic_pmc_attrs; - break; - #endif /* HAS_PPC_PMC_G4 */ -@@ -363,7 +362,7 @@ static void __cpuinit register_cpu_onlin - case PPC_PMC_PA6T: - /* PA Semi starts counting at PMC0 */ - attrs = pa6t_attrs; -- nattrs = sizeof(pa6t_attrs) / sizeof(struct sysdev_attribute); -+ nattrs = sizeof(pa6t_attrs) / sizeof(struct device_attribute); - pmc_attrs = NULL; - break; - #endif /* HAS_PPC_PMC_PA6T */ -@@ -374,24 +373,24 @@ static void __cpuinit register_cpu_onlin - } - - for (i = 0; i < nattrs; i++) -- sysdev_create_file(s, &attrs[i]); -+ device_create_file(s, &attrs[i]); - - if (pmc_attrs) - for (i = 0; i < cur_cpu_spec->num_pmcs; i++) -- sysdev_create_file(s, &pmc_attrs[i]); -+ device_create_file(s, &pmc_attrs[i]); - - #ifdef CONFIG_PPC64 - if (cpu_has_feature(CPU_FTR_MMCRA)) -- sysdev_create_file(s, &attr_mmcra); -+ device_create_file(s, &dev_attr_mmcra); - - if (cpu_has_feature(CPU_FTR_PURR)) -- sysdev_create_file(s, &attr_purr); -+ device_create_file(s, &dev_attr_purr); - - if (cpu_has_feature(CPU_FTR_SPURR)) -- sysdev_create_file(s, &attr_spurr); -+ device_create_file(s, &dev_attr_spurr); - - if (cpu_has_feature(CPU_FTR_DSCR)) -- sysdev_create_file(s, &attr_dscr); -+ device_create_file(s, &dev_attr_dscr); - #endif /* CONFIG_PPC64 */ - - cacheinfo_cpu_online(cpu); -@@ -401,8 +400,8 @@ static void __cpuinit register_cpu_onlin - static void unregister_cpu_online(unsigned int cpu) - { - struct cpu *c = &per_cpu(cpu_devices, cpu); -- struct sys_device *s = &c->sysdev; -- struct sysdev_attribute *attrs, *pmc_attrs; -+ struct device *s = &c->dev; -+ struct device_attribute *attrs, *pmc_attrs; - int i, nattrs; - - BUG_ON(!c->hotpluggable); -@@ -410,7 +409,7 @@ static void unregister_cpu_online(unsign - #ifdef CONFIG_PPC64 - if (!firmware_has_feature(FW_FEATURE_ISERIES) && - cpu_has_feature(CPU_FTR_SMT)) -- sysdev_remove_file(s, &attr_smt_snooze_delay); -+ device_remove_file(s, &dev_attr_smt_snooze_delay); - #endif - - /* PMC stuff */ -@@ -418,14 +417,14 @@ static void unregister_cpu_online(unsign - #ifdef HAS_PPC_PMC_IBM - case PPC_PMC_IBM: - attrs = ibm_common_attrs; -- nattrs = sizeof(ibm_common_attrs) / sizeof(struct sysdev_attribute); -+ nattrs = sizeof(ibm_common_attrs) / sizeof(struct device_attribute); - pmc_attrs = classic_pmc_attrs; - break; - #endif /* HAS_PPC_PMC_IBM */ - #ifdef HAS_PPC_PMC_G4 - case PPC_PMC_G4: - attrs = g4_common_attrs; -- nattrs = sizeof(g4_common_attrs) / sizeof(struct sysdev_attribute); -+ nattrs = sizeof(g4_common_attrs) / sizeof(struct device_attribute); - pmc_attrs = classic_pmc_attrs; - break; - #endif /* HAS_PPC_PMC_G4 */ -@@ -433,7 +432,7 @@ static void unregister_cpu_online(unsign - case PPC_PMC_PA6T: - /* PA Semi starts counting at PMC0 */ - attrs = pa6t_attrs; -- nattrs = sizeof(pa6t_attrs) / sizeof(struct sysdev_attribute); -+ nattrs = sizeof(pa6t_attrs) / sizeof(struct device_attribute); - pmc_attrs = NULL; - break; - #endif /* HAS_PPC_PMC_PA6T */ -@@ -444,24 +443,24 @@ static void unregister_cpu_online(unsign - } - - for (i = 0; i < nattrs; i++) -- sysdev_remove_file(s, &attrs[i]); -+ device_remove_file(s, &attrs[i]); - - if (pmc_attrs) - for (i = 0; i < cur_cpu_spec->num_pmcs; i++) -- sysdev_remove_file(s, &pmc_attrs[i]); -+ device_remove_file(s, &pmc_attrs[i]); - - #ifdef CONFIG_PPC64 - if (cpu_has_feature(CPU_FTR_MMCRA)) -- sysdev_remove_file(s, &attr_mmcra); -+ device_remove_file(s, &dev_attr_mmcra); - - if (cpu_has_feature(CPU_FTR_PURR)) -- sysdev_remove_file(s, &attr_purr); -+ device_remove_file(s, &dev_attr_purr); - - if (cpu_has_feature(CPU_FTR_SPURR)) -- sysdev_remove_file(s, &attr_spurr); -+ device_remove_file(s, &dev_attr_spurr); - - if (cpu_has_feature(CPU_FTR_DSCR)) -- sysdev_remove_file(s, &attr_dscr); -+ device_remove_file(s, &dev_attr_dscr); - #endif /* CONFIG_PPC64 */ - - cacheinfo_cpu_offline(cpu); -@@ -513,70 +512,70 @@ static struct notifier_block __cpuinitda - - static DEFINE_MUTEX(cpu_mutex); - --int cpu_add_sysdev_attr(struct sysdev_attribute *attr) -+int cpu_add_dev_attr(struct device_attribute *attr) - { - int cpu; - - mutex_lock(&cpu_mutex); - - for_each_possible_cpu(cpu) { -- sysdev_create_file(get_cpu_sysdev(cpu), attr); -+ device_create_file(get_cpu_device(cpu), attr); - } - - mutex_unlock(&cpu_mutex); - return 0; - } --EXPORT_SYMBOL_GPL(cpu_add_sysdev_attr); -+EXPORT_SYMBOL_GPL(cpu_add_dev_attr); - --int cpu_add_sysdev_attr_group(struct attribute_group *attrs) -+int cpu_add_dev_attr_group(struct attribute_group *attrs) - { - int cpu; -- struct sys_device *sysdev; -+ struct device *dev; - int ret; - - mutex_lock(&cpu_mutex); - - for_each_possible_cpu(cpu) { -- sysdev = get_cpu_sysdev(cpu); -- ret = sysfs_create_group(&sysdev->kobj, attrs); -+ dev = get_cpu_device(cpu); -+ ret = sysfs_create_group(&dev->kobj, attrs); - WARN_ON(ret != 0); - } - - mutex_unlock(&cpu_mutex); - return 0; - } --EXPORT_SYMBOL_GPL(cpu_add_sysdev_attr_group); -+EXPORT_SYMBOL_GPL(cpu_add_dev_attr_group); - - --void cpu_remove_sysdev_attr(struct sysdev_attribute *attr) -+void cpu_remove_dev_attr(struct device_attribute *attr) - { - int cpu; - - mutex_lock(&cpu_mutex); - - for_each_possible_cpu(cpu) { -- sysdev_remove_file(get_cpu_sysdev(cpu), attr); -+ device_remove_file(get_cpu_device(cpu), attr); - } - - mutex_unlock(&cpu_mutex); - } --EXPORT_SYMBOL_GPL(cpu_remove_sysdev_attr); -+EXPORT_SYMBOL_GPL(cpu_remove_dev_attr); - --void cpu_remove_sysdev_attr_group(struct attribute_group *attrs) -+void cpu_remove_dev_attr_group(struct attribute_group *attrs) - { - int cpu; -- struct sys_device *sysdev; -+ struct device *dev; - - mutex_lock(&cpu_mutex); - - for_each_possible_cpu(cpu) { -- sysdev = get_cpu_sysdev(cpu); -- sysfs_remove_group(&sysdev->kobj, attrs); -+ dev = get_cpu_device(cpu); -+ sysfs_remove_group(&dev->kobj, attrs); - } - - mutex_unlock(&cpu_mutex); - } --EXPORT_SYMBOL_GPL(cpu_remove_sysdev_attr_group); -+EXPORT_SYMBOL_GPL(cpu_remove_dev_attr_group); - - - /* NUMA stuff */ -@@ -590,7 +589,7 @@ static void register_nodes(void) - register_one_node(i); - } - --int sysfs_add_device_to_node(struct sys_device *dev, int nid) -+int sysfs_add_device_to_node(struct device *dev, int nid) - { - struct node *node = &node_devices[nid]; - return sysfs_create_link(&node->sysdev.kobj, &dev->kobj, -@@ -598,7 +597,7 @@ int sysfs_add_device_to_node(struct sys_ - } - EXPORT_SYMBOL_GPL(sysfs_add_device_to_node); - --void sysfs_remove_device_from_node(struct sys_device *dev, int nid) -+void sysfs_remove_device_from_node(struct device *dev, int nid) - { - struct node *node = &node_devices[nid]; - sysfs_remove_link(&node->sysdev.kobj, kobject_name(&dev->kobj)); -@@ -614,14 +613,14 @@ static void register_nodes(void) - #endif - - /* Only valid if CPU is present. */ --static ssize_t show_physical_id(struct sys_device *dev, -- struct sysdev_attribute *attr, char *buf) -+static ssize_t show_physical_id(struct device *dev, -+ struct device_attribute *attr, char *buf) - { -- struct cpu *cpu = container_of(dev, struct cpu, sysdev); -+ struct cpu *cpu = container_of(dev, struct cpu, dev); - -- return sprintf(buf, "%d\n", get_hard_smp_processor_id(cpu->sysdev.id)); -+ return sprintf(buf, "%d\n", get_hard_smp_processor_id(cpu->dev.id)); - } --static SYSDEV_ATTR(physical_id, 0444, show_physical_id, NULL); -+static DEVICE_ATTR(physical_id, 0444, show_physical_id, NULL); - - static int __init topology_init(void) - { -@@ -646,7 +645,7 @@ static int __init topology_init(void) - if (cpu_online(cpu) || c->hotpluggable) { - register_cpu(c, cpu); - -- sysdev_create_file(&c->sysdev, &attr_physical_id); -+ device_create_file(&c->dev, &dev_attr_physical_id); - } - - if (cpu_online(cpu)) ---- a/arch/powerpc/mm/numa.c -+++ b/arch/powerpc/mm/numa.c -@@ -1462,7 +1462,7 @@ int arch_update_cpu_topology(void) - { - int cpu, nid, old_nid; - unsigned int associativity[VPHN_ASSOC_BUFSIZE] = {0}; -- struct sys_device *sysdev; -+ struct device *dev; - - for_each_cpu(cpu,&cpu_associativity_changes_mask) { - vphn_get_associativity(cpu, associativity); -@@ -1483,9 +1483,9 @@ int arch_update_cpu_topology(void) - register_cpu_under_node(cpu, nid); - put_online_cpus(); - -- sysdev = get_cpu_sysdev(cpu); -- if (sysdev) -- kobject_uevent(&sysdev->kobj, KOBJ_CHANGE); -+ dev = get_cpu_device(cpu); -+ if (dev) -+ kobject_uevent(&dev->kobj, KOBJ_CHANGE); - } - - return 1; ---- a/arch/powerpc/platforms/cell/cbe_thermal.c -+++ b/arch/powerpc/platforms/cell/cbe_thermal.c -@@ -46,7 +46,7 @@ - */ - - #include <linux/module.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/kernel.h> - #include <linux/cpu.h> - #include <asm/spu.h> -@@ -59,8 +59,8 @@ - #define TEMP_MIN 65 - #define TEMP_MAX 125 - --#define SYSDEV_PREFIX_ATTR(_prefix,_name,_mode) \ --struct sysdev_attribute attr_ ## _prefix ## _ ## _name = { \ -+#define DEVICE_PREFIX_ATTR(_prefix,_name,_mode) \ -+struct device_attribute attr_ ## _prefix ## _ ## _name = { \ - .attr = { .name = __stringify(_name), .mode = _mode }, \ - .show = _prefix ## _show_ ## _name, \ - .store = _prefix ## _store_ ## _name, \ -@@ -76,36 +76,36 @@ static inline u8 temp_to_reg(u8 temp) - return ((temp - TEMP_MIN) >> 1) & 0x3f; - } - --static struct cbe_pmd_regs __iomem *get_pmd_regs(struct sys_device *sysdev) -+static struct cbe_pmd_regs __iomem *get_pmd_regs(struct device *dev) - { - struct spu *spu; - -- spu = container_of(sysdev, struct spu, sysdev); -+ spu = container_of(dev, struct spu, dev); - - return cbe_get_pmd_regs(spu_devnode(spu)); - } - - /* returns the value for a given spu in a given register */ --static u8 spu_read_register_value(struct sys_device *sysdev, union spe_reg __iomem *reg) -+static u8 spu_read_register_value(struct device *dev, union spe_reg __iomem *reg) - { - union spe_reg value; - struct spu *spu; - -- spu = container_of(sysdev, struct spu, sysdev); -+ spu = container_of(dev, struct spu, dev); - value.val = in_be64(®->val); - - return value.spe[spu->spe_id]; - } - --static ssize_t spu_show_temp(struct sys_device *sysdev, struct sysdev_attribute *attr, -+static ssize_t spu_show_temp(struct device *dev, struct device_attribute *attr, - char *buf) - { - u8 value; - struct cbe_pmd_regs __iomem *pmd_regs; - -- pmd_regs = get_pmd_regs(sysdev); -+ pmd_regs = get_pmd_regs(dev); - -- value = spu_read_register_value(sysdev, &pmd_regs->ts_ctsr1); -+ value = spu_read_register_value(dev, &pmd_regs->ts_ctsr1); - - return sprintf(buf, "%d\n", reg_to_temp(value)); - } -@@ -147,48 +147,48 @@ static ssize_t store_throttle(struct cbe - return size; - } - --static ssize_t spu_show_throttle_end(struct sys_device *sysdev, -- struct sysdev_attribute *attr, char *buf) -+static ssize_t spu_show_throttle_end(struct device *dev, -+ struct device_attribute *attr, char *buf) - { -- return show_throttle(get_pmd_regs(sysdev), buf, 0); -+ return show_throttle(get_pmd_regs(dev), buf, 0); - } - --static ssize_t spu_show_throttle_begin(struct sys_device *sysdev, -- struct sysdev_attribute *attr, char *buf) -+static ssize_t spu_show_throttle_begin(struct device *dev, -+ struct device_attribute *attr, char *buf) - { -- return show_throttle(get_pmd_regs(sysdev), buf, 8); -+ return show_throttle(get_pmd_regs(dev), buf, 8); - } - --static ssize_t spu_show_throttle_full_stop(struct sys_device *sysdev, -- struct sysdev_attribute *attr, char *buf) -+static ssize_t spu_show_throttle_full_stop(struct device *dev, -+ struct device_attribute *attr, char *buf) - { -- return show_throttle(get_pmd_regs(sysdev), buf, 16); -+ return show_throttle(get_pmd_regs(dev), buf, 16); - } - --static ssize_t spu_store_throttle_end(struct sys_device *sysdev, -- struct sysdev_attribute *attr, const char *buf, size_t size) -+static ssize_t spu_store_throttle_end(struct device *dev, -+ struct device_attribute *attr, const char *buf, size_t size) - { -- return store_throttle(get_pmd_regs(sysdev), buf, size, 0); -+ return store_throttle(get_pmd_regs(dev), buf, size, 0); - } - --static ssize_t spu_store_throttle_begin(struct sys_device *sysdev, -- struct sysdev_attribute *attr, const char *buf, size_t size) -+static ssize_t spu_store_throttle_begin(struct device *dev, -+ struct device_attribute *attr, const char *buf, size_t size) - { -- return store_throttle(get_pmd_regs(sysdev), buf, size, 8); -+ return store_throttle(get_pmd_regs(dev), buf, size, 8); - } - --static ssize_t spu_store_throttle_full_stop(struct sys_device *sysdev, -- struct sysdev_attribute *attr, const char *buf, size_t size) -+static ssize_t spu_store_throttle_full_stop(struct device *dev, -+ struct device_attribute *attr, const char *buf, size_t size) - { -- return store_throttle(get_pmd_regs(sysdev), buf, size, 16); -+ return store_throttle(get_pmd_regs(dev), buf, size, 16); - } - --static ssize_t ppe_show_temp(struct sys_device *sysdev, char *buf, int pos) -+static ssize_t ppe_show_temp(struct device *dev, char *buf, int pos) - { - struct cbe_pmd_regs __iomem *pmd_regs; - u64 value; - -- pmd_regs = cbe_get_cpu_pmd_regs(sysdev->id); -+ pmd_regs = cbe_get_cpu_pmd_regs(dev->id); - value = in_be64(&pmd_regs->ts_ctsr2); - - value = (value >> pos) & 0x3f; -@@ -199,64 +199,64 @@ static ssize_t ppe_show_temp(struct sys_ - - /* shows the temperature of the DTS on the PPE, - * located near the linear thermal sensor */ --static ssize_t ppe_show_temp0(struct sys_device *sysdev, -- struct sysdev_attribute *attr, char *buf) -+static ssize_t ppe_show_temp0(struct device *dev, -+ struct device_attribute *attr, char *buf) - { -- return ppe_show_temp(sysdev, buf, 32); -+ return ppe_show_temp(dev, buf, 32); - } - - /* shows the temperature of the second DTS on the PPE */ --static ssize_t ppe_show_temp1(struct sys_device *sysdev, -- struct sysdev_attribute *attr, char *buf) -+static ssize_t ppe_show_temp1(struct device *dev, -+ struct device_attribute *attr, char *buf) - { -- return ppe_show_temp(sysdev, buf, 0); -+ return ppe_show_temp(dev, buf, 0); - } - --static ssize_t ppe_show_throttle_end(struct sys_device *sysdev, -- struct sysdev_attribute *attr, char *buf) -+static ssize_t ppe_show_throttle_end(struct device *dev, -+ struct device_attribute *attr, char *buf) - { -- return show_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, 32); -+ return show_throttle(cbe_get_cpu_pmd_regs(dev->id), buf, 32); - } - --static ssize_t ppe_show_throttle_begin(struct sys_device *sysdev, -- struct sysdev_attribute *attr, char *buf) -+static ssize_t ppe_show_throttle_begin(struct device *dev, -+ struct device_attribute *attr, char *buf) - { -- return show_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, 40); -+ return show_throttle(cbe_get_cpu_pmd_regs(dev->id), buf, 40); - } - --static ssize_t ppe_show_throttle_full_stop(struct sys_device *sysdev, -- struct sysdev_attribute *attr, char *buf) -+static ssize_t ppe_show_throttle_full_stop(struct device *dev, -+ struct device_attribute *attr, char *buf) - { -- return show_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, 48); -+ return show_throttle(cbe_get_cpu_pmd_regs(dev->id), buf, 48); - } - --static ssize_t ppe_store_throttle_end(struct sys_device *sysdev, -- struct sysdev_attribute *attr, const char *buf, size_t size) -+static ssize_t ppe_store_throttle_end(struct device *dev, -+ struct device_attribute *attr, const char *buf, size_t size) - { -- return store_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, size, 32); -+ return store_throttle(cbe_get_cpu_pmd_regs(dev->id), buf, size, 32); - } - --static ssize_t ppe_store_throttle_begin(struct sys_device *sysdev, -- struct sysdev_attribute *attr, const char *buf, size_t size) -+static ssize_t ppe_store_throttle_begin(struct device *dev, -+ struct device_attribute *attr, const char *buf, size_t size) - { -- return store_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, size, 40); -+ return store_throttle(cbe_get_cpu_pmd_regs(dev->id), buf, size, 40); - } - --static ssize_t ppe_store_throttle_full_stop(struct sys_device *sysdev, -- struct sysdev_attribute *attr, const char *buf, size_t size) -+static ssize_t ppe_store_throttle_full_stop(struct device *dev, -+ struct device_attribute *attr, const char *buf, size_t size) - { -- return store_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, size, 48); -+ return store_throttle(cbe_get_cpu_pmd_regs(dev->id), buf, size, 48); - } - - --static struct sysdev_attribute attr_spu_temperature = { -+static struct device_attribute attr_spu_temperature = { - .attr = {.name = "temperature", .mode = 0400 }, - .show = spu_show_temp, - }; - --static SYSDEV_PREFIX_ATTR(spu, throttle_end, 0600); --static SYSDEV_PREFIX_ATTR(spu, throttle_begin, 0600); --static SYSDEV_PREFIX_ATTR(spu, throttle_full_stop, 0600); -+static DEVICE_PREFIX_ATTR(spu, throttle_end, 0600); -+static DEVICE_PREFIX_ATTR(spu, throttle_begin, 0600); -+static DEVICE_PREFIX_ATTR(spu, throttle_full_stop, 0600); - - - static struct attribute *spu_attributes[] = { -@@ -272,19 +272,19 @@ static struct attribute_group spu_attrib - .attrs = spu_attributes, - }; - --static struct sysdev_attribute attr_ppe_temperature0 = { -+static struct device_attribute attr_ppe_temperature0 = { - .attr = {.name = "temperature0", .mode = 0400 }, - .show = ppe_show_temp0, - }; - --static struct sysdev_attribute attr_ppe_temperature1 = { -+static struct device_attribute attr_ppe_temperature1 = { - .attr = {.name = "temperature1", .mode = 0400 }, - .show = ppe_show_temp1, - }; - --static SYSDEV_PREFIX_ATTR(ppe, throttle_end, 0600); --static SYSDEV_PREFIX_ATTR(ppe, throttle_begin, 0600); --static SYSDEV_PREFIX_ATTR(ppe, throttle_full_stop, 0600); -+static DEVICE_PREFIX_ATTR(ppe, throttle_end, 0600); -+static DEVICE_PREFIX_ATTR(ppe, throttle_begin, 0600); -+static DEVICE_PREFIX_ATTR(ppe, throttle_full_stop, 0600); - - static struct attribute *ppe_attributes[] = { - &attr_ppe_temperature0.attr, -@@ -307,7 +307,7 @@ static int __init init_default_values(vo - { - int cpu; - struct cbe_pmd_regs __iomem *pmd_regs; -- struct sys_device *sysdev; -+ struct device *dev; - union ppe_spe_reg tpr; - union spe_reg str1; - u64 str2; -@@ -349,14 +349,14 @@ static int __init init_default_values(vo - - for_each_possible_cpu (cpu) { - pr_debug("processing cpu %d\n", cpu); -- sysdev = get_cpu_sysdev(cpu); -+ dev = get_cpu_device(cpu); - -- if (!sysdev) { -- pr_info("invalid sysdev pointer for cbe_thermal\n"); -+ if (!dev) { -+ pr_info("invalid dev pointer for cbe_thermal\n"); - return -EINVAL; - } - -- pmd_regs = cbe_get_cpu_pmd_regs(sysdev->id); -+ pmd_regs = cbe_get_cpu_pmd_regs(dev->id); - - if (!pmd_regs) { - pr_info("invalid CBE regs pointer for cbe_thermal\n"); -@@ -379,8 +379,8 @@ static int __init thermal_init(void) - int rc = init_default_values(); - - if (rc == 0) { -- spu_add_sysdev_attr_group(&spu_attribute_group); -- cpu_add_sysdev_attr_group(&ppe_attribute_group); -+ spu_add_dev_attr_group(&spu_attribute_group); -+ cpu_add_dev_attr_group(&ppe_attribute_group); - } - - return rc; -@@ -389,8 +389,8 @@ module_init(thermal_init); - - static void __exit thermal_exit(void) - { -- spu_remove_sysdev_attr_group(&spu_attribute_group); -- cpu_remove_sysdev_attr_group(&ppe_attribute_group); -+ spu_remove_dev_attr_group(&spu_attribute_group); -+ cpu_remove_dev_attr_group(&ppe_attribute_group); - } - module_exit(thermal_exit); - ---- a/arch/powerpc/platforms/cell/spu_base.c -+++ b/arch/powerpc/platforms/cell/spu_base.c -@@ -519,31 +519,32 @@ void spu_init_channels(struct spu *spu) - } - EXPORT_SYMBOL_GPL(spu_init_channels); - --static struct sysdev_class spu_sysdev_class = { -+static struct bus_type spu_subsys = { - .name = "spu", -+ .dev_name = "spu", - }; - --int spu_add_sysdev_attr(struct sysdev_attribute *attr) -+int spu_add_dev_attr(struct device_attribute *attr) - { - struct spu *spu; - - mutex_lock(&spu_full_list_mutex); - list_for_each_entry(spu, &spu_full_list, full_list) -- sysdev_create_file(&spu->sysdev, attr); -+ device_create_file(&spu->dev, attr); - mutex_unlock(&spu_full_list_mutex); - - return 0; - } --EXPORT_SYMBOL_GPL(spu_add_sysdev_attr); -+EXPORT_SYMBOL_GPL(spu_add_dev_attr); - --int spu_add_sysdev_attr_group(struct attribute_group *attrs) -+int spu_add_dev_attr_group(struct attribute_group *attrs) - { - struct spu *spu; - int rc = 0; - - mutex_lock(&spu_full_list_mutex); - list_for_each_entry(spu, &spu_full_list, full_list) { -- rc = sysfs_create_group(&spu->sysdev.kobj, attrs); -+ rc = sysfs_create_group(&spu->dev.kobj, attrs); - - /* we're in trouble here, but try unwinding anyway */ - if (rc) { -@@ -552,7 +553,7 @@ int spu_add_sysdev_attr_group(struct att - - list_for_each_entry_continue_reverse(spu, - &spu_full_list, full_list) -- sysfs_remove_group(&spu->sysdev.kobj, attrs); -+ sysfs_remove_group(&spu->dev.kobj, attrs); - break; - } - } -@@ -561,45 +562,45 @@ int spu_add_sysdev_attr_group(struct att - - return rc; - } --EXPORT_SYMBOL_GPL(spu_add_sysdev_attr_group); -+EXPORT_SYMBOL_GPL(spu_add_dev_attr_group); - - --void spu_remove_sysdev_attr(struct sysdev_attribute *attr) -+void spu_remove_dev_attr(struct device_attribute *attr) - { - struct spu *spu; - - mutex_lock(&spu_full_list_mutex); - list_for_each_entry(spu, &spu_full_list, full_list) -- sysdev_remove_file(&spu->sysdev, attr); -+ device_remove_file(&spu->dev, attr); - mutex_unlock(&spu_full_list_mutex); - } --EXPORT_SYMBOL_GPL(spu_remove_sysdev_attr); -+EXPORT_SYMBOL_GPL(spu_remove_dev_attr); - --void spu_remove_sysdev_attr_group(struct attribute_group *attrs) -+void spu_remove_dev_attr_group(struct attribute_group *attrs) - { - struct spu *spu; - - mutex_lock(&spu_full_list_mutex); - list_for_each_entry(spu, &spu_full_list, full_list) -- sysfs_remove_group(&spu->sysdev.kobj, attrs); -+ sysfs_remove_group(&spu->dev.kobj, attrs); - mutex_unlock(&spu_full_list_mutex); - } --EXPORT_SYMBOL_GPL(spu_remove_sysdev_attr_group); -+EXPORT_SYMBOL_GPL(spu_remove_dev_attr_group); - --static int spu_create_sysdev(struct spu *spu) -+static int spu_create_dev(struct spu *spu) - { - int ret; - -- spu->sysdev.id = spu->number; -- spu->sysdev.cls = &spu_sysdev_class; -- ret = sysdev_register(&spu->sysdev); -+ spu->dev.id = spu->number; -+ spu->dev.bus = &spu_subsys; -+ ret = device_register(&spu->dev); - if (ret) { - printk(KERN_ERR "Can't register SPU %d with sysfs\n", - spu->number); - return ret; - } - -- sysfs_add_device_to_node(&spu->sysdev, spu->node); -+ sysfs_add_device_to_node(&spu->dev, spu->node); - - return 0; - } -@@ -635,7 +636,7 @@ static int __init create_spu(void *data) - if (ret) - goto out_destroy; - -- ret = spu_create_sysdev(spu); -+ ret = spu_create_dev(spu); - if (ret) - goto out_free_irqs; - -@@ -692,10 +693,10 @@ static unsigned long long spu_acct_time( - } - - --static ssize_t spu_stat_show(struct sys_device *sysdev, -- struct sysdev_attribute *attr, char *buf) -+static ssize_t spu_stat_show(struct device *dev, -+ struct device_attribute *attr, char *buf) - { -- struct spu *spu = container_of(sysdev, struct spu, sysdev); -+ struct spu *spu = container_of(dev, struct spu, dev); - - return sprintf(buf, "%s %llu %llu %llu %llu " - "%llu %llu %llu %llu %llu %llu %llu %llu\n", -@@ -714,7 +715,7 @@ static ssize_t spu_stat_show(struct sys_ - spu->stats.libassist); - } - --static SYSDEV_ATTR(stat, 0644, spu_stat_show, NULL); -+static DEVICE_ATTR(stat, 0644, spu_stat_show, NULL); - - #ifdef CONFIG_KEXEC - -@@ -813,8 +814,8 @@ static int __init init_spu_base(void) - if (!spu_management_ops) - goto out; - -- /* create sysdev class for spus */ -- ret = sysdev_class_register(&spu_sysdev_class); -+ /* create system subsystem for spus */ -+ ret = subsys_system_register(&spu_subsys, NULL); - if (ret) - goto out; - -@@ -823,7 +824,7 @@ static int __init init_spu_base(void) - if (ret < 0) { - printk(KERN_WARNING "%s: Error initializing spus\n", - __func__); -- goto out_unregister_sysdev_class; -+ goto out_unregister_subsys; - } - - if (ret > 0) -@@ -833,15 +834,15 @@ static int __init init_spu_base(void) - xmon_register_spus(&spu_full_list); - crash_register_spus(&spu_full_list); - mutex_unlock(&spu_full_list_mutex); -- spu_add_sysdev_attr(&attr_stat); -+ spu_add_dev_attr(&dev_attr_stat); - register_syscore_ops(&spu_syscore_ops); - - spu_init_affinity(); - - return 0; - -- out_unregister_sysdev_class: -- sysdev_class_unregister(&spu_sysdev_class); -+ out_unregister_subsys: -+ bus_unregister(&spu_subsys); - out: - return ret; - } ---- a/arch/powerpc/platforms/pseries/pseries_energy.c -+++ b/arch/powerpc/platforms/pseries/pseries_energy.c -@@ -15,7 +15,7 @@ - #include <linux/errno.h> - #include <linux/init.h> - #include <linux/seq_file.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/cpu.h> - #include <linux/of.h> - #include <asm/cputhreads.h> -@@ -184,7 +184,7 @@ static ssize_t get_best_energy_list(char - return s-page; - } - --static ssize_t get_best_energy_data(struct sys_device *dev, -+static ssize_t get_best_energy_data(struct device *dev, - char *page, int activate) - { - int rc; -@@ -207,26 +207,26 @@ static ssize_t get_best_energy_data(stru - - /* Wrapper functions */ - --static ssize_t cpu_activate_hint_list_show(struct sysdev_class *class, -- struct sysdev_class_attribute *attr, char *page) -+static ssize_t cpu_activate_hint_list_show(struct device *dev, -+ struct device_attribute *attr, char *page) - { - return get_best_energy_list(page, 1); - } - --static ssize_t cpu_deactivate_hint_list_show(struct sysdev_class *class, -- struct sysdev_class_attribute *attr, char *page) -+static ssize_t cpu_deactivate_hint_list_show(struct device *dev, -+ struct device_attribute *attr, char *page) - { - return get_best_energy_list(page, 0); - } - --static ssize_t percpu_activate_hint_show(struct sys_device *dev, -- struct sysdev_attribute *attr, char *page) -+static ssize_t percpu_activate_hint_show(struct device *dev, -+ struct device_attribute *attr, char *page) - { - return get_best_energy_data(dev, page, 1); - } - --static ssize_t percpu_deactivate_hint_show(struct sys_device *dev, -- struct sysdev_attribute *attr, char *page) -+static ssize_t percpu_deactivate_hint_show(struct device *dev, -+ struct device_attribute *attr, char *page) - { - return get_best_energy_data(dev, page, 0); - } -@@ -241,48 +241,48 @@ static ssize_t percpu_deactivate_hint_sh - * Per-cpu value of the hint - */ - --struct sysdev_class_attribute attr_cpu_activate_hint_list = -- _SYSDEV_CLASS_ATTR(pseries_activate_hint_list, 0444, -+struct device_attribute attr_cpu_activate_hint_list = -+ __ATTR(pseries_activate_hint_list, 0444, - cpu_activate_hint_list_show, NULL); - --struct sysdev_class_attribute attr_cpu_deactivate_hint_list = -- _SYSDEV_CLASS_ATTR(pseries_deactivate_hint_list, 0444, -+struct device_attribute attr_cpu_deactivate_hint_list = -+ __ATTR(pseries_deactivate_hint_list, 0444, - cpu_deactivate_hint_list_show, NULL); - --struct sysdev_attribute attr_percpu_activate_hint = -- _SYSDEV_ATTR(pseries_activate_hint, 0444, -+struct device_attribute attr_percpu_activate_hint = -+ __ATTR(pseries_activate_hint, 0444, - percpu_activate_hint_show, NULL); - --struct sysdev_attribute attr_percpu_deactivate_hint = -- _SYSDEV_ATTR(pseries_deactivate_hint, 0444, -+struct device_attribute attr_percpu_deactivate_hint = -+ __ATTR(pseries_deactivate_hint, 0444, - percpu_deactivate_hint_show, NULL); - - static int __init pseries_energy_init(void) - { - int cpu, err; -- struct sys_device *cpu_sys_dev; -+ struct device *cpu_dev; - - if (!check_for_h_best_energy()) { - printk(KERN_INFO "Hypercall H_BEST_ENERGY not supported\n"); - return 0; - } - /* Create the sysfs files */ -- err = sysfs_create_file(&cpu_sysdev_class.kset.kobj, -- &attr_cpu_activate_hint_list.attr); -+ err = device_create_file(cpu_subsys.dev_root, -+ &attr_cpu_activate_hint_list); - if (!err) -- err = sysfs_create_file(&cpu_sysdev_class.kset.kobj, -- &attr_cpu_deactivate_hint_list.attr); -+ err = device_create_file(cpu_subsys.dev_root, -+ &attr_cpu_deactivate_hint_list); - - if (err) - return err; - for_each_possible_cpu(cpu) { -- cpu_sys_dev = get_cpu_sysdev(cpu); -- err = sysfs_create_file(&cpu_sys_dev->kobj, -- &attr_percpu_activate_hint.attr); -+ cpu_dev = get_cpu_device(cpu); -+ err = device_create_file(cpu_dev, -+ &attr_percpu_activate_hint); - if (err) - break; -- err = sysfs_create_file(&cpu_sys_dev->kobj, -- &attr_percpu_deactivate_hint.attr); -+ err = device_create_file(cpu_dev, -+ &attr_percpu_deactivate_hint); - if (err) - break; - } -@@ -298,23 +298,20 @@ static int __init pseries_energy_init(vo - static void __exit pseries_energy_cleanup(void) - { - int cpu; -- struct sys_device *cpu_sys_dev; -+ struct device *cpu_dev; - - if (!sysfs_entries) - return; - - /* Remove the sysfs files */ -- sysfs_remove_file(&cpu_sysdev_class.kset.kobj, -- &attr_cpu_activate_hint_list.attr); -- -- sysfs_remove_file(&cpu_sysdev_class.kset.kobj, -- &attr_cpu_deactivate_hint_list.attr); -+ device_remove_file(cpu_subsys.dev_root, &attr_cpu_activate_hint_list); -+ device_remove_file(cpu_subsys.dev_root, &attr_cpu_deactivate_hint_list); - - for_each_possible_cpu(cpu) { -- cpu_sys_dev = get_cpu_sysdev(cpu); -- sysfs_remove_file(&cpu_sys_dev->kobj, -+ cpu_dev = get_cpu_device(cpu); -+ sysfs_remove_file(&cpu_dev->kobj, - &attr_percpu_activate_hint.attr); -- sysfs_remove_file(&cpu_sys_dev->kobj, -+ sysfs_remove_file(&cpu_dev->kobj, - &attr_percpu_deactivate_hint.attr); - } - } ---- a/arch/powerpc/sysdev/ppc4xx_cpm.c -+++ b/arch/powerpc/sysdev/ppc4xx_cpm.c -@@ -179,12 +179,12 @@ static struct kobj_attribute cpm_idle_at - - static void cpm_idle_config_sysfs(void) - { -- struct sys_device *sys_dev; -+ struct device *dev; - unsigned long ret; - -- sys_dev = get_cpu_sysdev(0); -+ dev = get_cpu_device(0); - -- ret = sysfs_create_file(&sys_dev->kobj, -+ ret = sysfs_create_file(&dev->kobj, - &cpm_idle_attr.attr); - if (ret) - printk(KERN_WARNING ---- a/arch/s390/kernel/smp.c -+++ b/arch/s390/kernel/smp.c -@@ -831,8 +831,8 @@ int setup_profiling_timer(unsigned int m - } - - #ifdef CONFIG_HOTPLUG_CPU --static ssize_t cpu_configure_show(struct sys_device *dev, -- struct sysdev_attribute *attr, char *buf) -+static ssize_t cpu_configure_show(struct device *dev, -+ struct device_attribute *attr, char *buf) - { - ssize_t count; - -@@ -842,8 +842,8 @@ static ssize_t cpu_configure_show(struct - return count; - } - --static ssize_t cpu_configure_store(struct sys_device *dev, -- struct sysdev_attribute *attr, -+static ssize_t cpu_configure_store(struct device *dev, -+ struct device_attribute *attr, - const char *buf, size_t count) - { - int cpu = dev->id; -@@ -889,11 +889,11 @@ out: - put_online_cpus(); - return rc ? rc : count; - } --static SYSDEV_ATTR(configure, 0644, cpu_configure_show, cpu_configure_store); -+static DEVICE_ATTR(configure, 0644, cpu_configure_show, cpu_configure_store); - #endif /* CONFIG_HOTPLUG_CPU */ - --static ssize_t cpu_polarization_show(struct sys_device *dev, -- struct sysdev_attribute *attr, char *buf) -+static ssize_t cpu_polarization_show(struct device *dev, -+ struct device_attribute *attr, char *buf) - { - int cpu = dev->id; - ssize_t count; -@@ -919,22 +919,22 @@ static ssize_t cpu_polarization_show(str - mutex_unlock(&smp_cpu_state_mutex); - return count; - } --static SYSDEV_ATTR(polarization, 0444, cpu_polarization_show, NULL); -+static DEVICE_ATTR(polarization, 0444, cpu_polarization_show, NULL); - --static ssize_t show_cpu_address(struct sys_device *dev, -- struct sysdev_attribute *attr, char *buf) -+static ssize_t show_cpu_address(struct device *dev, -+ struct device_attribute *attr, char *buf) - { - return sprintf(buf, "%d\n", __cpu_logical_map[dev->id]); - } --static SYSDEV_ATTR(address, 0444, show_cpu_address, NULL); -+static DEVICE_ATTR(address, 0444, show_cpu_address, NULL); - - - static struct attribute *cpu_common_attrs[] = { - #ifdef CONFIG_HOTPLUG_CPU -- &attr_configure.attr, -+ &dev_attr_configure.attr, - #endif -- &attr_address.attr, -- &attr_polarization.attr, -+ &dev_attr_address.attr, -+ &dev_attr_polarization.attr, - NULL, - }; - -@@ -942,8 +942,8 @@ static struct attribute_group cpu_common - .attrs = cpu_common_attrs, - }; - --static ssize_t show_capability(struct sys_device *dev, -- struct sysdev_attribute *attr, char *buf) -+static ssize_t show_capability(struct device *dev, -+ struct device_attribute *attr, char *buf) - { - unsigned int capability; - int rc; -@@ -953,10 +953,10 @@ static ssize_t show_capability(struct sy - return rc; - return sprintf(buf, "%u\n", capability); - } --static SYSDEV_ATTR(capability, 0444, show_capability, NULL); -+static DEVICE_ATTR(capability, 0444, show_capability, NULL); - --static ssize_t show_idle_count(struct sys_device *dev, -- struct sysdev_attribute *attr, char *buf) -+static ssize_t show_idle_count(struct device *dev, -+ struct device_attribute *attr, char *buf) - { - struct s390_idle_data *idle; - unsigned long long idle_count; -@@ -976,10 +976,10 @@ repeat: - goto repeat; - return sprintf(buf, "%llu\n", idle_count); - } --static SYSDEV_ATTR(idle_count, 0444, show_idle_count, NULL); -+static DEVICE_ATTR(idle_count, 0444, show_idle_count, NULL); - --static ssize_t show_idle_time(struct sys_device *dev, -- struct sysdev_attribute *attr, char *buf) -+static ssize_t show_idle_time(struct device *dev, -+ struct device_attribute *attr, char *buf) - { - struct s390_idle_data *idle; - unsigned long long now, idle_time, idle_enter; -@@ -1001,12 +1001,12 @@ repeat: - goto repeat; - return sprintf(buf, "%llu\n", idle_time >> 12); - } --static SYSDEV_ATTR(idle_time_us, 0444, show_idle_time, NULL); -+static DEVICE_ATTR(idle_time_us, 0444, show_idle_time, NULL); - - static struct attribute *cpu_online_attrs[] = { -- &attr_capability.attr, -- &attr_idle_count.attr, -- &attr_idle_time_us.attr, -+ &dev_attr_capability.attr, -+ &dev_attr_idle_count.attr, -+ &dev_attr_idle_time_us.attr, - NULL, - }; - -@@ -1019,7 +1019,7 @@ static int __cpuinit smp_cpu_notify(stru - { - unsigned int cpu = (unsigned int)(long)hcpu; - struct cpu *c = &per_cpu(cpu_devices, cpu); -- struct sys_device *s = &c->sysdev; -+ struct device *s = &c->dev; - struct s390_idle_data *idle; - int err = 0; - -@@ -1045,7 +1045,7 @@ static struct notifier_block __cpuinitda - static int __devinit smp_add_present_cpu(int cpu) - { - struct cpu *c = &per_cpu(cpu_devices, cpu); -- struct sys_device *s = &c->sysdev; -+ struct device *s = &c->dev; - int rc; - - c->hotpluggable = 1; -@@ -1098,8 +1098,8 @@ out: - return rc; - } - --static ssize_t __ref rescan_store(struct sysdev_class *class, -- struct sysdev_class_attribute *attr, -+static ssize_t __ref rescan_store(struct device *dev, -+ struct device_attribute *attr, - const char *buf, - size_t count) - { -@@ -1108,11 +1108,11 @@ static ssize_t __ref rescan_store(struct - rc = smp_rescan_cpus(); - return rc ? rc : count; - } --static SYSDEV_CLASS_ATTR(rescan, 0200, NULL, rescan_store); -+static DEVICE_ATTR(rescan, 0200, NULL, rescan_store); - #endif /* CONFIG_HOTPLUG_CPU */ - --static ssize_t dispatching_show(struct sysdev_class *class, -- struct sysdev_class_attribute *attr, -+static ssize_t dispatching_show(struct device *dev, -+ struct device_attribute *attr, - char *buf) - { - ssize_t count; -@@ -1123,8 +1123,8 @@ static ssize_t dispatching_show(struct s - return count; - } - --static ssize_t dispatching_store(struct sysdev_class *dev, -- struct sysdev_class_attribute *attr, -+static ssize_t dispatching_store(struct device *dev, -+ struct device_attribute *attr, - const char *buf, - size_t count) - { -@@ -1148,7 +1148,7 @@ out: - put_online_cpus(); - return rc ? rc : count; - } --static SYSDEV_CLASS_ATTR(dispatching, 0644, dispatching_show, -+static DEVICE_ATTR(dispatching, 0644, dispatching_show, - dispatching_store); - - static int __init topology_init(void) -@@ -1159,11 +1159,11 @@ static int __init topology_init(void) - register_cpu_notifier(&smp_cpu_nb); - - #ifdef CONFIG_HOTPLUG_CPU -- rc = sysdev_class_create_file(&cpu_sysdev_class, &attr_rescan); -+ rc = device_create_file(cpu_subsys.dev_root, &dev_attr_rescan); - if (rc) - return rc; - #endif -- rc = sysdev_class_create_file(&cpu_sysdev_class, &attr_dispatching); -+ rc = device_create_file(cpu_subsys.dev_root, &dev_attr_dispatching); - if (rc) - return rc; - for_each_present_cpu(cpu) { ---- a/arch/s390/kernel/topology.c -+++ b/arch/s390/kernel/topology.c -@@ -261,7 +261,7 @@ void store_topology(struct sysinfo_15_1_ - int arch_update_cpu_topology(void) - { - struct sysinfo_15_1_x *info = tl_info; -- struct sys_device *sysdev; -+ struct device *dev; - int cpu; - - if (!MACHINE_HAS_TOPOLOGY) { -@@ -273,8 +273,8 @@ int arch_update_cpu_topology(void) - tl_to_cores(info); - update_cpu_core_map(); - for_each_online_cpu(cpu) { -- sysdev = get_cpu_sysdev(cpu); -- kobject_uevent(&sysdev->kobj, KOBJ_CHANGE); -+ dev = get_cpu_device(cpu); -+ kobject_uevent(&dev->kobj, KOBJ_CHANGE); - } - return 1; - } ---- a/arch/sh/kernel/cpu/sh4/sq.c -+++ b/arch/sh/kernel/cpu/sh4/sq.c -@@ -13,7 +13,7 @@ - #include <linux/init.h> - #include <linux/cpu.h> - #include <linux/bitmap.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/kernel.h> - #include <linux/module.h> - #include <linux/slab.h> -@@ -337,9 +337,9 @@ static struct kobj_type ktype_percpu_ent - .default_attrs = sq_sysfs_attrs, - }; - --static int __devinit sq_sysdev_add(struct sys_device *sysdev) -+static int __devinit sq_dev_add(struct device *dev) - { -- unsigned int cpu = sysdev->id; -+ unsigned int cpu = dev->id; - struct kobject *kobj; - int error; - -@@ -348,25 +348,27 @@ static int __devinit sq_sysdev_add(struc - return -ENOMEM; - - kobj = sq_kobject[cpu]; -- error = kobject_init_and_add(kobj, &ktype_percpu_entry, &sysdev->kobj, -+ error = kobject_init_and_add(kobj, &ktype_percpu_entry, &dev->kobj, - "%s", "sq"); - if (!error) - kobject_uevent(kobj, KOBJ_ADD); - return error; - } - --static int __devexit sq_sysdev_remove(struct sys_device *sysdev) -+static int __devexit sq_dev_remove(struct device *dev) - { -- unsigned int cpu = sysdev->id; -+ unsigned int cpu = dev->id; - struct kobject *kobj = sq_kobject[cpu]; - - kobject_put(kobj); - return 0; - } - --static struct sysdev_driver sq_sysdev_driver = { -- .add = sq_sysdev_add, -- .remove = __devexit_p(sq_sysdev_remove), -+static struct subsys_interface sq_interface = { -+ .name = "sq" -+ .subsys = &cpu_subsys, -+ .add_dev = sq_dev_add, -+ .remove_dev = __devexit_p(sq_dev_remove), - }; - - static int __init sq_api_init(void) -@@ -386,7 +388,7 @@ static int __init sq_api_init(void) - if (unlikely(!sq_bitmap)) - goto out; - -- ret = sysdev_driver_register(&cpu_sysdev_class, &sq_sysdev_driver); -+ ret = subsys_interface_register(&sq_interface); - if (unlikely(ret != 0)) - goto out; - -@@ -401,7 +403,7 @@ out: - - static void __exit sq_api_exit(void) - { -- sysdev_driver_unregister(&cpu_sysdev_class, &sq_sysdev_driver); -+ subsys_interface_unregister(&sq_interface); - kfree(sq_bitmap); - kmem_cache_destroy(sq_cache); - } ---- a/arch/sparc/kernel/sysfs.c -+++ b/arch/sparc/kernel/sysfs.c -@@ -3,7 +3,7 @@ - * Copyright (C) 2007 David S. Miller <davem@davemloft.net> - */ - #include <linux/sched.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/cpu.h> - #include <linux/smp.h> - #include <linux/percpu.h> -@@ -16,13 +16,13 @@ - static DEFINE_PER_CPU(struct hv_mmu_statistics, mmu_stats) __attribute__((aligned(64))); - - #define SHOW_MMUSTAT_ULONG(NAME) \ --static ssize_t show_##NAME(struct sys_device *dev, \ -- struct sysdev_attribute *attr, char *buf) \ -+static ssize_t show_##NAME(struct device *dev, \ -+ struct device_attribute *attr, char *buf) \ - { \ - struct hv_mmu_statistics *p = &per_cpu(mmu_stats, dev->id); \ - return sprintf(buf, "%lu\n", p->NAME); \ - } \ --static SYSDEV_ATTR(NAME, 0444, show_##NAME, NULL) -+static DEVICE_ATTR(NAME, 0444, show_##NAME, NULL) - - SHOW_MMUSTAT_ULONG(immu_tsb_hits_ctx0_8k_tte); - SHOW_MMUSTAT_ULONG(immu_tsb_ticks_ctx0_8k_tte); -@@ -58,38 +58,38 @@ SHOW_MMUSTAT_ULONG(dmmu_tsb_hits_ctxnon0 - SHOW_MMUSTAT_ULONG(dmmu_tsb_ticks_ctxnon0_256mb_tte); - - static struct attribute *mmu_stat_attrs[] = { -- &attr_immu_tsb_hits_ctx0_8k_tte.attr, -- &attr_immu_tsb_ticks_ctx0_8k_tte.attr, -- &attr_immu_tsb_hits_ctx0_64k_tte.attr, -- &attr_immu_tsb_ticks_ctx0_64k_tte.attr, -- &attr_immu_tsb_hits_ctx0_4mb_tte.attr, -- &attr_immu_tsb_ticks_ctx0_4mb_tte.attr, -- &attr_immu_tsb_hits_ctx0_256mb_tte.attr, -- &attr_immu_tsb_ticks_ctx0_256mb_tte.attr, -- &attr_immu_tsb_hits_ctxnon0_8k_tte.attr, -- &attr_immu_tsb_ticks_ctxnon0_8k_tte.attr, -- &attr_immu_tsb_hits_ctxnon0_64k_tte.attr, -- &attr_immu_tsb_ticks_ctxnon0_64k_tte.attr, -- &attr_immu_tsb_hits_ctxnon0_4mb_tte.attr, -- &attr_immu_tsb_ticks_ctxnon0_4mb_tte.attr, -- &attr_immu_tsb_hits_ctxnon0_256mb_tte.attr, -- &attr_immu_tsb_ticks_ctxnon0_256mb_tte.attr, -- &attr_dmmu_tsb_hits_ctx0_8k_tte.attr, -- &attr_dmmu_tsb_ticks_ctx0_8k_tte.attr, -- &attr_dmmu_tsb_hits_ctx0_64k_tte.attr, -- &attr_dmmu_tsb_ticks_ctx0_64k_tte.attr, -- &attr_dmmu_tsb_hits_ctx0_4mb_tte.attr, -- &attr_dmmu_tsb_ticks_ctx0_4mb_tte.attr, -- &attr_dmmu_tsb_hits_ctx0_256mb_tte.attr, -- &attr_dmmu_tsb_ticks_ctx0_256mb_tte.attr, -- &attr_dmmu_tsb_hits_ctxnon0_8k_tte.attr, -- &attr_dmmu_tsb_ticks_ctxnon0_8k_tte.attr, -- &attr_dmmu_tsb_hits_ctxnon0_64k_tte.attr, -- &attr_dmmu_tsb_ticks_ctxnon0_64k_tte.attr, -- &attr_dmmu_tsb_hits_ctxnon0_4mb_tte.attr, -- &attr_dmmu_tsb_ticks_ctxnon0_4mb_tte.attr, -- &attr_dmmu_tsb_hits_ctxnon0_256mb_tte.attr, -- &attr_dmmu_tsb_ticks_ctxnon0_256mb_tte.attr, -+ &dev_attr_immu_tsb_hits_ctx0_8k_tte.attr, -+ &dev_attr_immu_tsb_ticks_ctx0_8k_tte.attr, -+ &dev_attr_immu_tsb_hits_ctx0_64k_tte.attr, -+ &dev_attr_immu_tsb_ticks_ctx0_64k_tte.attr, -+ &dev_attr_immu_tsb_hits_ctx0_4mb_tte.attr, -+ &dev_attr_immu_tsb_ticks_ctx0_4mb_tte.attr, -+ &dev_attr_immu_tsb_hits_ctx0_256mb_tte.attr, -+ &dev_attr_immu_tsb_ticks_ctx0_256mb_tte.attr, -+ &dev_attr_immu_tsb_hits_ctxnon0_8k_tte.attr, -+ &dev_attr_immu_tsb_ticks_ctxnon0_8k_tte.attr, -+ &dev_attr_immu_tsb_hits_ctxnon0_64k_tte.attr, -+ &dev_attr_immu_tsb_ticks_ctxnon0_64k_tte.attr, -+ &dev_attr_immu_tsb_hits_ctxnon0_4mb_tte.attr, -+ &dev_attr_immu_tsb_ticks_ctxnon0_4mb_tte.attr, -+ &dev_attr_immu_tsb_hits_ctxnon0_256mb_tte.attr, -+ &dev_attr_immu_tsb_ticks_ctxnon0_256mb_tte.attr, -+ &dev_attr_dmmu_tsb_hits_ctx0_8k_tte.attr, -+ &dev_attr_dmmu_tsb_ticks_ctx0_8k_tte.attr, -+ &dev_attr_dmmu_tsb_hits_ctx0_64k_tte.attr, -+ &dev_attr_dmmu_tsb_ticks_ctx0_64k_tte.attr, -+ &dev_attr_dmmu_tsb_hits_ctx0_4mb_tte.attr, -+ &dev_attr_dmmu_tsb_ticks_ctx0_4mb_tte.attr, -+ &dev_attr_dmmu_tsb_hits_ctx0_256mb_tte.attr, -+ &dev_attr_dmmu_tsb_ticks_ctx0_256mb_tte.attr, -+ &dev_attr_dmmu_tsb_hits_ctxnon0_8k_tte.attr, -+ &dev_attr_dmmu_tsb_ticks_ctxnon0_8k_tte.attr, -+ &dev_attr_dmmu_tsb_hits_ctxnon0_64k_tte.attr, -+ &dev_attr_dmmu_tsb_ticks_ctxnon0_64k_tte.attr, -+ &dev_attr_dmmu_tsb_hits_ctxnon0_4mb_tte.attr, -+ &dev_attr_dmmu_tsb_ticks_ctxnon0_4mb_tte.attr, -+ &dev_attr_dmmu_tsb_hits_ctxnon0_256mb_tte.attr, -+ &dev_attr_dmmu_tsb_ticks_ctxnon0_256mb_tte.attr, - NULL, - }; - -@@ -139,15 +139,15 @@ static unsigned long write_mmustat_enabl - return sun4v_mmustat_conf(ra, &orig_ra); - } - --static ssize_t show_mmustat_enable(struct sys_device *s, -- struct sysdev_attribute *attr, char *buf) -+static ssize_t show_mmustat_enable(struct device *s, -+ struct device_attribute *attr, char *buf) - { - unsigned long val = run_on_cpu(s->id, read_mmustat_enable, 0); - return sprintf(buf, "%lx\n", val); - } - --static ssize_t store_mmustat_enable(struct sys_device *s, -- struct sysdev_attribute *attr, const char *buf, -+static ssize_t store_mmustat_enable(struct device *s, -+ struct device_attribute *attr, const char *buf, - size_t count) - { - unsigned long val, err; -@@ -163,39 +163,39 @@ static ssize_t store_mmustat_enable(stru - return count; - } - --static SYSDEV_ATTR(mmustat_enable, 0644, show_mmustat_enable, store_mmustat_enable); -+static DEVICE_ATTR(mmustat_enable, 0644, show_mmustat_enable, store_mmustat_enable); - - static int mmu_stats_supported; - --static int register_mmu_stats(struct sys_device *s) -+static int register_mmu_stats(struct device *s) - { - if (!mmu_stats_supported) - return 0; -- sysdev_create_file(s, &attr_mmustat_enable); -+ device_create_file(s, &dev_attr_mmustat_enable); - return sysfs_create_group(&s->kobj, &mmu_stat_group); - } - - #ifdef CONFIG_HOTPLUG_CPU --static void unregister_mmu_stats(struct sys_device *s) -+static void unregister_mmu_stats(struct device *s) - { - if (!mmu_stats_supported) - return; - sysfs_remove_group(&s->kobj, &mmu_stat_group); -- sysdev_remove_file(s, &attr_mmustat_enable); -+ device_remove_file(s, &dev_attr_mmustat_enable); - } - #endif - - #define SHOW_CPUDATA_ULONG_NAME(NAME, MEMBER) \ --static ssize_t show_##NAME(struct sys_device *dev, \ -- struct sysdev_attribute *attr, char *buf) \ -+static ssize_t show_##NAME(struct device *dev, \ -+ struct device_attribute *attr, char *buf) \ - { \ - cpuinfo_sparc *c = &cpu_data(dev->id); \ - return sprintf(buf, "%lu\n", c->MEMBER); \ - } - - #define SHOW_CPUDATA_UINT_NAME(NAME, MEMBER) \ --static ssize_t show_##NAME(struct sys_device *dev, \ -- struct sysdev_attribute *attr, char *buf) \ -+static ssize_t show_##NAME(struct device *dev, \ -+ struct device_attribute *attr, char *buf) \ - { \ - cpuinfo_sparc *c = &cpu_data(dev->id); \ - return sprintf(buf, "%u\n", c->MEMBER); \ -@@ -209,14 +209,14 @@ SHOW_CPUDATA_UINT_NAME(l1_icache_line_si - SHOW_CPUDATA_UINT_NAME(l2_cache_size, ecache_size); - SHOW_CPUDATA_UINT_NAME(l2_cache_line_size, ecache_line_size); - --static struct sysdev_attribute cpu_core_attrs[] = { -- _SYSDEV_ATTR(clock_tick, 0444, show_clock_tick, NULL), -- _SYSDEV_ATTR(l1_dcache_size, 0444, show_l1_dcache_size, NULL), -- _SYSDEV_ATTR(l1_dcache_line_size, 0444, show_l1_dcache_line_size, NULL), -- _SYSDEV_ATTR(l1_icache_size, 0444, show_l1_icache_size, NULL), -- _SYSDEV_ATTR(l1_icache_line_size, 0444, show_l1_icache_line_size, NULL), -- _SYSDEV_ATTR(l2_cache_size, 0444, show_l2_cache_size, NULL), -- _SYSDEV_ATTR(l2_cache_line_size, 0444, show_l2_cache_line_size, NULL), -+static struct device_attribute cpu_core_attrs[] = { -+ __ATTR(clock_tick, 0444, show_clock_tick, NULL), -+ __ATTR(l1_dcache_size, 0444, show_l1_dcache_size, NULL), -+ __ATTR(l1_dcache_line_size, 0444, show_l1_dcache_line_size, NULL), -+ __ATTR(l1_icache_size, 0444, show_l1_icache_size, NULL), -+ __ATTR(l1_icache_line_size, 0444, show_l1_icache_line_size, NULL), -+ __ATTR(l2_cache_size, 0444, show_l2_cache_size, NULL), -+ __ATTR(l2_cache_line_size, 0444, show_l2_cache_line_size, NULL), - }; - - static DEFINE_PER_CPU(struct cpu, cpu_devices); -@@ -224,11 +224,11 @@ static DEFINE_PER_CPU(struct cpu, cpu_de - static void register_cpu_online(unsigned int cpu) - { - struct cpu *c = &per_cpu(cpu_devices, cpu); -- struct sys_device *s = &c->sysdev; -+ struct device *s = &c->dev; - int i; - - for (i = 0; i < ARRAY_SIZE(cpu_core_attrs); i++) -- sysdev_create_file(s, &cpu_core_attrs[i]); -+ device_create_file(s, &cpu_core_attrs[i]); - - register_mmu_stats(s); - } -@@ -237,12 +237,12 @@ static void register_cpu_online(unsigned - static void unregister_cpu_online(unsigned int cpu) - { - struct cpu *c = &per_cpu(cpu_devices, cpu); -- struct sys_device *s = &c->sysdev; -+ struct device *s = &c->dev; - int i; - - unregister_mmu_stats(s); - for (i = 0; i < ARRAY_SIZE(cpu_core_attrs); i++) -- sysdev_remove_file(s, &cpu_core_attrs[i]); -+ device_remove_file(s, &cpu_core_attrs[i]); - } - #endif - ---- a/arch/tile/kernel/sysfs.c -+++ b/arch/tile/kernel/sysfs.c -@@ -14,7 +14,7 @@ - * /sys entry support. - */ - --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/cpu.h> - #include <linux/slab.h> - #include <linux/smp.h> -@@ -32,55 +32,55 @@ static ssize_t get_hv_confstr(char *page - return n; - } - --static ssize_t chip_width_show(struct sysdev_class *dev, -- struct sysdev_class_attribute *attr, -+static ssize_t chip_width_show(struct device *dev, -+ struct device_attribute *attr, - char *page) - { - return sprintf(page, "%u\n", smp_width); - } --static SYSDEV_CLASS_ATTR(chip_width, 0444, chip_width_show, NULL); -+static DEVICE_ATTR(chip_width, 0444, chip_width_show, NULL); - --static ssize_t chip_height_show(struct sysdev_class *dev, -- struct sysdev_class_attribute *attr, -+static ssize_t chip_height_show(struct device *dev, -+ struct device_attribute *attr, - char *page) - { - return sprintf(page, "%u\n", smp_height); - } --static SYSDEV_CLASS_ATTR(chip_height, 0444, chip_height_show, NULL); -+static DEVICE_ATTR(chip_height, 0444, chip_height_show, NULL); - --static ssize_t chip_serial_show(struct sysdev_class *dev, -- struct sysdev_class_attribute *attr, -+static ssize_t chip_serial_show(struct device *dev, -+ struct device_attribute *attr, - char *page) - { - return get_hv_confstr(page, HV_CONFSTR_CHIP_SERIAL_NUM); - } --static SYSDEV_CLASS_ATTR(chip_serial, 0444, chip_serial_show, NULL); -+static DEVICE_ATTR(chip_serial, 0444, chip_serial_show, NULL); - --static ssize_t chip_revision_show(struct sysdev_class *dev, -- struct sysdev_class_attribute *attr, -+static ssize_t chip_revision_show(struct device *dev, -+ struct device_attribute *attr, - char *page) - { - return get_hv_confstr(page, HV_CONFSTR_CHIP_REV); - } --static SYSDEV_CLASS_ATTR(chip_revision, 0444, chip_revision_show, NULL); -+static DEVICE_ATTR(chip_revision, 0444, chip_revision_show, NULL); - - --static ssize_t type_show(struct sysdev_class *dev, -- struct sysdev_class_attribute *attr, -+static ssize_t type_show(struct device *dev, -+ struct device_attribute *attr, - char *page) - { - return sprintf(page, "tilera\n"); - } --static SYSDEV_CLASS_ATTR(type, 0444, type_show, NULL); -+static DEVICE_ATTR(type, 0444, type_show, NULL); - - #define HV_CONF_ATTR(name, conf) \ -- static ssize_t name ## _show(struct sysdev_class *dev, \ -- struct sysdev_class_attribute *attr, \ -+ static ssize_t name ## _show(struct device *dev, \ -+ struct device_attribute *attr, \ - char *page) \ - { \ - return get_hv_confstr(page, conf); \ - } \ -- static SYSDEV_CLASS_ATTR(name, 0444, name ## _show, NULL); -+ static DEVICE_ATTR(name, 0444, name ## _show, NULL); - - HV_CONF_ATTR(version, HV_CONFSTR_HV_SW_VER) - HV_CONF_ATTR(config_version, HV_CONFSTR_HV_CONFIG_VER) -@@ -96,15 +96,15 @@ HV_CONF_ATTR(mezz_description, HV_CONFST - HV_CONF_ATTR(switch_control, HV_CONFSTR_SWITCH_CONTROL) - - static struct attribute *board_attrs[] = { -- &attr_board_part.attr, -- &attr_board_serial.attr, -- &attr_board_revision.attr, -- &attr_board_description.attr, -- &attr_mezz_part.attr, -- &attr_mezz_serial.attr, -- &attr_mezz_revision.attr, -- &attr_mezz_description.attr, -- &attr_switch_control.attr, -+ &dev_attr_board_part.attr, -+ &dev_attr_board_serial.attr, -+ &dev_attr_board_revision.attr, -+ &dev_attr_board_description.attr, -+ &dev_attr_mezz_part.attr, -+ &dev_attr_mezz_serial.attr, -+ &dev_attr_mezz_revision.attr, -+ &dev_attr_mezz_description.attr, -+ &dev_attr_switch_control.attr, - NULL - }; - -@@ -151,12 +151,11 @@ hvconfig_bin_read(struct file *filp, str - - static int __init create_sysfs_entries(void) - { -- struct sysdev_class *cls = &cpu_sysdev_class; - int err = 0; - - #define create_cpu_attr(name) \ - if (!err) \ -- err = sysfs_create_file(&cls->kset.kobj, &attr_##name.attr); -+ err = device_create_file(cpu_subsys.dev_root, &dev_attr_##name); - create_cpu_attr(chip_width); - create_cpu_attr(chip_height); - create_cpu_attr(chip_serial); -@@ -164,7 +163,7 @@ static int __init create_sysfs_entries(v - - #define create_hv_attr(name) \ - if (!err) \ -- err = sysfs_create_file(hypervisor_kobj, &attr_##name.attr); -+ err = sysfs_create_file(hypervisor_kobj, &dev_attr_##name); - create_hv_attr(type); - create_hv_attr(version); - create_hv_attr(config_version); ---- 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) { - - void mce_setup(struct mce *m); - void mce_log(struct mce *m); --DECLARE_PER_CPU(struct sys_device, mce_sysdev); -+DECLARE_PER_CPU(struct device, mce_device); - - /* - * Maximum banks number. ---- 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_attrib - - #include <linux/kobject.h> - #include <linux/sysfs.h> -- --extern struct sysdev_class cpu_sysdev_class; /* from drivers/base/cpu.c */ -+#include <linux/cpu.h> - - /* pointer to kobject for cpuX/cache */ - static DEFINE_PER_CPU(struct kobject *, ici_cache_kobject); -@@ -1073,9 +1072,9 @@ err_out: - static DECLARE_BITMAP(cache_dev_map, NR_CPUS); - - /* Add/Remove cache interface for CPU device */ --static int __cpuinit cache_add_dev(struct sys_device * sys_dev) -+static int __cpuinit cache_add_dev(struct device *dev) - { -- unsigned int cpu = sys_dev->id; -+ unsigned int cpu = dev->id; - unsigned long i, j; - struct _index_kobject *this_object; - struct _cpuid4_info *this_leaf; -@@ -1087,7 +1086,7 @@ static int __cpuinit cache_add_dev(struc - - retval = kobject_init_and_add(per_cpu(ici_cache_kobject, cpu), - &ktype_percpu_entry, -- &sys_dev->kobj, "%s", "cache"); -+ &dev->kobj, "%s", "cache"); - if (retval < 0) { - cpuid4_cache_sysfs_exit(cpu); - return retval; -@@ -1124,9 +1123,9 @@ static int __cpuinit cache_add_dev(struc - return 0; - } - --static void __cpuinit cache_remove_dev(struct sys_device * sys_dev) -+static void __cpuinit cache_remove_dev(struct device *dev) - { -- unsigned int cpu = sys_dev->id; -+ unsigned int cpu = dev->id; - unsigned long i; - - if (per_cpu(ici_cpuid4_info, cpu) == NULL) -@@ -1145,17 +1144,17 @@ static int __cpuinit cacheinfo_cpu_callb - unsigned long action, void *hcpu) - { - unsigned int cpu = (unsigned long)hcpu; -- struct sys_device *sys_dev; -+ struct device *dev; - -- sys_dev = get_cpu_sysdev(cpu); -+ dev = get_cpu_device(cpu); - switch (action) { - case CPU_ONLINE: - case CPU_ONLINE_FROZEN: -- cache_add_dev(sys_dev); -+ cache_add_dev(dev); - break; - case CPU_DEAD: - case CPU_DEAD_FROZEN: -- cache_remove_dev(sys_dev); -+ cache_remove_dev(dev); - break; - } - return NOTIFY_OK; -@@ -1174,9 +1173,9 @@ static int __cpuinit cache_sysfs_init(vo - - for_each_online_cpu(i) { - int err; -- struct sys_device *sys_dev = get_cpu_sysdev(i); -+ struct device *dev = get_cpu_device(i); - -- err = cache_add_dev(sys_dev); -+ err = cache_add_dev(dev); - if (err) - return err; - } ---- a/arch/x86/kernel/cpu/mcheck/mce-internal.h -+++ b/arch/x86/kernel/cpu/mcheck/mce-internal.h -@@ -1,4 +1,4 @@ --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <asm/mce.h> - - enum severity_level { -@@ -17,7 +17,7 @@ enum severity_level { - struct mce_bank { - u64 ctl; /* subevents to enable */ - unsigned char init; /* initialise bank? */ -- struct sysdev_attribute attr; /* sysdev attribute */ -+ struct device_attribute attr; /* device attribute */ - char attrname[ATTR_LEN]; /* attribute name */ - }; - ---- a/arch/x86/kernel/cpu/mcheck/mce.c -+++ b/arch/x86/kernel/cpu/mcheck/mce.c -@@ -19,7 +19,7 @@ - #include <linux/kernel.h> - #include <linux/percpu.h> - #include <linux/string.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/syscore_ops.h> - #include <linux/delay.h> - #include <linux/ctype.h> -@@ -1770,7 +1770,7 @@ static struct syscore_ops mce_syscore_op - }; - - /* -- * mce_sysdev: Sysfs support -+ * mce_device: Sysfs support - */ - - static void mce_cpu_restart(void *data) -@@ -1806,27 +1806,28 @@ static void mce_enable_ce(void *all) - __mcheck_cpu_init_timer(); - } - --static struct sysdev_class mce_sysdev_class = { -+static struct bus_type mce_subsys = { - .name = "machinecheck", -+ .dev_name = "machinecheck", - }; - --DEFINE_PER_CPU(struct sys_device, mce_sysdev); -+DEFINE_PER_CPU(struct device, mce_device); - - __cpuinitdata - void (*threshold_cpu_callback)(unsigned long action, unsigned int cpu); - --static inline struct mce_bank *attr_to_bank(struct sysdev_attribute *attr) -+static inline struct mce_bank *attr_to_bank(struct device_attribute *attr) - { - return container_of(attr, struct mce_bank, attr); - } - --static ssize_t show_bank(struct sys_device *s, struct sysdev_attribute *attr, -+static ssize_t show_bank(struct device *s, struct device_attribute *attr, - char *buf) - { - return sprintf(buf, "%llx\n", attr_to_bank(attr)->ctl); - } - --static ssize_t set_bank(struct sys_device *s, struct sysdev_attribute *attr, -+static ssize_t set_bank(struct device *s, struct device_attribute *attr, - const char *buf, size_t size) - { - u64 new; -@@ -1841,14 +1842,14 @@ static ssize_t set_bank(struct sys_devic - } - - static ssize_t --show_trigger(struct sys_device *s, struct sysdev_attribute *attr, char *buf) -+show_trigger(struct device *s, struct device_attribute *attr, char *buf) - { - strcpy(buf, mce_helper); - strcat(buf, "\n"); - return strlen(mce_helper) + 1; - } - --static ssize_t set_trigger(struct sys_device *s, struct sysdev_attribute *attr, -+static ssize_t set_trigger(struct device *s, struct device_attribute *attr, - const char *buf, size_t siz) - { - char *p; -@@ -1863,8 +1864,8 @@ static ssize_t set_trigger(struct sys_de - return strlen(mce_helper) + !!p; - } - --static ssize_t set_ignore_ce(struct sys_device *s, -- struct sysdev_attribute *attr, -+static ssize_t set_ignore_ce(struct device *s, -+ struct device_attribute *attr, - const char *buf, size_t size) - { - u64 new; -@@ -1887,8 +1888,8 @@ static ssize_t set_ignore_ce(struct sys_ - return size; - } - --static ssize_t set_cmci_disabled(struct sys_device *s, -- struct sysdev_attribute *attr, -+static ssize_t set_cmci_disabled(struct device *s, -+ struct device_attribute *attr, - const char *buf, size_t size) - { - u64 new; -@@ -1910,108 +1911,107 @@ static ssize_t set_cmci_disabled(struct - return size; - } - --static ssize_t store_int_with_restart(struct sys_device *s, -- struct sysdev_attribute *attr, -+static ssize_t store_int_with_restart(struct device *s, -+ struct device_attribute *attr, - const char *buf, size_t size) - { -- ssize_t ret = sysdev_store_int(s, attr, buf, size); -+ ssize_t ret = device_store_int(s, attr, buf, size); - mce_restart(); - return ret; - } - --static SYSDEV_ATTR(trigger, 0644, show_trigger, set_trigger); --static SYSDEV_INT_ATTR(tolerant, 0644, tolerant); --static SYSDEV_INT_ATTR(monarch_timeout, 0644, monarch_timeout); --static SYSDEV_INT_ATTR(dont_log_ce, 0644, mce_dont_log_ce); -- --static struct sysdev_ext_attribute attr_check_interval = { -- _SYSDEV_ATTR(check_interval, 0644, sysdev_show_int, -- store_int_with_restart), -+static DEVICE_ATTR(trigger, 0644, show_trigger, set_trigger); -+static DEVICE_INT_ATTR(tolerant, 0644, tolerant); -+static DEVICE_INT_ATTR(monarch_timeout, 0644, monarch_timeout); -+static DEVICE_INT_ATTR(dont_log_ce, 0644, mce_dont_log_ce); -+ -+static struct dev_ext_attribute dev_attr_check_interval = { -+ __ATTR(check_interval, 0644, device_show_int, store_int_with_restart), - &check_interval - }; - --static struct sysdev_ext_attribute attr_ignore_ce = { -- _SYSDEV_ATTR(ignore_ce, 0644, sysdev_show_int, set_ignore_ce), -+static struct dev_ext_attribute dev_attr_ignore_ce = { -+ __ATTR(ignore_ce, 0644, device_show_int, set_ignore_ce), - &mce_ignore_ce - }; - --static struct sysdev_ext_attribute attr_cmci_disabled = { -- _SYSDEV_ATTR(cmci_disabled, 0644, sysdev_show_int, set_cmci_disabled), -+static struct dev_ext_attribute dev_attr_cmci_disabled = { -+ __ATTR(cmci_disabled, 0644, device_show_int, set_cmci_disabled), - &mce_cmci_disabled - }; - --static struct sysdev_attribute *mce_sysdev_attrs[] = { -- &attr_tolerant.attr, -- &attr_check_interval.attr, -- &attr_trigger, -- &attr_monarch_timeout.attr, -- &attr_dont_log_ce.attr, -- &attr_ignore_ce.attr, -- &attr_cmci_disabled.attr, -+static struct device_attribute *mce_device_attrs[] = { -+ &dev_attr_tolerant.attr, -+ &dev_attr_check_interval.attr, -+ &dev_attr_trigger, -+ &dev_attr_monarch_timeout.attr, -+ &dev_attr_dont_log_ce.attr, -+ &dev_attr_ignore_ce.attr, -+ &dev_attr_cmci_disabled.attr, - NULL - }; - --static cpumask_var_t mce_sysdev_initialized; -+static cpumask_var_t mce_device_initialized; - --/* Per cpu sysdev init. All of the cpus still share the same ctrl bank: */ --static __cpuinit int mce_sysdev_create(unsigned int cpu) -+/* Per cpu device init. All of the cpus still share the same ctrl bank: */ -+static __cpuinit int mce_device_create(unsigned int cpu) - { -- struct sys_device *sysdev = &per_cpu(mce_sysdev, cpu); -+ struct device *dev = &per_cpu(mce_device, cpu); - int err; - int i, j; - - if (!mce_available(&boot_cpu_data)) - return -EIO; - -- memset(&sysdev->kobj, 0, sizeof(struct kobject)); -- sysdev->id = cpu; -- sysdev->cls = &mce_sysdev_class; -+ memset(&dev->kobj, 0, sizeof(struct kobject)); -+ dev->id = cpu; -+ dev->bus = &mce_subsys; - -- err = sysdev_register(sysdev); -+ err = device_register(dev); - if (err) - return err; - -- for (i = 0; mce_sysdev_attrs[i]; i++) { -- err = sysdev_create_file(sysdev, mce_sysdev_attrs[i]); -+ for (i = 0; mce_device_attrs[i]; i++) { -+ err = device_create_file(dev, mce_device_attrs[i]); - if (err) - goto error; - } - for (j = 0; j < banks; j++) { -- err = sysdev_create_file(sysdev, &mce_banks[j].attr); -+ err = device_create_file(dev, &mce_banks[j].attr); - if (err) - goto error2; - } -- cpumask_set_cpu(cpu, mce_sysdev_initialized); -+ cpumask_set_cpu(cpu, mce_device_initialized); - - return 0; - error2: - while (--j >= 0) -- sysdev_remove_file(sysdev, &mce_banks[j].attr); -+ device_remove_file(dev, &mce_banks[j].attr); - error: - while (--i >= 0) -- sysdev_remove_file(sysdev, mce_sysdev_attrs[i]); -+ device_remove_file(dev, mce_device_attrs[i]); - -- sysdev_unregister(sysdev); -+ device_unregister(dev); - - return err; - } - --static __cpuinit void mce_sysdev_remove(unsigned int cpu) -+static __cpuinit void mce_device_remove(unsigned int cpu) - { -- struct sys_device *sysdev = &per_cpu(mce_sysdev, cpu); -+ struct device *dev = &per_cpu(mce_device, cpu); - int i; - -- if (!cpumask_test_cpu(cpu, mce_sysdev_initialized)) -+ if (!cpumask_test_cpu(cpu, mce_device_initialized)) - return; - -- for (i = 0; mce_sysdev_attrs[i]; i++) -- sysdev_remove_file(sysdev, mce_sysdev_attrs[i]); -+ for (i = 0; mce_device_attrs[i]; i++) -+ device_remove_file(dev, mce_device_attrs[i]); - - for (i = 0; i < banks; i++) -- sysdev_remove_file(sysdev, &mce_banks[i].attr); -+ device_remove_file(dev, &mce_banks[i].attr); - -- sysdev_unregister(sysdev); -- cpumask_clear_cpu(cpu, mce_sysdev_initialized); -+ device_unregister(dev); -+ cpumask_clear_cpu(cpu, mce_device_initialized); - } - - /* Make sure there are no machine checks on offlined CPUs. */ -@@ -2061,7 +2061,7 @@ mce_cpu_callback(struct notifier_block * - switch (action) { - case CPU_ONLINE: - case CPU_ONLINE_FROZEN: -- mce_sysdev_create(cpu); -+ mce_device_create(cpu); - if (threshold_cpu_callback) - threshold_cpu_callback(action, cpu); - break; -@@ -2069,7 +2069,7 @@ mce_cpu_callback(struct notifier_block * - case CPU_DEAD_FROZEN: - if (threshold_cpu_callback) - threshold_cpu_callback(action, cpu); -- mce_sysdev_remove(cpu); -+ mce_device_remove(cpu); - break; - case CPU_DOWN_PREPARE: - case CPU_DOWN_PREPARE_FROZEN: -@@ -2103,7 +2103,7 @@ static __init void mce_init_banks(void) - - for (i = 0; i < banks; i++) { - struct mce_bank *b = &mce_banks[i]; -- struct sysdev_attribute *a = &b->attr; -+ struct device_attribute *a = &b->attr; - - sysfs_attr_init(&a->attr); - a->attr.name = b->attrname; -@@ -2123,16 +2123,16 @@ static __init int mcheck_init_device(voi - if (!mce_available(&boot_cpu_data)) - return -EIO; - -- zalloc_cpumask_var(&mce_sysdev_initialized, GFP_KERNEL); -+ zalloc_cpumask_var(&mce_device_initialized, GFP_KERNEL); - - mce_init_banks(); - -- err = sysdev_class_register(&mce_sysdev_class); -+ err = subsys_system_register(&mce_subsys, NULL); - if (err) - return err; - - for_each_online_cpu(i) { -- err = mce_sysdev_create(i); -+ err = mce_device_create(i); - if (err) - return err; - } ---- a/arch/x86/kernel/cpu/mcheck/mce_amd.c -+++ b/arch/x86/kernel/cpu/mcheck/mce_amd.c -@@ -17,7 +17,6 @@ - #include <linux/notifier.h> - #include <linux/kobject.h> - #include <linux/percpu.h> --#include <linux/sysdev.h> - #include <linux/errno.h> - #include <linux/sched.h> - #include <linux/sysfs.h> -@@ -548,7 +547,7 @@ static __cpuinit int threshold_create_ba - if (!b) - goto out; - -- err = sysfs_create_link(&per_cpu(mce_sysdev, cpu).kobj, -+ err = sysfs_create_link(&per_cpu(mce_device, cpu).kobj, - b->kobj, name); - if (err) - goto out; -@@ -571,7 +570,7 @@ static __cpuinit int threshold_create_ba - goto out; - } - -- b->kobj = kobject_create_and_add(name, &per_cpu(mce_sysdev, cpu).kobj); -+ b->kobj = kobject_create_and_add(name, &per_cpu(mce_device, cpu).kobj); - if (!b->kobj) - goto out_free; - -@@ -591,7 +590,7 @@ static __cpuinit int threshold_create_ba - if (i == cpu) - continue; - -- err = sysfs_create_link(&per_cpu(mce_sysdev, i).kobj, -+ err = sysfs_create_link(&per_cpu(mce_device, i).kobj, - b->kobj, name); - if (err) - goto out; -@@ -669,7 +668,7 @@ static void threshold_remove_bank(unsign - #ifdef CONFIG_SMP - /* sibling symlink */ - if (shared_bank[bank] && b->blocks->cpu != cpu) { -- sysfs_remove_link(&per_cpu(mce_sysdev, cpu).kobj, name); -+ sysfs_remove_link(&per_cpu(mce_device, cpu).kobj, name); - per_cpu(threshold_banks, cpu)[bank] = NULL; - - return; -@@ -681,7 +680,7 @@ static void threshold_remove_bank(unsign - if (i == cpu) - continue; - -- sysfs_remove_link(&per_cpu(mce_sysdev, i).kobj, name); -+ sysfs_remove_link(&per_cpu(mce_device, i).kobj, name); - per_cpu(threshold_banks, i)[bank] = NULL; - } - ---- a/arch/x86/kernel/cpu/mcheck/therm_throt.c -+++ b/arch/x86/kernel/cpu/mcheck/therm_throt.c -@@ -19,7 +19,6 @@ - #include <linux/kernel.h> - #include <linux/percpu.h> - #include <linux/export.h> --#include <linux/sysdev.h> - #include <linux/types.h> - #include <linux/init.h> - #include <linux/smp.h> -@@ -69,16 +68,16 @@ static atomic_t therm_throt_en = ATOMIC_ - static u32 lvtthmr_init __read_mostly; - - #ifdef CONFIG_SYSFS --#define define_therm_throt_sysdev_one_ro(_name) \ -- static SYSDEV_ATTR(_name, 0444, \ -- therm_throt_sysdev_show_##_name, \ -+#define define_therm_throt_device_one_ro(_name) \ -+ static DEVICE_ATTR(_name, 0444, \ -+ therm_throt_device_show_##_name, \ - NULL) \ - --#define define_therm_throt_sysdev_show_func(event, name) \ -+#define define_therm_throt_device_show_func(event, name) \ - \ --static ssize_t therm_throt_sysdev_show_##event##_##name( \ -- struct sys_device *dev, \ -- struct sysdev_attribute *attr, \ -+static ssize_t therm_throt_device_show_##event##_##name( \ -+ struct device *dev, \ -+ struct device_attribute *attr, \ - char *buf) \ - { \ - unsigned int cpu = dev->id; \ -@@ -95,20 +94,20 @@ static ssize_t therm_throt_sysdev_show_# - return ret; \ - } - --define_therm_throt_sysdev_show_func(core_throttle, count); --define_therm_throt_sysdev_one_ro(core_throttle_count); -+define_therm_throt_device_show_func(core_throttle, count); -+define_therm_throt_device_one_ro(core_throttle_count); - --define_therm_throt_sysdev_show_func(core_power_limit, count); --define_therm_throt_sysdev_one_ro(core_power_limit_count); -+define_therm_throt_device_show_func(core_power_limit, count); -+define_therm_throt_device_one_ro(core_power_limit_count); - --define_therm_throt_sysdev_show_func(package_throttle, count); --define_therm_throt_sysdev_one_ro(package_throttle_count); -+define_therm_throt_device_show_func(package_throttle, count); -+define_therm_throt_device_one_ro(package_throttle_count); - --define_therm_throt_sysdev_show_func(package_power_limit, count); --define_therm_throt_sysdev_one_ro(package_power_limit_count); -+define_therm_throt_device_show_func(package_power_limit, count); -+define_therm_throt_device_one_ro(package_power_limit_count); - - static struct attribute *thermal_throttle_attrs[] = { -- &attr_core_throttle_count.attr, -+ &dev_attr_core_throttle_count.attr, - NULL - }; - -@@ -223,36 +222,36 @@ static int thresh_event_valid(int event) - - #ifdef CONFIG_SYSFS - /* Add/Remove thermal_throttle interface for CPU device: */ --static __cpuinit int thermal_throttle_add_dev(struct sys_device *sys_dev, -+static __cpuinit int thermal_throttle_add_dev(struct device *dev, - unsigned int cpu) - { - int err; - struct cpuinfo_x86 *c = &cpu_data(cpu); - -- err = sysfs_create_group(&sys_dev->kobj, &thermal_attr_group); -+ err = sysfs_create_group(&dev->kobj, &thermal_attr_group); - if (err) - return err; - - if (cpu_has(c, X86_FEATURE_PLN)) -- err = sysfs_add_file_to_group(&sys_dev->kobj, -- &attr_core_power_limit_count.attr, -+ err = sysfs_add_file_to_group(&dev->kobj, -+ &dev_attr_core_power_limit_count.attr, - thermal_attr_group.name); - if (cpu_has(c, X86_FEATURE_PTS)) { -- err = sysfs_add_file_to_group(&sys_dev->kobj, -- &attr_package_throttle_count.attr, -+ err = sysfs_add_file_to_group(&dev->kobj, -+ &dev_attr_package_throttle_count.attr, - thermal_attr_group.name); - if (cpu_has(c, X86_FEATURE_PLN)) -- err = sysfs_add_file_to_group(&sys_dev->kobj, -- &attr_package_power_limit_count.attr, -+ err = sysfs_add_file_to_group(&dev->kobj, -+ &dev_attr_package_power_limit_count.attr, - thermal_attr_group.name); - } - - return err; - } - --static __cpuinit void thermal_throttle_remove_dev(struct sys_device *sys_dev) -+static __cpuinit void thermal_throttle_remove_dev(struct device *dev) - { -- sysfs_remove_group(&sys_dev->kobj, &thermal_attr_group); -+ sysfs_remove_group(&dev->kobj, &thermal_attr_group); - } - - /* Mutex protecting device creation against CPU hotplug: */ -@@ -265,16 +264,16 @@ thermal_throttle_cpu_callback(struct not - void *hcpu) - { - unsigned int cpu = (unsigned long)hcpu; -- struct sys_device *sys_dev; -+ struct device *dev; - int err = 0; - -- sys_dev = get_cpu_sysdev(cpu); -+ dev = get_cpu_device(cpu); - - switch (action) { - case CPU_UP_PREPARE: - case CPU_UP_PREPARE_FROZEN: - mutex_lock(&therm_cpu_lock); -- err = thermal_throttle_add_dev(sys_dev, cpu); -+ err = thermal_throttle_add_dev(dev, cpu); - mutex_unlock(&therm_cpu_lock); - WARN_ON(err); - break; -@@ -283,7 +282,7 @@ thermal_throttle_cpu_callback(struct not - case CPU_DEAD: - case CPU_DEAD_FROZEN: - mutex_lock(&therm_cpu_lock); -- thermal_throttle_remove_dev(sys_dev); -+ thermal_throttle_remove_dev(dev); - mutex_unlock(&therm_cpu_lock); - break; - } -@@ -310,7 +309,7 @@ static __init int thermal_throttle_init_ - #endif - /* connect live CPUs to sysfs */ - for_each_online_cpu(cpu) { -- err = thermal_throttle_add_dev(get_cpu_sysdev(cpu), cpu); -+ err = thermal_throttle_add_dev(get_cpu_device(cpu), cpu); - WARN_ON(err); - } - #ifdef CONFIG_HOTPLUG_CPU ---- 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) - return err; - } - --static ssize_t reload_store(struct sys_device *dev, -- struct sysdev_attribute *attr, -+static ssize_t reload_store(struct device *dev, -+ struct device_attribute *attr, - const char *buf, size_t size) - { - unsigned long val; -@@ -318,30 +318,30 @@ static ssize_t reload_store(struct sys_d - return ret; - } - --static ssize_t version_show(struct sys_device *dev, -- struct sysdev_attribute *attr, char *buf) -+static ssize_t version_show(struct device *dev, -+ struct device_attribute *attr, char *buf) - { - struct ucode_cpu_info *uci = ucode_cpu_info + dev->id; - - return sprintf(buf, "0x%x\n", uci->cpu_sig.rev); - } - --static ssize_t pf_show(struct sys_device *dev, -- struct sysdev_attribute *attr, char *buf) -+static ssize_t pf_show(struct device *dev, -+ struct device_attribute *attr, char *buf) - { - struct ucode_cpu_info *uci = ucode_cpu_info + dev->id; - - return sprintf(buf, "0x%x\n", uci->cpu_sig.pf); - } - --static SYSDEV_ATTR(reload, 0200, NULL, reload_store); --static SYSDEV_ATTR(version, 0400, version_show, NULL); --static SYSDEV_ATTR(processor_flags, 0400, pf_show, NULL); -+static DEVICE_ATTR(reload, 0200, NULL, reload_store); -+static DEVICE_ATTR(version, 0400, version_show, NULL); -+static DEVICE_ATTR(processor_flags, 0400, pf_show, NULL); - - static struct attribute *mc_default_attrs[] = { -- &attr_reload.attr, -- &attr_version.attr, -- &attr_processor_flags.attr, -+ &dev_attr_reload.attr, -+ &dev_attr_version.attr, -+ &dev_attr_processor_flags.attr, - NULL - }; - -@@ -405,43 +405,45 @@ static enum ucode_state microcode_update - return ustate; - } - --static int mc_sysdev_add(struct sys_device *sys_dev) -+static int mc_device_add(struct device *dev, struct subsys_interface *sif) - { -- int err, cpu = sys_dev->id; -+ int err, cpu = dev->id; - - if (!cpu_online(cpu)) - return 0; - - pr_debug("CPU%d added\n", cpu); - -- err = sysfs_create_group(&sys_dev->kobj, &mc_attr_group); -+ err = sysfs_create_group(&dev->kobj, &mc_attr_group); - if (err) - return err; - - if (microcode_init_cpu(cpu) == UCODE_ERROR) { -- sysfs_remove_group(&sys_dev->kobj, &mc_attr_group); -+ sysfs_remove_group(&dev->kobj, &mc_attr_group); - return -EINVAL; - } - - return err; - } - --static int mc_sysdev_remove(struct sys_device *sys_dev) -+static int mc_device_remove(struct device *dev, struct subsys_interface *sif) - { -- int cpu = sys_dev->id; -+ int cpu = dev->id; - - if (!cpu_online(cpu)) - return 0; - - pr_debug("CPU%d removed\n", cpu); - microcode_fini_cpu(cpu); -- sysfs_remove_group(&sys_dev->kobj, &mc_attr_group); -+ sysfs_remove_group(&dev->kobj, &mc_attr_group); - return 0; - } - --static struct sysdev_driver mc_sysdev_driver = { -- .add = mc_sysdev_add, -- .remove = mc_sysdev_remove, -+static struct subsys_interface mc_cpu_interface = { -+ .name = "microcode", -+ .subsys = &cpu_subsys, -+ .add_dev = mc_device_add, -+ .remove_dev = mc_device_remove, - }; - - /** -@@ -464,9 +466,9 @@ static __cpuinit int - mc_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu) - { - unsigned int cpu = (unsigned long)hcpu; -- struct sys_device *sys_dev; -+ struct device *dev; - -- sys_dev = get_cpu_sysdev(cpu); -+ dev = get_cpu_device(cpu); - switch (action) { - case CPU_ONLINE: - case CPU_ONLINE_FROZEN: -@@ -474,13 +476,13 @@ mc_cpu_callback(struct notifier_block *n - case CPU_DOWN_FAILED: - case CPU_DOWN_FAILED_FROZEN: - pr_debug("CPU%d added\n", cpu); -- if (sysfs_create_group(&sys_dev->kobj, &mc_attr_group)) -+ if (sysfs_create_group(&dev->kobj, &mc_attr_group)) - pr_err("Failed to create group for CPU%d\n", cpu); - break; - case CPU_DOWN_PREPARE: - case CPU_DOWN_PREPARE_FROZEN: - /* Suspend is in progress, only remove the interface */ -- sysfs_remove_group(&sys_dev->kobj, &mc_attr_group); -+ sysfs_remove_group(&dev->kobj, &mc_attr_group); - pr_debug("CPU%d removed\n", cpu); - break; - -@@ -525,7 +527,7 @@ static int __init microcode_init(void) - get_online_cpus(); - mutex_lock(µcode_mutex); - -- error = sysdev_driver_register(&cpu_sysdev_class, &mc_sysdev_driver); -+ error = subsys_interface_register(&mc_cpu_interface); - - mutex_unlock(µcode_mutex); - put_online_cpus(); -@@ -535,7 +537,7 @@ static int __init microcode_init(void) - - error = microcode_dev_init(); - if (error) -- goto out_sysdev_driver; -+ goto out_subsys_interface; - - register_syscore_ops(&mc_syscore_ops); - register_hotcpu_notifier(&mc_cpu_notifier); -@@ -545,11 +547,11 @@ static int __init microcode_init(void) - - return 0; - --out_sysdev_driver: -+out_subsys_interface: - get_online_cpus(); - mutex_lock(µcode_mutex); - -- sysdev_driver_unregister(&cpu_sysdev_class, &mc_sysdev_driver); -+ subsys_interface_unregister(&mc_cpu_interface); - - mutex_unlock(µcode_mutex); - put_online_cpus(); -@@ -571,7 +573,7 @@ static void __exit microcode_exit(void) - get_online_cpus(); - mutex_lock(µcode_mutex); - -- sysdev_driver_unregister(&cpu_sysdev_class, &mc_sysdev_driver); -+ subsys_interface_unregister(&mc_cpu_interface); - - mutex_unlock(µcode_mutex); - put_online_cpus(); ---- a/drivers/acpi/processor_driver.c -+++ b/drivers/acpi/processor_driver.c -@@ -446,7 +446,7 @@ static int __cpuinit acpi_processor_add( - { - struct acpi_processor *pr = NULL; - int result = 0; -- struct sys_device *sysdev; -+ struct device *dev; - - pr = kzalloc(sizeof(struct acpi_processor), GFP_KERNEL); - if (!pr) -@@ -491,8 +491,8 @@ static int __cpuinit acpi_processor_add( - - per_cpu(processors, pr->id) = pr; - -- sysdev = get_cpu_sysdev(pr->id); -- if (sysfs_create_link(&device->dev.kobj, &sysdev->kobj, "sysdev")) { -+ dev = get_cpu_device(pr->id); -+ if (sysfs_create_link(&device->dev.kobj, &dev->kobj, "sysdev")) { - result = -EFAULT; - goto err_free_cpumask; - } ---- a/drivers/acpi/processor_thermal.c -+++ b/drivers/acpi/processor_thermal.c -@@ -30,7 +30,6 @@ - #include <linux/module.h> - #include <linux/init.h> - #include <linux/cpufreq.h> --#include <linux/sysdev.h> - - #include <asm/uaccess.h> - ---- a/drivers/base/cpu.c -+++ b/drivers/base/cpu.c -@@ -1,8 +1,7 @@ - /* -- * drivers/base/cpu.c - basic CPU class support -+ * CPU subsystem support - */ - --#include <linux/sysdev.h> - #include <linux/module.h> - #include <linux/init.h> - #include <linux/sched.h> -@@ -14,40 +13,40 @@ - - #include "base.h" - --static struct sysdev_class_attribute *cpu_sysdev_class_attrs[]; -- --struct sysdev_class cpu_sysdev_class = { -+struct bus_type cpu_subsys = { - .name = "cpu", -- .attrs = cpu_sysdev_class_attrs, -+ .dev_name = "cpu", - }; --EXPORT_SYMBOL(cpu_sysdev_class); -+EXPORT_SYMBOL_GPL(cpu_subsys); - --static DEFINE_PER_CPU(struct sys_device *, cpu_sys_devices); -+static DEFINE_PER_CPU(struct device *, cpu_sys_devices); - - #ifdef CONFIG_HOTPLUG_CPU --static ssize_t show_online(struct sys_device *dev, struct sysdev_attribute *attr, -+static ssize_t show_online(struct device *dev, -+ struct device_attribute *attr, - char *buf) - { -- struct cpu *cpu = container_of(dev, struct cpu, sysdev); -+ struct cpu *cpu = container_of(dev, struct cpu, dev); - -- return sprintf(buf, "%u\n", !!cpu_online(cpu->sysdev.id)); -+ return sprintf(buf, "%u\n", !!cpu_online(cpu->dev.id)); - } - --static ssize_t __ref store_online(struct sys_device *dev, struct sysdev_attribute *attr, -- const char *buf, size_t count) -+static ssize_t __ref store_online(struct device *dev, -+ struct device_attribute *attr, -+ const char *buf, size_t count) - { -- struct cpu *cpu = container_of(dev, struct cpu, sysdev); -+ struct cpu *cpu = container_of(dev, struct cpu, dev); - ssize_t ret; - - cpu_hotplug_driver_lock(); - switch (buf[0]) { - case '0': -- ret = cpu_down(cpu->sysdev.id); -+ ret = cpu_down(cpu->dev.id); - if (!ret) - kobject_uevent(&dev->kobj, KOBJ_OFFLINE); - break; - case '1': -- ret = cpu_up(cpu->sysdev.id); -+ ret = cpu_up(cpu->dev.id); - if (!ret) - kobject_uevent(&dev->kobj, KOBJ_ONLINE); - break; -@@ -60,44 +59,44 @@ static ssize_t __ref store_online(struct - ret = count; - return ret; - } --static SYSDEV_ATTR(online, 0644, show_online, store_online); -+static DEVICE_ATTR(online, 0644, show_online, store_online); - - static void __cpuinit register_cpu_control(struct cpu *cpu) - { -- sysdev_create_file(&cpu->sysdev, &attr_online); -+ device_create_file(&cpu->dev, &dev_attr_online); - } - void unregister_cpu(struct cpu *cpu) - { -- int logical_cpu = cpu->sysdev.id; -+ int logical_cpu = cpu->dev.id; - - unregister_cpu_under_node(logical_cpu, cpu_to_node(logical_cpu)); - -- sysdev_remove_file(&cpu->sysdev, &attr_online); -+ device_remove_file(&cpu->dev, &dev_attr_online); - -- sysdev_unregister(&cpu->sysdev); -+ device_unregister(&cpu->dev); - per_cpu(cpu_sys_devices, logical_cpu) = NULL; - return; - } - - #ifdef CONFIG_ARCH_CPU_PROBE_RELEASE --static ssize_t cpu_probe_store(struct sysdev_class *class, -- struct sysdev_class_attribute *attr, -+static ssize_t cpu_probe_store(struct device *dev, -+ struct device_attribute *attr, - const char *buf, - size_t count) - { - return arch_cpu_probe(buf, count); - } - --static ssize_t cpu_release_store(struct sysdev_class *class, -- struct sysdev_class_attribute *attr, -+static ssize_t cpu_release_store(struct device *dev, -+ struct device_attribute *attr, - const char *buf, - size_t count) - { - return arch_cpu_release(buf, count); - } - --static SYSDEV_CLASS_ATTR(probe, S_IWUSR, NULL, cpu_probe_store); --static SYSDEV_CLASS_ATTR(release, S_IWUSR, NULL, cpu_release_store); -+static DEVICE_ATTR(probe, S_IWUSR, NULL, cpu_probe_store); -+static DEVICE_ATTR(release, S_IWUSR, NULL, cpu_release_store); - #endif /* CONFIG_ARCH_CPU_PROBE_RELEASE */ - - #else /* ... !CONFIG_HOTPLUG_CPU */ -@@ -109,15 +108,15 @@ static inline void register_cpu_control( - #ifdef CONFIG_KEXEC - #include <linux/kexec.h> - --static ssize_t show_crash_notes(struct sys_device *dev, struct sysdev_attribute *attr, -+static ssize_t show_crash_notes(struct device *dev, struct device_attribute *attr, - char *buf) - { -- struct cpu *cpu = container_of(dev, struct cpu, sysdev); -+ struct cpu *cpu = container_of(dev, struct cpu, dev); - ssize_t rc; - unsigned long long addr; - int cpunum; - -- cpunum = cpu->sysdev.id; -+ cpunum = cpu->dev.id; - - /* - * Might be reading other cpu's data based on which cpu read thread -@@ -129,7 +128,7 @@ static ssize_t show_crash_notes(struct s - rc = sprintf(buf, "%Lx\n", addr); - return rc; - } --static SYSDEV_ATTR(crash_notes, 0400, show_crash_notes, NULL); -+static DEVICE_ATTR(crash_notes, 0400, show_crash_notes, NULL); - #endif - - /* -@@ -137,12 +136,12 @@ static SYSDEV_ATTR(crash_notes, 0400, sh - */ - - struct cpu_attr { -- struct sysdev_class_attribute attr; -+ struct device_attribute attr; - const struct cpumask *const * const map; - }; - --static ssize_t show_cpus_attr(struct sysdev_class *class, -- struct sysdev_class_attribute *attr, -+static ssize_t show_cpus_attr(struct device *dev, -+ struct device_attribute *attr, - char *buf) - { - struct cpu_attr *ca = container_of(attr, struct cpu_attr, attr); -@@ -153,10 +152,10 @@ static ssize_t show_cpus_attr(struct sys - return n; - } - --#define _CPU_ATTR(name, map) \ -- { _SYSDEV_CLASS_ATTR(name, 0444, show_cpus_attr, NULL), map } -+#define _CPU_ATTR(name, map) \ -+ { __ATTR(name, 0444, show_cpus_attr, NULL), map } - --/* Keep in sync with cpu_sysdev_class_attrs */ -+/* Keep in sync with cpu_subsys_attrs */ - static struct cpu_attr cpu_attrs[] = { - _CPU_ATTR(online, &cpu_online_mask), - _CPU_ATTR(possible, &cpu_possible_mask), -@@ -166,19 +165,19 @@ static struct cpu_attr cpu_attrs[] = { - /* - * Print values for NR_CPUS and offlined cpus - */ --static ssize_t print_cpus_kernel_max(struct sysdev_class *class, -- struct sysdev_class_attribute *attr, char *buf) -+static ssize_t print_cpus_kernel_max(struct device *dev, -+ struct device_attribute *attr, char *buf) - { - int n = snprintf(buf, PAGE_SIZE-2, "%d\n", NR_CPUS - 1); - return n; - } --static SYSDEV_CLASS_ATTR(kernel_max, 0444, print_cpus_kernel_max, NULL); -+static DEVICE_ATTR(kernel_max, 0444, print_cpus_kernel_max, NULL); - - /* arch-optional setting to enable display of offline cpus >= nr_cpu_ids */ - unsigned int total_cpus; - --static ssize_t print_cpus_offline(struct sysdev_class *class, -- struct sysdev_class_attribute *attr, char *buf) -+static ssize_t print_cpus_offline(struct device *dev, -+ struct device_attribute *attr, char *buf) - { - int n = 0, len = PAGE_SIZE-2; - cpumask_var_t offline; -@@ -205,7 +204,7 @@ static ssize_t print_cpus_offline(struct - n += snprintf(&buf[n], len - n, "\n"); - return n; - } --static SYSDEV_CLASS_ATTR(offline, 0444, print_cpus_offline, NULL); -+static DEVICE_ATTR(offline, 0444, print_cpus_offline, NULL); - - /* - * register_cpu - Setup a sysfs device for a CPU. -@@ -218,57 +217,66 @@ static SYSDEV_CLASS_ATTR(offline, 0444, - int __cpuinit register_cpu(struct cpu *cpu, int num) - { - int error; -- cpu->node_id = cpu_to_node(num); -- cpu->sysdev.id = num; -- cpu->sysdev.cls = &cpu_sysdev_class; -- -- error = sysdev_register(&cpu->sysdev); - -+ cpu->node_id = cpu_to_node(num); -+ cpu->dev.id = num; -+ cpu->dev.bus = &cpu_subsys; -+ error = device_register(&cpu->dev); - if (!error && cpu->hotpluggable) - register_cpu_control(cpu); - if (!error) -- per_cpu(cpu_sys_devices, num) = &cpu->sysdev; -+ per_cpu(cpu_sys_devices, num) = &cpu->dev; - if (!error) - register_cpu_under_node(num, cpu_to_node(num)); - - #ifdef CONFIG_KEXEC - if (!error) -- error = sysdev_create_file(&cpu->sysdev, &attr_crash_notes); -+ error = device_create_file(&cpu->dev, &dev_attr_crash_notes); - #endif - return error; - } - --struct sys_device *get_cpu_sysdev(unsigned cpu) -+struct device *get_cpu_device(unsigned cpu) - { - if (cpu < nr_cpu_ids && cpu_possible(cpu)) - return per_cpu(cpu_sys_devices, cpu); - else - return NULL; - } --EXPORT_SYMBOL_GPL(get_cpu_sysdev); -+EXPORT_SYMBOL_GPL(get_cpu_device); -+ -+static struct attribute *cpu_root_attrs[] = { -+#ifdef CONFIG_ARCH_CPU_PROBE_RELEASE -+ &dev_attr_probe.attr, -+ &dev_attr_release.attr, -+#endif -+ &cpu_attrs[0].attr.attr, -+ &cpu_attrs[1].attr.attr, -+ &cpu_attrs[2].attr.attr, -+ &dev_attr_kernel_max.attr, -+ &dev_attr_offline.attr, -+ NULL -+}; -+ -+static struct attribute_group cpu_root_attr_group = { -+ .attrs = cpu_root_attrs, -+}; -+ -+static const struct attribute_group *cpu_root_attr_groups[] = { -+ &cpu_root_attr_group, -+ NULL, -+}; - - int __init cpu_dev_init(void) - { - int err; - -- err = sysdev_class_register(&cpu_sysdev_class); -+ err = subsys_system_register(&cpu_subsys, cpu_root_attr_groups); -+ if (err) -+ return err; -+ - #if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT) -- if (!err) -- err = sched_create_sysfs_power_savings_entries(&cpu_sysdev_class); -+ err = sched_create_sysfs_power_savings_entries(cpu_subsys.dev_root); - #endif -- - return err; - } -- --static struct sysdev_class_attribute *cpu_sysdev_class_attrs[] = { --#ifdef CONFIG_ARCH_CPU_PROBE_RELEASE -- &attr_probe, -- &attr_release, --#endif -- &cpu_attrs[0].attr, -- &cpu_attrs[1].attr, -- &cpu_attrs[2].attr, -- &attr_kernel_max, -- &attr_offline, -- NULL --}; ---- a/drivers/base/node.c -+++ b/drivers/base/node.c -@@ -317,12 +317,12 @@ struct node node_devices[MAX_NUMNODES]; - int register_cpu_under_node(unsigned int cpu, unsigned int nid) - { - int ret; -- struct sys_device *obj; -+ struct device *obj; - - if (!node_online(nid)) - return 0; - -- obj = get_cpu_sysdev(cpu); -+ obj = get_cpu_device(cpu); - if (!obj) - return 0; - -@@ -339,12 +339,12 @@ int register_cpu_under_node(unsigned int - - int unregister_cpu_under_node(unsigned int cpu, unsigned int nid) - { -- struct sys_device *obj; -+ struct device *obj; - - if (!node_online(nid)) - return 0; - -- obj = get_cpu_sysdev(cpu); -+ obj = get_cpu_device(cpu); - if (!obj) - return 0; - ---- a/drivers/base/topology.c -+++ b/drivers/base/topology.c -@@ -23,7 +23,6 @@ - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ --#include <linux/sysdev.h> - #include <linux/init.h> - #include <linux/mm.h> - #include <linux/cpu.h> -@@ -32,14 +31,14 @@ - #include <linux/topology.h> - - #define define_one_ro_named(_name, _func) \ --static SYSDEV_ATTR(_name, 0444, _func, NULL) -+ static DEVICE_ATTR(_name, 0444, _func, NULL) - - #define define_one_ro(_name) \ --static SYSDEV_ATTR(_name, 0444, show_##_name, NULL) -+ static DEVICE_ATTR(_name, 0444, show_##_name, NULL) - - #define define_id_show_func(name) \ --static ssize_t show_##name(struct sys_device *dev, \ -- struct sysdev_attribute *attr, char *buf) \ -+static ssize_t show_##name(struct device *dev, \ -+ struct device_attribute *attr, char *buf) \ - { \ - unsigned int cpu = dev->id; \ - return sprintf(buf, "%d\n", topology_##name(cpu)); \ -@@ -65,16 +64,16 @@ static ssize_t show_cpumap(int type, con - - #ifdef arch_provides_topology_pointers - #define define_siblings_show_map(name) \ --static ssize_t show_##name(struct sys_device *dev, \ -- struct sysdev_attribute *attr, char *buf) \ -+static ssize_t show_##name(struct device *dev, \ -+ struct device_attribute *attr, char *buf) \ - { \ - unsigned int cpu = dev->id; \ - return show_cpumap(0, topology_##name(cpu), buf); \ - } - - #define define_siblings_show_list(name) \ --static ssize_t show_##name##_list(struct sys_device *dev, \ -- struct sysdev_attribute *attr, \ -+static ssize_t show_##name##_list(struct device *dev, \ -+ struct device_attribute *attr, \ - char *buf) \ - { \ - unsigned int cpu = dev->id; \ -@@ -83,15 +82,15 @@ static ssize_t show_##name##_list(struct - - #else - #define define_siblings_show_map(name) \ --static ssize_t show_##name(struct sys_device *dev, \ -- struct sysdev_attribute *attr, char *buf) \ -+static ssize_t show_##name(struct device *dev, \ -+ struct device_attribute *attr, char *buf) \ - { \ - return show_cpumap(0, topology_##name(dev->id), buf); \ - } - - #define define_siblings_show_list(name) \ --static ssize_t show_##name##_list(struct sys_device *dev, \ -- struct sysdev_attribute *attr, \ -+static ssize_t show_##name##_list(struct device *dev, \ -+ struct device_attribute *attr, \ - char *buf) \ - { \ - return show_cpumap(1, topology_##name(dev->id), buf); \ -@@ -124,16 +123,16 @@ define_one_ro_named(book_siblings_list, - #endif - - static struct attribute *default_attrs[] = { -- &attr_physical_package_id.attr, -- &attr_core_id.attr, -- &attr_thread_siblings.attr, -- &attr_thread_siblings_list.attr, -- &attr_core_siblings.attr, -- &attr_core_siblings_list.attr, -+ &dev_attr_physical_package_id.attr, -+ &dev_attr_core_id.attr, -+ &dev_attr_thread_siblings.attr, -+ &dev_attr_thread_siblings_list.attr, -+ &dev_attr_core_siblings.attr, -+ &dev_attr_core_siblings_list.attr, - #ifdef CONFIG_SCHED_BOOK -- &attr_book_id.attr, -- &attr_book_siblings.attr, -- &attr_book_siblings_list.attr, -+ &dev_attr_book_id.attr, -+ &dev_attr_book_siblings.attr, -+ &dev_attr_book_siblings_list.attr, - #endif - NULL - }; -@@ -146,16 +145,16 @@ static struct attribute_group topology_a - /* Add/Remove cpu_topology interface for CPU device */ - static int __cpuinit topology_add_dev(unsigned int cpu) - { -- struct sys_device *sys_dev = get_cpu_sysdev(cpu); -+ struct device *dev = get_cpu_device(cpu); - -- return sysfs_create_group(&sys_dev->kobj, &topology_attr_group); -+ return sysfs_create_group(&dev->kobj, &topology_attr_group); - } - - static void __cpuinit topology_remove_dev(unsigned int cpu) - { -- struct sys_device *sys_dev = get_cpu_sysdev(cpu); -+ struct device *dev = get_cpu_device(cpu); - -- sysfs_remove_group(&sys_dev->kobj, &topology_attr_group); -+ sysfs_remove_group(&dev->kobj, &topology_attr_group); - } - - static int __cpuinit topology_cpu_callback(struct notifier_block *nfb, ---- a/drivers/cpufreq/cpufreq.c -+++ b/drivers/cpufreq/cpufreq.c -@@ -679,7 +679,7 @@ static struct kobj_type ktype_cpufreq = - */ - static int cpufreq_add_dev_policy(unsigned int cpu, - struct cpufreq_policy *policy, -- struct sys_device *sys_dev) -+ struct device *dev) - { - int ret = 0; - #ifdef CONFIG_SMP -@@ -728,7 +728,7 @@ static int cpufreq_add_dev_policy(unsign - spin_unlock_irqrestore(&cpufreq_driver_lock, flags); - - pr_debug("CPU already managed, adding link\n"); -- ret = sysfs_create_link(&sys_dev->kobj, -+ ret = sysfs_create_link(&dev->kobj, - &managed_policy->kobj, - "cpufreq"); - if (ret) -@@ -761,7 +761,7 @@ static int cpufreq_add_dev_symlink(unsig - - for_each_cpu(j, policy->cpus) { - struct cpufreq_policy *managed_policy; -- struct sys_device *cpu_sys_dev; -+ struct device *cpu_dev; - - if (j == cpu) - continue; -@@ -770,8 +770,8 @@ static int cpufreq_add_dev_symlink(unsig - - pr_debug("CPU %u already managed, adding link\n", j); - managed_policy = cpufreq_cpu_get(cpu); -- cpu_sys_dev = get_cpu_sysdev(j); -- ret = sysfs_create_link(&cpu_sys_dev->kobj, &policy->kobj, -+ cpu_dev = get_cpu_device(j); -+ ret = sysfs_create_link(&cpu_dev->kobj, &policy->kobj, - "cpufreq"); - if (ret) { - cpufreq_cpu_put(managed_policy); -@@ -783,7 +783,7 @@ static int cpufreq_add_dev_symlink(unsig - - static int cpufreq_add_dev_interface(unsigned int cpu, - struct cpufreq_policy *policy, -- struct sys_device *sys_dev) -+ struct device *dev) - { - struct cpufreq_policy new_policy; - struct freq_attr **drv_attr; -@@ -793,7 +793,7 @@ static int cpufreq_add_dev_interface(uns - - /* prepare interface data */ - ret = kobject_init_and_add(&policy->kobj, &ktype_cpufreq, -- &sys_dev->kobj, "cpufreq"); -+ &dev->kobj, "cpufreq"); - if (ret) - return ret; - -@@ -866,9 +866,9 @@ err_out_kobj_put: - * with with cpu hotplugging and all hell will break loose. Tried to clean this - * mess up, but more thorough testing is needed. - Mathieu - */ --static int cpufreq_add_dev(struct sys_device *sys_dev) -+static int cpufreq_add_dev(struct device *dev, struct subsys_interface *sif) - { -- unsigned int cpu = sys_dev->id; -+ unsigned int cpu = dev->id; - int ret = 0, found = 0; - struct cpufreq_policy *policy; - unsigned long flags; -@@ -947,7 +947,7 @@ static int cpufreq_add_dev(struct sys_de - blocking_notifier_call_chain(&cpufreq_policy_notifier_list, - CPUFREQ_START, policy); - -- ret = cpufreq_add_dev_policy(cpu, policy, sys_dev); -+ ret = cpufreq_add_dev_policy(cpu, policy, dev); - if (ret) { - if (ret > 0) - /* This is a managed cpu, symlink created, -@@ -956,7 +956,7 @@ static int cpufreq_add_dev(struct sys_de - goto err_unlock_policy; - } - -- ret = cpufreq_add_dev_interface(cpu, policy, sys_dev); -+ ret = cpufreq_add_dev_interface(cpu, policy, dev); - if (ret) - goto err_out_unregister; - -@@ -999,15 +999,15 @@ module_out: - * Caller should already have policy_rwsem in write mode for this CPU. - * This routine frees the rwsem before returning. - */ --static int __cpufreq_remove_dev(struct sys_device *sys_dev) -+static int __cpufreq_remove_dev(struct device *dev, struct subsys_interface *sif) - { -- unsigned int cpu = sys_dev->id; -+ unsigned int cpu = dev->id; - unsigned long flags; - struct cpufreq_policy *data; - struct kobject *kobj; - struct completion *cmp; - #ifdef CONFIG_SMP -- struct sys_device *cpu_sys_dev; -+ struct device *cpu_dev; - unsigned int j; - #endif - -@@ -1032,7 +1032,7 @@ static int __cpufreq_remove_dev(struct s - pr_debug("removing link\n"); - cpumask_clear_cpu(cpu, data->cpus); - spin_unlock_irqrestore(&cpufreq_driver_lock, flags); -- kobj = &sys_dev->kobj; -+ kobj = &dev->kobj; - cpufreq_cpu_put(data); - unlock_policy_rwsem_write(cpu); - sysfs_remove_link(kobj, "cpufreq"); -@@ -1071,8 +1071,8 @@ static int __cpufreq_remove_dev(struct s - strncpy(per_cpu(cpufreq_cpu_governor, j), - data->governor->name, CPUFREQ_NAME_LEN); - #endif -- cpu_sys_dev = get_cpu_sysdev(j); -- kobj = &cpu_sys_dev->kobj; -+ cpu_dev = get_cpu_device(j); -+ kobj = &cpu_dev->kobj; - unlock_policy_rwsem_write(cpu); - sysfs_remove_link(kobj, "cpufreq"); - lock_policy_rwsem_write(cpu); -@@ -1112,11 +1112,11 @@ static int __cpufreq_remove_dev(struct s - if (unlikely(cpumask_weight(data->cpus) > 1)) { - /* first sibling now owns the new sysfs dir */ - cpumask_clear_cpu(cpu, data->cpus); -- cpufreq_add_dev(get_cpu_sysdev(cpumask_first(data->cpus))); -+ cpufreq_add_dev(get_cpu_device(cpumask_first(data->cpus)), NULL); - - /* finally remove our own symlink */ - lock_policy_rwsem_write(cpu); -- __cpufreq_remove_dev(sys_dev); -+ __cpufreq_remove_dev(dev, sif); - } - #endif - -@@ -1128,9 +1128,9 @@ static int __cpufreq_remove_dev(struct s - } - - --static int cpufreq_remove_dev(struct sys_device *sys_dev) -+static int cpufreq_remove_dev(struct device *dev, struct subsys_interface *sif) - { -- unsigned int cpu = sys_dev->id; -+ unsigned int cpu = dev->id; - int retval; - - if (cpu_is_offline(cpu)) -@@ -1139,7 +1139,7 @@ static int cpufreq_remove_dev(struct sys - if (unlikely(lock_policy_rwsem_write(cpu))) - BUG(); - -- retval = __cpufreq_remove_dev(sys_dev); -+ retval = __cpufreq_remove_dev(dev, sif); - return retval; - } - -@@ -1271,9 +1271,11 @@ out: - } - EXPORT_SYMBOL(cpufreq_get); - --static struct sysdev_driver cpufreq_sysdev_driver = { -- .add = cpufreq_add_dev, -- .remove = cpufreq_remove_dev, -+static struct subsys_interface cpufreq_interface = { -+ .name = "cpufreq", -+ .subsys = &cpu_subsys, -+ .add_dev = cpufreq_add_dev, -+ .remove_dev = cpufreq_remove_dev, - }; - - -@@ -1765,25 +1767,25 @@ static int __cpuinit cpufreq_cpu_callbac - unsigned long action, void *hcpu) - { - unsigned int cpu = (unsigned long)hcpu; -- struct sys_device *sys_dev; -+ struct device *dev; - -- sys_dev = get_cpu_sysdev(cpu); -- if (sys_dev) { -+ dev = get_cpu_device(cpu); -+ if (dev) { - switch (action) { - case CPU_ONLINE: - case CPU_ONLINE_FROZEN: -- cpufreq_add_dev(sys_dev); -+ cpufreq_add_dev(dev, NULL); - break; - case CPU_DOWN_PREPARE: - case CPU_DOWN_PREPARE_FROZEN: - if (unlikely(lock_policy_rwsem_write(cpu))) - BUG(); - -- __cpufreq_remove_dev(sys_dev); -+ __cpufreq_remove_dev(dev, NULL); - break; - case CPU_DOWN_FAILED: - case CPU_DOWN_FAILED_FROZEN: -- cpufreq_add_dev(sys_dev); -+ cpufreq_add_dev(dev, NULL); - break; - } - } -@@ -1830,8 +1832,7 @@ int cpufreq_register_driver(struct cpufr - cpufreq_driver = driver_data; - spin_unlock_irqrestore(&cpufreq_driver_lock, flags); - -- ret = sysdev_driver_register(&cpu_sysdev_class, -- &cpufreq_sysdev_driver); -+ ret = subsys_interface_register(&cpufreq_interface); - if (ret) - goto err_null_driver; - -@@ -1850,7 +1851,7 @@ int cpufreq_register_driver(struct cpufr - if (ret) { - pr_debug("no CPU initialized for driver %s\n", - driver_data->name); -- goto err_sysdev_unreg; -+ goto err_if_unreg; - } - } - -@@ -1858,9 +1859,8 @@ int cpufreq_register_driver(struct cpufr - pr_debug("driver %s up and running\n", driver_data->name); - - return 0; --err_sysdev_unreg: -- sysdev_driver_unregister(&cpu_sysdev_class, -- &cpufreq_sysdev_driver); -+err_if_unreg: -+ subsys_interface_unregister(&cpufreq_interface); - err_null_driver: - spin_lock_irqsave(&cpufreq_driver_lock, flags); - cpufreq_driver = NULL; -@@ -1887,7 +1887,7 @@ int cpufreq_unregister_driver(struct cpu - - pr_debug("unregistering driver %s\n", driver->name); - -- sysdev_driver_unregister(&cpu_sysdev_class, &cpufreq_sysdev_driver); -+ subsys_interface_unregister(&cpufreq_interface); - unregister_hotcpu_notifier(&cpufreq_cpu_notifier); - - spin_lock_irqsave(&cpufreq_driver_lock, flags); -@@ -1907,8 +1907,7 @@ static int __init cpufreq_core_init(void - init_rwsem(&per_cpu(cpu_policy_rwsem, cpu)); - } - -- cpufreq_global_kobject = kobject_create_and_add("cpufreq", -- &cpu_sysdev_class.kset.kobj); -+ cpufreq_global_kobject = kobject_create_and_add("cpufreq", &cpu_subsys.dev_root->kobj); - BUG_ON(!cpufreq_global_kobject); - register_syscore_ops(&cpufreq_syscore_ops); - ---- a/drivers/cpufreq/cpufreq_stats.c -+++ b/drivers/cpufreq/cpufreq_stats.c -@@ -11,7 +11,6 @@ - - #include <linux/kernel.h> - #include <linux/slab.h> --#include <linux/sysdev.h> - #include <linux/cpu.h> - #include <linux/sysfs.h> - #include <linux/cpufreq.h> ---- a/drivers/cpuidle/cpuidle.c -+++ b/drivers/cpuidle/cpuidle.c -@@ -291,10 +291,10 @@ EXPORT_SYMBOL_GPL(cpuidle_disable_device - static int __cpuidle_register_device(struct cpuidle_device *dev) - { - int ret; -- struct sys_device *sys_dev = get_cpu_sysdev((unsigned long)dev->cpu); -+ struct device *cpu_dev = get_cpu_device((unsigned long)dev->cpu); - struct cpuidle_driver *cpuidle_driver = cpuidle_get_driver(); - -- if (!sys_dev) -+ if (!dev) - return -EINVAL; - if (!try_module_get(cpuidle_driver->owner)) - return -EINVAL; -@@ -303,7 +303,7 @@ static int __cpuidle_register_device(str - - per_cpu(cpuidle_devices, dev->cpu) = dev; - list_add(&dev->device_list, &cpuidle_detected_devices); -- if ((ret = cpuidle_add_sysfs(sys_dev))) { -+ if ((ret = cpuidle_add_sysfs(cpu_dev))) { - module_put(cpuidle_driver->owner); - return ret; - } -@@ -344,7 +344,7 @@ EXPORT_SYMBOL_GPL(cpuidle_register_devic - */ - void cpuidle_unregister_device(struct cpuidle_device *dev) - { -- struct sys_device *sys_dev = get_cpu_sysdev((unsigned long)dev->cpu); -+ struct device *cpu_dev = get_cpu_device((unsigned long)dev->cpu); - struct cpuidle_driver *cpuidle_driver = cpuidle_get_driver(); - - if (dev->registered == 0) -@@ -354,7 +354,7 @@ void cpuidle_unregister_device(struct cp - - cpuidle_disable_device(dev); - -- cpuidle_remove_sysfs(sys_dev); -+ cpuidle_remove_sysfs(cpu_dev); - list_del(&dev->device_list); - wait_for_completion(&dev->kobj_unregister); - per_cpu(cpuidle_devices, dev->cpu) = NULL; -@@ -411,7 +411,7 @@ static int __init cpuidle_init(void) - if (cpuidle_disabled()) - return -ENODEV; - -- ret = cpuidle_add_class_sysfs(&cpu_sysdev_class); -+ ret = cpuidle_add_interface(cpu_subsys.dev_root); - if (ret) - return ret; - ---- a/drivers/cpuidle/cpuidle.h -+++ b/drivers/cpuidle/cpuidle.h -@@ -5,7 +5,7 @@ - #ifndef __DRIVER_CPUIDLE_H - #define __DRIVER_CPUIDLE_H - --#include <linux/sysdev.h> -+#include <linux/device.h> - - /* For internal use only */ - extern struct cpuidle_governor *cpuidle_curr_governor; -@@ -23,11 +23,11 @@ extern void cpuidle_uninstall_idle_handl - extern int cpuidle_switch_governor(struct cpuidle_governor *gov); - - /* sysfs */ --extern int cpuidle_add_class_sysfs(struct sysdev_class *cls); --extern void cpuidle_remove_class_sysfs(struct sysdev_class *cls); -+extern int cpuidle_add_interface(struct device *dev); -+extern void cpuidle_remove_interface(struct device *dev); - extern int cpuidle_add_state_sysfs(struct cpuidle_device *device); - extern void cpuidle_remove_state_sysfs(struct cpuidle_device *device); --extern int cpuidle_add_sysfs(struct sys_device *sysdev); --extern void cpuidle_remove_sysfs(struct sys_device *sysdev); -+extern int cpuidle_add_sysfs(struct device *dev); -+extern void cpuidle_remove_sysfs(struct device *dev); - - #endif /* __DRIVER_CPUIDLE_H */ ---- a/drivers/cpuidle/sysfs.c -+++ b/drivers/cpuidle/sysfs.c -@@ -22,8 +22,8 @@ static int __init cpuidle_sysfs_setup(ch - } - __setup("cpuidle_sysfs_switch", cpuidle_sysfs_setup); - --static ssize_t show_available_governors(struct sysdev_class *class, -- struct sysdev_class_attribute *attr, -+static ssize_t show_available_governors(struct device *dev, -+ struct device_attribute *attr, - char *buf) - { - ssize_t i = 0; -@@ -42,8 +42,8 @@ out: - return i; - } - --static ssize_t show_current_driver(struct sysdev_class *class, -- struct sysdev_class_attribute *attr, -+static ssize_t show_current_driver(struct device *dev, -+ struct device_attribute *attr, - char *buf) - { - ssize_t ret; -@@ -59,8 +59,8 @@ static ssize_t show_current_driver(struc - return ret; - } - --static ssize_t show_current_governor(struct sysdev_class *class, -- struct sysdev_class_attribute *attr, -+static ssize_t show_current_governor(struct device *dev, -+ struct device_attribute *attr, - char *buf) - { - ssize_t ret; -@@ -75,8 +75,8 @@ static ssize_t show_current_governor(str - return ret; - } - --static ssize_t store_current_governor(struct sysdev_class *class, -- struct sysdev_class_attribute *attr, -+static ssize_t store_current_governor(struct device *dev, -+ struct device_attribute *attr, - const char *buf, size_t count) - { - char gov_name[CPUIDLE_NAME_LEN]; -@@ -109,50 +109,48 @@ static ssize_t store_current_governor(st - return count; - } - --static SYSDEV_CLASS_ATTR(current_driver, 0444, show_current_driver, NULL); --static SYSDEV_CLASS_ATTR(current_governor_ro, 0444, show_current_governor, -- NULL); -- --static struct attribute *cpuclass_default_attrs[] = { -- &attr_current_driver.attr, -- &attr_current_governor_ro.attr, -+static DEVICE_ATTR(current_driver, 0444, show_current_driver, NULL); -+static DEVICE_ATTR(current_governor_ro, 0444, show_current_governor, NULL); -+ -+static struct attribute *cpuidle_default_attrs[] = { -+ &dev_attr_current_driver.attr, -+ &dev_attr_current_governor_ro.attr, - NULL - }; - --static SYSDEV_CLASS_ATTR(available_governors, 0444, show_available_governors, -- NULL); --static SYSDEV_CLASS_ATTR(current_governor, 0644, show_current_governor, -- store_current_governor); -- --static struct attribute *cpuclass_switch_attrs[] = { -- &attr_available_governors.attr, -- &attr_current_driver.attr, -- &attr_current_governor.attr, -+static DEVICE_ATTR(available_governors, 0444, show_available_governors, NULL); -+static DEVICE_ATTR(current_governor, 0644, show_current_governor, -+ store_current_governor); -+ -+static struct attribute *cpuidle_switch_attrs[] = { -+ &dev_attr_available_governors.attr, -+ &dev_attr_current_driver.attr, -+ &dev_attr_current_governor.attr, - NULL - }; - --static struct attribute_group cpuclass_attr_group = { -- .attrs = cpuclass_default_attrs, -+static struct attribute_group cpuidle_attr_group = { -+ .attrs = cpuidle_default_attrs, - .name = "cpuidle", - }; - - /** -- * cpuidle_add_class_sysfs - add CPU global sysfs attributes -+ * cpuidle_add_interface - add CPU global sysfs attributes - */ --int cpuidle_add_class_sysfs(struct sysdev_class *cls) -+int cpuidle_add_interface(struct device *dev) - { - if (sysfs_switch) -- cpuclass_attr_group.attrs = cpuclass_switch_attrs; -+ cpuidle_attr_group.attrs = cpuidle_switch_attrs; - -- return sysfs_create_group(&cls->kset.kobj, &cpuclass_attr_group); -+ return sysfs_create_group(&dev->kobj, &cpuidle_attr_group); - } - - /** -- * cpuidle_remove_class_sysfs - remove CPU global sysfs attributes -+ * cpuidle_remove_interface - remove CPU global sysfs attributes - */ --void cpuidle_remove_class_sysfs(struct sysdev_class *cls) -+void cpuidle_remove_interface(struct device *dev) - { -- sysfs_remove_group(&cls->kset.kobj, &cpuclass_attr_group); -+ sysfs_remove_group(&dev->kobj, &cpuidle_attr_group); - } - - struct cpuidle_attr { -@@ -365,16 +363,16 @@ void cpuidle_remove_state_sysfs(struct c - - /** - * cpuidle_add_sysfs - creates a sysfs instance for the target device -- * @sysdev: the target device -+ * @dev: the target device - */ --int cpuidle_add_sysfs(struct sys_device *sysdev) -+int cpuidle_add_sysfs(struct device *cpu_dev) - { -- int cpu = sysdev->id; -+ int cpu = cpu_dev->id; - struct cpuidle_device *dev; - int error; - - dev = per_cpu(cpuidle_devices, cpu); -- error = kobject_init_and_add(&dev->kobj, &ktype_cpuidle, &sysdev->kobj, -+ error = kobject_init_and_add(&dev->kobj, &ktype_cpuidle, &cpu_dev->kobj, - "cpuidle"); - if (!error) - kobject_uevent(&dev->kobj, KOBJ_ADD); -@@ -383,11 +381,11 @@ int cpuidle_add_sysfs(struct sys_device - - /** - * cpuidle_remove_sysfs - deletes a sysfs instance on the target device -- * @sysdev: the target device -+ * @dev: the target device - */ --void cpuidle_remove_sysfs(struct sys_device *sysdev) -+void cpuidle_remove_sysfs(struct device *cpu_dev) - { -- int cpu = sysdev->id; -+ int cpu = cpu_dev->id; - struct cpuidle_device *dev; - - dev = per_cpu(cpuidle_devices, cpu); ---- a/drivers/s390/char/sclp_config.c -+++ b/drivers/s390/char/sclp_config.c -@@ -11,7 +11,7 @@ - #include <linux/init.h> - #include <linux/errno.h> - #include <linux/cpu.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/workqueue.h> - #include <asm/smp.h> - -@@ -31,14 +31,14 @@ static struct work_struct sclp_cpu_chang - static void sclp_cpu_capability_notify(struct work_struct *work) - { - int cpu; -- struct sys_device *sysdev; -+ struct device *dev; - - s390_adjust_jiffies(); - pr_warning("cpu capability changed.\n"); - get_online_cpus(); - for_each_online_cpu(cpu) { -- sysdev = get_cpu_sysdev(cpu); -- kobject_uevent(&sysdev->kobj, KOBJ_CHANGE); -+ dev = get_cpu_device(cpu); -+ kobject_uevent(&dev->kobj, KOBJ_CHANGE); - } - put_online_cpus(); - } ---- a/include/linux/cpu.h -+++ b/include/linux/cpu.h -@@ -14,7 +14,7 @@ - #ifndef _LINUX_CPU_H_ - #define _LINUX_CPU_H_ - --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/node.h> - #include <linux/compiler.h> - #include <linux/cpumask.h> -@@ -22,19 +22,19 @@ - struct cpu { - int node_id; /* The node which contains the CPU */ - int hotpluggable; /* creates sysfs control file if hotpluggable */ -- struct sys_device sysdev; -+ struct device dev; - }; - - extern int register_cpu(struct cpu *cpu, int num); --extern struct sys_device *get_cpu_sysdev(unsigned cpu); -+extern struct device *get_cpu_device(unsigned cpu); - --extern int cpu_add_sysdev_attr(struct sysdev_attribute *attr); --extern void cpu_remove_sysdev_attr(struct sysdev_attribute *attr); -+extern int cpu_add_dev_attr(struct device_attribute *attr); -+extern void cpu_remove_dev_attr(struct device_attribute *attr); - --extern int cpu_add_sysdev_attr_group(struct attribute_group *attrs); --extern void cpu_remove_sysdev_attr_group(struct attribute_group *attrs); -+extern int cpu_add_dev_attr_group(struct attribute_group *attrs); -+extern void cpu_remove_dev_attr_group(struct attribute_group *attrs); - --extern int sched_create_sysfs_power_savings_entries(struct sysdev_class *cls); -+extern int sched_create_sysfs_power_savings_entries(struct device *dev); - - #ifdef CONFIG_HOTPLUG_CPU - extern void unregister_cpu(struct cpu *cpu); -@@ -160,7 +160,7 @@ static inline void cpu_maps_update_done( - } - - #endif /* CONFIG_SMP */ --extern struct sysdev_class cpu_sysdev_class; -+extern struct bus_type cpu_subsys; - - #ifdef CONFIG_HOTPLUG_CPU - /* Stop CPUs going up and down. */ ---- a/kernel/sched.c -+++ b/kernel/sched.c -@@ -7940,54 +7940,52 @@ static ssize_t sched_power_savings_store - } - - #ifdef CONFIG_SCHED_MC --static ssize_t sched_mc_power_savings_show(struct sysdev_class *class, -- struct sysdev_class_attribute *attr, -- char *page) -+static ssize_t sched_mc_power_savings_show(struct device *dev, -+ struct device_attribute *attr, -+ char *buf) - { -- return sprintf(page, "%u\n", sched_mc_power_savings); -+ return sprintf(buf, "%u\n", sched_mc_power_savings); - } --static ssize_t sched_mc_power_savings_store(struct sysdev_class *class, -- struct sysdev_class_attribute *attr, -+static ssize_t sched_mc_power_savings_store(struct device *dev, -+ struct device_attribute *attr, - const char *buf, size_t count) - { - return sched_power_savings_store(buf, count, 0); - } --static SYSDEV_CLASS_ATTR(sched_mc_power_savings, 0644, -- sched_mc_power_savings_show, -- sched_mc_power_savings_store); -+static DEVICE_ATTR(sched_mc_power_savings, 0644, -+ sched_mc_power_savings_show, -+ sched_mc_power_savings_store); - #endif - - #ifdef CONFIG_SCHED_SMT --static ssize_t sched_smt_power_savings_show(struct sysdev_class *dev, -- struct sysdev_class_attribute *attr, -- char *page) -+static ssize_t sched_smt_power_savings_show(struct device *dev, -+ struct device_attribute *attr, -+ char *buf) - { -- return sprintf(page, "%u\n", sched_smt_power_savings); -+ return sprintf(buf, "%u\n", sched_smt_power_savings); - } --static ssize_t sched_smt_power_savings_store(struct sysdev_class *dev, -- struct sysdev_class_attribute *attr, -+static ssize_t sched_smt_power_savings_store(struct device *dev, -+ struct device_attribute *attr, - const char *buf, size_t count) - { - return sched_power_savings_store(buf, count, 1); - } --static SYSDEV_CLASS_ATTR(sched_smt_power_savings, 0644, -+static DEVICE_ATTR(sched_smt_power_savings, 0644, - sched_smt_power_savings_show, - sched_smt_power_savings_store); - #endif - --int __init sched_create_sysfs_power_savings_entries(struct sysdev_class *cls) -+int __init sched_create_sysfs_power_savings_entries(struct device *dev) - { - int err = 0; - - #ifdef CONFIG_SCHED_SMT - if (smt_capable()) -- err = sysfs_create_file(&cls->kset.kobj, -- &attr_sched_smt_power_savings.attr); -+ err = device_create_file(dev, &dev_attr_sched_smt_power_savings); - #endif - #ifdef CONFIG_SCHED_MC - if (!err && mc_capable()) -- err = sysfs_create_file(&cls->kset.kobj, -- &attr_sched_mc_power_savings.attr); -+ err = device_create_file(dev, &dev_attr_sched_mc_power_savings); - #endif - return err; - } diff --git a/10-memory.patch b/10-memory.patch deleted file mode 100644 index b20a2a6..0000000 --- a/10-memory.patch +++ /dev/null @@ -1,969 +0,0 @@ -From: Kay Sievers <kay.sievers@vrfy.org> -Subject: convert 'memory' sysdev_class to a regular subsystem - -This moves the 'memory sysdev_class' over to a regular 'memory' subsystem -and converts the devices to regular devices. The sysdev drivers are -implemented as subsystem interfaces now. - -After all sysdev classes are ported to regular driver core entities, the -sysdev implementation will be entirely removed from the kernel. - -Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> ---- - arch/powerpc/kernel/sysfs.c | 4 - - drivers/base/memory.c | 160 ++++++++++++++++++-------------------------- - drivers/base/node.c | 146 ++++++++++++++++++++-------------------- - include/linux/memory.h | 3 - include/linux/node.h | 6 - - mm/compaction.c | 10 +- - mm/hugetlb.c | 34 ++++----- - mm/vmscan.c | 14 +-- - 8 files changed, 177 insertions(+), 200 deletions(-) - ---- a/arch/powerpc/kernel/sysfs.c -+++ b/arch/powerpc/kernel/sysfs.c -@@ -592,7 +592,7 @@ static void register_nodes(void) - int sysfs_add_device_to_node(struct device *dev, int nid) - { - struct node *node = &node_devices[nid]; -- return sysfs_create_link(&node->sysdev.kobj, &dev->kobj, -+ return sysfs_create_link(&node->dev.kobj, &dev->kobj, - kobject_name(&dev->kobj)); - } - EXPORT_SYMBOL_GPL(sysfs_add_device_to_node); -@@ -600,7 +600,7 @@ EXPORT_SYMBOL_GPL(sysfs_add_device_to_no - void sysfs_remove_device_from_node(struct device *dev, int nid) - { - struct node *node = &node_devices[nid]; -- sysfs_remove_link(&node->sysdev.kobj, kobject_name(&dev->kobj)); -+ sysfs_remove_link(&node->dev.kobj, kobject_name(&dev->kobj)); - } - EXPORT_SYMBOL_GPL(sysfs_remove_device_from_node); - ---- a/drivers/base/memory.c -+++ b/drivers/base/memory.c -@@ -1,5 +1,5 @@ - /* -- * drivers/base/memory.c - basic Memory class support -+ * Memory subsystem support - * - * Written by Matt Tolentino <matthew.e.tolentino@intel.com> - * Dave Hansen <haveblue@us.ibm.com> -@@ -10,7 +10,6 @@ - * SPARSEMEM should be contained here, or in mm/memory_hotplug.c. - */ - --#include <linux/sysdev.h> - #include <linux/module.h> - #include <linux/init.h> - #include <linux/topology.h> -@@ -38,26 +37,9 @@ static inline int base_memory_block_id(i - return section_nr / sections_per_block; - } - --static struct sysdev_class memory_sysdev_class = { -+static struct bus_type memory_subsys = { - .name = MEMORY_CLASS_NAME, --}; -- --static const char *memory_uevent_name(struct kset *kset, struct kobject *kobj) --{ -- return MEMORY_CLASS_NAME; --} -- --static int memory_uevent(struct kset *kset, struct kobject *obj, -- struct kobj_uevent_env *env) --{ -- int retval = 0; -- -- return retval; --} -- --static const struct kset_uevent_ops memory_uevent_ops = { -- .name = memory_uevent_name, -- .uevent = memory_uevent, -+ .dev_name = MEMORY_CLASS_NAME, - }; - - static BLOCKING_NOTIFIER_HEAD(memory_chain); -@@ -96,21 +78,21 @@ int register_memory(struct memory_block - { - int error; - -- memory->sysdev.cls = &memory_sysdev_class; -- memory->sysdev.id = memory->start_section_nr / sections_per_block; -+ memory->dev.bus = &memory_subsys; -+ memory->dev.id = memory->start_section_nr / sections_per_block; - -- error = sysdev_register(&memory->sysdev); -+ error = device_register(&memory->dev); - return error; - } - - static void - unregister_memory(struct memory_block *memory) - { -- BUG_ON(memory->sysdev.cls != &memory_sysdev_class); -+ BUG_ON(memory->dev.bus != &memory_subsys); - - /* drop the ref. we got in remove_memory_block() */ -- kobject_put(&memory->sysdev.kobj); -- sysdev_unregister(&memory->sysdev); -+ kobject_put(&memory->dev.kobj); -+ device_unregister(&memory->dev); - } - - unsigned long __weak memory_block_size_bytes(void) -@@ -138,22 +120,22 @@ static unsigned long get_memory_block_si - * uses. - */ - --static ssize_t show_mem_start_phys_index(struct sys_device *dev, -- struct sysdev_attribute *attr, char *buf) -+static ssize_t show_mem_start_phys_index(struct device *dev, -+ struct device_attribute *attr, char *buf) - { - struct memory_block *mem = -- container_of(dev, struct memory_block, sysdev); -+ container_of(dev, struct memory_block, dev); - unsigned long phys_index; - - phys_index = mem->start_section_nr / sections_per_block; - return sprintf(buf, "%08lx\n", phys_index); - } - --static ssize_t show_mem_end_phys_index(struct sys_device *dev, -- struct sysdev_attribute *attr, char *buf) -+static ssize_t show_mem_end_phys_index(struct device *dev, -+ struct device_attribute *attr, char *buf) - { - struct memory_block *mem = -- container_of(dev, struct memory_block, sysdev); -+ container_of(dev, struct memory_block, dev); - unsigned long phys_index; - - phys_index = mem->end_section_nr / sections_per_block; -@@ -163,13 +145,13 @@ static ssize_t show_mem_end_phys_index(s - /* - * Show whether the section of memory is likely to be hot-removable - */ --static ssize_t show_mem_removable(struct sys_device *dev, -- struct sysdev_attribute *attr, char *buf) -+static ssize_t show_mem_removable(struct device *dev, -+ struct device_attribute *attr, char *buf) - { - unsigned long i, pfn; - int ret = 1; - struct memory_block *mem = -- container_of(dev, struct memory_block, sysdev); -+ container_of(dev, struct memory_block, dev); - - for (i = 0; i < sections_per_block; i++) { - pfn = section_nr_to_pfn(mem->start_section_nr + i); -@@ -182,11 +164,11 @@ static ssize_t show_mem_removable(struct - /* - * online, offline, going offline, etc. - */ --static ssize_t show_mem_state(struct sys_device *dev, -- struct sysdev_attribute *attr, char *buf) -+static ssize_t show_mem_state(struct device *dev, -+ struct device_attribute *attr, char *buf) - { - struct memory_block *mem = -- container_of(dev, struct memory_block, sysdev); -+ container_of(dev, struct memory_block, dev); - ssize_t len = 0; - - /* -@@ -324,13 +306,13 @@ out: - } - - static ssize_t --store_mem_state(struct sys_device *dev, -- struct sysdev_attribute *attr, const char *buf, size_t count) -+store_mem_state(struct device *dev, -+ struct device_attribute *attr, const char *buf, size_t count) - { - struct memory_block *mem; - int ret = -EINVAL; - -- mem = container_of(dev, struct memory_block, sysdev); -+ mem = container_of(dev, struct memory_block, dev); - - if (!strncmp(buf, "online", min((int)count, 6))) - ret = memory_block_change_state(mem, MEM_ONLINE, MEM_OFFLINE); -@@ -351,41 +333,41 @@ store_mem_state(struct sys_device *dev, - * s.t. if I offline all of these sections I can then - * remove the physical device? - */ --static ssize_t show_phys_device(struct sys_device *dev, -- struct sysdev_attribute *attr, char *buf) -+static ssize_t show_phys_device(struct device *dev, -+ struct device_attribute *attr, char *buf) - { - struct memory_block *mem = -- container_of(dev, struct memory_block, sysdev); -+ container_of(dev, struct memory_block, dev); - return sprintf(buf, "%d\n", mem->phys_device); - } - --static SYSDEV_ATTR(phys_index, 0444, show_mem_start_phys_index, NULL); --static SYSDEV_ATTR(end_phys_index, 0444, show_mem_end_phys_index, NULL); --static SYSDEV_ATTR(state, 0644, show_mem_state, store_mem_state); --static SYSDEV_ATTR(phys_device, 0444, show_phys_device, NULL); --static SYSDEV_ATTR(removable, 0444, show_mem_removable, NULL); -+static DEVICE_ATTR(phys_index, 0444, show_mem_start_phys_index, NULL); -+static DEVICE_ATTR(end_phys_index, 0444, show_mem_end_phys_index, NULL); -+static DEVICE_ATTR(state, 0644, show_mem_state, store_mem_state); -+static DEVICE_ATTR(phys_device, 0444, show_phys_device, NULL); -+static DEVICE_ATTR(removable, 0444, show_mem_removable, NULL); - - #define mem_create_simple_file(mem, attr_name) \ -- sysdev_create_file(&mem->sysdev, &attr_##attr_name) -+ device_create_file(&mem->dev, &dev_attr_##attr_name) - #define mem_remove_simple_file(mem, attr_name) \ -- sysdev_remove_file(&mem->sysdev, &attr_##attr_name) -+ device_remove_file(&mem->dev, &dev_attr_##attr_name) - - /* - * Block size attribute stuff - */ - static ssize_t --print_block_size(struct sysdev_class *class, struct sysdev_class_attribute *attr, -+print_block_size(struct device *dev, struct device_attribute *attr, - char *buf) - { - return sprintf(buf, "%lx\n", get_memory_block_size()); - } - --static SYSDEV_CLASS_ATTR(block_size_bytes, 0444, print_block_size, NULL); -+static DEVICE_ATTR(block_size_bytes, 0444, print_block_size, NULL); - - static int block_size_init(void) - { -- return sysfs_create_file(&memory_sysdev_class.kset.kobj, -- &attr_block_size_bytes.attr); -+ return device_create_file(memory_subsys.dev_root, -+ &dev_attr_block_size_bytes); - } - - /* -@@ -396,7 +378,7 @@ static int block_size_init(void) - */ - #ifdef CONFIG_ARCH_MEMORY_PROBE - static ssize_t --memory_probe_store(struct class *class, struct class_attribute *attr, -+memory_probe_store(struct device *dev, struct device_attribute *attr, - const char *buf, size_t count) - { - u64 phys_addr; -@@ -423,12 +405,11 @@ memory_probe_store(struct class *class, - out: - return ret; - } --static CLASS_ATTR(probe, S_IWUSR, NULL, memory_probe_store); -+static DEVICE_ATTR(probe, S_IWUSR, NULL, memory_probe_store); - - static int memory_probe_init(void) - { -- return sysfs_create_file(&memory_sysdev_class.kset.kobj, -- &class_attr_probe.attr); -+ return device_create_file(memory_subsys.dev_root, &dev_attr_probe); - } - #else - static inline int memory_probe_init(void) -@@ -444,8 +425,8 @@ static inline int memory_probe_init(void - - /* Soft offline a page */ - static ssize_t --store_soft_offline_page(struct class *class, -- struct class_attribute *attr, -+store_soft_offline_page(struct device *dev, -+ struct device_attribute *attr, - const char *buf, size_t count) - { - int ret; -@@ -463,8 +444,8 @@ store_soft_offline_page(struct class *cl - - /* Forcibly offline a page, including killing processes. */ - static ssize_t --store_hard_offline_page(struct class *class, -- struct class_attribute *attr, -+store_hard_offline_page(struct device *dev, -+ struct device_attribute *attr, - const char *buf, size_t count) - { - int ret; -@@ -478,18 +459,18 @@ store_hard_offline_page(struct class *cl - return ret ? ret : count; - } - --static CLASS_ATTR(soft_offline_page, 0644, NULL, store_soft_offline_page); --static CLASS_ATTR(hard_offline_page, 0644, NULL, store_hard_offline_page); -+static DEVICE_ATTR(soft_offline_page, 0644, NULL, store_soft_offline_page); -+static DEVICE_ATTR(hard_offline_page, 0644, NULL, store_hard_offline_page); - - static __init int memory_fail_init(void) - { - int err; - -- err = sysfs_create_file(&memory_sysdev_class.kset.kobj, -- &class_attr_soft_offline_page.attr); -+ err = device_create_file(memory_subsys.dev_root, -+ &dev_attr_soft_offline_page); - if (!err) -- err = sysfs_create_file(&memory_sysdev_class.kset.kobj, -- &class_attr_hard_offline_page.attr); -+ err = device_create_file(memory_subsys.dev_root, -+ &dev_attr_hard_offline_page); - return err; - } - #else -@@ -509,31 +490,23 @@ int __weak arch_get_memory_phys_device(u - return 0; - } - -+/* -+ * A reference for the returned object is held and the reference for the -+ * hinted object is released. -+ */ - struct memory_block *find_memory_block_hinted(struct mem_section *section, - struct memory_block *hint) - { -- struct kobject *kobj; -- struct sys_device *sysdev; -- struct memory_block *mem; -- char name[sizeof(MEMORY_CLASS_NAME) + 9 + 1]; - int block_id = base_memory_block_id(__section_nr(section)); -+ struct device *hintdev = hint ? &hint->dev : NULL; -+ struct device *dev; - -- kobj = hint ? &hint->sysdev.kobj : NULL; -- -- /* -- * This only works because we know that section == sysdev->id -- * slightly redundant with sysdev_register() -- */ -- sprintf(&name[0], "%s%d", MEMORY_CLASS_NAME, block_id); -- -- kobj = kset_find_obj_hinted(&memory_sysdev_class.kset, name, kobj); -- if (!kobj) -+ dev = subsys_find_device_by_id(&memory_subsys, block_id, hintdev); -+ if (hint) -+ put_device(&hint->dev); -+ if (!dev) - return NULL; -- -- sysdev = container_of(kobj, struct sys_device, kobj); -- mem = container_of(sysdev, struct memory_block, sysdev); -- -- return mem; -+ return container_of(dev, struct memory_block, dev); - } - - /* -@@ -542,7 +515,7 @@ struct memory_block *find_memory_block_h - * this gets to be a real problem, we can always use a radix - * tree or something here. - * -- * This could be made generic for all sysdev classes. -+ * This could be made generic for all device subsystems. - */ - struct memory_block *find_memory_block(struct mem_section *section) - { -@@ -598,7 +571,7 @@ static int add_memory_section(int nid, s - mem = find_memory_block(section); - if (mem) { - mem->section_count++; -- kobject_put(&mem->sysdev.kobj); -+ kobject_put(&mem->dev.kobj); - } else - ret = init_memory_block(&mem, section, state); - -@@ -631,7 +604,7 @@ int remove_memory_block(unsigned long no - unregister_memory(mem); - kfree(mem); - } else -- kobject_put(&mem->sysdev.kobj); -+ kobject_put(&mem->dev.kobj); - - mutex_unlock(&mem_sysfs_mutex); - return 0; -@@ -664,8 +637,7 @@ int __init memory_dev_init(void) - int err; - unsigned long block_sz; - -- memory_sysdev_class.kset.uevent_ops = &memory_uevent_ops; -- ret = sysdev_class_register(&memory_sysdev_class); -+ ret = subsys_system_register(&memory_subsys, NULL); - if (ret) - goto out; - ---- a/drivers/base/node.c -+++ b/drivers/base/node.c -@@ -1,8 +1,7 @@ - /* -- * drivers/base/node.c - basic Node class support -+ * Basic Node interface support - */ - --#include <linux/sysdev.h> - #include <linux/module.h> - #include <linux/init.h> - #include <linux/mm.h> -@@ -19,18 +18,16 @@ - #include <linux/swap.h> - #include <linux/slab.h> - --static struct sysdev_class_attribute *node_state_attrs[]; -- --static struct sysdev_class node_class = { -+static struct bus_type node_subsys = { - .name = "node", -- .attrs = node_state_attrs, -+ .dev_name = "node", - }; - - --static ssize_t node_read_cpumap(struct sys_device *dev, int type, char *buf) -+static ssize_t node_read_cpumap(struct device *dev, int type, char *buf) - { - struct node *node_dev = to_node(dev); -- const struct cpumask *mask = cpumask_of_node(node_dev->sysdev.id); -+ const struct cpumask *mask = cpumask_of_node(node_dev->dev.id); - int len; - - /* 2008/04/07: buf currently PAGE_SIZE, need 9 chars per 32 bits. */ -@@ -44,23 +41,23 @@ static ssize_t node_read_cpumap(struct s - return len; - } - --static inline ssize_t node_read_cpumask(struct sys_device *dev, -- struct sysdev_attribute *attr, char *buf) -+static inline ssize_t node_read_cpumask(struct device *dev, -+ struct device_attribute *attr, char *buf) - { - return node_read_cpumap(dev, 0, buf); - } --static inline ssize_t node_read_cpulist(struct sys_device *dev, -- struct sysdev_attribute *attr, char *buf) -+static inline ssize_t node_read_cpulist(struct device *dev, -+ struct device_attribute *attr, char *buf) - { - return node_read_cpumap(dev, 1, buf); - } - --static SYSDEV_ATTR(cpumap, S_IRUGO, node_read_cpumask, NULL); --static SYSDEV_ATTR(cpulist, S_IRUGO, node_read_cpulist, NULL); -+static DEVICE_ATTR(cpumap, S_IRUGO, node_read_cpumask, NULL); -+static DEVICE_ATTR(cpulist, S_IRUGO, node_read_cpulist, NULL); - - #define K(x) ((x) << (PAGE_SHIFT - 10)) --static ssize_t node_read_meminfo(struct sys_device * dev, -- struct sysdev_attribute *attr, char * buf) -+static ssize_t node_read_meminfo(struct device * dev, -+ struct device_attribute *attr, char * buf) - { - int n; - int nid = dev->id; -@@ -157,10 +154,10 @@ static ssize_t node_read_meminfo(struct - } - - #undef K --static SYSDEV_ATTR(meminfo, S_IRUGO, node_read_meminfo, NULL); -+static DEVICE_ATTR(meminfo, S_IRUGO, node_read_meminfo, NULL); - --static ssize_t node_read_numastat(struct sys_device * dev, -- struct sysdev_attribute *attr, char * buf) -+static ssize_t node_read_numastat(struct device * dev, -+ struct device_attribute *attr, char * buf) - { - return sprintf(buf, - "numa_hit %lu\n" -@@ -176,10 +173,10 @@ static ssize_t node_read_numastat(struct - node_page_state(dev->id, NUMA_LOCAL), - node_page_state(dev->id, NUMA_OTHER)); - } --static SYSDEV_ATTR(numastat, S_IRUGO, node_read_numastat, NULL); -+static DEVICE_ATTR(numastat, S_IRUGO, node_read_numastat, NULL); - --static ssize_t node_read_vmstat(struct sys_device *dev, -- struct sysdev_attribute *attr, char *buf) -+static ssize_t node_read_vmstat(struct device *dev, -+ struct device_attribute *attr, char *buf) - { - int nid = dev->id; - int i; -@@ -191,10 +188,10 @@ static ssize_t node_read_vmstat(struct s - - return n; - } --static SYSDEV_ATTR(vmstat, S_IRUGO, node_read_vmstat, NULL); -+static DEVICE_ATTR(vmstat, S_IRUGO, node_read_vmstat, NULL); - --static ssize_t node_read_distance(struct sys_device * dev, -- struct sysdev_attribute *attr, char * buf) -+static ssize_t node_read_distance(struct device * dev, -+ struct device_attribute *attr, char * buf) - { - int nid = dev->id; - int len = 0; -@@ -212,7 +209,7 @@ static ssize_t node_read_distance(struct - len += sprintf(buf + len, "\n"); - return len; - } --static SYSDEV_ATTR(distance, S_IRUGO, node_read_distance, NULL); -+static DEVICE_ATTR(distance, S_IRUGO, node_read_distance, NULL); - - #ifdef CONFIG_HUGETLBFS - /* -@@ -230,7 +227,7 @@ static node_registration_func_t __hugetl - static inline bool hugetlb_register_node(struct node *node) - { - if (__hugetlb_register_node && -- node_state(node->sysdev.id, N_HIGH_MEMORY)) { -+ node_state(node->dev.id, N_HIGH_MEMORY)) { - __hugetlb_register_node(node); - return true; - } -@@ -266,17 +263,17 @@ int register_node(struct node *node, int - { - int error; - -- node->sysdev.id = num; -- node->sysdev.cls = &node_class; -- error = sysdev_register(&node->sysdev); -+ node->dev.id = num; -+ node->dev.bus = &node_subsys; -+ error = device_register(&node->dev); - - if (!error){ -- sysdev_create_file(&node->sysdev, &attr_cpumap); -- sysdev_create_file(&node->sysdev, &attr_cpulist); -- sysdev_create_file(&node->sysdev, &attr_meminfo); -- sysdev_create_file(&node->sysdev, &attr_numastat); -- sysdev_create_file(&node->sysdev, &attr_distance); -- sysdev_create_file(&node->sysdev, &attr_vmstat); -+ device_create_file(&node->dev, &dev_attr_cpumap); -+ device_create_file(&node->dev, &dev_attr_cpulist); -+ device_create_file(&node->dev, &dev_attr_meminfo); -+ device_create_file(&node->dev, &dev_attr_numastat); -+ device_create_file(&node->dev, &dev_attr_distance); -+ device_create_file(&node->dev, &dev_attr_vmstat); - - scan_unevictable_register_node(node); - -@@ -296,17 +293,17 @@ int register_node(struct node *node, int - */ - void unregister_node(struct node *node) - { -- sysdev_remove_file(&node->sysdev, &attr_cpumap); -- sysdev_remove_file(&node->sysdev, &attr_cpulist); -- sysdev_remove_file(&node->sysdev, &attr_meminfo); -- sysdev_remove_file(&node->sysdev, &attr_numastat); -- sysdev_remove_file(&node->sysdev, &attr_distance); -- sysdev_remove_file(&node->sysdev, &attr_vmstat); -+ device_remove_file(&node->dev, &dev_attr_cpumap); -+ device_remove_file(&node->dev, &dev_attr_cpulist); -+ device_remove_file(&node->dev, &dev_attr_meminfo); -+ device_remove_file(&node->dev, &dev_attr_numastat); -+ device_remove_file(&node->dev, &dev_attr_distance); -+ device_remove_file(&node->dev, &dev_attr_vmstat); - - scan_unevictable_unregister_node(node); - hugetlb_unregister_node(node); /* no-op, if memoryless node */ - -- sysdev_unregister(&node->sysdev); -+ device_unregister(&node->dev); - } - - struct node node_devices[MAX_NUMNODES]; -@@ -326,15 +323,15 @@ int register_cpu_under_node(unsigned int - if (!obj) - return 0; - -- ret = sysfs_create_link(&node_devices[nid].sysdev.kobj, -+ ret = sysfs_create_link(&node_devices[nid].dev.kobj, - &obj->kobj, - kobject_name(&obj->kobj)); - if (ret) - return ret; - - return sysfs_create_link(&obj->kobj, -- &node_devices[nid].sysdev.kobj, -- kobject_name(&node_devices[nid].sysdev.kobj)); -+ &node_devices[nid].dev.kobj, -+ kobject_name(&node_devices[nid].dev.kobj)); - } - - int unregister_cpu_under_node(unsigned int cpu, unsigned int nid) -@@ -348,10 +345,10 @@ int unregister_cpu_under_node(unsigned i - if (!obj) - return 0; - -- sysfs_remove_link(&node_devices[nid].sysdev.kobj, -+ sysfs_remove_link(&node_devices[nid].dev.kobj, - kobject_name(&obj->kobj)); - sysfs_remove_link(&obj->kobj, -- kobject_name(&node_devices[nid].sysdev.kobj)); -+ kobject_name(&node_devices[nid].dev.kobj)); - - return 0; - } -@@ -393,15 +390,15 @@ int register_mem_sect_under_node(struct - continue; - if (page_nid != nid) - continue; -- ret = sysfs_create_link_nowarn(&node_devices[nid].sysdev.kobj, -- &mem_blk->sysdev.kobj, -- kobject_name(&mem_blk->sysdev.kobj)); -+ ret = sysfs_create_link_nowarn(&node_devices[nid].dev.kobj, -+ &mem_blk->dev.kobj, -+ kobject_name(&mem_blk->dev.kobj)); - if (ret) - return ret; - -- return sysfs_create_link_nowarn(&mem_blk->sysdev.kobj, -- &node_devices[nid].sysdev.kobj, -- kobject_name(&node_devices[nid].sysdev.kobj)); -+ return sysfs_create_link_nowarn(&mem_blk->dev.kobj, -+ &node_devices[nid].dev.kobj, -+ kobject_name(&node_devices[nid].dev.kobj)); - } - /* mem section does not span the specified node */ - return 0; -@@ -434,10 +431,10 @@ int unregister_mem_sect_under_nodes(stru - continue; - if (node_test_and_set(nid, *unlinked_nodes)) - continue; -- sysfs_remove_link(&node_devices[nid].sysdev.kobj, -- kobject_name(&mem_blk->sysdev.kobj)); -- sysfs_remove_link(&mem_blk->sysdev.kobj, -- kobject_name(&node_devices[nid].sysdev.kobj)); -+ sysfs_remove_link(&node_devices[nid].dev.kobj, -+ kobject_name(&mem_blk->dev.kobj)); -+ sysfs_remove_link(&mem_blk->dev.kobj, -+ kobject_name(&node_devices[nid].dev.kobj)); - } - NODEMASK_FREE(unlinked_nodes); - return 0; -@@ -468,7 +465,7 @@ static int link_mem_sections(int nid) - } - - if (mem_blk) -- kobject_put(&mem_blk->sysdev.kobj); -+ kobject_put(&mem_blk->dev.kobj); - return err; - } - -@@ -596,19 +593,19 @@ static ssize_t print_nodes_state(enum no - } - - struct node_attr { -- struct sysdev_class_attribute attr; -+ struct device_attribute attr; - enum node_states state; - }; - --static ssize_t show_node_state(struct sysdev_class *class, -- struct sysdev_class_attribute *attr, char *buf) -+static ssize_t show_node_state(struct device *dev, -+ struct device_attribute *attr, char *buf) - { - struct node_attr *na = container_of(attr, struct node_attr, attr); - return print_nodes_state(na->state, buf); - } - - #define _NODE_ATTR(name, state) \ -- { _SYSDEV_CLASS_ATTR(name, 0444, show_node_state, NULL), state } -+ { __ATTR(name, 0444, show_node_state, NULL), state } - - static struct node_attr node_state_attr[] = { - _NODE_ATTR(possible, N_POSSIBLE), -@@ -620,17 +617,26 @@ static struct node_attr node_state_attr[ - #endif - }; - --static struct sysdev_class_attribute *node_state_attrs[] = { -- &node_state_attr[0].attr, -- &node_state_attr[1].attr, -- &node_state_attr[2].attr, -- &node_state_attr[3].attr, -+static struct attribute *node_state_attrs[] = { -+ &node_state_attr[0].attr.attr, -+ &node_state_attr[1].attr.attr, -+ &node_state_attr[2].attr.attr, -+ &node_state_attr[3].attr.attr, - #ifdef CONFIG_HIGHMEM -- &node_state_attr[4].attr, -+ &node_state_attr[4].attr.attr, - #endif - NULL - }; - -+static struct attribute_group memory_root_attr_group = { -+ .attrs = node_state_attrs, -+}; -+ -+static const struct attribute_group *cpu_root_attr_groups[] = { -+ &memory_root_attr_group, -+ NULL, -+}; -+ - #define NODE_CALLBACK_PRI 2 /* lower than SLAB */ - static int __init register_node_type(void) - { -@@ -639,7 +645,7 @@ static int __init register_node_type(voi - BUILD_BUG_ON(ARRAY_SIZE(node_state_attr) != NR_NODE_STATES); - BUILD_BUG_ON(ARRAY_SIZE(node_state_attrs)-1 != NR_NODE_STATES); - -- ret = sysdev_class_register(&node_class); -+ ret = subsys_system_register(&node_subsys, cpu_root_attr_groups); - if (!ret) { - hotplug_memory_notifier(node_memory_callback, - NODE_CALLBACK_PRI); ---- a/include/linux/memory.h -+++ b/include/linux/memory.h -@@ -15,7 +15,6 @@ - #ifndef _LINUX_MEMORY_H_ - #define _LINUX_MEMORY_H_ - --#include <linux/sysdev.h> - #include <linux/node.h> - #include <linux/compiler.h> - #include <linux/mutex.h> -@@ -38,7 +37,7 @@ struct memory_block { - int phys_device; /* to which fru does this belong? */ - void *hw; /* optional pointer to fw/hw data */ - int (*phys_callback)(struct memory_block *); -- struct sys_device sysdev; -+ struct device dev; - }; - - int arch_get_memory_phys_device(unsigned long start_pfn); ---- a/include/linux/node.h -+++ b/include/linux/node.h -@@ -14,12 +14,12 @@ - #ifndef _LINUX_NODE_H_ - #define _LINUX_NODE_H_ - --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/cpumask.h> - #include <linux/workqueue.h> - - struct node { -- struct sys_device sysdev; -+ struct device dev; - - #if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_HUGETLBFS) - struct work_struct node_work; -@@ -80,6 +80,6 @@ static inline void register_hugetlbfs_wi - } - #endif - --#define to_node(sys_device) container_of(sys_device, struct node, sysdev) -+#define to_node(device) container_of(device, struct node, dev) - - #endif /* _LINUX_NODE_H_ */ ---- a/mm/compaction.c -+++ b/mm/compaction.c -@@ -721,23 +721,23 @@ int sysctl_extfrag_handler(struct ctl_ta - } - - #if defined(CONFIG_SYSFS) && defined(CONFIG_NUMA) --ssize_t sysfs_compact_node(struct sys_device *dev, -- struct sysdev_attribute *attr, -+ssize_t sysfs_compact_node(struct device *dev, -+ struct device_attribute *attr, - const char *buf, size_t count) - { - compact_node(dev->id); - - return count; - } --static SYSDEV_ATTR(compact, S_IWUSR, NULL, sysfs_compact_node); -+static DEVICE_ATTR(compact, S_IWUSR, NULL, sysfs_compact_node); - - int compaction_register_node(struct node *node) - { -- return sysdev_create_file(&node->sysdev, &attr_compact); -+ return device_create_file(&node->dev, &dev_attr_compact); - } - - void compaction_unregister_node(struct node *node) - { -- return sysdev_remove_file(&node->sysdev, &attr_compact); -+ return device_remove_file(&node->dev, &dev_attr_compact); - } - #endif /* CONFIG_SYSFS && CONFIG_NUMA */ ---- a/mm/hugetlb.c -+++ b/mm/hugetlb.c -@@ -1592,9 +1592,9 @@ static void __init hugetlb_sysfs_init(vo - - /* - * node_hstate/s - associate per node hstate attributes, via their kobjects, -- * with node sysdevs in node_devices[] using a parallel array. The array -- * index of a node sysdev or _hstate == node id. -- * This is here to avoid any static dependency of the node sysdev driver, in -+ * with node devices in node_devices[] using a parallel array. The array -+ * index of a node device or _hstate == node id. -+ * This is here to avoid any static dependency of the node device driver, in - * the base kernel, on the hugetlb module. - */ - struct node_hstate { -@@ -1604,7 +1604,7 @@ struct node_hstate { - struct node_hstate node_hstates[MAX_NUMNODES]; - - /* -- * A subset of global hstate attributes for node sysdevs -+ * A subset of global hstate attributes for node devices - */ - static struct attribute *per_node_hstate_attrs[] = { - &nr_hugepages_attr.attr, -@@ -1618,7 +1618,7 @@ static struct attribute_group per_node_h - }; - - /* -- * kobj_to_node_hstate - lookup global hstate for node sysdev hstate attr kobj. -+ * kobj_to_node_hstate - lookup global hstate for node device hstate attr kobj. - * Returns node id via non-NULL nidp. - */ - static struct hstate *kobj_to_node_hstate(struct kobject *kobj, int *nidp) -@@ -1641,13 +1641,13 @@ static struct hstate *kobj_to_node_hstat - } - - /* -- * Unregister hstate attributes from a single node sysdev. -+ * Unregister hstate attributes from a single node device. - * No-op if no hstate attributes attached. - */ - void hugetlb_unregister_node(struct node *node) - { - struct hstate *h; -- struct node_hstate *nhs = &node_hstates[node->sysdev.id]; -+ struct node_hstate *nhs = &node_hstates[node->dev.id]; - - if (!nhs->hugepages_kobj) - return; /* no hstate attributes */ -@@ -1663,7 +1663,7 @@ void hugetlb_unregister_node(struct node - } - - /* -- * hugetlb module exit: unregister hstate attributes from node sysdevs -+ * hugetlb module exit: unregister hstate attributes from node devices - * that have them. - */ - static void hugetlb_unregister_all_nodes(void) -@@ -1671,7 +1671,7 @@ static void hugetlb_unregister_all_nodes - int nid; - - /* -- * disable node sysdev registrations. -+ * disable node device registrations. - */ - register_hugetlbfs_with_node(NULL, NULL); - -@@ -1683,20 +1683,20 @@ static void hugetlb_unregister_all_nodes - } - - /* -- * Register hstate attributes for a single node sysdev. -+ * Register hstate attributes for a single node device. - * No-op if attributes already registered. - */ - void hugetlb_register_node(struct node *node) - { - struct hstate *h; -- struct node_hstate *nhs = &node_hstates[node->sysdev.id]; -+ struct node_hstate *nhs = &node_hstates[node->dev.id]; - int err; - - if (nhs->hugepages_kobj) - return; /* already allocated */ - - nhs->hugepages_kobj = kobject_create_and_add("hugepages", -- &node->sysdev.kobj); -+ &node->dev.kobj); - if (!nhs->hugepages_kobj) - return; - -@@ -1707,7 +1707,7 @@ void hugetlb_register_node(struct node * - if (err) { - printk(KERN_ERR "Hugetlb: Unable to add hstate %s" - " for node %d\n", -- h->name, node->sysdev.id); -+ h->name, node->dev.id); - hugetlb_unregister_node(node); - break; - } -@@ -1716,8 +1716,8 @@ void hugetlb_register_node(struct node * - - /* - * hugetlb init time: register hstate attributes for all registered node -- * sysdevs of nodes that have memory. All on-line nodes should have -- * registered their associated sysdev by this time. -+ * devices of nodes that have memory. All on-line nodes should have -+ * registered their associated device by this time. - */ - static void hugetlb_register_all_nodes(void) - { -@@ -1725,12 +1725,12 @@ static void hugetlb_register_all_nodes(v - - for_each_node_state(nid, N_HIGH_MEMORY) { - struct node *node = &node_devices[nid]; -- if (node->sysdev.id == nid) -+ if (node->dev.id == nid) - hugetlb_register_node(node); - } - - /* -- * Let the node sysdev driver know we're here so it can -+ * Let the node device driver know we're here so it can - * [un]register hstate attributes on node hotplug. - */ - register_hugetlbfs_with_node(hugetlb_register_node, ---- a/mm/vmscan.c -+++ b/mm/vmscan.c -@@ -3475,16 +3475,16 @@ int scan_unevictable_handler(struct ctl_ - * a specified node's per zone unevictable lists for evictable pages. - */ - --static ssize_t read_scan_unevictable_node(struct sys_device *dev, -- struct sysdev_attribute *attr, -+static ssize_t read_scan_unevictable_node(struct device *dev, -+ struct device_attribute *attr, - char *buf) - { - warn_scan_unevictable_pages(); - return sprintf(buf, "0\n"); /* always zero; should fit... */ - } - --static ssize_t write_scan_unevictable_node(struct sys_device *dev, -- struct sysdev_attribute *attr, -+static ssize_t write_scan_unevictable_node(struct device *dev, -+ struct device_attribute *attr, - const char *buf, size_t count) - { - warn_scan_unevictable_pages(); -@@ -3492,17 +3492,17 @@ static ssize_t write_scan_unevictable_no - } - - --static SYSDEV_ATTR(scan_unevictable_pages, S_IRUGO | S_IWUSR, -+static DEVICE_ATTR(scan_unevictable_pages, S_IRUGO | S_IWUSR, - read_scan_unevictable_node, - write_scan_unevictable_node); - - int scan_unevictable_register_node(struct node *node) - { -- return sysdev_create_file(&node->sysdev, &attr_scan_unevictable_pages); -+ return device_create_file(&node->dev, &dev_attr_scan_unevictable_pages); - } - - void scan_unevictable_unregister_node(struct node *node) - { -- sysdev_remove_file(&node->sysdev, &attr_scan_unevictable_pages); -+ device_remove_file(&node->dev, &dev_attr_scan_unevictable_pages); - } - #endif diff --git a/11-s390-time.patch b/11-s390-time.patch deleted file mode 100644 index 479303d..0000000 --- a/11-s390-time.patch +++ /dev/null @@ -1,563 +0,0 @@ -From: Kay Sievers <kay.sievers@vrfy.org> -Subject: s390: time - convert sysdev_class to a regular subsystem - -After all sysdev classes are ported to regular driver core entities, the -sysdev implementation will be entirely removed from the kernel. - -Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> ---- - arch/s390/kernel/time.c | 260 ++++++++++++++++++++++++------------------------ - 1 file changed, 131 insertions(+), 129 deletions(-) - ---- a/arch/s390/kernel/time.c -+++ b/arch/s390/kernel/time.c -@@ -27,7 +27,7 @@ - #include <linux/cpu.h> - #include <linux/stop_machine.h> - #include <linux/time.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/delay.h> - #include <linux/init.h> - #include <linux/smp.h> -@@ -1116,34 +1116,35 @@ out_unlock: - /* - * Sysfs interface functions - */ --static struct sysdev_class etr_sysclass = { -- .name = "etr", -+static struct bus_type etr_subsys = { -+ .name = "etr", -+ .dev_name = "etr", - }; - --static struct sys_device etr_port0_dev = { -+static struct device etr_port0_dev = { - .id = 0, -- .cls = &etr_sysclass, -+ .bus = &etr_subsys, - }; - --static struct sys_device etr_port1_dev = { -+static struct device etr_port1_dev = { - .id = 1, -- .cls = &etr_sysclass, -+ .bus = &etr_subsys, - }; - - /* -- * ETR class attributes -+ * ETR subsys attributes - */ --static ssize_t etr_stepping_port_show(struct sysdev_class *class, -- struct sysdev_class_attribute *attr, -+static ssize_t etr_stepping_port_show(struct device *dev, -+ struct device_attribute *attr, - char *buf) - { - return sprintf(buf, "%i\n", etr_port0.esw.p); - } - --static SYSDEV_CLASS_ATTR(stepping_port, 0400, etr_stepping_port_show, NULL); -+static DEVICE_ATTR(stepping_port, 0400, etr_stepping_port_show, NULL); - --static ssize_t etr_stepping_mode_show(struct sysdev_class *class, -- struct sysdev_class_attribute *attr, -+static ssize_t etr_stepping_mode_show(struct device *dev, -+ struct device_attribute *attr, - char *buf) - { - char *mode_str; -@@ -1157,12 +1158,12 @@ static ssize_t etr_stepping_mode_show(st - return sprintf(buf, "%s\n", mode_str); - } - --static SYSDEV_CLASS_ATTR(stepping_mode, 0400, etr_stepping_mode_show, NULL); -+static DEVICE_ATTR(stepping_mode, 0400, etr_stepping_mode_show, NULL); - - /* - * ETR port attributes - */ --static inline struct etr_aib *etr_aib_from_dev(struct sys_device *dev) -+static inline struct etr_aib *etr_aib_from_dev(struct device *dev) - { - if (dev == &etr_port0_dev) - return etr_port0_online ? &etr_port0 : NULL; -@@ -1170,8 +1171,8 @@ static inline struct etr_aib *etr_aib_fr - return etr_port1_online ? &etr_port1 : NULL; - } - --static ssize_t etr_online_show(struct sys_device *dev, -- struct sysdev_attribute *attr, -+static ssize_t etr_online_show(struct device *dev, -+ struct device_attribute *attr, - char *buf) - { - unsigned int online; -@@ -1180,8 +1181,8 @@ static ssize_t etr_online_show(struct sy - return sprintf(buf, "%i\n", online); - } - --static ssize_t etr_online_store(struct sys_device *dev, -- struct sysdev_attribute *attr, -+static ssize_t etr_online_store(struct device *dev, -+ struct device_attribute *attr, - const char *buf, size_t count) - { - unsigned int value; -@@ -1218,20 +1219,20 @@ out: - return count; - } - --static SYSDEV_ATTR(online, 0600, etr_online_show, etr_online_store); -+static DEVICE_ATTR(online, 0600, etr_online_show, etr_online_store); - --static ssize_t etr_stepping_control_show(struct sys_device *dev, -- struct sysdev_attribute *attr, -+static ssize_t etr_stepping_control_show(struct device *dev, -+ struct device_attribute *attr, - char *buf) - { - return sprintf(buf, "%i\n", (dev == &etr_port0_dev) ? - etr_eacr.e0 : etr_eacr.e1); - } - --static SYSDEV_ATTR(stepping_control, 0400, etr_stepping_control_show, NULL); -+static DEVICE_ATTR(stepping_control, 0400, etr_stepping_control_show, NULL); - --static ssize_t etr_mode_code_show(struct sys_device *dev, -- struct sysdev_attribute *attr, char *buf) -+static ssize_t etr_mode_code_show(struct device *dev, -+ struct device_attribute *attr, char *buf) - { - if (!etr_port0_online && !etr_port1_online) - /* Status word is not uptodate if both ports are offline. */ -@@ -1240,10 +1241,10 @@ static ssize_t etr_mode_code_show(struct - etr_port0.esw.psc0 : etr_port0.esw.psc1); - } - --static SYSDEV_ATTR(state_code, 0400, etr_mode_code_show, NULL); -+static DEVICE_ATTR(state_code, 0400, etr_mode_code_show, NULL); - --static ssize_t etr_untuned_show(struct sys_device *dev, -- struct sysdev_attribute *attr, char *buf) -+static ssize_t etr_untuned_show(struct device *dev, -+ struct device_attribute *attr, char *buf) - { - struct etr_aib *aib = etr_aib_from_dev(dev); - -@@ -1252,10 +1253,10 @@ static ssize_t etr_untuned_show(struct s - return sprintf(buf, "%i\n", aib->edf1.u); - } - --static SYSDEV_ATTR(untuned, 0400, etr_untuned_show, NULL); -+static DEVICE_ATTR(untuned, 0400, etr_untuned_show, NULL); - --static ssize_t etr_network_id_show(struct sys_device *dev, -- struct sysdev_attribute *attr, char *buf) -+static ssize_t etr_network_id_show(struct device *dev, -+ struct device_attribute *attr, char *buf) - { - struct etr_aib *aib = etr_aib_from_dev(dev); - -@@ -1264,10 +1265,10 @@ static ssize_t etr_network_id_show(struc - return sprintf(buf, "%i\n", aib->edf1.net_id); - } - --static SYSDEV_ATTR(network, 0400, etr_network_id_show, NULL); -+static DEVICE_ATTR(network, 0400, etr_network_id_show, NULL); - --static ssize_t etr_id_show(struct sys_device *dev, -- struct sysdev_attribute *attr, char *buf) -+static ssize_t etr_id_show(struct device *dev, -+ struct device_attribute *attr, char *buf) - { - struct etr_aib *aib = etr_aib_from_dev(dev); - -@@ -1276,10 +1277,10 @@ static ssize_t etr_id_show(struct sys_de - return sprintf(buf, "%i\n", aib->edf1.etr_id); - } - --static SYSDEV_ATTR(id, 0400, etr_id_show, NULL); -+static DEVICE_ATTR(id, 0400, etr_id_show, NULL); - --static ssize_t etr_port_number_show(struct sys_device *dev, -- struct sysdev_attribute *attr, char *buf) -+static ssize_t etr_port_number_show(struct device *dev, -+ struct device_attribute *attr, char *buf) - { - struct etr_aib *aib = etr_aib_from_dev(dev); - -@@ -1288,10 +1289,10 @@ static ssize_t etr_port_number_show(stru - return sprintf(buf, "%i\n", aib->edf1.etr_pn); - } - --static SYSDEV_ATTR(port, 0400, etr_port_number_show, NULL); -+static DEVICE_ATTR(port, 0400, etr_port_number_show, NULL); - --static ssize_t etr_coupled_show(struct sys_device *dev, -- struct sysdev_attribute *attr, char *buf) -+static ssize_t etr_coupled_show(struct device *dev, -+ struct device_attribute *attr, char *buf) - { - struct etr_aib *aib = etr_aib_from_dev(dev); - -@@ -1300,10 +1301,10 @@ static ssize_t etr_coupled_show(struct s - return sprintf(buf, "%i\n", aib->edf3.c); - } - --static SYSDEV_ATTR(coupled, 0400, etr_coupled_show, NULL); -+static DEVICE_ATTR(coupled, 0400, etr_coupled_show, NULL); - --static ssize_t etr_local_time_show(struct sys_device *dev, -- struct sysdev_attribute *attr, char *buf) -+static ssize_t etr_local_time_show(struct device *dev, -+ struct device_attribute *attr, char *buf) - { - struct etr_aib *aib = etr_aib_from_dev(dev); - -@@ -1312,10 +1313,10 @@ static ssize_t etr_local_time_show(struc - return sprintf(buf, "%i\n", aib->edf3.blto); - } - --static SYSDEV_ATTR(local_time, 0400, etr_local_time_show, NULL); -+static DEVICE_ATTR(local_time, 0400, etr_local_time_show, NULL); - --static ssize_t etr_utc_offset_show(struct sys_device *dev, -- struct sysdev_attribute *attr, char *buf) -+static ssize_t etr_utc_offset_show(struct device *dev, -+ struct device_attribute *attr, char *buf) - { - struct etr_aib *aib = etr_aib_from_dev(dev); - -@@ -1324,64 +1325,64 @@ static ssize_t etr_utc_offset_show(struc - return sprintf(buf, "%i\n", aib->edf3.buo); - } - --static SYSDEV_ATTR(utc_offset, 0400, etr_utc_offset_show, NULL); -+static DEVICE_ATTR(utc_offset, 0400, etr_utc_offset_show, NULL); - --static struct sysdev_attribute *etr_port_attributes[] = { -- &attr_online, -- &attr_stepping_control, -- &attr_state_code, -- &attr_untuned, -- &attr_network, -- &attr_id, -- &attr_port, -- &attr_coupled, -- &attr_local_time, -- &attr_utc_offset, -+static struct device_attribute *etr_port_attributes[] = { -+ &dev_attr_online, -+ &dev_attr_stepping_control, -+ &dev_attr_state_code, -+ &dev_attr_untuned, -+ &dev_attr_network, -+ &dev_attr_id, -+ &dev_attr_port, -+ &dev_attr_coupled, -+ &dev_attr_local_time, -+ &dev_attr_utc_offset, - NULL - }; - --static int __init etr_register_port(struct sys_device *dev) -+static int __init etr_register_port(struct device *dev) - { -- struct sysdev_attribute **attr; -+ struct device_attribute **attr; - int rc; - -- rc = sysdev_register(dev); -+ rc = device_register(dev); - if (rc) - goto out; - for (attr = etr_port_attributes; *attr; attr++) { -- rc = sysdev_create_file(dev, *attr); -+ rc = device_create_file(dev, *attr); - if (rc) - goto out_unreg; - } - return 0; - out_unreg: - for (; attr >= etr_port_attributes; attr--) -- sysdev_remove_file(dev, *attr); -- sysdev_unregister(dev); -+ device_remove_file(dev, *attr); -+ device_unregister(dev); - out: - return rc; - } - --static void __init etr_unregister_port(struct sys_device *dev) -+static void __init etr_unregister_port(struct device *dev) - { -- struct sysdev_attribute **attr; -+ struct device_attribute **attr; - - for (attr = etr_port_attributes; *attr; attr++) -- sysdev_remove_file(dev, *attr); -- sysdev_unregister(dev); -+ device_remove_file(dev, *attr); -+ device_unregister(dev); - } - - static int __init etr_init_sysfs(void) - { - int rc; - -- rc = sysdev_class_register(&etr_sysclass); -+ rc = subsys_system_register(&etr_subsys, NULL); - if (rc) - goto out; -- rc = sysdev_class_create_file(&etr_sysclass, &attr_stepping_port); -+ rc = device_create_file(etr_subsys.dev_root, &dev_attr_stepping_port); - if (rc) -- goto out_unreg_class; -- rc = sysdev_class_create_file(&etr_sysclass, &attr_stepping_mode); -+ goto out_unreg_subsys; -+ rc = device_create_file(etr_subsys.dev_root, &dev_attr_stepping_mode); - if (rc) - goto out_remove_stepping_port; - rc = etr_register_port(&etr_port0_dev); -@@ -1395,11 +1396,11 @@ static int __init etr_init_sysfs(void) - out_remove_port0: - etr_unregister_port(&etr_port0_dev); - out_remove_stepping_mode: -- sysdev_class_remove_file(&etr_sysclass, &attr_stepping_mode); -+ device_remove_file(etr_subsys.dev_root, &dev_attr_stepping_mode); - out_remove_stepping_port: -- sysdev_class_remove_file(&etr_sysclass, &attr_stepping_port); --out_unreg_class: -- sysdev_class_unregister(&etr_sysclass); -+ device_remove_file(etr_subsys.dev_root, &dev_attr_stepping_port); -+out_unreg_subsys: -+ bus_unregister(&etr_subsys); - out: - return rc; - } -@@ -1599,14 +1600,15 @@ out_unlock: - } - - /* -- * STP class sysfs interface functions -+ * STP subsys sysfs interface functions - */ --static struct sysdev_class stp_sysclass = { -- .name = "stp", -+static struct bus_type stp_subsys = { -+ .name = "stp", -+ .dev_name = "stp", - }; - --static ssize_t stp_ctn_id_show(struct sysdev_class *class, -- struct sysdev_class_attribute *attr, -+static ssize_t stp_ctn_id_show(struct device *dev, -+ struct device_attribute *attr, - char *buf) - { - if (!stp_online) -@@ -1615,10 +1617,10 @@ static ssize_t stp_ctn_id_show(struct sy - *(unsigned long long *) stp_info.ctnid); - } - --static SYSDEV_CLASS_ATTR(ctn_id, 0400, stp_ctn_id_show, NULL); -+static DEVICE_ATTR(ctn_id, 0400, stp_ctn_id_show, NULL); - --static ssize_t stp_ctn_type_show(struct sysdev_class *class, -- struct sysdev_class_attribute *attr, -+static ssize_t stp_ctn_type_show(struct device *dev, -+ struct device_attribute *attr, - char *buf) - { - if (!stp_online) -@@ -1626,10 +1628,10 @@ static ssize_t stp_ctn_type_show(struct - return sprintf(buf, "%i\n", stp_info.ctn); - } - --static SYSDEV_CLASS_ATTR(ctn_type, 0400, stp_ctn_type_show, NULL); -+static DEVICE_ATTR(ctn_type, 0400, stp_ctn_type_show, NULL); - --static ssize_t stp_dst_offset_show(struct sysdev_class *class, -- struct sysdev_class_attribute *attr, -+static ssize_t stp_dst_offset_show(struct device *dev, -+ struct device_attribute *attr, - char *buf) - { - if (!stp_online || !(stp_info.vbits & 0x2000)) -@@ -1637,10 +1639,10 @@ static ssize_t stp_dst_offset_show(struc - return sprintf(buf, "%i\n", (int)(s16) stp_info.dsto); - } - --static SYSDEV_CLASS_ATTR(dst_offset, 0400, stp_dst_offset_show, NULL); -+static DEVICE_ATTR(dst_offset, 0400, stp_dst_offset_show, NULL); - --static ssize_t stp_leap_seconds_show(struct sysdev_class *class, -- struct sysdev_class_attribute *attr, -+static ssize_t stp_leap_seconds_show(struct device *dev, -+ struct device_attribute *attr, - char *buf) - { - if (!stp_online || !(stp_info.vbits & 0x8000)) -@@ -1648,10 +1650,10 @@ static ssize_t stp_leap_seconds_show(str - return sprintf(buf, "%i\n", (int)(s16) stp_info.leaps); - } - --static SYSDEV_CLASS_ATTR(leap_seconds, 0400, stp_leap_seconds_show, NULL); -+static DEVICE_ATTR(leap_seconds, 0400, stp_leap_seconds_show, NULL); - --static ssize_t stp_stratum_show(struct sysdev_class *class, -- struct sysdev_class_attribute *attr, -+static ssize_t stp_stratum_show(struct device *dev, -+ struct device_attribute *attr, - char *buf) - { - if (!stp_online) -@@ -1659,10 +1661,10 @@ static ssize_t stp_stratum_show(struct s - return sprintf(buf, "%i\n", (int)(s16) stp_info.stratum); - } - --static SYSDEV_CLASS_ATTR(stratum, 0400, stp_stratum_show, NULL); -+static DEVICE_ATTR(stratum, 0400, stp_stratum_show, NULL); - --static ssize_t stp_time_offset_show(struct sysdev_class *class, -- struct sysdev_class_attribute *attr, -+static ssize_t stp_time_offset_show(struct device *dev, -+ struct device_attribute *attr, - char *buf) - { - if (!stp_online || !(stp_info.vbits & 0x0800)) -@@ -1670,10 +1672,10 @@ static ssize_t stp_time_offset_show(stru - return sprintf(buf, "%i\n", (int) stp_info.tto); - } - --static SYSDEV_CLASS_ATTR(time_offset, 0400, stp_time_offset_show, NULL); -+static DEVICE_ATTR(time_offset, 0400, stp_time_offset_show, NULL); - --static ssize_t stp_time_zone_offset_show(struct sysdev_class *class, -- struct sysdev_class_attribute *attr, -+static ssize_t stp_time_zone_offset_show(struct device *dev, -+ struct device_attribute *attr, - char *buf) - { - if (!stp_online || !(stp_info.vbits & 0x4000)) -@@ -1681,11 +1683,11 @@ static ssize_t stp_time_zone_offset_show - return sprintf(buf, "%i\n", (int)(s16) stp_info.tzo); - } - --static SYSDEV_CLASS_ATTR(time_zone_offset, 0400, -+static DEVICE_ATTR(time_zone_offset, 0400, - stp_time_zone_offset_show, NULL); - --static ssize_t stp_timing_mode_show(struct sysdev_class *class, -- struct sysdev_class_attribute *attr, -+static ssize_t stp_timing_mode_show(struct device *dev, -+ struct device_attribute *attr, - char *buf) - { - if (!stp_online) -@@ -1693,10 +1695,10 @@ static ssize_t stp_timing_mode_show(stru - return sprintf(buf, "%i\n", stp_info.tmd); - } - --static SYSDEV_CLASS_ATTR(timing_mode, 0400, stp_timing_mode_show, NULL); -+static DEVICE_ATTR(timing_mode, 0400, stp_timing_mode_show, NULL); - --static ssize_t stp_timing_state_show(struct sysdev_class *class, -- struct sysdev_class_attribute *attr, -+static ssize_t stp_timing_state_show(struct device *dev, -+ struct device_attribute *attr, - char *buf) - { - if (!stp_online) -@@ -1704,17 +1706,17 @@ static ssize_t stp_timing_state_show(str - return sprintf(buf, "%i\n", stp_info.tst); - } - --static SYSDEV_CLASS_ATTR(timing_state, 0400, stp_timing_state_show, NULL); -+static DEVICE_ATTR(timing_state, 0400, stp_timing_state_show, NULL); - --static ssize_t stp_online_show(struct sysdev_class *class, -- struct sysdev_class_attribute *attr, -+static ssize_t stp_online_show(struct device *dev, -+ struct device_attribute *attr, - char *buf) - { - return sprintf(buf, "%i\n", stp_online); - } - --static ssize_t stp_online_store(struct sysdev_class *class, -- struct sysdev_class_attribute *attr, -+static ssize_t stp_online_store(struct device *dev, -+ struct device_attribute *attr, - const char *buf, size_t count) - { - unsigned int value; -@@ -1736,47 +1738,47 @@ static ssize_t stp_online_store(struct s - } - - /* -- * Can't use SYSDEV_CLASS_ATTR because the attribute should be named -- * stp/online but attr_online already exists in this file .. -+ * Can't use DEVICE_ATTR because the attribute should be named -+ * stp/online but dev_attr_online already exists in this file .. - */ --static struct sysdev_class_attribute attr_stp_online = { -+static struct device_attribute dev_attr_stp_online = { - .attr = { .name = "online", .mode = 0600 }, - .show = stp_online_show, - .store = stp_online_store, - }; - --static struct sysdev_class_attribute *stp_attributes[] = { -- &attr_ctn_id, -- &attr_ctn_type, -- &attr_dst_offset, -- &attr_leap_seconds, -- &attr_stp_online, -- &attr_stratum, -- &attr_time_offset, -- &attr_time_zone_offset, -- &attr_timing_mode, -- &attr_timing_state, -+static struct device_attribute *stp_attributes[] = { -+ &dev_attr_ctn_id, -+ &dev_attr_ctn_type, -+ &dev_attr_dst_offset, -+ &dev_attr_leap_seconds, -+ &dev_attr_stp_online, -+ &dev_attr_stratum, -+ &dev_attr_time_offset, -+ &dev_attr_time_zone_offset, -+ &dev_attr_timing_mode, -+ &dev_attr_timing_state, - NULL - }; - - static int __init stp_init_sysfs(void) - { -- struct sysdev_class_attribute **attr; -+ struct device_attribute **attr; - int rc; - -- rc = sysdev_class_register(&stp_sysclass); -+ rc = subsys_system_register(&stp_subsys, NULL); - if (rc) - goto out; - for (attr = stp_attributes; *attr; attr++) { -- rc = sysdev_class_create_file(&stp_sysclass, *attr); -+ rc = device_create_file(stp_subsys.dev_root, *attr); - if (rc) - goto out_unreg; - } - return 0; - out_unreg: - for (; attr >= stp_attributes; attr--) -- sysdev_class_remove_file(&stp_sysclass, *attr); -- sysdev_class_unregister(&stp_sysclass); -+ device_remove_file(stp_subsys.dev_root, *attr); -+ bus_unregister(&stp_subsys); - out: - return rc; - } diff --git a/12-power-cmm.patch b/12-power-cmm.patch deleted file mode 100644 index c94ebeb..0000000 --- a/12-power-cmm.patch +++ /dev/null @@ -1,179 +0,0 @@ -From: Kay Sievers <kay.sievers@vrfy.org> -Subject: power: cmm - convert sysdev_class to a regular subsystem - -After all sysdev classes are ported to regular driver core entities, the -sysdev implementation will be entirely removed from the kernel. - -Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> ---- - arch/powerpc/platforms/pseries/cmm.c | 67 +++++++++++++++++------------------ - 1 file changed, 34 insertions(+), 33 deletions(-) - ---- a/arch/powerpc/platforms/pseries/cmm.c -+++ b/arch/powerpc/platforms/pseries/cmm.c -@@ -33,7 +33,7 @@ - #include <linux/sched.h> - #include <linux/stringify.h> - #include <linux/swap.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <asm/firmware.h> - #include <asm/hvcall.h> - #include <asm/mmu.h> -@@ -65,7 +65,7 @@ static unsigned int oom_kb = CMM_OOM_KB; - static unsigned int cmm_debug = CMM_DEBUG; - static unsigned int cmm_disabled = CMM_DISABLE; - static unsigned long min_mem_mb = CMM_MIN_MEM_MB; --static struct sys_device cmm_sysdev; -+static struct device cmm_dev; - - MODULE_AUTHOR("Brian King <brking@linux.vnet.ibm.com>"); - MODULE_DESCRIPTION("IBM System p Collaborative Memory Manager"); -@@ -347,25 +347,25 @@ static int cmm_thread(void *dummy) - } - - #define CMM_SHOW(name, format, args...) \ -- static ssize_t show_##name(struct sys_device *dev, \ -- struct sysdev_attribute *attr, \ -+ static ssize_t show_##name(struct device *dev, \ -+ struct device_attribute *attr, \ - char *buf) \ - { \ - return sprintf(buf, format, ##args); \ - } \ -- static SYSDEV_ATTR(name, S_IRUGO, show_##name, NULL) -+ static DEVICE_ATTR(name, S_IRUGO, show_##name, NULL) - - CMM_SHOW(loaned_kb, "%lu\n", PAGES2KB(loaned_pages)); - CMM_SHOW(loaned_target_kb, "%lu\n", PAGES2KB(loaned_pages_target)); - --static ssize_t show_oom_pages(struct sys_device *dev, -- struct sysdev_attribute *attr, char *buf) -+static ssize_t show_oom_pages(struct device *dev, -+ struct device_attribute *attr, char *buf) - { - return sprintf(buf, "%lu\n", PAGES2KB(oom_freed_pages)); - } - --static ssize_t store_oom_pages(struct sys_device *dev, -- struct sysdev_attribute *attr, -+static ssize_t store_oom_pages(struct device *dev, -+ struct device_attribute *attr, - const char *buf, size_t count) - { - unsigned long val = simple_strtoul (buf, NULL, 10); -@@ -379,17 +379,18 @@ static ssize_t store_oom_pages(struct sy - return count; - } - --static SYSDEV_ATTR(oom_freed_kb, S_IWUSR| S_IRUGO, -+static DEVICE_ATTR(oom_freed_kb, S_IWUSR| S_IRUGO, - show_oom_pages, store_oom_pages); - --static struct sysdev_attribute *cmm_attrs[] = { -- &attr_loaned_kb, -- &attr_loaned_target_kb, -- &attr_oom_freed_kb, -+static struct device_attribute *cmm_attrs[] = { -+ &dev_attr_loaned_kb, -+ &dev_attr_loaned_target_kb, -+ &dev_attr_oom_freed_kb, - }; - --static struct sysdev_class cmm_sysdev_class = { -+static struct bus_type cmm_subsys = { - .name = "cmm", -+ .dev_name = "cmm", - }; - - /** -@@ -398,21 +399,21 @@ static struct sysdev_class cmm_sysdev_cl - * Return value: - * 0 on success / other on failure - **/ --static int cmm_sysfs_register(struct sys_device *sysdev) -+static int cmm_sysfs_register(struct device *dev) - { - int i, rc; - -- if ((rc = sysdev_class_register(&cmm_sysdev_class))) -+ if ((rc = subsys_system_register(&cmm_subsys, NULL))) - return rc; - -- sysdev->id = 0; -- sysdev->cls = &cmm_sysdev_class; -+ dev->id = 0; -+ dev->bus = &cmm_subsys; - -- if ((rc = sysdev_register(sysdev))) -- goto class_unregister; -+ if ((rc = device_register(dev))) -+ goto subsys_unregister; - - for (i = 0; i < ARRAY_SIZE(cmm_attrs); i++) { -- if ((rc = sysdev_create_file(sysdev, cmm_attrs[i]))) -+ if ((rc = device_create_file(dev, cmm_attrs[i]))) - goto fail; - } - -@@ -420,10 +421,10 @@ static int cmm_sysfs_register(struct sys - - fail: - while (--i >= 0) -- sysdev_remove_file(sysdev, cmm_attrs[i]); -- sysdev_unregister(sysdev); --class_unregister: -- sysdev_class_unregister(&cmm_sysdev_class); -+ device_remove_file(dev, cmm_attrs[i]); -+ device_unregister(dev); -+subsys_unregister: -+ bus_unregister(&cmm_subsys); - return rc; - } - -@@ -431,14 +432,14 @@ class_unregister: - * cmm_unregister_sysfs - Unregister from sysfs - * - **/ --static void cmm_unregister_sysfs(struct sys_device *sysdev) -+static void cmm_unregister_sysfs(struct device *dev) - { - int i; - - for (i = 0; i < ARRAY_SIZE(cmm_attrs); i++) -- sysdev_remove_file(sysdev, cmm_attrs[i]); -- sysdev_unregister(sysdev); -- sysdev_class_unregister(&cmm_sysdev_class); -+ device_remove_file(dev, cmm_attrs[i]); -+ device_unregister(dev); -+ bus_unregister(&cmm_subsys); - } - - /** -@@ -657,7 +658,7 @@ static int cmm_init(void) - if ((rc = register_reboot_notifier(&cmm_reboot_nb))) - goto out_oom_notifier; - -- if ((rc = cmm_sysfs_register(&cmm_sysdev))) -+ if ((rc = cmm_sysfs_register(&cmm_dev))) - goto out_reboot_notifier; - - if (register_memory_notifier(&cmm_mem_nb) || -@@ -678,7 +679,7 @@ static int cmm_init(void) - out_unregister_notifier: - unregister_memory_notifier(&cmm_mem_nb); - unregister_memory_isolate_notifier(&cmm_mem_isolate_nb); -- cmm_unregister_sysfs(&cmm_sysdev); -+ cmm_unregister_sysfs(&cmm_dev); - out_reboot_notifier: - unregister_reboot_notifier(&cmm_reboot_nb); - out_oom_notifier: -@@ -701,7 +702,7 @@ static void cmm_exit(void) - unregister_memory_notifier(&cmm_mem_nb); - unregister_memory_isolate_notifier(&cmm_mem_isolate_nb); - cmm_free_pages(loaned_pages); -- cmm_unregister_sysfs(&cmm_sysdev); -+ cmm_unregister_sysfs(&cmm_dev); - } - - /** diff --git a/13-power-qe_ic.patch b/13-power-qe_ic.patch deleted file mode 100644 index 15a658a..0000000 --- a/13-power-qe_ic.patch +++ /dev/null @@ -1,54 +0,0 @@ -From: Kay Sievers <kay.sievers@vrfy.org> -Subject: power: qe_ic - convert sysdev_class to a regular subsystem - -After all sysdev classes are ported to regular driver core entities, the -sysdev implementation will be entirely removed from the kernel. - -Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> ---- - arch/powerpc/sysdev/qe_lib/qe_ic.c | 12 ++++++------ - 1 file changed, 6 insertions(+), 6 deletions(-) - ---- a/arch/powerpc/sysdev/qe_lib/qe_ic.c -+++ b/arch/powerpc/sysdev/qe_lib/qe_ic.c -@@ -22,7 +22,6 @@ - #include <linux/stddef.h> - #include <linux/sched.h> - #include <linux/signal.h> --#include <linux/sysdev.h> - #include <linux/device.h> - #include <linux/bootmem.h> - #include <linux/spinlock.h> -@@ -484,13 +483,14 @@ int qe_ic_set_high_priority(unsigned int - return 0; - } - --static struct sysdev_class qe_ic_sysclass = { -+static struct bus_type qe_ic_subsys = { - .name = "qe_ic", -+ .dev_name = "qe_ic", - }; - --static struct sys_device device_qe_ic = { -+static struct device device_qe_ic = { - .id = 0, -- .cls = &qe_ic_sysclass, -+ .bus = &qe_ic_subsys, - }; - - static int __init init_qe_ic_sysfs(void) -@@ -499,12 +499,12 @@ static int __init init_qe_ic_sysfs(void) - - printk(KERN_DEBUG "Registering qe_ic with sysfs...\n"); - -- rc = sysdev_class_register(&qe_ic_sysclass); -+ rc = subsys_system_register(&qe_ic_subsys, NULL); - if (rc) { - printk(KERN_ERR "Failed registering qe_ic sys class\n"); - return -ENODEV; - } -- rc = sysdev_register(&device_qe_ic); -+ rc = device_register(&device_qe_ic); - if (rc) { - printk(KERN_ERR "Failed registering qe_ic sys device\n"); - return -ENODEV; diff --git a/14-power-suspend.patch b/14-power-suspend.patch deleted file mode 100644 index ff79a10..0000000 --- a/14-power-suspend.patch +++ /dev/null @@ -1,99 +0,0 @@ -From: Kay Sievers <kay.sievers@vrfy.org> -Subject: power: suspend - convert sysdev_class to a regular subsystem - -After all sysdev classes are ported to regular driver core entities, the -sysdev implementation will be entirely removed from the kernel. - -Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> ---- - arch/powerpc/platforms/pseries/suspend.c | 33 +++++++++++++++---------------- - 1 file changed, 17 insertions(+), 16 deletions(-) - ---- a/arch/powerpc/platforms/pseries/suspend.c -+++ b/arch/powerpc/platforms/pseries/suspend.c -@@ -26,7 +26,7 @@ - #include <asm/rtas.h> - - static u64 stream_id; --static struct sys_device suspend_sysdev; -+static struct device suspend_dev; - static DECLARE_COMPLETION(suspend_work); - static struct rtas_suspend_me_data suspend_data; - static atomic_t suspending; -@@ -110,8 +110,8 @@ static int pseries_prepare_late(void) - - /** - * store_hibernate - Initiate partition hibernation -- * @classdev: sysdev class struct -- * @attr: class device attribute struct -+ * @dev: subsys root device -+ * @attr: device attribute struct - * @buf: buffer - * @count: buffer size - * -@@ -121,8 +121,8 @@ static int pseries_prepare_late(void) - * Return value: - * number of bytes printed to buffer / other on failure - **/ --static ssize_t store_hibernate(struct sysdev_class *classdev, -- struct sysdev_class_attribute *attr, -+static ssize_t store_hibernate(struct device *dev, -+ struct device_attribute *attr, - const char *buf, size_t count) - { - int rc; -@@ -148,10 +148,11 @@ static ssize_t store_hibernate(struct sy - return rc; - } - --static SYSDEV_CLASS_ATTR(hibernate, S_IWUSR, NULL, store_hibernate); -+static DEVICE_ATTR(hibernate, S_IWUSR, NULL, store_hibernate); - --static struct sysdev_class suspend_sysdev_class = { -+static struct bus_type suspend_subsys = { - .name = "power", -+ .dev_name = "power", - }; - - static const struct platform_suspend_ops pseries_suspend_ops = { -@@ -167,23 +168,23 @@ static const struct platform_suspend_ops - * Return value: - * 0 on success / other on failure - **/ --static int pseries_suspend_sysfs_register(struct sys_device *sysdev) -+static int pseries_suspend_sysfs_register(struct device *dev) - { - int rc; - -- if ((rc = sysdev_class_register(&suspend_sysdev_class))) -+ if ((rc = subsys_system_register(&suspend_subsys, NULL))) - return rc; - -- sysdev->id = 0; -- sysdev->cls = &suspend_sysdev_class; -+ dev->id = 0; -+ dev->bus = &suspend_subsys; - -- if ((rc = sysdev_class_create_file(&suspend_sysdev_class, &attr_hibernate))) -- goto class_unregister; -+ if ((rc = device_create_file(suspend_subsys.dev_root, &dev_attr_hibernate))) -+ goto subsys_unregister; - - return 0; - --class_unregister: -- sysdev_class_unregister(&suspend_sysdev_class); -+subsys_unregister: -+ bus_unregister(&suspend_subsys); - return rc; - } - -@@ -204,7 +205,7 @@ static int __init pseries_suspend_init(v - if (suspend_data.token == RTAS_UNKNOWN_SERVICE) - return 0; - -- if ((rc = pseries_suspend_sysfs_register(&suspend_sysdev))) -+ if ((rc = pseries_suspend_sysfs_register(&suspend_dev))) - return rc; - - ppc_md.suspend_disable_cpu = pseries_suspend_cpu; diff --git a/15-sh-intc.patch b/15-sh-intc.patch deleted file mode 100644 index 7f5facb..0000000 --- a/15-sh-intc.patch +++ /dev/null @@ -1,165 +0,0 @@ -From: Kay Sievers <kay.sievers@vrfy.org> -Subject: sh: intc - convert sysdev_class to a regular subsystem - -After all sysdev classes are ported to regular driver core entities, the -sysdev implementation will be entirely removed from the kernel. - -Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> ---- - drivers/sh/intc/core.c | 29 +++++++++++++++-------------- - drivers/sh/intc/internals.h | 6 +++--- - drivers/sh/intc/userimask.c | 16 ++++++++-------- - 3 files changed, 26 insertions(+), 25 deletions(-) - ---- a/drivers/sh/intc/core.c -+++ b/drivers/sh/intc/core.c -@@ -25,7 +25,7 @@ - #include <linux/stat.h> - #include <linux/interrupt.h> - #include <linux/sh_intc.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/syscore_ops.h> - #include <linux/list.h> - #include <linux/spinlock.h> -@@ -434,46 +434,47 @@ struct syscore_ops intc_syscore_ops = { - .resume = intc_resume, - }; - --struct sysdev_class intc_sysdev_class = { -+struct bus_type intc_subsys = { - .name = "intc", -+ .dev_name = "intc", - }; - - static ssize_t --show_intc_name(struct sys_device *dev, struct sysdev_attribute *attr, char *buf) -+show_intc_name(struct device *dev, struct device_attribute *attr, char *buf) - { - struct intc_desc_int *d; - -- d = container_of(dev, struct intc_desc_int, sysdev); -+ d = container_of(dev, struct intc_desc_int, dev); - - return sprintf(buf, "%s\n", d->chip.name); - } - --static SYSDEV_ATTR(name, S_IRUGO, show_intc_name, NULL); -+static DEVICE_ATTR(name, S_IRUGO, show_intc_name, NULL); - --static int __init register_intc_sysdevs(void) -+static int __init register_intc_devs(void) - { - struct intc_desc_int *d; - int error; - - register_syscore_ops(&intc_syscore_ops); - -- error = sysdev_class_register(&intc_sysdev_class); -+ error = subsys_system_register(&intc_subsys, NULL); - if (!error) { - list_for_each_entry(d, &intc_list, list) { -- d->sysdev.id = d->index; -- d->sysdev.cls = &intc_sysdev_class; -- error = sysdev_register(&d->sysdev); -+ d->dev.id = d->index; -+ d->dev.bus = &intc_subsys; -+ error = device_register(&d->dev); - if (error == 0) -- error = sysdev_create_file(&d->sysdev, -- &attr_name); -+ error = device_create_file(&d->dev, -+ &dev_attr_name); - if (error) - break; - } - } - - if (error) -- pr_err("sysdev registration error\n"); -+ pr_err("device registration error\n"); - - return error; - } --device_initcall(register_intc_sysdevs); -+device_initcall(register_intc_devs); ---- a/drivers/sh/intc/internals.h -+++ b/drivers/sh/intc/internals.h -@@ -4,7 +4,7 @@ - #include <linux/kernel.h> - #include <linux/types.h> - #include <linux/radix-tree.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - - #define _INTC_MK(fn, mode, addr_e, addr_d, width, shift) \ - ((shift) | ((width) << 5) | ((fn) << 9) | ((mode) << 13) | \ -@@ -51,7 +51,7 @@ struct intc_subgroup_entry { - - struct intc_desc_int { - struct list_head list; -- struct sys_device sysdev; -+ struct device dev; - struct radix_tree_root tree; - raw_spinlock_t lock; - unsigned int index; -@@ -157,7 +157,7 @@ void _intc_enable(struct irq_data *data, - extern struct list_head intc_list; - extern raw_spinlock_t intc_big_lock; - extern unsigned int nr_intc_controllers; --extern struct sysdev_class intc_sysdev_class; -+extern struct bus_type intc_subsys; - - unsigned int intc_get_dfl_prio_level(void); - unsigned int intc_get_prio_level(unsigned int irq); ---- a/drivers/sh/intc/userimask.c -+++ b/drivers/sh/intc/userimask.c -@@ -10,7 +10,7 @@ - #define pr_fmt(fmt) "intc: " fmt - - #include <linux/errno.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/init.h> - #include <linux/io.h> - #include <linux/stat.h> -@@ -20,15 +20,15 @@ - static void __iomem *uimask; - - static ssize_t --show_intc_userimask(struct sysdev_class *cls, -- struct sysdev_class_attribute *attr, char *buf) -+show_intc_userimask(struct device *dev, -+ struct device_attribute *attr, char *buf) - { - return sprintf(buf, "%d\n", (__raw_readl(uimask) >> 4) & 0xf); - } - - static ssize_t --store_intc_userimask(struct sysdev_class *cls, -- struct sysdev_class_attribute *attr, -+store_intc_userimask(struct device *dev, -+ struct device_attribute *attr, - const char *buf, size_t count) - { - unsigned long level; -@@ -55,8 +55,8 @@ store_intc_userimask(struct sysdev_class - return count; - } - --static SYSDEV_CLASS_ATTR(userimask, S_IRUSR | S_IWUSR, -- show_intc_userimask, store_intc_userimask); -+static DEVICE_ATTR(userimask, S_IRUSR | S_IWUSR, -+ show_intc_userimask, store_intc_userimask); - - - static int __init userimask_sysdev_init(void) -@@ -64,7 +64,7 @@ static int __init userimask_sysdev_init( - if (unlikely(!uimask)) - return -ENXIO; - -- return sysdev_class_create_file(&intc_sysdev_class, &attr_userimask); -+ return device_create_file(intc_subsys.dev_root, &dev_attr_userimask); - } - late_initcall(userimask_sysdev_init); - diff --git a/16-sh-dma.patch b/16-sh-dma.patch deleted file mode 100644 index 53df9b4..0000000 --- a/16-sh-dma.patch +++ /dev/null @@ -1,210 +0,0 @@ -From: Kay Sievers <kay.sievers@vrfy.org> -Subject: sh: dma - convert sysdev_class to a regular subsystem - -After all sysdev classes are ported to regular driver core entities, the -sysdev implementation will be entirely removed from the kernel. - -Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> ---- - arch/sh/drivers/dma/dma-sysfs.c | 81 ++++++++++++++++++++-------------------- - arch/sh/include/asm/dma.h | 4 - - 2 files changed, 43 insertions(+), 42 deletions(-) - ---- a/arch/sh/drivers/dma/dma-sysfs.c -+++ b/arch/sh/drivers/dma/dma-sysfs.c -@@ -12,18 +12,19 @@ - #include <linux/kernel.h> - #include <linux/init.h> - #include <linux/stat.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/platform_device.h> - #include <linux/err.h> - #include <linux/string.h> - #include <asm/dma.h> - --static struct sysdev_class dma_sysclass = { -+static struct bus_type dma_subsys = { - .name = "dma", -+ .dev_name = "dma", - }; - --static ssize_t dma_show_devices(struct sys_device *dev, -- struct sysdev_attribute *attr, char *buf) -+static ssize_t dma_show_devices(struct device *dev, -+ struct device_attribute *attr, char *buf) - { - ssize_t len = 0; - int i; -@@ -43,29 +44,29 @@ static ssize_t dma_show_devices(struct s - return len; - } - --static SYSDEV_ATTR(devices, S_IRUGO, dma_show_devices, NULL); -+static DEVICE_ATTR(devices, S_IRUGO, dma_show_devices, NULL); - --static int __init dma_sysclass_init(void) -+static int __init dma_subsys_init(void) - { - int ret; - -- ret = sysdev_class_register(&dma_sysclass); -+ ret = subsys_system_register(&dma_subsys, NULL); - if (unlikely(ret)) - return ret; - -- return sysfs_create_file(&dma_sysclass.kset.kobj, &attr_devices.attr); -+ return device_create_file(dma_subsys.dev_root, &dev_attr_devices.attr); - } --postcore_initcall(dma_sysclass_init); -+postcore_initcall(dma_subsys_init); - --static ssize_t dma_show_dev_id(struct sys_device *dev, -- struct sysdev_attribute *attr, char *buf) -+static ssize_t dma_show_dev_id(struct device *dev, -+ struct device_attribute *attr, char *buf) - { - struct dma_channel *channel = to_dma_channel(dev); - return sprintf(buf, "%s\n", channel->dev_id); - } - --static ssize_t dma_store_dev_id(struct sys_device *dev, -- struct sysdev_attribute *attr, -+static ssize_t dma_store_dev_id(struct device *dev, -+ struct device_attribute *attr, - const char *buf, size_t count) - { - struct dma_channel *channel = to_dma_channel(dev); -@@ -73,10 +74,10 @@ static ssize_t dma_store_dev_id(struct s - return count; - } - --static SYSDEV_ATTR(dev_id, S_IRUGO | S_IWUSR, dma_show_dev_id, dma_store_dev_id); -+static DEVICE_ATTR(dev_id, S_IRUGO | S_IWUSR, dma_show_dev_id, dma_store_dev_id); - --static ssize_t dma_store_config(struct sys_device *dev, -- struct sysdev_attribute *attr, -+static ssize_t dma_store_config(struct device *dev, -+ struct device_attribute *attr, - const char *buf, size_t count) - { - struct dma_channel *channel = to_dma_channel(dev); -@@ -88,17 +89,17 @@ static ssize_t dma_store_config(struct s - return count; - } - --static SYSDEV_ATTR(config, S_IWUSR, NULL, dma_store_config); -+static DEVICE_ATTR(config, S_IWUSR, NULL, dma_store_config); - --static ssize_t dma_show_mode(struct sys_device *dev, -- struct sysdev_attribute *attr, char *buf) -+static ssize_t dma_show_mode(struct device *dev, -+ struct device_attribute *attr, char *buf) - { - struct dma_channel *channel = to_dma_channel(dev); - return sprintf(buf, "0x%08x\n", channel->mode); - } - --static ssize_t dma_store_mode(struct sys_device *dev, -- struct sysdev_attribute *attr, -+static ssize_t dma_store_mode(struct device *dev, -+ struct device_attribute *attr, - const char *buf, size_t count) - { - struct dma_channel *channel = to_dma_channel(dev); -@@ -106,38 +107,38 @@ static ssize_t dma_store_mode(struct sys - return count; - } - --static SYSDEV_ATTR(mode, S_IRUGO | S_IWUSR, dma_show_mode, dma_store_mode); -+static DEVICE_ATTR(mode, S_IRUGO | S_IWUSR, dma_show_mode, dma_store_mode); - - #define dma_ro_attr(field, fmt) \ --static ssize_t dma_show_##field(struct sys_device *dev, \ -- struct sysdev_attribute *attr, char *buf)\ -+static ssize_t dma_show_##field(struct device *dev, \ -+ struct device_attribute *attr, char *buf)\ - { \ - struct dma_channel *channel = to_dma_channel(dev); \ - return sprintf(buf, fmt, channel->field); \ - } \ --static SYSDEV_ATTR(field, S_IRUGO, dma_show_##field, NULL); -+static DEVICE_ATTR(field, S_IRUGO, dma_show_##field, NULL); - - dma_ro_attr(count, "0x%08x\n"); - dma_ro_attr(flags, "0x%08lx\n"); - - int dma_create_sysfs_files(struct dma_channel *chan, struct dma_info *info) - { -- struct sys_device *dev = &chan->dev; -+ struct device *dev = &chan->dev; - char name[16]; - int ret; - - dev->id = chan->vchan; -- dev->cls = &dma_sysclass; -+ dev->bus = &dma_subsys; - -- ret = sysdev_register(dev); -+ ret = device_register(dev); - if (ret) - return ret; - -- ret |= sysdev_create_file(dev, &attr_dev_id); -- ret |= sysdev_create_file(dev, &attr_count); -- ret |= sysdev_create_file(dev, &attr_mode); -- ret |= sysdev_create_file(dev, &attr_flags); -- ret |= sysdev_create_file(dev, &attr_config); -+ ret |= device_create_file(dev, &dev_attr_dev_id); -+ ret |= device_create_file(dev, &dev_attr_count); -+ ret |= device_create_file(dev, &dev_attr_mode); -+ ret |= device_create_file(dev, &dev_attr_flags); -+ ret |= device_create_file(dev, &dev_attr_config); - - if (unlikely(ret)) { - dev_err(&info->pdev->dev, "Failed creating attrs\n"); -@@ -150,17 +151,17 @@ int dma_create_sysfs_files(struct dma_ch - - void dma_remove_sysfs_files(struct dma_channel *chan, struct dma_info *info) - { -- struct sys_device *dev = &chan->dev; -+ struct device *dev = &chan->dev; - char name[16]; - -- sysdev_remove_file(dev, &attr_dev_id); -- sysdev_remove_file(dev, &attr_count); -- sysdev_remove_file(dev, &attr_mode); -- sysdev_remove_file(dev, &attr_flags); -- sysdev_remove_file(dev, &attr_config); -+ device_remove_file(dev, &dev_attr_dev_id); -+ device_remove_file(dev, &dev_attr_count); -+ device_remove_file(dev, &dev_attr_mode); -+ device_remove_file(dev, &dev_attr_flags); -+ device_remove_file(dev, &dev_attr_config); - - snprintf(name, sizeof(name), "dma%d", chan->chan); - sysfs_remove_link(&info->pdev->dev.kobj, name); - -- sysdev_unregister(dev); -+ device_unregister(dev); - } ---- a/arch/sh/include/asm/dma.h -+++ b/arch/sh/include/asm/dma.h -@@ -14,7 +14,7 @@ - #include <linux/spinlock.h> - #include <linux/wait.h> - #include <linux/sched.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <cpu/dma.h> - #include <asm-generic/dma.h> - -@@ -91,7 +91,7 @@ struct dma_channel { - - wait_queue_head_t wait_queue; - -- struct sys_device dev; -+ struct device dev; - void *priv_data; - }; - diff --git a/17-mips-txx9-7segled.patch b/17-mips-txx9-7segled.patch deleted file mode 100644 index 4c68d17..0000000 --- a/17-mips-txx9-7segled.patch +++ /dev/null @@ -1,119 +0,0 @@ -From: Kay Sievers <kay.sievers@vrfy.org> -Subject: mips: 7segled - convert sysdev_class to a regular subsystem - -After all sysdev classes are ported to regular driver core entities, the -sysdev implementation will be entirely removed from the kernel. - -Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> ---- - arch/mips/txx9/generic/7segled.c | 44 +++++++++++++++++++-------------------- - 1 file changed, 22 insertions(+), 22 deletions(-) - ---- a/arch/mips/txx9/generic/7segled.c -+++ b/arch/mips/txx9/generic/7segled.c -@@ -9,7 +9,7 @@ - * (C) Copyright TOSHIBA CORPORATION 2005-2007 - * All Rights Reserved. - */ --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/slab.h> - #include <linux/map_to_7segment.h> - #include <asm/txx9/generic.h> -@@ -37,8 +37,8 @@ int txx9_7segled_putc(unsigned int pos, - return 0; - } - --static ssize_t ascii_store(struct sys_device *dev, -- struct sysdev_attribute *attr, -+static ssize_t ascii_store(struct device *dev, -+ struct device_attribute *attr, - const char *buf, size_t size) - { - unsigned int ch = dev->id; -@@ -46,8 +46,8 @@ static ssize_t ascii_store(struct sys_de - return size; - } - --static ssize_t raw_store(struct sys_device *dev, -- struct sysdev_attribute *attr, -+static ssize_t raw_store(struct device *dev, -+ struct device_attribute *attr, - const char *buf, size_t size) - { - unsigned int ch = dev->id; -@@ -55,19 +55,19 @@ static ssize_t raw_store(struct sys_devi - return size; - } - --static SYSDEV_ATTR(ascii, 0200, NULL, ascii_store); --static SYSDEV_ATTR(raw, 0200, NULL, raw_store); -+static DEVICE_ATTR(ascii, 0200, NULL, ascii_store); -+static DEVICE_ATTR(raw, 0200, NULL, raw_store); - --static ssize_t map_seg7_show(struct sysdev_class *class, -- struct sysdev_class_attribute *attr, -+static ssize_t map_seg7_show(struct device *dev, -+ struct device_attribute *attr, - char *buf) - { - memcpy(buf, &txx9_seg7map, sizeof(txx9_seg7map)); - return sizeof(txx9_seg7map); - } - --static ssize_t map_seg7_store(struct sysdev_class *class, -- struct sysdev_class_attribute *attr, -+static ssize_t map_seg7_store(struct device *dev, -+ struct device_attribute *attr, - const char *buf, size_t size) - { - if (size != sizeof(txx9_seg7map)) -@@ -76,10 +76,11 @@ static ssize_t map_seg7_store(struct sys - return size; - } - --static SYSDEV_CLASS_ATTR(map_seg7, 0600, map_seg7_show, map_seg7_store); -+static DEVICE_ATTR(map_seg7, 0600, map_seg7_show, map_seg7_store); - --static struct sysdev_class tx_7segled_sysdev_class = { -- .name = "7segled", -+static struct bus_type tx_7segled_subsys = { -+ .name = "7segled", -+ .dev_name = "7segled", - }; - - static int __init tx_7segled_init_sysfs(void) -@@ -87,26 +88,25 @@ static int __init tx_7segled_init_sysfs( - int error, i; - if (!tx_7segled_num) - return -ENODEV; -- error = sysdev_class_register(&tx_7segled_sysdev_class); -+ error = subsys_system_register(&tx_7segled_subsys, NULL); - if (error) - return error; -- error = sysdev_class_create_file(&tx_7segled_sysdev_class, -- &attr_map_seg7); -+ error = device_create_file(tx_7segled_subsys.dev_root, &dev_attr_map_seg7); - if (error) - return error; - for (i = 0; i < tx_7segled_num; i++) { -- struct sys_device *dev; -+ struct device *dev; - dev = kzalloc(sizeof(*dev), GFP_KERNEL); - if (!dev) { - error = -ENODEV; - break; - } - dev->id = i; -- dev->cls = &tx_7segled_sysdev_class; -- error = sysdev_register(dev); -+ dev->dev = &tx_7segled_subsys; -+ error = device_register(dev); - if (!error) { -- sysdev_create_file(dev, &attr_ascii); -- sysdev_create_file(dev, &attr_raw); -+ device_create_file(dev, &dev_attr_ascii); -+ device_create_file(dev, &dev_attr_raw); - } - } - return error; diff --git a/18-mips-txx9_sram.patch b/18-mips-txx9_sram.patch deleted file mode 100644 index ff3fdf1..0000000 --- a/18-mips-txx9_sram.patch +++ /dev/null @@ -1,104 +0,0 @@ -From: Kay Sievers <kay.sievers@vrfy.org> -Subject: mips: txx9_sram - convert sysdev_class to a regular subsystem - -After all sysdev classes are ported to regular driver core entities, the -sysdev implementation will be entirely removed from the kernel. - -Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> ---- - arch/mips/txx9/generic/setup.c | 34 ++++++++++++++++------------------ - 1 file changed, 16 insertions(+), 18 deletions(-) - ---- a/arch/mips/txx9/generic/setup.c -+++ b/arch/mips/txx9/generic/setup.c -@@ -22,7 +22,7 @@ - #include <linux/serial_core.h> - #include <linux/mtd/physmap.h> - #include <linux/leds.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/slab.h> - #include <linux/irq.h> - #include <asm/bootinfo.h> -@@ -897,10 +897,13 @@ void __init txx9_aclc_init(unsigned long - #endif - } - --static struct sysdev_class txx9_sramc_sysdev_class; -+static struct bus_type txx9_sramc_subsys = { -+ .name = "txx9_sram", -+ .dev_name = "txx9_sram", -+}; - --struct txx9_sramc_sysdev { -- struct sys_device dev; -+struct txx9_sramc_dev { -+ struct device dev; - struct bin_attribute bindata_attr; - void __iomem *base; - }; -@@ -909,7 +912,7 @@ static ssize_t txx9_sram_read(struct fil - struct bin_attribute *bin_attr, - char *buf, loff_t pos, size_t size) - { -- struct txx9_sramc_sysdev *dev = bin_attr->private; -+ struct txx9_sramc_dev *dev = bin_attr->private; - size_t ramsize = bin_attr->size; - - if (pos >= ramsize) -@@ -924,7 +927,7 @@ static ssize_t txx9_sram_write(struct fi - struct bin_attribute *bin_attr, - char *buf, loff_t pos, size_t size) - { -- struct txx9_sramc_sysdev *dev = bin_attr->private; -+ struct txx9_sramc_dev *dev = bin_attr->private; - size_t ramsize = bin_attr->size; - - if (pos >= ramsize) -@@ -937,18 +940,13 @@ static ssize_t txx9_sram_write(struct fi - - void __init txx9_sramc_init(struct resource *r) - { -- struct txx9_sramc_sysdev *dev; -+ struct txx9_sramc_dev *dev; - size_t size; - int err; - -- if (!txx9_sramc_sysdev_class.name) { -- txx9_sramc_sysdev_class.name = "txx9_sram"; -- err = sysdev_class_register(&txx9_sramc_sysdev_class); -- if (err) { -- txx9_sramc_sysdev_class.name = NULL; -- return; -- } -- } -+ err = subsys_system_register(&txx9_sramc_subsys, NULL); -+ if (err) -+ return; - dev = kzalloc(sizeof(*dev), GFP_KERNEL); - if (!dev) - return; -@@ -956,7 +954,7 @@ void __init txx9_sramc_init(struct resou - dev->base = ioremap(r->start, size); - if (!dev->base) - goto exit; -- dev->dev.cls = &txx9_sramc_sysdev_class; -+ dev->dev.bus = &txx9_sramc_subsys; - sysfs_bin_attr_init(&dev->bindata_attr); - dev->bindata_attr.attr.name = "bindata"; - dev->bindata_attr.attr.mode = S_IRUSR | S_IWUSR; -@@ -964,12 +962,12 @@ void __init txx9_sramc_init(struct resou - dev->bindata_attr.write = txx9_sram_write; - dev->bindata_attr.size = size; - dev->bindata_attr.private = dev; -- err = sysdev_register(&dev->dev); -+ err = device_register(&dev->dev); - if (err) - goto exit; - err = sysfs_create_bin_file(&dev->dev.kobj, &dev->bindata_attr); - if (err) { -- sysdev_unregister(&dev->dev); -+ device_unregister(&dev->dev); - goto exit; - } - return; diff --git a/19-m68k-gpio.patch b/19-m68k-gpio.patch deleted file mode 100644 index 021746b..0000000 --- a/19-m68k-gpio.patch +++ /dev/null @@ -1,40 +0,0 @@ -From: Kay Sievers <kay.sievers@vrfy.org> -Subject: m86k: gpio - convert sysdev_class to a regular subsystem - -After all sysdev classes are ported to regular driver core entities, the -sysdev implementation will be entirely removed from the kernel. - -Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> ---- - arch/m68k/platform/coldfire/gpio.c | 9 +++++---- - 1 file changed, 5 insertions(+), 4 deletions(-) - ---- a/arch/m68k/platform/coldfire/gpio.c -+++ b/arch/m68k/platform/coldfire/gpio.c -@@ -15,7 +15,7 @@ - - #include <linux/kernel.h> - #include <linux/init.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - - #include <asm/gpio.h> - #include <asm/pinmux.h> -@@ -115,13 +115,14 @@ void mcf_gpio_free(struct gpio_chip *chi - mcf_pinmux_release(mcf_chip->gpio_to_pinmux[offset], 0); - } - --struct sysdev_class mcf_gpio_sysclass = { -- .name = "gpio", -+struct bus_type mcf_gpio_subsys = { -+ .name = "gpio", -+ .dev_name = "gpio", - }; - - static int __init mcf_gpio_sysinit(void) - { -- return sysdev_class_register(&mcf_gpio_sysclass); -+ return subsys_system_register(&mcf_gpio_subsys, NULL); - } - - core_initcall(mcf_gpio_sysinit); diff --git a/20-arm.patch b/20-arm.patch deleted file mode 100644 index 80c64b0..0000000 --- a/20-arm.patch +++ /dev/null @@ -1,2038 +0,0 @@ -From: Kay Sievers <kay.sievers@vrfy.org> -Subject: arm: convert sysdev_class to a regular subsystem - -After all sysdev classes are ported to regular driver core entities, the -sysdev implementation will be entirely removed from the kernel. - -Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> ---- - arch/arm/include/asm/mach/time.h | 2 - - arch/arm/kernel/leds.c | 21 +++++++------ - arch/arm/mach-exynos/cpu.c | 15 +++++---- - arch/arm/mach-exynos/pm.c | 10 +++--- - arch/arm/mach-s3c2410/cpu-freq.c | 26 ++++++++-------- - arch/arm/mach-s3c2410/dma.c | 28 ++++++++++------- - arch/arm/mach-s3c2410/include/mach/dma.h | 4 +- - arch/arm/mach-s3c2410/pll.c | 20 +++++++----- - arch/arm/mach-s3c2410/pm.c | 36 ++++++++++++++--------- - arch/arm/mach-s3c2410/s3c2410.c | 24 ++++++++------- - arch/arm/mach-s3c2412/cpu-freq.c | 13 ++++---- - arch/arm/mach-s3c2412/dma.c | 12 ++++--- - arch/arm/mach-s3c2412/irq.c | 12 ++++--- - arch/arm/mach-s3c2412/pm.c | 12 ++++--- - arch/arm/mach-s3c2412/s3c2412.c | 15 +++++---- - arch/arm/mach-s3c2416/irq.c | 12 ++++--- - arch/arm/mach-s3c2416/pm.c | 12 ++++--- - arch/arm/mach-s3c2416/s3c2416.c | 15 +++++---- - arch/arm/mach-s3c2440/clock.c | 15 +++++---- - arch/arm/mach-s3c2440/dma.c | 12 ++++--- - arch/arm/mach-s3c2440/irq.c | 12 ++++--- - arch/arm/mach-s3c2440/s3c2440-cpufreq.c | 22 +++++++------- - arch/arm/mach-s3c2440/s3c2440-pll-12000000.c | 20 +++++++----- - arch/arm/mach-s3c2440/s3c2440-pll-16934400.c | 24 +++++++-------- - arch/arm/mach-s3c2440/s3c2440.c | 8 ++--- - arch/arm/mach-s3c2440/s3c2442.c | 17 +++++----- - arch/arm/mach-s3c2440/s3c244x-clock.c | 19 +++++++----- - arch/arm/mach-s3c2440/s3c244x-irq.c | 20 +++++++----- - arch/arm/mach-s3c2440/s3c244x.c | 16 +++++----- - arch/arm/mach-s3c2443/dma.c | 12 ++++--- - arch/arm/mach-s3c2443/irq.c | 12 ++++--- - arch/arm/mach-s3c2443/s3c2443.c | 15 +++++---- - arch/arm/mach-s3c64xx/cpu.c | 19 ++++++------ - arch/arm/mach-s3c64xx/dma.c | 23 +++++++------- - arch/arm/mach-s3c64xx/s3c6400.c | 15 +++++---- - arch/arm/mach-s3c64xx/s3c6410.c | 15 +++++---- - arch/arm/mach-s5p64x0/cpu.c | 15 +++++---- - arch/arm/mach-s5p64x0/pm.c | 10 +++--- - arch/arm/mach-s5pc100/cpu.c | 15 +++++---- - arch/arm/mach-s5pv210/cpu.c | 15 +++++---- - arch/arm/mach-s5pv210/pm.c | 10 +++--- - arch/arm/plat-samsung/include/plat/cpu.h | 26 ++++++++-------- - arch/arm/plat-samsung/include/plat/dma-s3c24xx.h | 2 - - arch/arm/plat-samsung/include/plat/pm.h | 2 - - 44 files changed, 378 insertions(+), 302 deletions(-) - ---- a/arch/arm/include/asm/mach/time.h -+++ b/arch/arm/include/asm/mach/time.h -@@ -10,7 +10,7 @@ - #ifndef __ASM_ARM_MACH_TIME_H - #define __ASM_ARM_MACH_TIME_H - --#include <linux/sysdev.h> -+#include <linux/device.h> - - /* - * This is our kernel timer structure. ---- a/arch/arm/kernel/leds.c -+++ b/arch/arm/kernel/leds.c -@@ -9,7 +9,7 @@ - */ - #include <linux/export.h> - #include <linux/init.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/syscore_ops.h> - #include <linux/string.h> - -@@ -34,8 +34,8 @@ static const struct leds_evt_name evt_na - { "red", led_red_on, led_red_off }, - }; - --static ssize_t leds_store(struct sys_device *dev, -- struct sysdev_attribute *attr, -+static ssize_t leds_store(struct device *dev, -+ struct device_attribute *attr, - const char *buf, size_t size) - { - int ret = -EINVAL, len = strcspn(buf, " "); -@@ -69,15 +69,16 @@ static ssize_t leds_store(struct sys_dev - return ret; - } - --static SYSDEV_ATTR(event, 0200, NULL, leds_store); -+static DEVICE_ATTR(event, 0200, NULL, leds_store); - --static struct sysdev_class leds_sysclass = { -+static struct bus_type leds_subsys = { - .name = "leds", -+ .dev_name = "leds", - }; - --static struct sys_device leds_device = { -+static struct device leds_device = { - .id = 0, -- .cls = &leds_sysclass, -+ .bus = &leds_subsys, - }; - - static int leds_suspend(void) -@@ -105,11 +106,11 @@ static struct syscore_ops leds_syscore_o - static int __init leds_init(void) - { - int ret; -- ret = sysdev_class_register(&leds_sysclass); -+ ret = subsys_system_register(&leds_subsys, NULL); - if (ret == 0) -- ret = sysdev_register(&leds_device); -+ ret = device_register(&leds_device); - if (ret == 0) -- ret = sysdev_create_file(&leds_device, &attr_event); -+ ret = device_create_file(&leds_device, &dev_attr_event); - if (ret == 0) - register_syscore_ops(&leds_syscore_ops); - return ret; ---- a/arch/arm/mach-exynos/cpu.c -+++ b/arch/arm/mach-exynos/cpu.c -@@ -9,7 +9,7 @@ - */ - - #include <linux/sched.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - - #include <asm/mach/map.h> - #include <asm/mach/irq.h> -@@ -243,17 +243,18 @@ void __init exynos4_init_irq(void) - s5p_init_irq(NULL, 0); - } - --struct sysdev_class exynos4_sysclass = { -- .name = "exynos4-core", -+struct bus_type exynos4_subsys = { -+ .name = "exynos4-core", -+ .dev_name = "exynos4-core", - }; - --static struct sys_device exynos4_sysdev = { -- .cls = &exynos4_sysclass, -+static struct device exynos4_dev = { -+ .bus = &exynos4_subsys, - }; - - static int __init exynos4_core_init(void) - { -- return sysdev_class_register(&exynos4_sysclass); -+ return subsys_system_register(&exynos4_subsys, NULL); - } - core_initcall(exynos4_core_init); - -@@ -294,5 +295,5 @@ int __init exynos_init(void) - if (soc_is_exynos4210() || soc_is_exynos4212() || soc_is_exynos4412()) - s5p_reset_hook = exynos4_sw_reset; - -- return sysdev_register(&exynos4_sysdev); -+ return device_register(&exynos4_dev); - } ---- a/arch/arm/mach-exynos/pm.c -+++ b/arch/arm/mach-exynos/pm.c -@@ -205,7 +205,7 @@ static void exynos4_pm_prepare(void) - - } - --static int exynos4_pm_add(struct sys_device *sysdev) -+static int exynos4_pm_add(struct device *dev) - { - pm_cpu_prep = exynos4_pm_prepare; - pm_cpu_sleep = exynos4_cpu_suspend; -@@ -301,8 +301,10 @@ static void exynos4_restore_pll(void) - } while (epll_wait || vpll_wait); - } - --static struct sysdev_driver exynos4_pm_driver = { -- .add = exynos4_pm_add, -+static struct subsys_interface exynos4_pm_interface = { -+ .name = "exynos4_pm", -+ .subsys = &exynos4_subsys, -+ .add_dev = exynos4_pm_add, - }; - - static __init int exynos4_pm_drvinit(void) -@@ -325,7 +327,7 @@ static __init int exynos4_pm_drvinit(voi - clk_put(pll_base); - } - -- return sysdev_driver_register(&exynos4_sysclass, &exynos4_pm_driver); -+ return subsys_interface_register(&exynos4_pm_interface); - } - arch_initcall(exynos4_pm_drvinit); - ---- a/arch/arm/mach-s3c2410/cpu-freq.c -+++ b/arch/arm/mach-s3c2410/cpu-freq.c -@@ -16,7 +16,7 @@ - #include <linux/interrupt.h> - #include <linux/ioport.h> - #include <linux/cpufreq.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/clk.h> - #include <linux/err.h> - #include <linux/io.h> -@@ -115,24 +115,25 @@ static struct s3c_cpufreq_info s3c2410_c - .debug_io_show = s3c_cpufreq_debugfs_call(s3c2410_iotiming_debugfs), - }; - --static int s3c2410_cpufreq_add(struct sys_device *sysdev) -+static int s3c2410_cpufreq_add(struct device *dev) - { - return s3c_cpufreq_register(&s3c2410_cpufreq_info); - } - --static struct sysdev_driver s3c2410_cpufreq_driver = { -- .add = s3c2410_cpufreq_add, -+static struct subsys_interface s3c2410_cpufreq_interface = { -+ .name = "s3c2410_cpufreq", -+ .subsys = &s3c2410_subsys, -+ .add_dev = s3c2410_cpufreq_add, - }; - - static int __init s3c2410_cpufreq_init(void) - { -- return sysdev_driver_register(&s3c2410_sysclass, -- &s3c2410_cpufreq_driver); -+ return subsys_interface_register(&s3c2410_cpufreq_interface); - } - - arch_initcall(s3c2410_cpufreq_init); - --static int s3c2410a_cpufreq_add(struct sys_device *sysdev) -+static int s3c2410a_cpufreq_add(struct device *dev) - { - /* alter the maximum freq settings for S3C2410A. If a board knows - * it only has a maximum of 200, then it should register its own -@@ -143,17 +144,18 @@ static int s3c2410a_cpufreq_add(struct s - s3c2410_cpufreq_info.max.pclk = 66500000; - s3c2410_cpufreq_info.name = "s3c2410a"; - -- return s3c2410_cpufreq_add(sysdev); -+ return s3c2410_cpufreq_add(dev); - } - --static struct sysdev_driver s3c2410a_cpufreq_driver = { -- .add = s3c2410a_cpufreq_add, -+static struct subsys_interface s3c2410a_cpufreq_interface = { -+ .name = "s3c2410a_cpufreq", -+ .subsys = &s3c2410a_subsys, -+ .add_dev = s3c2410a_cpufreq_add, - }; - - static int __init s3c2410a_cpufreq_init(void) - { -- return sysdev_driver_register(&s3c2410a_sysclass, -- &s3c2410a_cpufreq_driver); -+ return subsys_interface_register(&s3c2410a_cpufreq_interface); - } - - arch_initcall(s3c2410a_cpufreq_init); ---- a/arch/arm/mach-s3c2410/dma.c -+++ b/arch/arm/mach-s3c2410/dma.c -@@ -14,7 +14,7 @@ - - #include <linux/kernel.h> - #include <linux/init.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/serial_core.h> - - #include <mach/map.h> -@@ -132,7 +132,7 @@ static struct s3c24xx_dma_order __initda - }, - }; - --static int __init s3c2410_dma_add(struct sys_device *sysdev) -+static int __init s3c2410_dma_add(struct device *dev) - { - s3c2410_dma_init(); - s3c24xx_dma_order_set(&s3c2410_dma_order); -@@ -140,24 +140,28 @@ static int __init s3c2410_dma_add(struct - } - - #if defined(CONFIG_CPU_S3C2410) --static struct sysdev_driver s3c2410_dma_driver = { -- .add = s3c2410_dma_add, -+static struct subsys_interface s3c2410_dma_interface = { -+ .name = "s3c2410_dma", -+ .subsys = &s3c2410_subsys, -+ .add_dev = s3c2410_dma_add, - }; - - static int __init s3c2410_dma_drvinit(void) - { -- return sysdev_driver_register(&s3c2410_sysclass, &s3c2410_dma_driver); -+ return subsys_interface_register(&s3c2410_interface); - } - - arch_initcall(s3c2410_dma_drvinit); - --static struct sysdev_driver s3c2410a_dma_driver = { -- .add = s3c2410_dma_add, -+static struct subsys_interface s3c2410a_dma_interface = { -+ .name = "s3c2410a_dma", -+ .subsys = &s3c2410a_subsys, -+ .add_dev = s3c2410_dma_add, - }; - - static int __init s3c2410a_dma_drvinit(void) - { -- return sysdev_driver_register(&s3c2410a_sysclass, &s3c2410a_dma_driver); -+ return subsys_interface_register(&s3c2410a_dma_interface); - } - - arch_initcall(s3c2410a_dma_drvinit); -@@ -165,13 +169,15 @@ arch_initcall(s3c2410a_dma_drvinit); - - #if defined(CONFIG_CPU_S3C2442) - /* S3C2442 DMA contains the same selection table as the S3C2410 */ --static struct sysdev_driver s3c2442_dma_driver = { -- .add = s3c2410_dma_add, -+static struct subsys_interface s3c2442_dma_interface = { -+ .name = "s3c2442_dma", -+ .subsys = &s3c2442_subsys, -+ .add_dev = s3c2410_dma_add, - }; - - static int __init s3c2442_dma_drvinit(void) - { -- return sysdev_driver_register(&s3c2442_sysclass, &s3c2442_dma_driver); -+ return subsys_interface_register(&s3c2442_dma_interface); - } - - arch_initcall(s3c2442_dma_drvinit); ---- a/arch/arm/mach-s3c2410/include/mach/dma.h -+++ b/arch/arm/mach-s3c2410/include/mach/dma.h -@@ -13,7 +13,7 @@ - #ifndef __ASM_ARCH_DMA_H - #define __ASM_ARCH_DMA_H __FILE__ - --#include <linux/sysdev.h> -+#include <linux/device.h> - - #define MAX_DMA_TRANSFER_SIZE 0x100000 /* Data Unit is half word */ - -@@ -202,7 +202,7 @@ struct s3c2410_dma_chan { - struct s3c2410_dma_buf *end; /* end of queue */ - - /* system device */ -- struct sys_device dev; -+ struct device dev; - }; - - typedef unsigned long dma_device_t; ---- a/arch/arm/mach-s3c2410/pll.c -+++ b/arch/arm/mach-s3c2410/pll.c -@@ -25,7 +25,7 @@ - #include <linux/types.h> - #include <linux/kernel.h> - #include <linux/module.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/list.h> - #include <linux/clk.h> - #include <linux/err.h> -@@ -66,30 +66,34 @@ static struct cpufreq_frequency_table pl - { .frequency = 270000000, .index = PLLVAL(127, 1, 1), }, - }; - --static int s3c2410_plls_add(struct sys_device *dev) -+static int s3c2410_plls_add(struct device *dev) - { - return s3c_plltab_register(pll_vals_12MHz, ARRAY_SIZE(pll_vals_12MHz)); - } - --static struct sysdev_driver s3c2410_plls_drv = { -- .add = s3c2410_plls_add, -+static struct subsys_interface s3c2410_plls_interface = { -+ .name = "s3c2410_plls", -+ .subsys = &s3c2410_subsys, -+ .add_dev = s3c2410_plls_add, - }; - - static int __init s3c2410_pll_init(void) - { -- return sysdev_driver_register(&s3c2410_sysclass, &s3c2410_plls_drv); -+ return subsys_interface_register(&s3c2410_plls_interface); - - } - - arch_initcall(s3c2410_pll_init); - --static struct sysdev_driver s3c2410a_plls_drv = { -- .add = s3c2410_plls_add, -+static struct subsys_interface s3c2410a_plls_interface = { -+ .name = "s3c2410a_plls", -+ .subsys = &s3c2410a_subsys, -+ .add_dev = s3c2410_plls_add, - }; - - static int __init s3c2410a_pll_init(void) - { -- return sysdev_driver_register(&s3c2410a_sysclass, &s3c2410a_plls_drv); -+ return subsys_interface_register(&s3c2410a_plls_interface); - } - - arch_initcall(s3c2410a_pll_init); ---- a/arch/arm/mach-s3c2410/pm.c -+++ b/arch/arm/mach-s3c2410/pm.c -@@ -24,7 +24,7 @@ - #include <linux/suspend.h> - #include <linux/errno.h> - #include <linux/time.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/syscore_ops.h> - #include <linux/gpio.h> - #include <linux/io.h> -@@ -111,7 +111,7 @@ struct syscore_ops s3c2410_pm_syscore_op - .resume = s3c2410_pm_resume, - }; - --static int s3c2410_pm_add(struct sys_device *dev) -+static int s3c2410_pm_add(struct device *dev) - { - pm_cpu_prep = s3c2410_pm_prepare; - pm_cpu_sleep = s3c2410_cpu_suspend; -@@ -120,52 +120,60 @@ static int s3c2410_pm_add(struct sys_dev - } - - #if defined(CONFIG_CPU_S3C2410) --static struct sysdev_driver s3c2410_pm_driver = { -- .add = s3c2410_pm_add, -+static struct subsys_interface s3c2410_pm_interface = { -+ .name = "s3c2410_pm", -+ .subsys = &s3c2410_subsys, -+ .add_dev = s3c2410_pm_add, - }; - - /* register ourselves */ - - static int __init s3c2410_pm_drvinit(void) - { -- return sysdev_driver_register(&s3c2410_sysclass, &s3c2410_pm_driver); -+ return subsys_interface_register(&s3c2410_pm_interface); - } - - arch_initcall(s3c2410_pm_drvinit); - --static struct sysdev_driver s3c2410a_pm_driver = { -- .add = s3c2410_pm_add, -+static struct subsys_interface s3c2410a_pm_interface = { -+ .name = "s3c2410a_pm", -+ subsys = &s3c2410a_subsys, -+ .add_dev = s3c2410_pm_add, - }; - - static int __init s3c2410a_pm_drvinit(void) - { -- return sysdev_driver_register(&s3c2410a_sysclass, &s3c2410a_pm_driver); -+ return subsys_interface_register(&s3c2410a_pm_interface); - } - - arch_initcall(s3c2410a_pm_drvinit); - #endif - - #if defined(CONFIG_CPU_S3C2440) --static struct sysdev_driver s3c2440_pm_driver = { -- .add = s3c2410_pm_add, -+static struct subsys_interface s3c2440_pm_interface = { -+ .name = "s3c2440_pm", -+ .subsys = &s3c2440_subsys, -+ .add_dev = s3c2410_pm_add, - }; - - static int __init s3c2440_pm_drvinit(void) - { -- return sysdev_driver_register(&s3c2440_sysclass, &s3c2440_pm_driver); -+ return subsys_interface_register(&s3c2440_pm_interface); - } - - arch_initcall(s3c2440_pm_drvinit); - #endif - - #if defined(CONFIG_CPU_S3C2442) --static struct sysdev_driver s3c2442_pm_driver = { -- .add = s3c2410_pm_add, -+static struct subsys_interface s3c2442_pm_interface = { -+ .name = "s3c2442_pm", -+ .subsys = &s3c2442_subsys, -+ .add_dev = s3c2410_pm_add, - }; - - static int __init s3c2442_pm_drvinit(void) - { -- return sysdev_driver_register(&s3c2442_sysclass, &s3c2442_pm_driver); -+ return subsys_interface_register(&s3c2442_pm_interface); - } - - arch_initcall(s3c2442_pm_drvinit); ---- a/arch/arm/mach-s3c2410/s3c2410.c -+++ b/arch/arm/mach-s3c2410/s3c2410.c -@@ -18,7 +18,7 @@ - #include <linux/init.h> - #include <linux/gpio.h> - #include <linux/clk.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/syscore_ops.h> - #include <linux/serial_core.h> - #include <linux/platform_device.h> -@@ -131,22 +131,24 @@ void __init s3c2410_init_clocks(int xtal - s3c24xx_register_clock(&s3c2410_armclk); - } - --struct sysdev_class s3c2410_sysclass = { -+struct bus_type s3c2410_subsys = { - .name = "s3c2410-core", -+ .dev_name = "s3c2410-core", - }; - - /* Note, we would have liked to name this s3c2410-core, but we cannot -- * register two sysdev_class with the same name. -+ * register two subsystems with the same name. - */ --struct sysdev_class s3c2410a_sysclass = { -+struct bus_type s3c2410a_subsys = { - .name = "s3c2410a-core", -+ .dev_name = "s3c2410a-core", - }; - --static struct sys_device s3c2410_sysdev = { -- .cls = &s3c2410_sysclass, -+static struct device s3c2410_dev = { -+ .bus = &s3c2410_subsys, - }; - --/* need to register class before we actually register the device, and -+/* need to register the subsystem before we actually register the device, and - * we also need to ensure that it has been initialised before any of the - * drivers even try to use it (even if not on an s3c2410 based system) - * as a driver which may support both 2410 and 2440 may try and use it. -@@ -154,14 +156,14 @@ static struct sys_device s3c2410_sysdev - - static int __init s3c2410_core_init(void) - { -- return sysdev_class_register(&s3c2410_sysclass); -+ return subsys_system_register(&s3c2410_subsys, NULL); - } - - core_initcall(s3c2410_core_init); - - static int __init s3c2410a_core_init(void) - { -- return sysdev_class_register(&s3c2410a_sysclass); -+ return subsys_system_register(&s3c2410a_subsys, NULL); - } - - core_initcall(s3c2410a_core_init); -@@ -175,11 +177,11 @@ int __init s3c2410_init(void) - #endif - register_syscore_ops(&s3c24xx_irq_syscore_ops); - -- return sysdev_register(&s3c2410_sysdev); -+ return device_register(&s3c2410_dev); - } - - int __init s3c2410a_init(void) - { -- s3c2410_sysdev.cls = &s3c2410a_sysclass; -+ s3c2410_dev.bus = &s3c2410a_subsys; - return s3c2410_init(); - } ---- a/arch/arm/mach-s3c2412/cpu-freq.c -+++ b/arch/arm/mach-s3c2412/cpu-freq.c -@@ -16,7 +16,7 @@ - #include <linux/interrupt.h> - #include <linux/ioport.h> - #include <linux/cpufreq.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/delay.h> - #include <linux/clk.h> - #include <linux/err.h> -@@ -194,7 +194,7 @@ static struct s3c_cpufreq_info s3c2412_c - .debug_io_show = s3c_cpufreq_debugfs_call(s3c2412_iotiming_debugfs), - }; - --static int s3c2412_cpufreq_add(struct sys_device *sysdev) -+static int s3c2412_cpufreq_add(struct device *dev) - { - unsigned long fclk_rate; - -@@ -244,14 +244,15 @@ err_fclk: - return -ENOENT; - } - --static struct sysdev_driver s3c2412_cpufreq_driver = { -- .add = s3c2412_cpufreq_add, -+static struct subsys_interface s3c2412_cpufreq_interface = { -+ .name = "s3c2412_cpufreq", -+ .subsys = &s3c2412_subsys, -+ .add_dev = s3c2412_cpufreq_add, - }; - - static int s3c2412_cpufreq_init(void) - { -- return sysdev_driver_register(&s3c2412_sysclass, -- &s3c2412_cpufreq_driver); -+ return subsys_interface_register(&s3c2412_cpufreq_interface); - } - - arch_initcall(s3c2412_cpufreq_init); ---- a/arch/arm/mach-s3c2412/dma.c -+++ b/arch/arm/mach-s3c2412/dma.c -@@ -14,7 +14,7 @@ - - #include <linux/kernel.h> - #include <linux/init.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/serial_core.h> - #include <linux/io.h> - -@@ -159,19 +159,21 @@ static struct s3c24xx_dma_selection __in - .map_size = ARRAY_SIZE(s3c2412_dma_mappings), - }; - --static int __init s3c2412_dma_add(struct sys_device *sysdev) -+static int __init s3c2412_dma_add(struct device *dev) - { - s3c2410_dma_init(); - return s3c24xx_dma_init_map(&s3c2412_dma_sel); - } - --static struct sysdev_driver s3c2412_dma_driver = { -- .add = s3c2412_dma_add, -+static struct subsys_interface s3c2412_dma_interface = { -+ .name = "s3c2412_dma", -+ .subsys = &s3c2412_subsys, -+ .add_dev = s3c2412_dma_add, - }; - - static int __init s3c2412_dma_init(void) - { -- return sysdev_driver_register(&s3c2412_sysclass, &s3c2412_dma_driver); -+ return subsys_interface_register(&s3c2412_dma_interface); - } - - arch_initcall(s3c2412_dma_init); ---- a/arch/arm/mach-s3c2412/irq.c -+++ b/arch/arm/mach-s3c2412/irq.c -@@ -23,7 +23,7 @@ - #include <linux/module.h> - #include <linux/interrupt.h> - #include <linux/ioport.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/io.h> - - #include <mach/hardware.h> -@@ -170,7 +170,7 @@ static int s3c2412_irq_rtc_wake(struct i - - static struct irq_chip s3c2412_irq_rtc_chip; - --static int s3c2412_irq_add(struct sys_device *sysdev) -+static int s3c2412_irq_add(struct device *dev) - { - unsigned int irqno; - -@@ -200,13 +200,15 @@ static int s3c2412_irq_add(struct sys_de - return 0; - } - --static struct sysdev_driver s3c2412_irq_driver = { -- .add = s3c2412_irq_add, -+static struct subsys_interface s3c2412_irq_interface = { -+ .name = "s3c2412_irq", -+ .subsys = &s3c2412_subsys, -+ .add_dev = s3c2412_irq_add, - }; - - static int s3c2412_irq_init(void) - { -- return sysdev_driver_register(&s3c2412_sysclass, &s3c2412_irq_driver); -+ return subsys_interface_register(&s3c2412_irq_interface); - } - - arch_initcall(s3c2412_irq_init); ---- a/arch/arm/mach-s3c2412/pm.c -+++ b/arch/arm/mach-s3c2412/pm.c -@@ -16,7 +16,7 @@ - #include <linux/list.h> - #include <linux/timer.h> - #include <linux/init.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/syscore_ops.h> - #include <linux/platform_device.h> - #include <linux/io.h> -@@ -56,7 +56,7 @@ static void s3c2412_pm_prepare(void) - { - } - --static int s3c2412_pm_add(struct sys_device *sysdev) -+static int s3c2412_pm_add(struct device *dev) - { - pm_cpu_prep = s3c2412_pm_prepare; - pm_cpu_sleep = s3c2412_cpu_suspend; -@@ -87,13 +87,15 @@ static struct sleep_save s3c2412_sleep[] - SAVE_ITEM(S3C2413_GPJSLPCON), - }; - --static struct sysdev_driver s3c2412_pm_driver = { -- .add = s3c2412_pm_add, -+static struct subsys_interface s3c2412_pm_interface = { -+ .name = "s3c2412_pm", -+ .subsys = &s3c2412_subsys, -+ .add_dev = s3c2412_pm_add, - }; - - static __init int s3c2412_pm_init(void) - { -- return sysdev_driver_register(&s3c2412_sysclass, &s3c2412_pm_driver); -+ return subsys_interface_register_register(&s3c2412_pm_interface); - } - - arch_initcall(s3c2412_pm_init); ---- a/arch/arm/mach-s3c2412/s3c2412.c -+++ b/arch/arm/mach-s3c2412/s3c2412.c -@@ -18,7 +18,7 @@ - #include <linux/init.h> - #include <linux/clk.h> - #include <linux/delay.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/syscore_ops.h> - #include <linux/serial_core.h> - #include <linux/platform_device.h> -@@ -220,25 +220,26 @@ void __init s3c2412_init_clocks(int xtal - s3c2412_baseclk_add(); - } - --/* need to register class before we actually register the device, and -+/* need to register the subsystem before we actually register the device, and - * we also need to ensure that it has been initialised before any of the - * drivers even try to use it (even if not on an s3c2412 based system) - * as a driver which may support both 2410 and 2440 may try and use it. - */ - --struct sysdev_class s3c2412_sysclass = { -+struct bus_type s3c2412_subsys = { - .name = "s3c2412-core", -+ .dev_name = "s3c2412-core", - }; - - static int __init s3c2412_core_init(void) - { -- return sysdev_class_register(&s3c2412_sysclass); -+ return subsys_system_register(&s3c2412_subsys, NULL); - } - - core_initcall(s3c2412_core_init); - --static struct sys_device s3c2412_sysdev = { -- .cls = &s3c2412_sysclass, -+static struct device s3c2412_dev = { -+ .bus = &s3c2412_subsys, - }; - - int __init s3c2412_init(void) -@@ -250,5 +251,5 @@ int __init s3c2412_init(void) - #endif - register_syscore_ops(&s3c24xx_irq_syscore_ops); - -- return sysdev_register(&s3c2412_sysdev); -+ return device_register(&s3c2412_dev); - } ---- a/arch/arm/mach-s3c2416/irq.c -+++ b/arch/arm/mach-s3c2416/irq.c -@@ -25,7 +25,7 @@ - #include <linux/module.h> - #include <linux/interrupt.h> - #include <linux/ioport.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/io.h> - - #include <mach/hardware.h> -@@ -213,7 +213,7 @@ static int __init s3c2416_add_sub(unsign - return 0; - } - --static int __init s3c2416_irq_add(struct sys_device *sysdev) -+static int __init s3c2416_irq_add(struct device *dev) - { - printk(KERN_INFO "S3C2416: IRQ Support\n"); - -@@ -234,13 +234,15 @@ static int __init s3c2416_irq_add(struct - return 0; - } - --static struct sysdev_driver s3c2416_irq_driver = { -- .add = s3c2416_irq_add, -+static struct subsys_interface s3c2416_irq_interface = { -+ .name = "s3c2416_irq", -+ .subsys = &s3c2416_subsys, -+ .add_dev = s3c2416_irq_add, - }; - - static int __init s3c2416_irq_init(void) - { -- return sysdev_driver_register(&s3c2416_sysclass, &s3c2416_irq_driver); -+ return subsys_interface_register(&s3c2416_irq_interface); - } - - arch_initcall(s3c2416_irq_init); ---- a/arch/arm/mach-s3c2416/pm.c -+++ b/arch/arm/mach-s3c2416/pm.c -@@ -10,7 +10,7 @@ - * published by the Free Software Foundation. - */ - --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/syscore_ops.h> - #include <linux/io.h> - -@@ -48,7 +48,7 @@ static void s3c2416_pm_prepare(void) - __raw_writel(virt_to_phys(s3c_cpu_resume), S3C2412_INFORM1); - } - --static int s3c2416_pm_add(struct sys_device *sysdev) -+static int s3c2416_pm_add(struct device *dev) - { - pm_cpu_prep = s3c2416_pm_prepare; - pm_cpu_sleep = s3c2416_cpu_suspend; -@@ -56,13 +56,15 @@ static int s3c2416_pm_add(struct sys_dev - return 0; - } - --static struct sysdev_driver s3c2416_pm_driver = { -- .add = s3c2416_pm_add, -+static struct subsys_interface s3c2416_pm_interface = { -+ .name = "s3c2416_pm", -+ .subsys = &s3c2416_subsys, -+ .add_dev = s3c2416_pm_add, - }; - - static __init int s3c2416_pm_init(void) - { -- return sysdev_driver_register(&s3c2416_sysclass, &s3c2416_pm_driver); -+ return subsys_interface_register(&s3c2416_pm_interface); - } - - arch_initcall(s3c2416_pm_init); ---- a/arch/arm/mach-s3c2416/s3c2416.c -+++ b/arch/arm/mach-s3c2416/s3c2416.c -@@ -31,7 +31,7 @@ - #include <linux/gpio.h> - #include <linux/platform_device.h> - #include <linux/serial_core.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/syscore_ops.h> - #include <linux/clk.h> - #include <linux/io.h> -@@ -68,12 +68,13 @@ static struct map_desc s3c2416_iodesc[] - IODESC_ENT(TIMER), - }; - --struct sysdev_class s3c2416_sysclass = { -+struct bus_type s3c2416_subsys = { - .name = "s3c2416-core", -+ .dev_name = "s3c2416-core", - }; - --static struct sys_device s3c2416_sysdev = { -- .cls = &s3c2416_sysclass, -+static struct device s3c2416_dev = { -+ .bus = &s3c2416_subsys, - }; - - static void s3c2416_hard_reset(void) -@@ -105,7 +106,7 @@ int __init s3c2416_init(void) - #endif - register_syscore_ops(&s3c24xx_irq_syscore_ops); - -- return sysdev_register(&s3c2416_sysdev); -+ return device_register(&s3c2416_dev); - } - - void __init s3c2416_init_uarts(struct s3c2410_uartcfg *cfg, int no) -@@ -133,7 +134,7 @@ void __init s3c2416_map_io(void) - iotable_init(s3c2416_iodesc, ARRAY_SIZE(s3c2416_iodesc)); - } - --/* need to register class before we actually register the device, and -+/* need to register the subsystem before we actually register the device, and - * we also need to ensure that it has been initialised before any of the - * drivers even try to use it (even if not on an s3c2416 based system) - * as a driver which may support both 2443 and 2440 may try and use it. -@@ -141,7 +142,7 @@ void __init s3c2416_map_io(void) - - static int __init s3c2416_core_init(void) - { -- return sysdev_class_register(&s3c2416_sysclass); -+ return subsys_system_register(&s3c2416_subsys, NULL); - } - - core_initcall(s3c2416_core_init); ---- a/arch/arm/mach-s3c2440/clock.c -+++ b/arch/arm/mach-s3c2440/clock.c -@@ -28,7 +28,6 @@ - #include <linux/errno.h> - #include <linux/err.h> - #include <linux/device.h> --#include <linux/sysdev.h> - #include <linux/interrupt.h> - #include <linux/ioport.h> - #include <linux/mutex.h> -@@ -108,7 +107,7 @@ static struct clk s3c2440_clk_ac97 = { - .ctrlbit = S3C2440_CLKCON_CAMERA, - }; - --static int s3c2440_clk_add(struct sys_device *sysdev) -+static int s3c2440_clk_add(struct device *dev) - { - struct clk *clock_upll; - struct clk *clock_h; -@@ -137,13 +136,15 @@ static int s3c2440_clk_add(struct sys_de - return 0; - } - --static struct sysdev_driver s3c2440_clk_driver = { -- .add = s3c2440_clk_add, -+static struct subsys_interface s3c2440_clk_interface = { -+ .name = "s3c2440_clk", -+ .subsys = &s3c2440_subsys, -+ .add_dev = s3c2440_clk_add, - }; - --static __init int s3c24xx_clk_driver(void) -+static __init int s3c24xx_clk_init(void) - { -- return sysdev_driver_register(&s3c2440_sysclass, &s3c2440_clk_driver); -+ return subsys_interface_register(&s3c2440_clk_interface); - } - --arch_initcall(s3c24xx_clk_driver); -+arch_initcall(s3c24xx_clk_init); ---- a/arch/arm/mach-s3c2440/dma.c -+++ b/arch/arm/mach-s3c2440/dma.c -@@ -14,7 +14,7 @@ - - #include <linux/kernel.h> - #include <linux/init.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/serial_core.h> - - #include <mach/map.h> -@@ -174,20 +174,22 @@ static struct s3c24xx_dma_order __initda - }, - }; - --static int __init s3c2440_dma_add(struct sys_device *sysdev) -+static int __init s3c2440_dma_add(struct device *dev) - { - s3c2410_dma_init(); - s3c24xx_dma_order_set(&s3c2440_dma_order); - return s3c24xx_dma_init_map(&s3c2440_dma_sel); - } - --static struct sysdev_driver s3c2440_dma_driver = { -- .add = s3c2440_dma_add, -+static struct subsys_interface s3c2440_dma_interface = { -+ .name = "s3c2440_dma", -+ .subsys = &s3c2440_subsys, -+ .add_dev = s3c2440_dma_add, - }; - - static int __init s3c2440_dma_init(void) - { -- return sysdev_driver_register(&s3c2440_sysclass, &s3c2440_dma_driver); -+ return subsys_interface_register(&s3c2440_dma_interface); - } - - arch_initcall(s3c2440_dma_init); ---- a/arch/arm/mach-s3c2440/irq.c -+++ b/arch/arm/mach-s3c2440/irq.c -@@ -23,7 +23,7 @@ - #include <linux/module.h> - #include <linux/interrupt.h> - #include <linux/ioport.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/io.h> - - #include <mach/hardware.h> -@@ -92,7 +92,7 @@ static struct irq_chip s3c_irq_wdtac97 = - .irq_ack = s3c_irq_wdtac97_ack, - }; - --static int s3c2440_irq_add(struct sys_device *sysdev) -+static int s3c2440_irq_add(struct device *dev) - { - unsigned int irqno; - -@@ -113,13 +113,15 @@ static int s3c2440_irq_add(struct sys_de - return 0; - } - --static struct sysdev_driver s3c2440_irq_driver = { -- .add = s3c2440_irq_add, -+static struct subsys_interface s3c2440_irq_interface = { -+ .name = "s3c2440_irq", -+ .subsys = &s3c2440_subsys, -+ .add_dev = s3c2440_irq_add, - }; - - static int s3c2440_irq_init(void) - { -- return sysdev_driver_register(&s3c2440_sysclass, &s3c2440_irq_driver); -+ return subsys_interface_register(&s3c2440_irq_interface); - } - - arch_initcall(s3c2440_irq_init); ---- a/arch/arm/mach-s3c2440/s3c2440-cpufreq.c -+++ b/arch/arm/mach-s3c2440/s3c2440-cpufreq.c -@@ -17,7 +17,7 @@ - #include <linux/interrupt.h> - #include <linux/ioport.h> - #include <linux/cpufreq.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/delay.h> - #include <linux/clk.h> - #include <linux/err.h> -@@ -270,7 +270,7 @@ struct s3c_cpufreq_info s3c2440_cpufreq_ - .debug_io_show = s3c_cpufreq_debugfs_call(s3c2410_iotiming_debugfs), - }; - --static int s3c2440_cpufreq_add(struct sys_device *sysdev) -+static int s3c2440_cpufreq_add(struct device *dev) - { - xtal = s3c_cpufreq_clk_get(NULL, "xtal"); - hclk = s3c_cpufreq_clk_get(NULL, "hclk"); -@@ -285,27 +285,29 @@ static int s3c2440_cpufreq_add(struct sy - return s3c_cpufreq_register(&s3c2440_cpufreq_info); - } - --static struct sysdev_driver s3c2440_cpufreq_driver = { -- .add = s3c2440_cpufreq_add, -+static struct subsys_interface s3c2440_cpufreq_interface = { -+ .name = "s3c2440_cpufreq", -+ .subsys = &s3c2440_subsys, -+ .add_dev = s3c2440_cpufreq_add, - }; - - static int s3c2440_cpufreq_init(void) - { -- return sysdev_driver_register(&s3c2440_sysclass, -- &s3c2440_cpufreq_driver); -+ return subsys_interface_register(&s3c2440_cpufreq_interface); - } - - /* arch_initcall adds the clocks we need, so use subsys_initcall. */ - subsys_initcall(s3c2440_cpufreq_init); - --static struct sysdev_driver s3c2442_cpufreq_driver = { -- .add = s3c2440_cpufreq_add, -+static struct subsys_interface s3c2442_cpufreq_interface = { -+ .name = "s3c2442_cpufreq", -+ .subsys = &s3c2442_subsys, -+ .add_dev = s3c2440_cpufreq_add, - }; - - static int s3c2442_cpufreq_init(void) - { -- return sysdev_driver_register(&s3c2442_sysclass, -- &s3c2442_cpufreq_driver); -+ return subsys_interface_register(&s3c2442_cpufreq_interface); - } - - subsys_initcall(s3c2442_cpufreq_init); ---- a/arch/arm/mach-s3c2440/s3c2440-pll-12000000.c -+++ b/arch/arm/mach-s3c2440/s3c2440-pll-12000000.c -@@ -14,7 +14,7 @@ - - #include <linux/types.h> - #include <linux/kernel.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/clk.h> - #include <linux/err.h> - -@@ -51,7 +51,7 @@ static struct cpufreq_frequency_table s3 - { .frequency = 400000000, .index = PLLVAL(0x5c, 1, 1), }, /* FVco 800.000000 */ - }; - --static int s3c2440_plls12_add(struct sys_device *dev) -+static int s3c2440_plls12_add(struct device *dev) - { - struct clk *xtal_clk; - unsigned long xtal; -@@ -72,25 +72,29 @@ static int s3c2440_plls12_add(struct sys - return 0; - } - --static struct sysdev_driver s3c2440_plls12_drv = { -- .add = s3c2440_plls12_add, -+static struct subsys_interface s3c2440_plls12_interface = { -+ .name = "s3c2440_plls12", -+ .subsys = &s3c2440_subsys, -+ .add_dev = s3c2440_plls12_add, - }; - - static int __init s3c2440_pll_12mhz(void) - { -- return sysdev_driver_register(&s3c2440_sysclass, &s3c2440_plls12_drv); -+ return subsys_interface_register(&s3c2440_plls12_interface); - - } - - arch_initcall(s3c2440_pll_12mhz); - --static struct sysdev_driver s3c2442_plls12_drv = { -- .add = s3c2440_plls12_add, -+static struct subsys_interface s3c2442_plls12_interface = { -+ .name = "s3c2442_plls12", -+ .subsys = &s3c2442_subsys, -+ .add_dev = s3c2440_plls12_add, - }; - - static int __init s3c2442_pll_12mhz(void) - { -- return sysdev_driver_register(&s3c2442_sysclass, &s3c2442_plls12_drv); -+ return subsys_interface_register(&s3c2442_plls12_interface); - - } - ---- a/arch/arm/mach-s3c2440/s3c2440-pll-16934400.c -+++ b/arch/arm/mach-s3c2440/s3c2440-pll-16934400.c -@@ -14,7 +14,7 @@ - - #include <linux/types.h> - #include <linux/kernel.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/clk.h> - #include <linux/err.h> - -@@ -79,7 +79,7 @@ static struct cpufreq_frequency_table s3 - { .frequency = 402192000, .index = PLLVAL(87, 2, 1), }, /* FVco 804.384000 */ - }; - --static int s3c2440_plls169344_add(struct sys_device *dev) -+static int s3c2440_plls169344_add(struct device *dev) - { - struct clk *xtal_clk; - unsigned long xtal; -@@ -100,28 +100,28 @@ static int s3c2440_plls169344_add(struct - return 0; - } - --static struct sysdev_driver s3c2440_plls169344_drv = { -- .add = s3c2440_plls169344_add, -+static struct subsys_interface s3c2440_plls169344_interface = { -+ .name = "s3c2440_plls169344", -+ .subsys = &s3c2440_subsys, -+ .add_dev = s3c2440_plls169344_add, - }; - - static int __init s3c2440_pll_16934400(void) - { -- return sysdev_driver_register(&s3c2440_sysclass, -- &s3c2440_plls169344_drv); -- -+ return subsys_interface_register(&s3c2440_plls169344_interface); - } - - arch_initcall(s3c2440_pll_16934400); - --static struct sysdev_driver s3c2442_plls169344_drv = { -- .add = s3c2440_plls169344_add, -+static struct subsys_interface s3c2442_plls169344_interface = { -+ .name = "s3c2442_plls169344", -+ .subsys = &s3c2442_subsys, -+ .add_dev = s3c2440_plls169344_add, - }; - - static int __init s3c2442_pll_16934400(void) - { -- return sysdev_driver_register(&s3c2442_sysclass, -- &s3c2442_plls169344_drv); -- -+ return subsys_interface_register(&s3c2442_plls169344_interface); - } - - arch_initcall(s3c2442_pll_16934400); ---- a/arch/arm/mach-s3c2440/s3c2440.c -+++ b/arch/arm/mach-s3c2440/s3c2440.c -@@ -18,7 +18,7 @@ - #include <linux/init.h> - #include <linux/platform_device.h> - #include <linux/serial_core.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/syscore_ops.h> - #include <linux/gpio.h> - #include <linux/clk.h> -@@ -40,8 +40,8 @@ - #include <plat/gpio-cfg.h> - #include <plat/gpio-cfg-helpers.h> - --static struct sys_device s3c2440_sysdev = { -- .cls = &s3c2440_sysclass, -+static struct device s3c2440_dev = { -+ .bus = &s3c2440_subsys, - }; - - int __init s3c2440_init(void) -@@ -63,7 +63,7 @@ int __init s3c2440_init(void) - - /* register our system device for everything else */ - -- return sysdev_register(&s3c2440_sysdev); -+ return device_register(&s3c2440_dev); - } - - void __init s3c2440_map_io(void) ---- a/arch/arm/mach-s3c2440/s3c2442.c -+++ b/arch/arm/mach-s3c2440/s3c2442.c -@@ -28,7 +28,6 @@ - #include <linux/errno.h> - #include <linux/err.h> - #include <linux/device.h> --#include <linux/sysdev.h> - #include <linux/syscore_ops.h> - #include <linux/interrupt.h> - #include <linux/ioport.h> -@@ -123,7 +122,7 @@ static struct clk s3c2442_clk_cam_upll = - }, - }; - --static int s3c2442_clk_add(struct sys_device *sysdev) -+static int s3c2442_clk_add(struct device *dev) - { - struct clk *clock_upll; - struct clk *clock_h; -@@ -149,20 +148,22 @@ static int s3c2442_clk_add(struct sys_de - return 0; - } - --static struct sysdev_driver s3c2442_clk_driver = { -- .add = s3c2442_clk_add, -+static struct subsys_interface s3c2442_clk_interface = { -+ .name = "s3c2442_clk", -+ .subsys = &s3c2442_subsys, -+ .add_dev s3c2442_clk_add, - }; - - static __init int s3c2442_clk_init(void) - { -- return sysdev_driver_register(&s3c2442_sysclass, &s3c2442_clk_driver); -+ return subsys_interface_register(&s3c2442_clk_interface); - } - - arch_initcall(s3c2442_clk_init); - - --static struct sys_device s3c2442_sysdev = { -- .cls = &s3c2442_sysclass, -+static struct device s3c2442_dev = { -+ .bus = &s3c2442_subsys, - }; - - int __init s3c2442_init(void) -@@ -175,7 +176,7 @@ int __init s3c2442_init(void) - register_syscore_ops(&s3c244x_pm_syscore_ops); - register_syscore_ops(&s3c24xx_irq_syscore_ops); - -- return sysdev_register(&s3c2442_sysdev); -+ return device_register(&s3c2442_dev); - } - - void __init s3c2442_map_io(void) ---- a/arch/arm/mach-s3c2440/s3c244x-clock.c -+++ b/arch/arm/mach-s3c2440/s3c244x-clock.c -@@ -28,7 +28,6 @@ - #include <linux/errno.h> - #include <linux/err.h> - #include <linux/device.h> --#include <linux/sysdev.h> - #include <linux/interrupt.h> - #include <linux/ioport.h> - #include <linux/clk.h> -@@ -73,7 +72,7 @@ static struct clk clk_arm = { - }, - }; - --static int s3c244x_clk_add(struct sys_device *sysdev) -+static int s3c244x_clk_add(struct device *dev) - { - unsigned long camdivn = __raw_readl(S3C2440_CAMDIVN); - unsigned long clkdivn; -@@ -115,24 +114,28 @@ static int s3c244x_clk_add(struct sys_de - return 0; - } - --static struct sysdev_driver s3c2440_clk_driver = { -- .add = s3c244x_clk_add, -+static struct subsys_interface s3c2440_clk_interface = { -+ .name = "s3c2440_clk", -+ .subsys = &s3c2440_subsys, -+ .add_dev = s3c244x_clk_add, - }; - - static int s3c2440_clk_init(void) - { -- return sysdev_driver_register(&s3c2440_sysclass, &s3c2440_clk_driver); -+ return subsys_interface_register(&s3c2440_clk_interface); - } - - arch_initcall(s3c2440_clk_init); - --static struct sysdev_driver s3c2442_clk_driver = { -- .add = s3c244x_clk_add, -+static struct subsys_interface s3c2442_clk_interface = { -+ .name = "s3c2442_clk", -+ .subsys = &s3c2442_subsys, -+ .add_dev = s3c244x_clk_add, - }; - - static int s3c2442_clk_init(void) - { -- return sysdev_driver_register(&s3c2442_sysclass, &s3c2442_clk_driver); -+ return subsys_interface_register(&s3c2442_clk_interface); - } - - arch_initcall(s3c2442_clk_init); ---- a/arch/arm/mach-s3c2440/s3c244x-irq.c -+++ b/arch/arm/mach-s3c2440/s3c244x-irq.c -@@ -23,7 +23,7 @@ - #include <linux/module.h> - #include <linux/interrupt.h> - #include <linux/ioport.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/io.h> - - #include <mach/hardware.h> -@@ -91,7 +91,7 @@ static struct irq_chip s3c_irq_cam = { - .irq_ack = s3c_irq_cam_ack, - }; - --static int s3c244x_irq_add(struct sys_device *sysdev) -+static int s3c244x_irq_add(struct device *dev) - { - unsigned int irqno; - -@@ -114,25 +114,29 @@ static int s3c244x_irq_add(struct sys_de - return 0; - } - --static struct sysdev_driver s3c2440_irq_driver = { -- .add = s3c244x_irq_add, -+static struct subsys_interface s3c2440_irq_interface = { -+ .name = "s3c2440_irq", -+ .subsys = &s3c2440_subsys, -+ .add_dev = s3c244x_irq_add, - }; - - static int s3c2440_irq_init(void) - { -- return sysdev_driver_register(&s3c2440_sysclass, &s3c2440_irq_driver); -+ return subsys_interface_register(&s3c2440_irq_interface); - } - - arch_initcall(s3c2440_irq_init); - --static struct sysdev_driver s3c2442_irq_driver = { -- .add = s3c244x_irq_add, -+static struct subsys_interface s3c2442_irq_interface = { -+ .name = "s3c2442_irq", -+ .subsys = &s3c2442_subsys, -+ .add_dev = s3c244x_irq_add, - }; - - - static int s3c2442_irq_init(void) - { -- return sysdev_driver_register(&s3c2442_sysclass, &s3c2442_irq_driver); -+ return subsys_interface_register(&s3c2442_irq_interface); - } - - arch_initcall(s3c2442_irq_init); ---- a/arch/arm/mach-s3c2440/s3c244x.c -+++ b/arch/arm/mach-s3c2440/s3c244x.c -@@ -18,7 +18,7 @@ - #include <linux/init.h> - #include <linux/serial_core.h> - #include <linux/platform_device.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/syscore_ops.h> - #include <linux/clk.h> - #include <linux/io.h> -@@ -135,17 +135,19 @@ void __init s3c244x_init_clocks(int xtal - s3c2410_baseclk_add(); - } - --/* Since the S3C2442 and S3C2440 share items, put both sysclasses here */ -+/* Since the S3C2442 and S3C2440 share items, put both subsystems here */ - --struct sysdev_class s3c2440_sysclass = { -+struct bus_type s3c2440_subsys = { - .name = "s3c2440-core", -+ .dev_name = "s3c2440-core", - }; - --struct sysdev_class s3c2442_sysclass = { -+struct bus_type s3c2442_subsys = { - .name = "s3c2442-core", -+ .dev_name = "s3c2442-core", - }; - --/* need to register class before we actually register the device, and -+/* need to register the subsystem before we actually register the device, and - * we also need to ensure that it has been initialised before any of the - * drivers even try to use it (even if not on an s3c2440 based system) - * as a driver which may support both 2410 and 2440 may try and use it. -@@ -153,14 +155,14 @@ struct sysdev_class s3c2442_sysclass = { - - static int __init s3c2440_core_init(void) - { -- return sysdev_class_register(&s3c2440_sysclass); -+ return subsys_system_register(&s3c2440_subsys, NULL); - } - - core_initcall(s3c2440_core_init); - - static int __init s3c2442_core_init(void) - { -- return sysdev_class_register(&s3c2442_sysclass); -+ return subsys_system_register(&s3c2442_subsys, NULL); - } - - core_initcall(s3c2442_core_init); ---- a/arch/arm/mach-s3c2443/dma.c -+++ b/arch/arm/mach-s3c2443/dma.c -@@ -14,7 +14,7 @@ - - #include <linux/kernel.h> - #include <linux/init.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/serial_core.h> - #include <linux/io.h> - -@@ -135,19 +135,21 @@ static struct s3c24xx_dma_selection __in - .map_size = ARRAY_SIZE(s3c2443_dma_mappings), - }; - --static int __init s3c2443_dma_add(struct sys_device *sysdev) -+static int __init s3c2443_dma_add(struct device *dev) - { - s3c24xx_dma_init(6, IRQ_S3C2443_DMA0, 0x100); - return s3c24xx_dma_init_map(&s3c2443_dma_sel); - } - --static struct sysdev_driver s3c2443_dma_driver = { -- .add = s3c2443_dma_add, -+static struct subsys_interface s3c2443_dma_interface = { -+ .name = "s3c2443_dma", -+ .subsys = &s3c2443_subsys, -+ .add_dev = s3c2443_dma_add, - }; - - static int __init s3c2443_dma_init(void) - { -- return sysdev_driver_register(&s3c2443_sysclass, &s3c2443_dma_driver); -+ return subsys_interface_register(&s3c2443_dma_interface); - } - - arch_initcall(s3c2443_dma_init); ---- a/arch/arm/mach-s3c2443/irq.c -+++ b/arch/arm/mach-s3c2443/irq.c -@@ -23,7 +23,7 @@ - #include <linux/module.h> - #include <linux/interrupt.h> - #include <linux/ioport.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/io.h> - - #include <mach/hardware.h> -@@ -241,7 +241,7 @@ static int __init s3c2443_add_sub(unsign - return 0; - } - --static int __init s3c2443_irq_add(struct sys_device *sysdev) -+static int __init s3c2443_irq_add(struct device *dev) - { - printk("S3C2443: IRQ Support\n"); - -@@ -265,13 +265,15 @@ static int __init s3c2443_irq_add(struct - return 0; - } - --static struct sysdev_driver s3c2443_irq_driver = { -- .add = s3c2443_irq_add, -+static struct subsys_interface s3c2443_irq_interface = { -+ .name = "s3c2443_irq", -+ .subsys = &s3c2443_subsys, -+ .add_dev = s3c2443_irq_add, - }; - - static int __init s3c2443_irq_init(void) - { -- return sysdev_driver_register(&s3c2443_sysclass, &s3c2443_irq_driver); -+ return subsys_interface_register(&s3c2443_irq_interface); - } - - arch_initcall(s3c2443_irq_init); ---- a/arch/arm/mach-s3c2443/s3c2443.c -+++ b/arch/arm/mach-s3c2443/s3c2443.c -@@ -19,7 +19,7 @@ - #include <linux/gpio.h> - #include <linux/platform_device.h> - #include <linux/serial_core.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/clk.h> - #include <linux/io.h> - -@@ -49,12 +49,13 @@ static struct map_desc s3c2443_iodesc[] - IODESC_ENT(TIMER), - }; - --struct sysdev_class s3c2443_sysclass = { -+struct bus_type s3c2443_subsys = { - .name = "s3c2443-core", -+ .dev_name = "s3c2443-core", - }; - --static struct sys_device s3c2443_sysdev = { -- .cls = &s3c2443_sysclass, -+static struct device s3c2443_dev = { -+ .bus = &s3c2443_subsys, - }; - - static void s3c2443_hard_reset(void) -@@ -77,7 +78,7 @@ int __init s3c2443_init(void) - s3c_device_wdt.resource[1].start = IRQ_S3C2443_WDT; - s3c_device_wdt.resource[1].end = IRQ_S3C2443_WDT; - -- return sysdev_register(&s3c2443_sysdev); -+ return device_register(&s3c2443_dev); - } - - void __init s3c2443_init_uarts(struct s3c2410_uartcfg *cfg, int no) -@@ -99,7 +100,7 @@ void __init s3c2443_map_io(void) - iotable_init(s3c2443_iodesc, ARRAY_SIZE(s3c2443_iodesc)); - } - --/* need to register class before we actually register the device, and -+/* need to register the subsystem before we actually register the device, and - * we also need to ensure that it has been initialised before any of the - * drivers even try to use it (even if not on an s3c2443 based system) - * as a driver which may support both 2443 and 2440 may try and use it. -@@ -107,7 +108,7 @@ void __init s3c2443_map_io(void) - - static int __init s3c2443_core_init(void) - { -- return sysdev_class_register(&s3c2443_sysclass); -+ return subsys_system_register(&s3c2443_subsys, NULL); - } - - core_initcall(s3c2443_core_init); ---- a/arch/arm/mach-s3c64xx/cpu.c -+++ b/arch/arm/mach-s3c64xx/cpu.c -@@ -16,7 +16,7 @@ - #include <linux/module.h> - #include <linux/interrupt.h> - #include <linux/ioport.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/serial_core.h> - #include <linux/platform_device.h> - #include <linux/io.h> -@@ -122,12 +122,13 @@ static struct map_desc s3c_iodesc[] __in - }; - - --struct sysdev_class s3c64xx_sysclass = { -- .name = "s3c64xx-core", -+struct bus_type s3c64xx_subsys = { -+ .name = "s3c64xx-core", -+ .dev_name = "s3c64xx-core", - }; - --static struct sys_device s3c64xx_sysdev = { -- .cls = &s3c64xx_sysclass, -+static struct device s3c64xx_dev = { -+ .bus = &s3c64xx_subsys, - }; - - /* uart registration process */ -@@ -152,10 +153,10 @@ void __init s3c64xx_init_io(struct map_d - s3c_init_cpu(samsung_cpu_id, cpu_ids, ARRAY_SIZE(cpu_ids)); - } - --static __init int s3c64xx_sysdev_init(void) -+static __init int s3c64xx_dev_init(void) - { -- sysdev_class_register(&s3c64xx_sysclass); -- return sysdev_register(&s3c64xx_sysdev); -+ subsys_system_register(&s3c64xx_subsys, NULL); -+ return device_register(&s3c64xx_dev); - } - --core_initcall(s3c64xx_sysdev_init); -+core_initcall(s3c64xx_dev_init); ---- a/arch/arm/mach-s3c64xx/dma.c -+++ b/arch/arm/mach-s3c64xx/dma.c -@@ -16,7 +16,7 @@ - #include <linux/module.h> - #include <linux/interrupt.h> - #include <linux/dmapool.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/errno.h> - #include <linux/slab.h> - #include <linux/delay.h> -@@ -35,7 +35,7 @@ - /* dma channel state information */ - - struct s3c64xx_dmac { -- struct sys_device sysdev; -+ struct device dev; - struct clk *clk; - void __iomem *regs; - struct s3c2410_dma_chan *channels; -@@ -631,8 +631,9 @@ static irqreturn_t s3c64xx_dma_irq(int i - return IRQ_HANDLED; - } - --static struct sysdev_class dma_sysclass = { -+static struct bus_type dma_subsys = { - .name = "s3c64xx-dma", -+ .dev_name = "s3c64xx-dma", - }; - - static int s3c64xx_dma_init1(int chno, enum dma_ch chbase, -@@ -651,12 +652,12 @@ static int s3c64xx_dma_init1(int chno, e - return -ENOMEM; - } - -- dmac->sysdev.id = chno / 8; -- dmac->sysdev.cls = &dma_sysclass; -+ dmac->dev.id = chno / 8; -+ dmac->dev.bus = &dma_subsys; - -- err = sysdev_register(&dmac->sysdev); -+ err = device_register(&dmac->dev); - if (err) { -- printk(KERN_ERR "%s: failed to register sysdevice\n", __func__); -+ printk(KERN_ERR "%s: failed to register device\n", __func__); - goto err_alloc; - } - -@@ -667,7 +668,7 @@ static int s3c64xx_dma_init1(int chno, e - goto err_dev; - } - -- snprintf(clkname, sizeof(clkname), "dma%d", dmac->sysdev.id); -+ snprintf(clkname, sizeof(clkname), "dma%d", dmac->dev.id); - - dmac->clk = clk_get(NULL, clkname); - if (IS_ERR(dmac->clk)) { -@@ -715,7 +716,7 @@ err_clk: - err_map: - iounmap(regs); - err_dev: -- sysdev_unregister(&dmac->sysdev); -+ device_unregister(&dmac->dev); - err_alloc: - kfree(dmac); - return err; -@@ -733,9 +734,9 @@ static int __init s3c64xx_dma_init(void) - return -ENOMEM; - } - -- ret = sysdev_class_register(&dma_sysclass); -+ ret = subsys_system_register(&dma_subsys, NULL); - if (ret) { -- printk(KERN_ERR "%s: failed to create sysclass\n", __func__); -+ printk(KERN_ERR "%s: failed to create subsys\n", __func__); - return -ENOMEM; - } - ---- a/arch/arm/mach-s3c64xx/s3c6400.c -+++ b/arch/arm/mach-s3c64xx/s3c6400.c -@@ -17,7 +17,7 @@ - #include <linux/init.h> - #include <linux/clk.h> - #include <linux/io.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/serial_core.h> - #include <linux/platform_device.h> - -@@ -70,17 +70,18 @@ void __init s3c6400_init_irq(void) - s3c64xx_init_irq(~0 & ~(0xf << 5), ~0); - } - --static struct sysdev_class s3c6400_sysclass = { -- .name = "s3c6400-core", -+static struct bus_type s3c6400_subsys = { -+ .name = "s3c6400-core", -+ .dev_name = "s3c6400-core", - }; - --static struct sys_device s3c6400_sysdev = { -- .cls = &s3c6400_sysclass, -+static struct device s3c6400_dev = { -+ .bus = &s3c6400_subsys, - }; - - static int __init s3c6400_core_init(void) - { -- return sysdev_class_register(&s3c6400_sysclass); -+ return subsys_system_register(&s3c6400_subsys, NULL); - } - - core_initcall(s3c6400_core_init); -@@ -89,5 +90,5 @@ int __init s3c6400_init(void) - { - printk("S3C6400: Initialising architecture\n"); - -- return sysdev_register(&s3c6400_sysdev); -+ return device_register(&s3c6400_dev); - } ---- a/arch/arm/mach-s3c64xx/s3c6410.c -+++ b/arch/arm/mach-s3c64xx/s3c6410.c -@@ -18,7 +18,7 @@ - #include <linux/init.h> - #include <linux/clk.h> - #include <linux/io.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/serial_core.h> - #include <linux/platform_device.h> - -@@ -75,17 +75,18 @@ void __init s3c6410_init_irq(void) - s3c64xx_init_irq(~0 & ~(1 << 7), ~0); - } - --struct sysdev_class s3c6410_sysclass = { -- .name = "s3c6410-core", -+struct bus_type s3c6410_subsys = { -+ .name = "s3c6410-core", -+ .dev_name = "s3c6410-core", - }; - --static struct sys_device s3c6410_sysdev = { -- .cls = &s3c6410_sysclass, -+static struct device s3c6410_dev = { -+ .bus = &s3c6410_subsys, - }; - - static int __init s3c6410_core_init(void) - { -- return sysdev_class_register(&s3c6410_sysclass); -+ return subsys_system_register(&s3c6410_subsys, NULL); - } - - core_initcall(s3c6410_core_init); -@@ -94,5 +95,5 @@ int __init s3c6410_init(void) - { - printk("S3C6410: Initialising architecture\n"); - -- return sysdev_register(&s3c6410_sysdev); -+ return device_register(&s3c6410_dev); - } ---- a/arch/arm/mach-s5p64x0/cpu.c -+++ b/arch/arm/mach-s5p64x0/cpu.c -@@ -16,7 +16,7 @@ - #include <linux/init.h> - #include <linux/clk.h> - #include <linux/io.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/serial_core.h> - #include <linux/platform_device.h> - #include <linux/sched.h> -@@ -190,17 +190,18 @@ void __init s5p6450_init_irq(void) - s5p_init_irq(vic, ARRAY_SIZE(vic)); - } - --struct sysdev_class s5p64x0_sysclass = { -- .name = "s5p64x0-core", -+struct bus_type s5p64x0_subsys = { -+ .name = "s5p64x0-core", -+ .dev_name = "s5p64x0-core", - }; - --static struct sys_device s5p64x0_sysdev = { -- .cls = &s5p64x0_sysclass, -+static struct device s5p64x0_subsys = { -+ .bus = &s5p64x0_subsys, - }; - - static int __init s5p64x0_core_init(void) - { -- return sysdev_class_register(&s5p64x0_sysclass); -+ return subsys_system_register(&s5p64x0_subsys, NULL); - } - core_initcall(s5p64x0_core_init); - -@@ -211,5 +212,5 @@ int __init s5p64x0_init(void) - /* set idle function */ - pm_idle = s5p64x0_idle; - -- return sysdev_register(&s5p64x0_sysdev); -+ return device_register(&s5p64x0_dev); - } ---- a/arch/arm/mach-s5p64x0/pm.c -+++ b/arch/arm/mach-s5p64x0/pm.c -@@ -160,7 +160,7 @@ static void s5p64x0_pm_prepare(void) - - } - --static int s5p64x0_pm_add(struct sys_device *sysdev) -+static int s5p64x0_pm_add(struct device *dev) - { - pm_cpu_prep = s5p64x0_pm_prepare; - pm_cpu_sleep = s5p64x0_cpu_suspend; -@@ -169,15 +169,17 @@ static int s5p64x0_pm_add(struct sys_dev - return 0; - } - --static struct sysdev_driver s5p64x0_pm_driver = { -- .add = s5p64x0_pm_add, -+static struct subsys_interface s5p64x0_pm_interface = { -+ .name = "s5p64x0_pm", -+ .subsys = &s5p64x0_subsys, -+ .add_dev = s5p64x0_pm_add, - }; - - static __init int s5p64x0_pm_drvinit(void) - { - s3c_pm_init(); - -- return sysdev_driver_register(&s5p64x0_sysclass, &s5p64x0_pm_driver); -+ return subsys_interface_register(&s5p64x0_pm_interface); - } - arch_initcall(s5p64x0_pm_drvinit); - ---- a/arch/arm/mach-s5pc100/cpu.c -+++ b/arch/arm/mach-s5pc100/cpu.c -@@ -21,7 +21,7 @@ - #include <linux/init.h> - #include <linux/clk.h> - #include <linux/io.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/serial_core.h> - #include <linux/platform_device.h> - #include <linux/sched.h> -@@ -143,17 +143,18 @@ void __init s5pc100_init_irq(void) - s5p_init_irq(vic, ARRAY_SIZE(vic)); - } - --static struct sysdev_class s5pc100_sysclass = { -- .name = "s5pc100-core", -+static struct bus_type s5pc100_subsys = { -+ .name = "s5pc100-core", -+ .dev_name = "s5pc100-core", - }; - --static struct sys_device s5pc100_sysdev = { -- .cls = &s5pc100_sysclass, -+static struct device s5pc100_dev = { -+ .bus = &s5pc100_subsys, - }; - - static int __init s5pc100_core_init(void) - { -- return sysdev_class_register(&s5pc100_sysclass); -+ return subsys_system_register(&s5pc100_subsys, NULL); - } - - core_initcall(s5pc100_core_init); -@@ -165,5 +166,5 @@ int __init s5pc100_init(void) - /* set idle function */ - pm_idle = s5pc100_idle; - -- return sysdev_register(&s5pc100_sysdev); -+ return device_register(&s5pc100_sys); - } ---- a/arch/arm/mach-s5pv210/cpu.c -+++ b/arch/arm/mach-s5pv210/cpu.c -@@ -17,7 +17,7 @@ - #include <linux/module.h> - #include <linux/clk.h> - #include <linux/io.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/platform_device.h> - #include <linux/sched.h> - #include <linux/dma-mapping.h> -@@ -174,17 +174,18 @@ void __init s5pv210_init_irq(void) - s5p_init_irq(vic, ARRAY_SIZE(vic)); - } - --struct sysdev_class s5pv210_sysclass = { -- .name = "s5pv210-core", -+struct bus_type s5pv210_subsys = { -+ .name = "s5pv210-core", -+ .dev_name = "s5pv210-core", - }; - --static struct sys_device s5pv210_sysdev = { -- .cls = &s5pv210_sysclass, -+static struct device s5pv210_dev = { -+ .bus = &s5pv210_subsys, - }; - - static int __init s5pv210_core_init(void) - { -- return sysdev_class_register(&s5pv210_sysclass); -+ return subsys_system_register(&s5pv210_subsys, NULL); - } - - core_initcall(s5pv210_core_init); -@@ -199,5 +200,5 @@ int __init s5pv210_init(void) - /* set sw_reset function */ - s5p_reset_hook = s5pv210_sw_reset; - -- return sysdev_register(&s5pv210_sysdev); -+ return device_register(&s5pv210_dev); - } ---- a/arch/arm/mach-s5pv210/pm.c -+++ b/arch/arm/mach-s5pv210/pm.c -@@ -133,7 +133,7 @@ static void s5pv210_pm_prepare(void) - s3c_pm_do_save(s5pv210_core_save, ARRAY_SIZE(s5pv210_core_save)); - } - --static int s5pv210_pm_add(struct sys_device *sysdev) -+static int s5pv210_pm_add(struct device *dev) - { - pm_cpu_prep = s5pv210_pm_prepare; - pm_cpu_sleep = s5pv210_cpu_suspend; -@@ -141,13 +141,15 @@ static int s5pv210_pm_add(struct sys_dev - return 0; - } - --static struct sysdev_driver s5pv210_pm_driver = { -- .add = s5pv210_pm_add, -+static struct subsys_interface s5pv210_pm_interface = { -+ .name = "s5pv210_pm", -+ .subsys = &s5pv210_subsys, -+ .add_dev = s5pv210_pm_add, - }; - - static __init int s5pv210_pm_drvinit(void) - { -- return sysdev_driver_register(&s5pv210_sysclass, &s5pv210_pm_driver); -+ return subsys_interface_register(&s5pv210_pm_interface); - } - arch_initcall(s5pv210_pm_drvinit); - ---- a/arch/arm/plat-samsung/include/plat/cpu.h -+++ b/arch/arm/plat-samsung/include/plat/cpu.h -@@ -185,20 +185,20 @@ extern struct syscore_ops s3c2416_pm_sys - extern struct syscore_ops s3c244x_pm_syscore_ops; - extern struct syscore_ops s3c64xx_irq_syscore_ops; - --/* system device classes */ -+/* system device subsystems */ - --extern struct sysdev_class s3c2410_sysclass; --extern struct sysdev_class s3c2410a_sysclass; --extern struct sysdev_class s3c2412_sysclass; --extern struct sysdev_class s3c2416_sysclass; --extern struct sysdev_class s3c2440_sysclass; --extern struct sysdev_class s3c2442_sysclass; --extern struct sysdev_class s3c2443_sysclass; --extern struct sysdev_class s3c6410_sysclass; --extern struct sysdev_class s3c64xx_sysclass; --extern struct sysdev_class s5p64x0_sysclass; --extern struct sysdev_class s5pv210_sysclass; --extern struct sysdev_class exynos4_sysclass; -+extern struct bus_type s3c2410_subsys; -+extern struct bus_type s3c2410a_subsys; -+extern struct bus_type s3c2412_subsys; -+extern struct bus_type s3c2416_subsys; -+extern struct bus_type s3c2440_subsys; -+extern struct bus_type s3c2442_subsys; -+extern struct bus_type s3c2443_subsys; -+extern struct bus_type s3c6410_subsys; -+extern struct bus_type s3c64xx_subsys; -+extern struct bus_type s5p64x0_subsys; -+extern struct bus_type s5pv210_subsys; -+extern struct bus_type exynos4_subsys; - - extern void (*s5pc1xx_idle)(void); - ---- a/arch/arm/plat-samsung/include/plat/dma-s3c24xx.h -+++ b/arch/arm/plat-samsung/include/plat/dma-s3c24xx.h -@@ -12,7 +12,7 @@ - - #include <plat/dma-core.h> - --extern struct sysdev_class dma_sysclass; -+extern struct bus_type dma_subsys; - extern struct s3c2410_dma_chan s3c2410_chans[S3C_DMA_CHANNELS]; - - #define DMA_CH_VALID (1<<31) ---- a/arch/arm/plat-samsung/include/plat/pm.h -+++ b/arch/arm/plat-samsung/include/plat/pm.h -@@ -17,7 +17,7 @@ - - #include <linux/irq.h> - --struct sys_device; -+struct device; - - #ifdef CONFIG_PM - diff --git a/99-core-remove.patch b/99-core-remove.patch deleted file mode 100644 index 6d3de7f..0000000 --- a/99-core-remove.patch +++ /dev/null @@ -1,1412 +0,0 @@ -From: Kay Sievers <kay.sievers@vrfy.org> -Subject: driver-core: remove sysdev implementation - -Delete all remaining pieces of the needless special case of 'system devices'. -They never made much sense and they are now just regular subsystems and -devices, like everything else in the system. - -Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> ---- - arch/arm/mach-bcmring/core.c | 1 - arch/arm/mach-exynos/irq-eint.c | 2 - arch/arm/mach-integrator/integrator_cp.c | 2 - arch/arm/mach-ks8695/irq.c | 2 - arch/arm/mach-lpc32xx/phy3250.c | 2 - arch/arm/mach-msm/board-sapphire.c | 2 - arch/arm/mach-realview/core.c | 2 - arch/arm/mach-realview/realview_eb.c | 2 - arch/arm/mach-realview/realview_pb1176.c | 2 - arch/arm/mach-realview/realview_pb11mp.c | 2 - arch/arm/mach-realview/realview_pba8.c | 2 - arch/arm/mach-realview/realview_pbx.c | 2 - arch/arm/mach-s3c2410/bast-irq.c | 2 - arch/arm/mach-s3c2410/mach-h1940.c | 2 - arch/arm/mach-s3c2410/mach-qt2410.c | 2 - arch/arm/mach-s3c2412/clock.c | 2 - arch/arm/mach-s3c2440/mach-rx1950.c | 2 - arch/arm/mach-s3c2440/mach-rx3715.c | 2 - arch/arm/mach-s3c2443/clock.c | 2 - arch/arm/mach-s3c64xx/irq-eint.c | 2 - arch/arm/mach-s5p64x0/clock-s5p6440.c | 2 - arch/arm/mach-s5p64x0/clock-s5p6450.c | 2 - arch/arm/mach-s5p64x0/clock.c | 2 - arch/arm/mach-s5pv210/clock.c | 2 - arch/arm/mach-s5pv210/mach-smdkc110.c | 2 - arch/arm/mach-s5pv210/mach-smdkv210.c | 2 - arch/arm/mach-versatile/core.c | 1 - arch/arm/mach-versatile/versatile_ab.c | 1 - arch/arm/mach-versatile/versatile_pb.c | 1 - arch/arm/mach-vexpress/v2m.c | 2 - arch/arm/mach-w90x900/irq.c | 2 - arch/arm/plat-s3c24xx/common-smdk.c | 2 - arch/arm/plat-s3c24xx/cpu-freq.c | 2 - arch/arm/plat-s3c24xx/irq.c | 2 - arch/arm/plat-s3c24xx/pm-simtec.c | 1 - arch/arm/plat-s3c24xx/s3c2410-clock.c | 2 - arch/arm/plat-s3c24xx/s3c2412-iotiming.c | 2 - arch/arm/plat-s5p/clock.c | 2 - arch/arm/plat-s5p/irq-eint.c | 2 - arch/arm/plat-samsung/clock-clksrc.c | 2 - arch/arm/plat-samsung/clock.c | 2 - arch/arm/plat-samsung/pm-gpio.c | 2 - arch/arm/plat-samsung/wakeup-mask.c | 2 - arch/avr32/boards/merisc/merisc_sysfs.c | 1 - arch/avr32/kernel/irq.c | 2 - arch/mips/txx9/generic/setup_tx4939.c | 2 - arch/powerpc/platforms/cell/smp.c | 2 - arch/powerpc/platforms/iseries/smp.c | 2 - arch/powerpc/platforms/powermac/cpufreq_32.c | 2 - arch/powerpc/platforms/pseries/smp.c | 2 - arch/powerpc/sysdev/uic.c | 1 - arch/unicore32/kernel/puv3-core.c | 1 - arch/unicore32/kernel/puv3-nb0916.c | 1 - arch/x86/kernel/hpet.c | 1 - arch/x86/kernel/irqinit.c | 2 - arch/x86/platform/uv/uv_sysfs.c | 2 - drivers/base/Makefile | 2 - drivers/base/sys.c | 383 --------------------------- - drivers/gpio/gpio-samsung.c | 2 - drivers/leds/led-class.c | 1 - drivers/leds/led-triggers.c | 1 - drivers/macintosh/smu.c | 4 - drivers/net/bonding/bond_sysfs.c | 1 - drivers/platform/x86/intel_scu_ipc.c | 2 - drivers/s390/block/xpram.c | 2 - include/linux/kobject.h | 2 - include/linux/sysdev.h | 164 ----------- - kernel/time/clockevents.c | 1 - lib/kobject.c | 37 -- - 69 files changed, 50 insertions(+), 654 deletions(-) - ---- a/arch/arm/mach-bcmring/core.c -+++ b/arch/arm/mach-bcmring/core.c -@@ -25,7 +25,6 @@ - #include <linux/device.h> - #include <linux/dma-mapping.h> - #include <linux/platform_device.h> --#include <linux/sysdev.h> - #include <linux/interrupt.h> - #include <linux/amba/bus.h> - #include <linux/clkdev.h> ---- a/arch/arm/mach-exynos/irq-eint.c -+++ b/arch/arm/mach-exynos/irq-eint.c -@@ -14,7 +14,7 @@ - #include <linux/interrupt.h> - #include <linux/irq.h> - #include <linux/io.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/gpio.h> - - #include <plat/pm.h> ---- a/arch/arm/mach-integrator/integrator_cp.c -+++ b/arch/arm/mach-integrator/integrator_cp.c -@@ -14,7 +14,7 @@ - #include <linux/platform_device.h> - #include <linux/dma-mapping.h> - #include <linux/string.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/amba/bus.h> - #include <linux/amba/kmi.h> - #include <linux/amba/clcd.h> ---- a/arch/arm/mach-ks8695/irq.c -+++ b/arch/arm/mach-ks8695/irq.c -@@ -23,7 +23,7 @@ - #include <linux/module.h> - #include <linux/interrupt.h> - #include <linux/ioport.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/io.h> - - #include <mach/hardware.h> ---- a/arch/arm/mach-lpc32xx/phy3250.c -+++ b/arch/arm/mach-lpc32xx/phy3250.c -@@ -18,7 +18,7 @@ - - #include <linux/init.h> - #include <linux/platform_device.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/interrupt.h> - #include <linux/irq.h> - #include <linux/dma-mapping.h> ---- a/arch/arm/mach-msm/board-sapphire.c -+++ b/arch/arm/mach-msm/board-sapphire.c -@@ -18,7 +18,7 @@ - #include <linux/input.h> - #include <linux/interrupt.h> - #include <linux/irq.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - - #include <linux/delay.h> - ---- a/arch/arm/mach-realview/core.c -+++ b/arch/arm/mach-realview/core.c -@@ -21,7 +21,7 @@ - #include <linux/init.h> - #include <linux/platform_device.h> - #include <linux/dma-mapping.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/interrupt.h> - #include <linux/amba/bus.h> - #include <linux/amba/clcd.h> ---- a/arch/arm/mach-realview/realview_eb.c -+++ b/arch/arm/mach-realview/realview_eb.c -@@ -21,7 +21,7 @@ - - #include <linux/init.h> - #include <linux/platform_device.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/amba/bus.h> - #include <linux/amba/pl061.h> - #include <linux/amba/mmci.h> ---- a/arch/arm/mach-realview/realview_pb1176.c -+++ b/arch/arm/mach-realview/realview_pb1176.c -@@ -21,7 +21,7 @@ - - #include <linux/init.h> - #include <linux/platform_device.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/amba/bus.h> - #include <linux/amba/pl061.h> - #include <linux/amba/mmci.h> ---- a/arch/arm/mach-realview/realview_pb11mp.c -+++ b/arch/arm/mach-realview/realview_pb11mp.c -@@ -21,7 +21,7 @@ - - #include <linux/init.h> - #include <linux/platform_device.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/amba/bus.h> - #include <linux/amba/pl061.h> - #include <linux/amba/mmci.h> ---- a/arch/arm/mach-realview/realview_pba8.c -+++ b/arch/arm/mach-realview/realview_pba8.c -@@ -21,7 +21,7 @@ - - #include <linux/init.h> - #include <linux/platform_device.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/amba/bus.h> - #include <linux/amba/pl061.h> - #include <linux/amba/mmci.h> ---- a/arch/arm/mach-realview/realview_pbx.c -+++ b/arch/arm/mach-realview/realview_pbx.c -@@ -20,7 +20,7 @@ - - #include <linux/init.h> - #include <linux/platform_device.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/amba/bus.h> - #include <linux/amba/pl061.h> - #include <linux/amba/mmci.h> ---- a/arch/arm/mach-s3c2410/bast-irq.c -+++ b/arch/arm/mach-s3c2410/bast-irq.c -@@ -24,7 +24,7 @@ - #include <linux/init.h> - #include <linux/module.h> - #include <linux/ioport.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/io.h> - - #include <asm/mach-types.h> ---- a/arch/arm/mach-s3c2410/mach-h1940.c -+++ b/arch/arm/mach-s3c2410/mach-h1940.c -@@ -18,7 +18,7 @@ - #include <linux/memblock.h> - #include <linux/timer.h> - #include <linux/init.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/serial_core.h> - #include <linux/platform_device.h> - #include <linux/io.h> ---- a/arch/arm/mach-s3c2410/mach-qt2410.c -+++ b/arch/arm/mach-s3c2410/mach-qt2410.c -@@ -28,7 +28,7 @@ - #include <linux/timer.h> - #include <linux/init.h> - #include <linux/gpio.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/platform_device.h> - #include <linux/serial_core.h> - #include <linux/spi/spi.h> ---- a/arch/arm/mach-s3c2412/clock.c -+++ b/arch/arm/mach-s3c2412/clock.c -@@ -26,7 +26,7 @@ - #include <linux/list.h> - #include <linux/errno.h> - #include <linux/err.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/clk.h> - #include <linux/mutex.h> - #include <linux/delay.h> ---- a/arch/arm/mach-s3c2440/mach-rx1950.c -+++ b/arch/arm/mach-s3c2440/mach-rx1950.c -@@ -24,7 +24,7 @@ - #include <linux/serial_core.h> - #include <linux/input.h> - #include <linux/gpio_keys.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/pda_power.h> - #include <linux/pwm_backlight.h> - #include <linux/pwm.h> ---- a/arch/arm/mach-s3c2440/mach-rx3715.c -+++ b/arch/arm/mach-s3c2440/mach-rx3715.c -@@ -20,7 +20,7 @@ - #include <linux/init.h> - #include <linux/tty.h> - #include <linux/console.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/platform_device.h> - #include <linux/serial_core.h> - #include <linux/serial.h> ---- a/arch/arm/mach-s3c2443/clock.c -+++ b/arch/arm/mach-s3c2443/clock.c -@@ -27,7 +27,7 @@ - #include <linux/list.h> - #include <linux/errno.h> - #include <linux/err.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/clk.h> - #include <linux/mutex.h> - #include <linux/serial_core.h> ---- a/arch/arm/mach-s3c64xx/irq-eint.c -+++ b/arch/arm/mach-s3c64xx/irq-eint.c -@@ -14,7 +14,7 @@ - - #include <linux/kernel.h> - #include <linux/interrupt.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/gpio.h> - #include <linux/irq.h> - #include <linux/io.h> ---- a/arch/arm/mach-s5p64x0/clock-s5p6440.c -+++ b/arch/arm/mach-s5p64x0/clock-s5p6440.c -@@ -17,7 +17,7 @@ - #include <linux/errno.h> - #include <linux/err.h> - #include <linux/clk.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/io.h> - - #include <mach/hardware.h> ---- a/arch/arm/mach-s5p64x0/clock-s5p6450.c -+++ b/arch/arm/mach-s5p64x0/clock-s5p6450.c -@@ -17,7 +17,7 @@ - #include <linux/errno.h> - #include <linux/err.h> - #include <linux/clk.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/io.h> - - #include <mach/hardware.h> ---- a/arch/arm/mach-s5p64x0/clock.c -+++ b/arch/arm/mach-s5p64x0/clock.c -@@ -17,7 +17,7 @@ - #include <linux/errno.h> - #include <linux/err.h> - #include <linux/clk.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/io.h> - - #include <mach/hardware.h> ---- a/arch/arm/mach-s5pv210/clock.c -+++ b/arch/arm/mach-s5pv210/clock.c -@@ -17,7 +17,7 @@ - #include <linux/errno.h> - #include <linux/err.h> - #include <linux/clk.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/io.h> - - #include <mach/map.h> ---- a/arch/arm/mach-s5pv210/mach-smdkc110.c -+++ b/arch/arm/mach-s5pv210/mach-smdkc110.c -@@ -13,7 +13,7 @@ - #include <linux/init.h> - #include <linux/serial_core.h> - #include <linux/i2c.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - - #include <asm/mach/arch.h> - #include <asm/mach/map.h> ---- a/arch/arm/mach-s5pv210/mach-smdkv210.c -+++ b/arch/arm/mach-s5pv210/mach-smdkv210.c -@@ -13,7 +13,7 @@ - #include <linux/i2c.h> - #include <linux/init.h> - #include <linux/serial_core.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/dm9000.h> - #include <linux/fb.h> - #include <linux/gpio.h> ---- a/arch/arm/mach-versatile/core.c -+++ b/arch/arm/mach-versatile/core.c -@@ -22,7 +22,6 @@ - #include <linux/device.h> - #include <linux/dma-mapping.h> - #include <linux/platform_device.h> --#include <linux/sysdev.h> - #include <linux/interrupt.h> - #include <linux/irqdomain.h> - #include <linux/of_address.h> ---- a/arch/arm/mach-versatile/versatile_ab.c -+++ b/arch/arm/mach-versatile/versatile_ab.c -@@ -21,7 +21,6 @@ - - #include <linux/init.h> - #include <linux/device.h> --#include <linux/sysdev.h> - #include <linux/amba/bus.h> - #include <linux/io.h> - ---- a/arch/arm/mach-versatile/versatile_pb.c -+++ b/arch/arm/mach-versatile/versatile_pb.c -@@ -21,7 +21,6 @@ - - #include <linux/init.h> - #include <linux/device.h> --#include <linux/sysdev.h> - #include <linux/amba/bus.h> - #include <linux/amba/pl061.h> - #include <linux/amba/mmci.h> ---- a/arch/arm/mach-vexpress/v2m.c -+++ b/arch/arm/mach-vexpress/v2m.c -@@ -10,7 +10,7 @@ - #include <linux/ata_platform.h> - #include <linux/smsc911x.h> - #include <linux/spinlock.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/usb/isp1760.h> - #include <linux/clkdev.h> - #include <linux/mtd/physmap.h> ---- a/arch/arm/mach-w90x900/irq.c -+++ b/arch/arm/mach-w90x900/irq.c -@@ -19,7 +19,7 @@ - #include <linux/interrupt.h> - #include <linux/ioport.h> - #include <linux/ptrace.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/io.h> - - #include <asm/irq.h> ---- a/arch/arm/plat-s3c24xx/common-smdk.c -+++ b/arch/arm/plat-s3c24xx/common-smdk.c -@@ -19,7 +19,7 @@ - #include <linux/timer.h> - #include <linux/init.h> - #include <linux/gpio.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/platform_device.h> - - #include <linux/mtd/mtd.h> ---- a/arch/arm/plat-s3c24xx/cpu-freq.c -+++ b/arch/arm/plat-s3c24xx/cpu-freq.c -@@ -20,7 +20,7 @@ - #include <linux/clk.h> - #include <linux/err.h> - #include <linux/io.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/sysfs.h> - #include <linux/slab.h> - ---- a/arch/arm/plat-s3c24xx/irq.c -+++ b/arch/arm/plat-s3c24xx/irq.c -@@ -22,7 +22,7 @@ - #include <linux/module.h> - #include <linux/interrupt.h> - #include <linux/ioport.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/syscore_ops.h> - - #include <asm/irq.h> ---- a/arch/arm/plat-s3c24xx/pm-simtec.c -+++ b/arch/arm/plat-s3c24xx/pm-simtec.c -@@ -18,7 +18,6 @@ - #include <linux/list.h> - #include <linux/timer.h> - #include <linux/init.h> --#include <linux/sysdev.h> - #include <linux/device.h> - #include <linux/io.h> - ---- a/arch/arm/plat-s3c24xx/s3c2410-clock.c -+++ b/arch/arm/plat-s3c24xx/s3c2410-clock.c -@@ -26,7 +26,7 @@ - #include <linux/list.h> - #include <linux/errno.h> - #include <linux/err.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/clk.h> - #include <linux/mutex.h> - #include <linux/delay.h> ---- a/arch/arm/plat-s3c24xx/s3c2412-iotiming.c -+++ b/arch/arm/plat-s3c24xx/s3c2412-iotiming.c -@@ -17,7 +17,7 @@ - #include <linux/ioport.h> - #include <linux/cpufreq.h> - #include <linux/seq_file.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/delay.h> - #include <linux/clk.h> - #include <linux/err.h> ---- a/arch/arm/plat-s5p/clock.c -+++ b/arch/arm/plat-s5p/clock.c -@@ -17,7 +17,7 @@ - #include <linux/errno.h> - #include <linux/err.h> - #include <linux/clk.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/io.h> - #include <asm/div64.h> - ---- a/arch/arm/plat-s5p/irq-eint.c -+++ b/arch/arm/plat-s5p/irq-eint.c -@@ -14,7 +14,7 @@ - #include <linux/interrupt.h> - #include <linux/irq.h> - #include <linux/io.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/gpio.h> - - #include <asm/hardware/vic.h> ---- a/arch/arm/plat-samsung/clock-clksrc.c -+++ b/arch/arm/plat-samsung/clock-clksrc.c -@@ -16,7 +16,7 @@ - #include <linux/errno.h> - #include <linux/err.h> - #include <linux/clk.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/io.h> - - #include <plat/clock.h> ---- a/arch/arm/plat-samsung/clock.c -+++ b/arch/arm/plat-samsung/clock.c -@@ -33,7 +33,7 @@ - #include <linux/errno.h> - #include <linux/err.h> - #include <linux/platform_device.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/interrupt.h> - #include <linux/ioport.h> - #include <linux/clk.h> ---- a/arch/arm/plat-samsung/pm-gpio.c -+++ b/arch/arm/plat-samsung/pm-gpio.c -@@ -14,7 +14,7 @@ - */ - - #include <linux/kernel.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/init.h> - #include <linux/io.h> - #include <linux/gpio.h> ---- a/arch/arm/plat-samsung/wakeup-mask.c -+++ b/arch/arm/plat-samsung/wakeup-mask.c -@@ -11,7 +11,7 @@ - - #include <linux/kernel.h> - #include <linux/spinlock.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/types.h> - #include <linux/irq.h> - #include <linux/io.h> ---- a/arch/avr32/boards/merisc/merisc_sysfs.c -+++ b/arch/avr32/boards/merisc/merisc_sysfs.c -@@ -13,7 +13,6 @@ - #include <linux/list.h> - #include <linux/spinlock.h> - #include <linux/device.h> --#include <linux/sysdev.h> - #include <linux/timer.h> - #include <linux/err.h> - #include <linux/ctype.h> ---- a/arch/avr32/kernel/irq.c -+++ b/arch/avr32/kernel/irq.c -@@ -14,7 +14,7 @@ - #include <linux/kernel_stat.h> - #include <linux/proc_fs.h> - #include <linux/seq_file.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - - /* May be overridden by platform code */ - int __weak nmi_enable(void) ---- a/arch/mips/txx9/generic/setup_tx4939.c -+++ b/arch/mips/txx9/generic/setup_tx4939.c -@@ -15,7 +15,7 @@ - #include <linux/delay.h> - #include <linux/netdevice.h> - #include <linux/notifier.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/ethtool.h> - #include <linux/param.h> - #include <linux/ptrace.h> ---- a/arch/powerpc/platforms/cell/smp.c -+++ b/arch/powerpc/platforms/cell/smp.c -@@ -23,7 +23,7 @@ - #include <linux/spinlock.h> - #include <linux/cache.h> - #include <linux/err.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/cpu.h> - - #include <asm/ptrace.h> ---- a/arch/powerpc/platforms/iseries/smp.c -+++ b/arch/powerpc/platforms/iseries/smp.c -@@ -24,7 +24,7 @@ - #include <linux/spinlock.h> - #include <linux/cache.h> - #include <linux/err.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/cpu.h> - - #include <asm/ptrace.h> ---- a/arch/powerpc/platforms/powermac/cpufreq_32.c -+++ b/arch/powerpc/platforms/powermac/cpufreq_32.c -@@ -23,7 +23,7 @@ - #include <linux/pmu.h> - #include <linux/cpufreq.h> - #include <linux/init.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/hardirq.h> - #include <asm/prom.h> - #include <asm/machdep.h> ---- a/arch/powerpc/platforms/pseries/smp.c -+++ b/arch/powerpc/platforms/pseries/smp.c -@@ -22,7 +22,7 @@ - #include <linux/spinlock.h> - #include <linux/cache.h> - #include <linux/err.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/cpu.h> - - #include <asm/ptrace.h> ---- a/arch/powerpc/sysdev/uic.c -+++ b/arch/powerpc/sysdev/uic.c -@@ -18,7 +18,6 @@ - #include <linux/stddef.h> - #include <linux/sched.h> - #include <linux/signal.h> --#include <linux/sysdev.h> - #include <linux/device.h> - #include <linux/bootmem.h> - #include <linux/spinlock.h> ---- a/arch/unicore32/kernel/puv3-core.c -+++ b/arch/unicore32/kernel/puv3-core.c -@@ -13,7 +13,6 @@ - - #include <linux/init.h> - #include <linux/device.h> --#include <linux/sysdev.h> - #include <linux/amba/bus.h> - #include <linux/platform_device.h> - #include <linux/io.h> ---- a/arch/unicore32/kernel/puv3-nb0916.c -+++ b/arch/unicore32/kernel/puv3-nb0916.c -@@ -13,7 +13,6 @@ - - #include <linux/init.h> - #include <linux/device.h> --#include <linux/sysdev.h> - #include <linux/platform_device.h> - #include <linux/mtd/physmap.h> - #include <linux/io.h> ---- a/arch/x86/kernel/hpet.c -+++ b/arch/x86/kernel/hpet.c -@@ -2,7 +2,6 @@ - #include <linux/clockchips.h> - #include <linux/interrupt.h> - #include <linux/export.h> --#include <linux/sysdev.h> - #include <linux/delay.h> - #include <linux/errno.h> - #include <linux/i8253.h> ---- a/arch/x86/kernel/irqinit.c -+++ b/arch/x86/kernel/irqinit.c -@@ -9,7 +9,7 @@ - #include <linux/kprobes.h> - #include <linux/init.h> - #include <linux/kernel_stat.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/bitops.h> - #include <linux/acpi.h> - #include <linux/io.h> ---- a/arch/x86/platform/uv/uv_sysfs.c -+++ b/arch/x86/platform/uv/uv_sysfs.c -@@ -19,7 +19,7 @@ - * Copyright (c) Russ Anderson - */ - --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <asm/uv/bios.h> - #include <asm/uv/uv.h> - ---- a/drivers/base/Makefile -+++ b/drivers/base/Makefile -@@ -1,6 +1,6 @@ - # Makefile for the Linux device tree - --obj-y := core.o sys.o bus.o dd.o syscore.o \ -+obj-y := core.o bus.o dd.o syscore.o \ - driver.o class.o platform.o \ - cpu.o firmware.o init.o map.o devres.o \ - attribute_container.o transport_class.o ---- a/drivers/base/sys.c -+++ /dev/null -@@ -1,383 +0,0 @@ --/* -- * sys.c - pseudo-bus for system 'devices' (cpus, PICs, timers, etc) -- * -- * Copyright (c) 2002-3 Patrick Mochel -- * 2002-3 Open Source Development Lab -- * -- * This file is released under the GPLv2 -- * -- * This exports a 'system' bus type. -- * By default, a 'sys' bus gets added to the root of the system. There will -- * always be core system devices. Devices can use sysdev_register() to -- * add themselves as children of the system bus. -- */ -- --#include <linux/sysdev.h> --#include <linux/err.h> --#include <linux/module.h> --#include <linux/kernel.h> --#include <linux/init.h> --#include <linux/string.h> --#include <linux/pm.h> --#include <linux/device.h> --#include <linux/mutex.h> --#include <linux/interrupt.h> -- --#include "base.h" -- --#define to_sysdev(k) container_of(k, struct sys_device, kobj) --#define to_sysdev_attr(a) container_of(a, struct sysdev_attribute, attr) -- -- --static ssize_t --sysdev_show(struct kobject *kobj, struct attribute *attr, char *buffer) --{ -- struct sys_device *sysdev = to_sysdev(kobj); -- struct sysdev_attribute *sysdev_attr = to_sysdev_attr(attr); -- -- if (sysdev_attr->show) -- return sysdev_attr->show(sysdev, sysdev_attr, buffer); -- return -EIO; --} -- -- --static ssize_t --sysdev_store(struct kobject *kobj, struct attribute *attr, -- const char *buffer, size_t count) --{ -- struct sys_device *sysdev = to_sysdev(kobj); -- struct sysdev_attribute *sysdev_attr = to_sysdev_attr(attr); -- -- if (sysdev_attr->store) -- return sysdev_attr->store(sysdev, sysdev_attr, buffer, count); -- return -EIO; --} -- --static const struct sysfs_ops sysfs_ops = { -- .show = sysdev_show, -- .store = sysdev_store, --}; -- --static struct kobj_type ktype_sysdev = { -- .sysfs_ops = &sysfs_ops, --}; -- -- --int sysdev_create_file(struct sys_device *s, struct sysdev_attribute *a) --{ -- return sysfs_create_file(&s->kobj, &a->attr); --} -- -- --void sysdev_remove_file(struct sys_device *s, struct sysdev_attribute *a) --{ -- sysfs_remove_file(&s->kobj, &a->attr); --} -- --EXPORT_SYMBOL_GPL(sysdev_create_file); --EXPORT_SYMBOL_GPL(sysdev_remove_file); -- --#define to_sysdev_class(k) container_of(k, struct sysdev_class, kset.kobj) --#define to_sysdev_class_attr(a) container_of(a, \ -- struct sysdev_class_attribute, attr) -- --static ssize_t sysdev_class_show(struct kobject *kobj, struct attribute *attr, -- char *buffer) --{ -- struct sysdev_class *class = to_sysdev_class(kobj); -- struct sysdev_class_attribute *class_attr = to_sysdev_class_attr(attr); -- -- if (class_attr->show) -- return class_attr->show(class, class_attr, buffer); -- return -EIO; --} -- --static ssize_t sysdev_class_store(struct kobject *kobj, struct attribute *attr, -- const char *buffer, size_t count) --{ -- struct sysdev_class *class = to_sysdev_class(kobj); -- struct sysdev_class_attribute *class_attr = to_sysdev_class_attr(attr); -- -- if (class_attr->store) -- return class_attr->store(class, class_attr, buffer, count); -- return -EIO; --} -- --static const struct sysfs_ops sysfs_class_ops = { -- .show = sysdev_class_show, -- .store = sysdev_class_store, --}; -- --static struct kobj_type ktype_sysdev_class = { -- .sysfs_ops = &sysfs_class_ops, --}; -- --int sysdev_class_create_file(struct sysdev_class *c, -- struct sysdev_class_attribute *a) --{ -- return sysfs_create_file(&c->kset.kobj, &a->attr); --} --EXPORT_SYMBOL_GPL(sysdev_class_create_file); -- --void sysdev_class_remove_file(struct sysdev_class *c, -- struct sysdev_class_attribute *a) --{ -- sysfs_remove_file(&c->kset.kobj, &a->attr); --} --EXPORT_SYMBOL_GPL(sysdev_class_remove_file); -- --extern struct kset *system_kset; -- --int sysdev_class_register(struct sysdev_class *cls) --{ -- int retval; -- -- pr_debug("Registering sysdev class '%s'\n", cls->name); -- -- INIT_LIST_HEAD(&cls->drivers); -- memset(&cls->kset.kobj, 0x00, sizeof(struct kobject)); -- cls->kset.kobj.parent = &system_kset->kobj; -- cls->kset.kobj.ktype = &ktype_sysdev_class; -- cls->kset.kobj.kset = system_kset; -- -- retval = kobject_set_name(&cls->kset.kobj, "%s", cls->name); -- if (retval) -- return retval; -- -- retval = kset_register(&cls->kset); -- if (!retval && cls->attrs) -- retval = sysfs_create_files(&cls->kset.kobj, -- (const struct attribute **)cls->attrs); -- return retval; --} -- --void sysdev_class_unregister(struct sysdev_class *cls) --{ -- pr_debug("Unregistering sysdev class '%s'\n", -- kobject_name(&cls->kset.kobj)); -- if (cls->attrs) -- sysfs_remove_files(&cls->kset.kobj, -- (const struct attribute **)cls->attrs); -- kset_unregister(&cls->kset); --} -- --EXPORT_SYMBOL_GPL(sysdev_class_register); --EXPORT_SYMBOL_GPL(sysdev_class_unregister); -- --static DEFINE_MUTEX(sysdev_drivers_lock); -- --/* -- * @dev != NULL means that we're unwinding because some drv->add() -- * failed for some reason. You need to grab sysdev_drivers_lock before -- * calling this. -- */ --static void __sysdev_driver_remove(struct sysdev_class *cls, -- struct sysdev_driver *drv, -- struct sys_device *from_dev) --{ -- struct sys_device *dev = from_dev; -- -- list_del_init(&drv->entry); -- if (!cls) -- return; -- -- if (!drv->remove) -- goto kset_put; -- -- if (dev) -- list_for_each_entry_continue_reverse(dev, &cls->kset.list, -- kobj.entry) -- drv->remove(dev); -- else -- list_for_each_entry(dev, &cls->kset.list, kobj.entry) -- drv->remove(dev); -- --kset_put: -- kset_put(&cls->kset); --} -- --/** -- * sysdev_driver_register - Register auxiliary driver -- * @cls: Device class driver belongs to. -- * @drv: Driver. -- * -- * @drv is inserted into @cls->drivers to be -- * called on each operation on devices of that class. The refcount -- * of @cls is incremented. -- */ --int sysdev_driver_register(struct sysdev_class *cls, struct sysdev_driver *drv) --{ -- struct sys_device *dev = NULL; -- int err = 0; -- -- if (!cls) { -- WARN(1, KERN_WARNING "sysdev: invalid class passed to %s!\n", -- __func__); -- return -EINVAL; -- } -- -- /* Check whether this driver has already been added to a class. */ -- if (drv->entry.next && !list_empty(&drv->entry)) -- WARN(1, KERN_WARNING "sysdev: class %s: driver (%p) has already" -- " been registered to a class, something is wrong, but " -- "will forge on!\n", cls->name, drv); -- -- mutex_lock(&sysdev_drivers_lock); -- if (cls && kset_get(&cls->kset)) { -- list_add_tail(&drv->entry, &cls->drivers); -- -- /* If devices of this class already exist, tell the driver */ -- if (drv->add) { -- list_for_each_entry(dev, &cls->kset.list, kobj.entry) { -- err = drv->add(dev); -- if (err) -- goto unwind; -- } -- } -- } else { -- err = -EINVAL; -- WARN(1, KERN_ERR "%s: invalid device class\n", __func__); -- } -- -- goto unlock; -- --unwind: -- __sysdev_driver_remove(cls, drv, dev); -- --unlock: -- mutex_unlock(&sysdev_drivers_lock); -- return err; --} -- --/** -- * sysdev_driver_unregister - Remove an auxiliary driver. -- * @cls: Class driver belongs to. -- * @drv: Driver. -- */ --void sysdev_driver_unregister(struct sysdev_class *cls, -- struct sysdev_driver *drv) --{ -- mutex_lock(&sysdev_drivers_lock); -- __sysdev_driver_remove(cls, drv, NULL); -- mutex_unlock(&sysdev_drivers_lock); --} --EXPORT_SYMBOL_GPL(sysdev_driver_register); --EXPORT_SYMBOL_GPL(sysdev_driver_unregister); -- --/** -- * sysdev_register - add a system device to the tree -- * @sysdev: device in question -- * -- */ --int sysdev_register(struct sys_device *sysdev) --{ -- int error; -- struct sysdev_class *cls = sysdev->cls; -- -- if (!cls) -- return -EINVAL; -- -- pr_debug("Registering sys device of class '%s'\n", -- kobject_name(&cls->kset.kobj)); -- -- /* initialize the kobject to 0, in case it had previously been used */ -- memset(&sysdev->kobj, 0x00, sizeof(struct kobject)); -- -- /* Make sure the kset is set */ -- sysdev->kobj.kset = &cls->kset; -- -- /* Register the object */ -- error = kobject_init_and_add(&sysdev->kobj, &ktype_sysdev, NULL, -- "%s%d", kobject_name(&cls->kset.kobj), -- sysdev->id); -- -- if (!error) { -- struct sysdev_driver *drv; -- -- pr_debug("Registering sys device '%s'\n", -- kobject_name(&sysdev->kobj)); -- -- mutex_lock(&sysdev_drivers_lock); -- /* Generic notification is implicit, because it's that -- * code that should have called us. -- */ -- -- /* Notify class auxiliary drivers */ -- list_for_each_entry(drv, &cls->drivers, entry) { -- if (drv->add) -- drv->add(sysdev); -- } -- mutex_unlock(&sysdev_drivers_lock); -- kobject_uevent(&sysdev->kobj, KOBJ_ADD); -- } -- -- return error; --} -- --void sysdev_unregister(struct sys_device *sysdev) --{ -- struct sysdev_driver *drv; -- -- mutex_lock(&sysdev_drivers_lock); -- list_for_each_entry(drv, &sysdev->cls->drivers, entry) { -- if (drv->remove) -- drv->remove(sysdev); -- } -- mutex_unlock(&sysdev_drivers_lock); -- -- kobject_put(&sysdev->kobj); --} -- --EXPORT_SYMBOL_GPL(sysdev_register); --EXPORT_SYMBOL_GPL(sysdev_unregister); -- --#define to_ext_attr(x) container_of(x, struct sysdev_ext_attribute, attr) -- --ssize_t sysdev_store_ulong(struct sys_device *sysdev, -- struct sysdev_attribute *attr, -- const char *buf, size_t size) --{ -- struct sysdev_ext_attribute *ea = to_ext_attr(attr); -- char *end; -- unsigned long new = simple_strtoul(buf, &end, 0); -- if (end == buf) -- return -EINVAL; -- *(unsigned long *)(ea->var) = new; -- /* Always return full write size even if we didn't consume all */ -- return size; --} --EXPORT_SYMBOL_GPL(sysdev_store_ulong); -- --ssize_t sysdev_show_ulong(struct sys_device *sysdev, -- struct sysdev_attribute *attr, -- char *buf) --{ -- struct sysdev_ext_attribute *ea = to_ext_attr(attr); -- return snprintf(buf, PAGE_SIZE, "%lx\n", *(unsigned long *)(ea->var)); --} --EXPORT_SYMBOL_GPL(sysdev_show_ulong); -- --ssize_t sysdev_store_int(struct sys_device *sysdev, -- struct sysdev_attribute *attr, -- const char *buf, size_t size) --{ -- struct sysdev_ext_attribute *ea = to_ext_attr(attr); -- char *end; -- long new = simple_strtol(buf, &end, 0); -- if (end == buf || new > INT_MAX || new < INT_MIN) -- return -EINVAL; -- *(int *)(ea->var) = new; -- /* Always return full write size even if we didn't consume all */ -- return size; --} --EXPORT_SYMBOL_GPL(sysdev_store_int); -- --ssize_t sysdev_show_int(struct sys_device *sysdev, -- struct sysdev_attribute *attr, -- char *buf) --{ -- struct sysdev_ext_attribute *ea = to_ext_attr(attr); -- return snprintf(buf, PAGE_SIZE, "%d\n", *(int *)(ea->var)); --} --EXPORT_SYMBOL_GPL(sysdev_show_int); -- ---- a/drivers/gpio/gpio-samsung.c -+++ b/drivers/gpio/gpio-samsung.c -@@ -22,7 +22,7 @@ - #include <linux/spinlock.h> - #include <linux/module.h> - #include <linux/interrupt.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/ioport.h> - - #include <asm/irq.h> ---- a/drivers/leds/led-class.c -+++ b/drivers/leds/led-class.c -@@ -15,7 +15,6 @@ - #include <linux/list.h> - #include <linux/spinlock.h> - #include <linux/device.h> --#include <linux/sysdev.h> - #include <linux/timer.h> - #include <linux/err.h> - #include <linux/ctype.h> ---- a/drivers/leds/led-triggers.c -+++ b/drivers/leds/led-triggers.c -@@ -17,7 +17,6 @@ - #include <linux/list.h> - #include <linux/spinlock.h> - #include <linux/device.h> --#include <linux/sysdev.h> - #include <linux/timer.h> - #include <linux/rwsem.h> - #include <linux/leds.h> ---- a/drivers/macintosh/smu.c -+++ b/drivers/macintosh/smu.c -@@ -32,7 +32,6 @@ - #include <linux/completion.h> - #include <linux/miscdevice.h> - #include <linux/delay.h> --#include <linux/sysdev.h> - #include <linux/poll.h> - #include <linux/mutex.h> - #include <linux/of_device.h> -@@ -681,9 +680,6 @@ static struct platform_driver smu_of_pla - static int __init smu_init_sysfs(void) - { - /* -- * Due to sysfs bogosity, a sysdev is not a real device, so -- * we should in fact create both if we want sysdev semantics -- * for power management. - * For now, we don't power manage machines with an SMU chip, - * I'm a bit too far from figuring out how that works with those - * new chipsets, but that will come back and bite us ---- a/drivers/net/bonding/bond_sysfs.c -+++ b/drivers/net/bonding/bond_sysfs.c -@@ -26,7 +26,6 @@ - #include <linux/module.h> - #include <linux/device.h> - #include <linux/sched.h> --#include <linux/sysdev.h> - #include <linux/fs.h> - #include <linux/types.h> - #include <linux/string.h> ---- a/drivers/platform/x86/intel_scu_ipc.c -+++ b/drivers/platform/x86/intel_scu_ipc.c -@@ -19,7 +19,7 @@ - #include <linux/delay.h> - #include <linux/errno.h> - #include <linux/init.h> --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/pm.h> - #include <linux/pci.h> - #include <linux/interrupt.h> ---- a/drivers/s390/block/xpram.c -+++ b/drivers/s390/block/xpram.c -@@ -36,7 +36,7 @@ - #include <linux/blkdev.h> - #include <linux/blkpg.h> - #include <linux/hdreg.h> /* HDIO_GETGEO */ --#include <linux/sysdev.h> -+#include <linux/device.h> - #include <linux/bio.h> - #include <linux/suspend.h> - #include <linux/platform_device.h> ---- a/include/linux/kobject.h -+++ b/include/linux/kobject.h -@@ -191,8 +191,6 @@ static inline struct kobj_type *get_ktyp - } - - extern struct kobject *kset_find_obj(struct kset *, const char *); --extern struct kobject *kset_find_obj_hinted(struct kset *, const char *, -- struct kobject *); - - /* The global /sys/kernel/ kobject for people to chain off of */ - extern struct kobject *kernel_kobj; ---- a/include/linux/sysdev.h -+++ /dev/null -@@ -1,164 +0,0 @@ --/** -- * System devices follow a slightly different driver model. -- * They don't need to do dynammic driver binding, can't be probed, -- * and don't reside on any type of peripheral bus. -- * So, we represent and treat them a little differently. -- * -- * We still have a notion of a driver for a system device, because we still -- * want to perform basic operations on these devices. -- * -- * We also support auxiliary drivers binding to devices of a certain class. -- * -- * This allows configurable drivers to register themselves for devices of -- * a certain type. And, it allows class definitions to reside in generic -- * code while arch-specific code can register specific drivers. -- * -- * Auxiliary drivers registered with a NULL cls are registered as drivers -- * for all system devices, and get notification calls for each device. -- */ -- -- --#ifndef _SYSDEV_H_ --#define _SYSDEV_H_ -- --#include <linux/kobject.h> --#include <linux/pm.h> -- -- --struct sys_device; --struct sysdev_class_attribute; -- --struct sysdev_class { -- const char *name; -- struct list_head drivers; -- struct sysdev_class_attribute **attrs; -- struct kset kset; --}; -- --struct sysdev_class_attribute { -- struct attribute attr; -- ssize_t (*show)(struct sysdev_class *, struct sysdev_class_attribute *, -- char *); -- ssize_t (*store)(struct sysdev_class *, struct sysdev_class_attribute *, -- const char *, size_t); --}; -- --#define _SYSDEV_CLASS_ATTR(_name,_mode,_show,_store) \ --{ \ -- .attr = {.name = __stringify(_name), .mode = _mode }, \ -- .show = _show, \ -- .store = _store, \ --} -- --#define SYSDEV_CLASS_ATTR(_name,_mode,_show,_store) \ -- struct sysdev_class_attribute attr_##_name = \ -- _SYSDEV_CLASS_ATTR(_name,_mode,_show,_store) -- -- --extern int sysdev_class_register(struct sysdev_class *); --extern void sysdev_class_unregister(struct sysdev_class *); -- --extern int sysdev_class_create_file(struct sysdev_class *, -- struct sysdev_class_attribute *); --extern void sysdev_class_remove_file(struct sysdev_class *, -- struct sysdev_class_attribute *); --/** -- * Auxiliary system device drivers. -- */ -- --struct sysdev_driver { -- struct list_head entry; -- int (*add)(struct sys_device *); -- int (*remove)(struct sys_device *); --}; -- -- --extern int sysdev_driver_register(struct sysdev_class *, struct sysdev_driver *); --extern void sysdev_driver_unregister(struct sysdev_class *, struct sysdev_driver *); -- -- --/** -- * sys_devices can be simplified a lot from regular devices, because they're -- * simply not as versatile. -- */ -- --struct sys_device { -- u32 id; -- struct sysdev_class * cls; -- struct kobject kobj; --}; -- --extern int sysdev_register(struct sys_device *); --extern void sysdev_unregister(struct sys_device *); -- -- --struct sysdev_attribute { -- struct attribute attr; -- ssize_t (*show)(struct sys_device *, struct sysdev_attribute *, char *); -- ssize_t (*store)(struct sys_device *, struct sysdev_attribute *, -- const char *, size_t); --}; -- -- --#define _SYSDEV_ATTR(_name, _mode, _show, _store) \ --{ \ -- .attr = { .name = __stringify(_name), .mode = _mode }, \ -- .show = _show, \ -- .store = _store, \ --} -- --#define SYSDEV_ATTR(_name, _mode, _show, _store) \ -- struct sysdev_attribute attr_##_name = \ -- _SYSDEV_ATTR(_name, _mode, _show, _store); -- --extern int sysdev_create_file(struct sys_device *, struct sysdev_attribute *); --extern void sysdev_remove_file(struct sys_device *, struct sysdev_attribute *); -- --/* Create/remove NULL terminated attribute list */ --static inline int --sysdev_create_files(struct sys_device *d, struct sysdev_attribute **a) --{ -- return sysfs_create_files(&d->kobj, (const struct attribute **)a); --} -- --static inline void --sysdev_remove_files(struct sys_device *d, struct sysdev_attribute **a) --{ -- return sysfs_remove_files(&d->kobj, (const struct attribute **)a); --} -- --struct sysdev_ext_attribute { -- struct sysdev_attribute attr; -- void *var; --}; -- --/* -- * Support for simple variable sysdev attributes. -- * The pointer to the variable is stored in a sysdev_ext_attribute -- */ -- --/* Add more types as needed */ -- --extern ssize_t sysdev_show_ulong(struct sys_device *, struct sysdev_attribute *, -- char *); --extern ssize_t sysdev_store_ulong(struct sys_device *, -- struct sysdev_attribute *, const char *, size_t); --extern ssize_t sysdev_show_int(struct sys_device *, struct sysdev_attribute *, -- char *); --extern ssize_t sysdev_store_int(struct sys_device *, -- struct sysdev_attribute *, const char *, size_t); -- --#define _SYSDEV_ULONG_ATTR(_name, _mode, _var) \ -- { _SYSDEV_ATTR(_name, _mode, sysdev_show_ulong, sysdev_store_ulong), \ -- &(_var) } --#define SYSDEV_ULONG_ATTR(_name, _mode, _var) \ -- struct sysdev_ext_attribute attr_##_name = \ -- _SYSDEV_ULONG_ATTR(_name, _mode, _var); --#define _SYSDEV_INT_ATTR(_name, _mode, _var) \ -- { _SYSDEV_ATTR(_name, _mode, sysdev_show_int, sysdev_store_int), \ -- &(_var) } --#define SYSDEV_INT_ATTR(_name, _mode, _var) \ -- struct sysdev_ext_attribute attr_##_name = \ -- _SYSDEV_INT_ATTR(_name, _mode, _var); -- --#endif /* _SYSDEV_H_ */ ---- a/kernel/time/clockevents.c -+++ b/kernel/time/clockevents.c -@@ -17,7 +17,6 @@ - #include <linux/module.h> - #include <linux/notifier.h> - #include <linux/smp.h> --#include <linux/sysdev.h> - - #include "tick-internal.h" - ---- a/lib/kobject.c -+++ b/lib/kobject.c -@@ -746,43 +746,11 @@ void kset_unregister(struct kset *k) - */ - struct kobject *kset_find_obj(struct kset *kset, const char *name) - { -- return kset_find_obj_hinted(kset, name, NULL); --} -- --/** -- * kset_find_obj_hinted - search for object in kset given a predecessor hint. -- * @kset: kset we're looking in. -- * @name: object's name. -- * @hint: hint to possible object's predecessor. -- * -- * Check the hint's next object and if it is a match return it directly, -- * otherwise, fall back to the behavior of kset_find_obj(). Either way -- * a reference for the returned object is held and the reference on the -- * hinted object is released. -- */ --struct kobject *kset_find_obj_hinted(struct kset *kset, const char *name, -- struct kobject *hint) --{ - struct kobject *k; - struct kobject *ret = NULL; - - spin_lock(&kset->list_lock); - -- if (!hint) -- goto slow_search; -- -- /* end of list detection */ -- if (hint->entry.next == kset->list.next) -- goto slow_search; -- -- k = container_of(hint->entry.next, struct kobject, entry); -- if (!kobject_name(k) || strcmp(kobject_name(k), name)) -- goto slow_search; -- -- ret = kobject_get(k); -- goto unlock_exit; -- --slow_search: - list_for_each_entry(k, &kset->list, entry) { - if (kobject_name(k) && !strcmp(kobject_name(k), name)) { - ret = kobject_get(k); -@@ -790,12 +758,7 @@ slow_search: - } - } - --unlock_exit: - spin_unlock(&kset->list_lock); -- -- if (hint) -- kobject_put(hint); -- - return ret; - } - diff --git a/modinfo.patch b/modinfo.patch new file mode 100644 index 0000000..0af33c3 --- /dev/null +++ b/modinfo.patch @@ -0,0 +1,143 @@ +From: Kay Sievers <kay.sievers@vrfy.org> +Subject: modules: sysfs - export taint, address, size + +Recent tools do not use /proc to retrieve module information. A few values +are currently missing from sysfs. + +Cc: Lucas De Marchi <lucas.demarchi@profusion.mobi> +Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> +--- + kernel/module.c | 89 +++++++++++++++++++++++++++++++++++++++----------------- + 1 file changed, 62 insertions(+), 27 deletions(-) + +--- a/kernel/module.c ++++ b/kernel/module.c +@@ -849,6 +849,26 @@ out: + return ret; + } + ++static size_t module_flags_taint(struct module *mod, char *buf) ++{ ++ size_t l = 0; ++ ++ if (mod->taints & (1 << TAINT_PROPRIETARY_MODULE)) ++ buf[l++] = 'P'; ++ else if (mod->taints & (1 << TAINT_OOT_MODULE)) ++ buf[l++] = 'O'; ++ if (mod->taints & (1 << TAINT_FORCED_MODULE)) ++ buf[l++] = 'F'; ++ if (mod->taints & (1 << TAINT_CRAP)) ++ buf[l++] = 'C'; ++ /* ++ * TAINT_FORCED_RMMOD: could be added. ++ * TAINT_UNSAFE_SMP, TAINT_MACHINE_CHECK, TAINT_BAD_PAGE don't ++ * apply to modules. ++ */ ++ return l; ++} ++ + static inline void print_unload_info(struct seq_file *m, struct module *mod) + { + struct module_use *use; +@@ -907,10 +927,8 @@ static ssize_t show_refcnt(struct module + return sprintf(buffer, "%u\n", module_refcount(mk->mod)); + } + +-static struct module_attribute refcnt = { +- .attr = { .name = "refcnt", .mode = 0444 }, +- .show = show_refcnt, +-}; ++static struct module_attribute refcnt = ++ __ATTR(refcnt, 0444, show_refcnt, NULL); + + void module_put(struct module *module) + { +@@ -970,10 +988,8 @@ static ssize_t show_initstate(struct mod + return sprintf(buffer, "%s\n", state); + } + +-static struct module_attribute initstate = { +- .attr = { .name = "initstate", .mode = 0444 }, +- .show = show_initstate, +-}; ++static struct module_attribute module_initstate = ++ __ATTR(initstate, 0444, show_initstate, NULL); + + static ssize_t store_uevent(struct module_attribute *mattr, + struct module_kobject *mk, +@@ -986,16 +1002,48 @@ static ssize_t store_uevent(struct modul + return count; + } + +-struct module_attribute module_uevent = { +- .attr = { .name = "uevent", .mode = 0200 }, +- .store = store_uevent, +-}; ++struct module_attribute module_uevent = ++ __ATTR(uevent, 0200, NULL, store_uevent); ++ ++static ssize_t show_address(struct module_attribute *mattr, ++ struct module_kobject *mk, char *buffer) ++{ ++ return sprintf(buffer, "0x%pK\n", mk->mod->module_core); ++} ++ ++struct module_attribute module_address = ++ __ATTR(address, 0444, show_address, NULL); ++ ++static ssize_t show_size(struct module_attribute *mattr, ++ struct module_kobject *mk, char *buffer) ++{ ++ return sprintf(buffer, "%u\n", mk->mod->init_size + mk->mod->core_size); ++} ++ ++struct module_attribute module_size = ++ __ATTR(size, 0444, show_size, NULL); ++ ++static ssize_t show_taint(struct module_attribute *mattr, ++ struct module_kobject *mk, char *buffer) ++{ ++ size_t l; ++ ++ l = module_flags_taint(mk->mod, buffer); ++ buffer[l++] = '\n'; ++ return l; ++} ++ ++struct module_attribute module_taint = ++ __ATTR(taint, 0444, show_taint, NULL); + + static struct module_attribute *modinfo_attrs[] = { + &modinfo_version, + &modinfo_srcversion, +- &initstate, ++ &module_initstate, + &module_uevent, ++ &module_address, ++ &module_size, ++ &module_taint, + #ifdef CONFIG_MODULE_UNLOAD + &refcnt, + #endif +@@ -3256,20 +3304,7 @@ static char *module_flags(struct module + mod->state == MODULE_STATE_GOING || + mod->state == MODULE_STATE_COMING) { + buf[bx++] = '('; +- if (mod->taints & (1 << TAINT_PROPRIETARY_MODULE)) +- buf[bx++] = 'P'; +- else if (mod->taints & (1 << TAINT_OOT_MODULE)) +- buf[bx++] = 'O'; +- if (mod->taints & (1 << TAINT_FORCED_MODULE)) +- buf[bx++] = 'F'; +- if (mod->taints & (1 << TAINT_CRAP)) +- buf[bx++] = 'C'; +- /* +- * TAINT_FORCED_RMMOD: could be added. +- * TAINT_UNSAFE_SMP, TAINT_MACHINE_CHECK, TAINT_BAD_PAGE don't +- * apply to modules. +- */ +- ++ bx += module_flags_taint(mod, buf + bx); + /* Show a - for module-is-being-unloaded */ + if (mod->state == MODULE_STATE_GOING) + buf[bx++] = '-'; diff --git a/prctl-child_reaper.patch b/prctl-child_reaper.patch index 52bd372..20ca356 100644 --- a/prctl-child_reaper.patch +++ b/prctl-child_reaper.patch @@ -81,7 +81,7 @@ Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> #endif /* _LINUX_PRCTL_H */ --- a/include/linux/sched.h +++ b/include/linux/sched.h -@@ -550,6 +550,18 @@ struct signal_struct { +@@ -552,6 +552,18 @@ struct signal_struct { int group_stop_count; unsigned int flags; /* see SIGNAL_* flags below */ @@ -102,7 +102,7 @@ Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> --- a/kernel/exit.c +++ b/kernel/exit.c -@@ -689,11 +689,12 @@ static void exit_mm(struct task_struct * +@@ -687,11 +687,12 @@ static void exit_mm(struct task_struct * } /* @@ -120,7 +120,7 @@ Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> */ static struct task_struct *find_new_reaper(struct task_struct *father) __releases(&tasklist_lock) -@@ -724,6 +725,23 @@ static struct task_struct *find_new_reap +@@ -722,6 +723,23 @@ static struct task_struct *find_new_reap * forget_original_parent() must move them somewhere. */ pid_ns->child_reaper = init_pid_ns.child_reaper; @@ -146,7 +146,7 @@ Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> return pid_ns->child_reaper; --- a/kernel/fork.c +++ b/kernel/fork.c -@@ -987,6 +987,9 @@ static int copy_signal(unsigned long clo +@@ -979,6 +979,9 @@ static int copy_signal(unsigned long clo sig->oom_score_adj = current->signal->oom_score_adj; sig->oom_score_adj_min = current->signal->oom_score_adj_min; @@ -158,7 +158,7 @@ Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> return 0; --- a/kernel/sys.c +++ b/kernel/sys.c -@@ -1799,6 +1799,14 @@ SYSCALL_DEFINE5(prctl, int, option, unsi +@@ -1841,6 +1841,14 @@ SYSCALL_DEFINE5(prctl, int, option, unsi else error = PR_MCE_KILL_DEFAULT; break; @@ -1,19 +1,2 @@ -01-core-support.patch -04-rtmutex.patch -05-clocksource.patch -06-ibm-rtl.patch -07-edac.patch -08-xen.patch -09-cpu.patch -10-memory.patch -11-s390-time.patch -12-power-cmm.patch -13-power-qe_ic.patch -14-power-suspend.patch -15-sh-intc.patch -16-sh-dma.patch -17-mips-txx9-7segled.patch -18-mips-txx9_sram.patch -19-m68k-gpio.patch -20-arm.patch -99-core-remove.patch +prctl-child_reaper.patch +modinfo.patch |