Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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.

Cc: Doug Thompson <dougthompson@xmission.com>
Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: Lucas De Marchi <lucas.demarchi@profusion.mobi>
Cc: Borislav Petkov <borislav.petkov@amd.com>
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by

Kay Sievers and committed by
Greg Kroah-Hartman
fe5ff8b8 997d3eaf

+53 -59
+3 -4
drivers/edac/edac_core.h
··· 32 32 #include <linux/completion.h> 33 33 #include <linux/kobject.h> 34 34 #include <linux/platform_device.h> 35 - #include <linux/sysdev.h> 36 35 #include <linux/workqueue.h> 37 36 #include <linux/edac.h> 38 37 ··· 242 243 */ 243 244 struct edac_dev_sysfs_attribute *sysfs_attributes; 244 245 245 - /* pointer to main 'edac' class in sysfs */ 246 - struct sysdev_class *edac_class; 246 + /* pointer to main 'edac' subsys in sysfs */ 247 + struct bus_type *edac_subsys; 247 248 248 249 /* the internal state of this controller instance */ 249 250 int op_state; ··· 341 342 342 343 int pci_idx; 343 344 344 - struct sysdev_class *edac_class; /* pointer to class */ 345 + struct bus_type *edac_subsys; /* pointer to subsystem */ 345 346 346 347 /* the internal state of this controller instance */ 347 348 int op_state;
-1
drivers/edac/edac_device.c
··· 23 23 #include <linux/jiffies.h> 24 24 #include <linux/spinlock.h> 25 25 #include <linux/list.h> 26 - #include <linux/sysdev.h> 27 26 #include <linux/ctype.h> 28 27 #include <linux/workqueue.h> 29 28 #include <asm/uaccess.h>
+10 -10
drivers/edac/edac_device_sysfs.c
··· 1 1 /* 2 - * file for managing the edac_device class of devices for EDAC 2 + * file for managing the edac_device subsystem of devices for EDAC 3 3 * 4 4 * (C) 2007 SoftwareBitMaker 5 5 * ··· 230 230 */ 231 231 int edac_device_register_sysfs_main_kobj(struct edac_device_ctl_info *edac_dev) 232 232 { 233 - struct sysdev_class *edac_class; 233 + struct bus_type *edac_subsys; 234 234 int err; 235 235 236 236 debugf1("%s()\n", __func__); 237 237 238 238 /* get the /sys/devices/system/edac reference */ 239 - edac_class = edac_get_sysfs_class(); 240 - if (edac_class == NULL) { 241 - debugf1("%s() no edac_class error\n", __func__); 239 + edac_subsys = edac_get_sysfs_subsys(); 240 + if (edac_subsys == NULL) { 241 + debugf1("%s() no edac_subsys error\n", __func__); 242 242 err = -ENODEV; 243 243 goto err_out; 244 244 } 245 245 246 - /* Point to the 'edac_class' this instance 'reports' to */ 247 - edac_dev->edac_class = edac_class; 246 + /* Point to the 'edac_subsys' this instance 'reports' to */ 247 + edac_dev->edac_subsys = edac_subsys; 248 248 249 249 /* Init the devices's kobject */ 250 250 memset(&edac_dev->kobj, 0, sizeof(struct kobject)); ··· 261 261 262 262 /* register */ 263 263 err = kobject_init_and_add(&edac_dev->kobj, &ktype_device_ctrl, 264 - &edac_class->kset.kobj, 264 + &edac_subsys->dev_root->kobj, 265 265 "%s", edac_dev->name); 266 266 if (err) { 267 267 debugf1("%s()Failed to register '.../edac/%s'\n", ··· 284 284 module_put(edac_dev->owner); 285 285 286 286 err_mod_get: 287 - edac_put_sysfs_class(); 287 + edac_put_sysfs_subsys(); 288 288 289 289 err_out: 290 290 return err; ··· 308 308 * b) 'kfree' the memory 309 309 */ 310 310 kobject_put(&dev->kobj); 311 - edac_put_sysfs_class(); 311 + edac_put_sysfs_subsys(); 312 312 } 313 313 314 314 /* edac_dev -> instance information */
-1
drivers/edac/edac_mc.c
··· 25 25 #include <linux/jiffies.h> 26 26 #include <linux/spinlock.h> 27 27 #include <linux/list.h> 28 - #include <linux/sysdev.h> 29 28 #include <linux/ctype.h> 30 29 #include <linux/edac.h> 31 30 #include <asm/uaccess.h>
+8 -8
drivers/edac/edac_mc_sysfs.c
··· 1021 1021 int edac_sysfs_setup_mc_kset(void) 1022 1022 { 1023 1023 int err = -EINVAL; 1024 - struct sysdev_class *edac_class; 1024 + struct bus_type *edac_subsys; 1025 1025 1026 1026 debugf1("%s()\n", __func__); 1027 1027 1028 - /* get the /sys/devices/system/edac class reference */ 1029 - edac_class = edac_get_sysfs_class(); 1030 - if (edac_class == NULL) { 1031 - debugf1("%s() no edac_class error=%d\n", __func__, err); 1028 + /* get the /sys/devices/system/edac subsys reference */ 1029 + edac_subsys = edac_get_sysfs_subsys(); 1030 + if (edac_subsys == NULL) { 1031 + debugf1("%s() no edac_subsys error=%d\n", __func__, err); 1032 1032 goto fail_out; 1033 1033 } 1034 1034 1035 1035 /* Init the MC's kobject */ 1036 - mc_kset = kset_create_and_add("mc", NULL, &edac_class->kset.kobj); 1036 + mc_kset = kset_create_and_add("mc", NULL, &edac_subsys->dev_root->kobj); 1037 1037 if (!mc_kset) { 1038 1038 err = -ENOMEM; 1039 1039 debugf1("%s() Failed to register '.../edac/mc'\n", __func__); ··· 1045 1045 return 0; 1046 1046 1047 1047 fail_kset: 1048 - edac_put_sysfs_class(); 1048 + edac_put_sysfs_subsys(); 1049 1049 1050 1050 fail_out: 1051 1051 return err; ··· 1059 1059 void edac_sysfs_teardown_mc_kset(void) 1060 1060 { 1061 1061 kset_unregister(mc_kset); 1062 - edac_put_sysfs_class(); 1062 + edac_put_sysfs_subsys(); 1063 1063 } 1064 1064
-2
drivers/edac/edac_module.h
··· 10 10 #ifndef __EDAC_MODULE_H__ 11 11 #define __EDAC_MODULE_H__ 12 12 13 - #include <linux/sysdev.h> 14 - 15 13 #include "edac_core.h" 16 14 17 15 /*
-1
drivers/edac/edac_pci.c
··· 19 19 #include <linux/slab.h> 20 20 #include <linux/spinlock.h> 21 21 #include <linux/list.h> 22 - #include <linux/sysdev.h> 23 22 #include <linux/ctype.h> 24 23 #include <linux/workqueue.h> 25 24 #include <asm/uaccess.h>
+8 -8
drivers/edac/edac_pci_sysfs.c
··· 338 338 * edac_pci_main_kobj_setup() 339 339 * 340 340 * setup the sysfs for EDAC PCI attributes 341 - * assumes edac_class has already been initialized 341 + * assumes edac_subsys has already been initialized 342 342 */ 343 343 static int edac_pci_main_kobj_setup(void) 344 344 { 345 345 int err; 346 - struct sysdev_class *edac_class; 346 + struct bus_type *edac_subsys; 347 347 348 348 debugf0("%s()\n", __func__); 349 349 ··· 354 354 /* First time, so create the main kobject and its 355 355 * controls and attributes 356 356 */ 357 - edac_class = edac_get_sysfs_class(); 358 - if (edac_class == NULL) { 359 - debugf1("%s() no edac_class\n", __func__); 357 + edac_subsys = edac_get_sysfs_subsys(); 358 + if (edac_subsys == NULL) { 359 + debugf1("%s() no edac_subsys\n", __func__); 360 360 err = -ENODEV; 361 361 goto decrement_count_fail; 362 362 } ··· 381 381 /* Instanstiate the pci object */ 382 382 err = kobject_init_and_add(edac_pci_top_main_kobj, 383 383 &ktype_edac_pci_main_kobj, 384 - &edac_class->kset.kobj, "pci"); 384 + &edac_subsys->dev_root->kobj, "pci"); 385 385 if (err) { 386 386 debugf1("Failed to register '.../edac/pci'\n"); 387 387 goto kobject_init_and_add_fail; ··· 404 404 module_put(THIS_MODULE); 405 405 406 406 mod_get_fail: 407 - edac_put_sysfs_class(); 407 + edac_put_sysfs_subsys(); 408 408 409 409 decrement_count_fail: 410 410 /* if are on this error exit, nothing to tear down */ ··· 432 432 __func__); 433 433 kobject_put(edac_pci_top_main_kobj); 434 434 } 435 - edac_put_sysfs_class(); 435 + edac_put_sysfs_subsys(); 436 436 } 437 437 438 438 /*
+14 -13
drivers/edac/edac_stub.c
··· 26 26 int edac_err_assert = 0; 27 27 EXPORT_SYMBOL_GPL(edac_err_assert); 28 28 29 - static atomic_t edac_class_valid = ATOMIC_INIT(0); 29 + static atomic_t edac_subsys_valid = ATOMIC_INIT(0); 30 30 31 31 /* 32 32 * called to determine if there is an EDAC driver interested in ··· 54 54 * sysfs object: /sys/devices/system/edac 55 55 * need to export to other files 56 56 */ 57 - struct sysdev_class edac_class = { 57 + struct bus_type edac_subsys = { 58 58 .name = "edac", 59 + .dev_name = "edac", 59 60 }; 60 - EXPORT_SYMBOL_GPL(edac_class); 61 + EXPORT_SYMBOL_GPL(edac_subsys); 61 62 62 63 /* return pointer to the 'edac' node in sysfs */ 63 - struct sysdev_class *edac_get_sysfs_class(void) 64 + struct bus_type *edac_get_sysfs_subsys(void) 64 65 { 65 66 int err = 0; 66 67 67 - if (atomic_read(&edac_class_valid)) 68 + if (atomic_read(&edac_subsys_valid)) 68 69 goto out; 69 70 70 71 /* create the /sys/devices/system/edac directory */ 71 - err = sysdev_class_register(&edac_class); 72 + err = subsys_system_register(&edac_subsys, NULL); 72 73 if (err) { 73 74 printk(KERN_ERR "Error registering toplevel EDAC sysfs dir\n"); 74 75 return NULL; 75 76 } 76 77 77 78 out: 78 - atomic_inc(&edac_class_valid); 79 - return &edac_class; 79 + atomic_inc(&edac_subsys_valid); 80 + return &edac_subsys; 80 81 } 81 - EXPORT_SYMBOL_GPL(edac_get_sysfs_class); 82 + EXPORT_SYMBOL_GPL(edac_get_sysfs_subsys); 82 83 83 - void edac_put_sysfs_class(void) 84 + void edac_put_sysfs_subsys(void) 84 85 { 85 86 /* last user unregisters it */ 86 - if (atomic_dec_and_test(&edac_class_valid)) 87 - sysdev_class_unregister(&edac_class); 87 + if (atomic_dec_and_test(&edac_subsys_valid)) 88 + bus_unregister(&edac_subsys); 88 89 } 89 - EXPORT_SYMBOL_GPL(edac_put_sysfs_class); 90 + EXPORT_SYMBOL_GPL(edac_put_sysfs_subsys);
+6 -7
drivers/edac/mce_amd_inj.c
··· 11 11 */ 12 12 13 13 #include <linux/kobject.h> 14 - #include <linux/sysdev.h> 15 14 #include <linux/edac.h> 16 15 #include <linux/module.h> 17 16 #include <asm/mce.h> ··· 115 116 116 117 static int __init edac_init_mce_inject(void) 117 118 { 118 - struct sysdev_class *edac_class = NULL; 119 + struct bus_type *edac_subsys = NULL; 119 120 int i, err = 0; 120 121 121 - edac_class = edac_get_sysfs_class(); 122 - if (!edac_class) 122 + edac_subsys = edac_get_sysfs_subsys(); 123 + if (!edac_subsys) 123 124 return -EINVAL; 124 125 125 - mce_kobj = kobject_create_and_add("mce", &edac_class->kset.kobj); 126 + mce_kobj = kobject_create_and_add("mce", &edac_subsys->dev_root->kobj); 126 127 if (!mce_kobj) { 127 128 printk(KERN_ERR "Error creating a mce kset.\n"); 128 129 err = -ENOMEM; ··· 146 147 kobject_del(mce_kobj); 147 148 148 149 err_mce_kobj: 149 - edac_put_sysfs_class(); 150 + edac_put_sysfs_subsys(); 150 151 151 152 return err; 152 153 } ··· 160 161 161 162 kobject_del(mce_kobj); 162 163 163 - edac_put_sysfs_class(); 164 + edac_put_sysfs_subsys(); 164 165 } 165 166 166 167 module_init(edac_init_mce_inject);
+4 -4
include/linux/edac.h
··· 13 13 #define _LINUX_EDAC_H_ 14 14 15 15 #include <linux/atomic.h> 16 - #include <linux/sysdev.h> 16 + #include <linux/device.h> 17 17 18 18 #define EDAC_OPSTATE_INVAL -1 19 19 #define EDAC_OPSTATE_POLL 0 ··· 23 23 extern int edac_op_state; 24 24 extern int edac_err_assert; 25 25 extern atomic_t edac_handlers; 26 - extern struct sysdev_class edac_class; 26 + extern struct bus_type edac_subsys; 27 27 28 28 extern int edac_handler_set(void); 29 29 extern void edac_atomic_assert_error(void); 30 - extern struct sysdev_class *edac_get_sysfs_class(void); 31 - extern void edac_put_sysfs_class(void); 30 + extern struct bus_type *edac_get_sysfs_subsys(void); 31 + extern void edac_put_sysfs_subsys(void); 32 32 33 33 static inline void opstate_init(void) 34 34 {