Commit fe5ff8b84c8b03348a2f64ea9d884348faec2217

Authored by Kay Sievers
Committed by Greg Kroah-Hartman
1 parent 997d3eaf02

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>

Showing 11 changed files with 53 additions and 59 deletions Side-by-side Diff

drivers/edac/edac_core.h
... ... @@ -32,7 +32,6 @@
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  
... ... @@ -243,8 +242,8 @@
243 242 */
244 243 struct edac_dev_sysfs_attribute *sysfs_attributes;
245 244  
246   - /* pointer to main 'edac' class in sysfs */
247   - struct sysdev_class *edac_class;
  245 + /* pointer to main 'edac' subsys in sysfs */
  246 + struct bus_type *edac_subsys;
248 247  
249 248 /* the internal state of this controller instance */
250 249 int op_state;
... ... @@ -342,7 +341,7 @@
342 341  
343 342 int pci_idx;
344 343  
345   - struct sysdev_class *edac_class; /* pointer to class */
  344 + struct bus_type *edac_subsys; /* pointer to subsystem */
346 345  
347 346 /* the internal state of this controller instance */
348 347 int op_state;
drivers/edac/edac_device.c
... ... @@ -23,7 +23,6 @@
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>
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 *
6 6  
7 7  
... ... @@ -230,21 +230,21 @@
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,7 +261,7 @@
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,7 +284,7 @@
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,7 +308,7 @@
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 */
drivers/edac/edac_mc.c
... ... @@ -25,7 +25,6 @@
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>
drivers/edac/edac_mc_sysfs.c
... ... @@ -1021,19 +1021,19 @@
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,7 +1045,7 @@
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,6 +1059,6 @@
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 }
drivers/edac/edac_module.h
... ... @@ -10,8 +10,6 @@
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 /*
drivers/edac/edac_pci.c
... ... @@ -19,7 +19,6 @@
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>
drivers/edac/edac_pci_sysfs.c
... ... @@ -338,12 +338,12 @@
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,9 +354,9 @@
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,7 +381,7 @@
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,7 +404,7 @@
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,7 +432,7 @@
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 /*
drivers/edac/edac_stub.c
... ... @@ -26,7 +26,7 @@
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
33 33  
34 34  
35 35  
36 36  
37 37  
38 38  
39 39  
40 40  
41 41  
42 42  
... ... @@ -54,37 +54,38 @@
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);
drivers/edac/mce_amd_inj.c
... ... @@ -11,7 +11,6 @@
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>
18 17  
19 18  
... ... @@ -116,14 +115,14 @@
116 115  
117 116 static int __init edac_init_mce_inject(void)
118 117 {
119   - struct sysdev_class *edac_class = NULL;
  118 + struct bus_type *edac_subsys = NULL;
120 119 int i, err = 0;
121 120  
122   - edac_class = edac_get_sysfs_class();
123   - if (!edac_class)
  121 + edac_subsys = edac_get_sysfs_subsys();
  122 + if (!edac_subsys)
124 123 return -EINVAL;
125 124  
126   - mce_kobj = kobject_create_and_add("mce", &edac_class->kset.kobj);
  125 + mce_kobj = kobject_create_and_add("mce", &edac_subsys->dev_root->kobj);
127 126 if (!mce_kobj) {
128 127 printk(KERN_ERR "Error creating a mce kset.\n");
129 128 err = -ENOMEM;
... ... @@ -147,7 +146,7 @@
147 146 kobject_del(mce_kobj);
148 147  
149 148 err_mce_kobj:
150   - edac_put_sysfs_class();
  149 + edac_put_sysfs_subsys();
151 150  
152 151 return err;
153 152 }
... ... @@ -161,7 +160,7 @@
161 160  
162 161 kobject_del(mce_kobj);
163 162  
164   - edac_put_sysfs_class();
  163 + edac_put_sysfs_subsys();
165 164 }
166 165  
167 166 module_init(edac_init_mce_inject);
include/linux/edac.h
... ... @@ -13,7 +13,7 @@
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
20 20  
... ... @@ -23,12 +23,12 @@
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 {