aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2011-12-14 18:21:07 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2011-12-14 18:21:07 -0500
commitfe5ff8b84c8b03348a2f64ea9d884348faec2217 (patch)
tree8ad7290974ee129eee717a80846d25ea202fa21b
parent997d3eaf02cad6fdb54bd6085c9a7c48ddd68a2d (diff)
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>
-rw-r--r--drivers/edac/edac_core.h7
-rw-r--r--drivers/edac/edac_device.c1
-rw-r--r--drivers/edac/edac_device_sysfs.c20
-rw-r--r--drivers/edac/edac_mc.c1
-rw-r--r--drivers/edac/edac_mc_sysfs.c16
-rw-r--r--drivers/edac/edac_module.h2
-rw-r--r--drivers/edac/edac_pci.c1
-rw-r--r--drivers/edac/edac_pci_sysfs.c16
-rw-r--r--drivers/edac/edac_stub.c27
-rw-r--r--drivers/edac/mce_amd_inj.c13
-rw-r--r--include/linux/edac.h8
11 files changed, 53 insertions, 59 deletions
diff --git a/drivers/edac/edac_core.h b/drivers/edac/edac_core.h
index fe90cd4a7ebc..e48ab3108ad8 100644
--- a/drivers/edac/edac_core.h
+++ b/drivers/edac/edac_core.h
@@ -32,7 +32,6 @@
32#include <linux/completion.h> 32#include <linux/completion.h>
33#include <linux/kobject.h> 33#include <linux/kobject.h>
34#include <linux/platform_device.h> 34#include <linux/platform_device.h>
35#include <linux/sysdev.h>
36#include <linux/workqueue.h> 35#include <linux/workqueue.h>
37#include <linux/edac.h> 36#include <linux/edac.h>
38 37
@@ -243,8 +242,8 @@ struct edac_device_ctl_info {
243 */ 242 */
244 struct edac_dev_sysfs_attribute *sysfs_attributes; 243 struct edac_dev_sysfs_attribute *sysfs_attributes;
245 244
246 /* pointer to main 'edac' class in sysfs */ 245 /* pointer to main 'edac' subsys in sysfs */
247 struct sysdev_class *edac_class; 246 struct bus_type *edac_subsys;
248 247
249 /* the internal state of this controller instance */ 248 /* the internal state of this controller instance */
250 int op_state; 249 int op_state;
@@ -342,7 +341,7 @@ struct edac_pci_ctl_info {
342 341
343 int pci_idx; 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 /* the internal state of this controller instance */ 346 /* the internal state of this controller instance */
348 int op_state; 347 int op_state;
diff --git a/drivers/edac/edac_device.c b/drivers/edac/edac_device.c
index c3f67437afb6..4b154593343a 100644
--- a/drivers/edac/edac_device.c
+++ b/drivers/edac/edac_device.c
@@ -23,7 +23,6 @@
23#include <linux/jiffies.h> 23#include <linux/jiffies.h>
24#include <linux/spinlock.h> 24#include <linux/spinlock.h>
25#include <linux/list.h> 25#include <linux/list.h>
26#include <linux/sysdev.h>
27#include <linux/ctype.h> 26#include <linux/ctype.h>
28#include <linux/workqueue.h> 27#include <linux/workqueue.h>
29#include <asm/uaccess.h> 28#include <asm/uaccess.h>
diff --git a/drivers/edac/edac_device_sysfs.c b/drivers/edac/edac_device_sysfs.c
index 86649df00285..b4ea185ccebf 100644
--- a/drivers/edac/edac_device_sysfs.c
+++ b/drivers/edac/edac_device_sysfs.c
@@ -1,5 +1,5 @@
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 * (C) 2007 SoftwareBitMaker 4 * (C) 2007 SoftwareBitMaker
5 * 5 *
@@ -230,21 +230,21 @@ static struct kobj_type ktype_device_ctrl = {
230 */ 230 */
231int edac_device_register_sysfs_main_kobj(struct edac_device_ctl_info *edac_dev) 231int 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 int err; 234 int err;
235 235
236 debugf1("%s()\n", __func__); 236 debugf1("%s()\n", __func__);
237 237
238 /* get the /sys/devices/system/edac reference */ 238 /* get the /sys/devices/system/edac reference */
239 edac_class = edac_get_sysfs_class(); 239 edac_subsys = edac_get_sysfs_subsys();
240 if (edac_class == NULL) { 240 if (edac_subsys == NULL) {
241 debugf1("%s() no edac_class error\n", __func__); 241 debugf1("%s() no edac_subsys error\n", __func__);
242 err = -ENODEV; 242 err = -ENODEV;
243 goto err_out; 243 goto err_out;
244 } 244 }
245 245
246 /* Point to the 'edac_class' this instance 'reports' to */ 246 /* Point to the 'edac_subsys' this instance 'reports' to */
247 edac_dev->edac_class = edac_class; 247 edac_dev->edac_subsys = edac_subsys;
248 248
249 /* Init the devices's kobject */ 249 /* Init the devices's kobject */
250 memset(&edac_dev->kobj, 0, sizeof(struct kobject)); 250 memset(&edac_dev->kobj, 0, sizeof(struct kobject));
@@ -261,7 +261,7 @@ int edac_device_register_sysfs_main_kobj(struct edac_device_ctl_info *edac_dev)
261 261
262 /* register */ 262 /* register */
263 err = kobject_init_and_add(&edac_dev->kobj, &ktype_device_ctrl, 263 err = kobject_init_and_add(&edac_dev->kobj, &ktype_device_ctrl,
264 &edac_class->kset.kobj, 264 &edac_subsys->dev_root->kobj,
265 "%s", edac_dev->name); 265 "%s", edac_dev->name);
266 if (err) { 266 if (err) {
267 debugf1("%s()Failed to register '.../edac/%s'\n", 267 debugf1("%s()Failed to register '.../edac/%s'\n",
@@ -284,7 +284,7 @@ err_kobj_reg:
284 module_put(edac_dev->owner); 284 module_put(edac_dev->owner);
285 285
286err_mod_get: 286err_mod_get:
287 edac_put_sysfs_class(); 287 edac_put_sysfs_subsys();
288 288
289err_out: 289err_out:
290 return err; 290 return err;
@@ -308,7 +308,7 @@ void edac_device_unregister_sysfs_main_kobj(struct edac_device_ctl_info *dev)
308 * b) 'kfree' the memory 308 * b) 'kfree' the memory
309 */ 309 */
310 kobject_put(&dev->kobj); 310 kobject_put(&dev->kobj);
311 edac_put_sysfs_class(); 311 edac_put_sysfs_subsys();
312} 312}
313 313
314/* edac_dev -> instance information */ 314/* edac_dev -> instance information */
diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c
index d69144a09043..ca6c04d350ee 100644
--- a/drivers/edac/edac_mc.c
+++ b/drivers/edac/edac_mc.c
@@ -25,7 +25,6 @@
25#include <linux/jiffies.h> 25#include <linux/jiffies.h>
26#include <linux/spinlock.h> 26#include <linux/spinlock.h>
27#include <linux/list.h> 27#include <linux/list.h>
28#include <linux/sysdev.h>
29#include <linux/ctype.h> 28#include <linux/ctype.h>
30#include <linux/edac.h> 29#include <linux/edac.h>
31#include <asm/uaccess.h> 30#include <asm/uaccess.h>
diff --git a/drivers/edac/edac_mc_sysfs.c b/drivers/edac/edac_mc_sysfs.c
index 29ffa350bfbe..d56e63477d5c 100644
--- 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 mem_ctl_info *mci)
1021int edac_sysfs_setup_mc_kset(void) 1021int edac_sysfs_setup_mc_kset(void)
1022{ 1022{
1023 int err = -EINVAL; 1023 int err = -EINVAL;
1024 struct sysdev_class *edac_class; 1024 struct bus_type *edac_subsys;
1025 1025
1026 debugf1("%s()\n", __func__); 1026 debugf1("%s()\n", __func__);
1027 1027
1028 /* get the /sys/devices/system/edac class reference */ 1028 /* get the /sys/devices/system/edac subsys reference */
1029 edac_class = edac_get_sysfs_class(); 1029 edac_subsys = edac_get_sysfs_subsys();
1030 if (edac_class == NULL) { 1030 if (edac_subsys == NULL) {
1031 debugf1("%s() no edac_class error=%d\n", __func__, err); 1031 debugf1("%s() no edac_subsys error=%d\n", __func__, err);
1032 goto fail_out; 1032 goto fail_out;
1033 } 1033 }
1034 1034
1035 /* Init the MC's kobject */ 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 if (!mc_kset) { 1037 if (!mc_kset) {
1038 err = -ENOMEM; 1038 err = -ENOMEM;
1039 debugf1("%s() Failed to register '.../edac/mc'\n", __func__); 1039 debugf1("%s() Failed to register '.../edac/mc'\n", __func__);
@@ -1045,7 +1045,7 @@ int edac_sysfs_setup_mc_kset(void)
1045 return 0; 1045 return 0;
1046 1046
1047fail_kset: 1047fail_kset:
1048 edac_put_sysfs_class(); 1048 edac_put_sysfs_subsys();
1049 1049
1050fail_out: 1050fail_out:
1051 return err; 1051 return err;
@@ -1059,6 +1059,6 @@ fail_out:
1059void edac_sysfs_teardown_mc_kset(void) 1059void edac_sysfs_teardown_mc_kset(void)
1060{ 1060{
1061 kset_unregister(mc_kset); 1061 kset_unregister(mc_kset);
1062 edac_put_sysfs_class(); 1062 edac_put_sysfs_subsys();
1063} 1063}
1064 1064
diff --git a/drivers/edac/edac_module.h b/drivers/edac/edac_module.h
index 17aabb7b90ec..00f81b47a51f 100644
--- a/drivers/edac/edac_module.h
+++ b/drivers/edac/edac_module.h
@@ -10,8 +10,6 @@
10#ifndef __EDAC_MODULE_H__ 10#ifndef __EDAC_MODULE_H__
11#define __EDAC_MODULE_H__ 11#define __EDAC_MODULE_H__
12 12
13#include <linux/sysdev.h>
14
15#include "edac_core.h" 13#include "edac_core.h"
16 14
17/* 15/*
diff --git a/drivers/edac/edac_pci.c b/drivers/edac/edac_pci.c
index 2b378207d571..63af1c5673d1 100644
--- a/drivers/edac/edac_pci.c
+++ b/drivers/edac/edac_pci.c
@@ -19,7 +19,6 @@
19#include <linux/slab.h> 19#include <linux/slab.h>
20#include <linux/spinlock.h> 20#include <linux/spinlock.h>
21#include <linux/list.h> 21#include <linux/list.h>
22#include <linux/sysdev.h>
23#include <linux/ctype.h> 22#include <linux/ctype.h>
24#include <linux/workqueue.h> 23#include <linux/workqueue.h>
25#include <asm/uaccess.h> 24#include <asm/uaccess.h>
diff --git a/drivers/edac/edac_pci_sysfs.c b/drivers/edac/edac_pci_sysfs.c
index 495198ad059c..97f5064e3992 100644
--- 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_main_kobj = {
338 * edac_pci_main_kobj_setup() 338 * edac_pci_main_kobj_setup()
339 * 339 *
340 * setup the sysfs for EDAC PCI attributes 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 */
343static int edac_pci_main_kobj_setup(void) 343static int edac_pci_main_kobj_setup(void)
344{ 344{
345 int err; 345 int err;
346 struct sysdev_class *edac_class; 346 struct bus_type *edac_subsys;
347 347
348 debugf0("%s()\n", __func__); 348 debugf0("%s()\n", __func__);
349 349
@@ -354,9 +354,9 @@ static int edac_pci_main_kobj_setup(void)
354 /* First time, so create the main kobject and its 354 /* First time, so create the main kobject and its
355 * controls and attributes 355 * controls and attributes
356 */ 356 */
357 edac_class = edac_get_sysfs_class(); 357 edac_subsys = edac_get_sysfs_subsys();
358 if (edac_class == NULL) { 358 if (edac_subsys == NULL) {
359 debugf1("%s() no edac_class\n", __func__); 359 debugf1("%s() no edac_subsys\n", __func__);
360 err = -ENODEV; 360 err = -ENODEV;
361 goto decrement_count_fail; 361 goto decrement_count_fail;
362 } 362 }
@@ -381,7 +381,7 @@ static int edac_pci_main_kobj_setup(void)
381 /* Instanstiate the pci object */ 381 /* Instanstiate the pci object */
382 err = kobject_init_and_add(edac_pci_top_main_kobj, 382 err = kobject_init_and_add(edac_pci_top_main_kobj,
383 &ktype_edac_pci_main_kobj, 383 &ktype_edac_pci_main_kobj,
384 &edac_class->kset.kobj, "pci"); 384 &edac_subsys->dev_root->kobj, "pci");
385 if (err) { 385 if (err) {
386 debugf1("Failed to register '.../edac/pci'\n"); 386 debugf1("Failed to register '.../edac/pci'\n");
387 goto kobject_init_and_add_fail; 387 goto kobject_init_and_add_fail;
@@ -404,7 +404,7 @@ kzalloc_fail:
404 module_put(THIS_MODULE); 404 module_put(THIS_MODULE);
405 405
406mod_get_fail: 406mod_get_fail:
407 edac_put_sysfs_class(); 407 edac_put_sysfs_subsys();
408 408
409decrement_count_fail: 409decrement_count_fail:
410 /* if are on this error exit, nothing to tear down */ 410 /* if are on this error exit, nothing to tear down */
@@ -432,7 +432,7 @@ static void edac_pci_main_kobj_teardown(void)
432 __func__); 432 __func__);
433 kobject_put(edac_pci_top_main_kobj); 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/*
diff --git a/drivers/edac/edac_stub.c b/drivers/edac/edac_stub.c
index 86ad2eee1201..670c4481453b 100644
--- a/drivers/edac/edac_stub.c
+++ b/drivers/edac/edac_stub.c
@@ -26,7 +26,7 @@ EXPORT_SYMBOL_GPL(edac_handlers);
26int edac_err_assert = 0; 26int edac_err_assert = 0;
27EXPORT_SYMBOL_GPL(edac_err_assert); 27EXPORT_SYMBOL_GPL(edac_err_assert);
28 28
29static atomic_t edac_class_valid = ATOMIC_INIT(0); 29static atomic_t edac_subsys_valid = ATOMIC_INIT(0);
30 30
31/* 31/*
32 * called to determine if there is an EDAC driver interested in 32 * called to determine if there is an EDAC driver interested in
@@ -54,36 +54,37 @@ EXPORT_SYMBOL_GPL(edac_atomic_assert_error);
54 * sysfs object: /sys/devices/system/edac 54 * sysfs object: /sys/devices/system/edac
55 * need to export to other files 55 * need to export to other files
56 */ 56 */
57struct sysdev_class edac_class = { 57struct bus_type edac_subsys = {
58 .name = "edac", 58 .name = "edac",
59 .dev_name = "edac",
59}; 60};
60EXPORT_SYMBOL_GPL(edac_class); 61EXPORT_SYMBOL_GPL(edac_subsys);
61 62
62/* return pointer to the 'edac' node in sysfs */ 63/* return pointer to the 'edac' node in sysfs */
63struct sysdev_class *edac_get_sysfs_class(void) 64struct bus_type *edac_get_sysfs_subsys(void)
64{ 65{
65 int err = 0; 66 int err = 0;
66 67
67 if (atomic_read(&edac_class_valid)) 68 if (atomic_read(&edac_subsys_valid))
68 goto out; 69 goto out;
69 70
70 /* create the /sys/devices/system/edac directory */ 71 /* create the /sys/devices/system/edac directory */
71 err = sysdev_class_register(&edac_class); 72 err = subsys_system_register(&edac_subsys, NULL);
72 if (err) { 73 if (err) {
73 printk(KERN_ERR "Error registering toplevel EDAC sysfs dir\n"); 74 printk(KERN_ERR "Error registering toplevel EDAC sysfs dir\n");
74 return NULL; 75 return NULL;
75 } 76 }
76 77
77out: 78out:
78 atomic_inc(&edac_class_valid); 79 atomic_inc(&edac_subsys_valid);
79 return &edac_class; 80 return &edac_subsys;
80} 81}
81EXPORT_SYMBOL_GPL(edac_get_sysfs_class); 82EXPORT_SYMBOL_GPL(edac_get_sysfs_subsys);
82 83
83void edac_put_sysfs_class(void) 84void edac_put_sysfs_subsys(void)
84{ 85{
85 /* last user unregisters it */ 86 /* last user unregisters it */
86 if (atomic_dec_and_test(&edac_class_valid)) 87 if (atomic_dec_and_test(&edac_subsys_valid))
87 sysdev_class_unregister(&edac_class); 88 bus_unregister(&edac_subsys);
88} 89}
89EXPORT_SYMBOL_GPL(edac_put_sysfs_class); 90EXPORT_SYMBOL_GPL(edac_put_sysfs_subsys);
diff --git a/drivers/edac/mce_amd_inj.c b/drivers/edac/mce_amd_inj.c
index 73c3e26a0bce..885e8ad8fdcf 100644
--- a/drivers/edac/mce_amd_inj.c
+++ b/drivers/edac/mce_amd_inj.c
@@ -11,7 +11,6 @@
11 */ 11 */
12 12
13#include <linux/kobject.h> 13#include <linux/kobject.h>
14#include <linux/sysdev.h>
15#include <linux/edac.h> 14#include <linux/edac.h>
16#include <linux/module.h> 15#include <linux/module.h>
17#include <asm/mce.h> 16#include <asm/mce.h>
@@ -116,14 +115,14 @@ static struct edac_mce_attr *sysfs_attrs[] = { &mce_attr_status, &mce_attr_misc,
116 115
117static int __init edac_init_mce_inject(void) 116static int __init edac_init_mce_inject(void)
118{ 117{
119 struct sysdev_class *edac_class = NULL; 118 struct bus_type *edac_subsys = NULL;
120 int i, err = 0; 119 int i, err = 0;
121 120
122 edac_class = edac_get_sysfs_class(); 121 edac_subsys = edac_get_sysfs_subsys();
123 if (!edac_class) 122 if (!edac_subsys)
124 return -EINVAL; 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 if (!mce_kobj) { 126 if (!mce_kobj) {
128 printk(KERN_ERR "Error creating a mce kset.\n"); 127 printk(KERN_ERR "Error creating a mce kset.\n");
129 err = -ENOMEM; 128 err = -ENOMEM;
@@ -147,7 +146,7 @@ err_sysfs_create:
147 kobject_del(mce_kobj); 146 kobject_del(mce_kobj);
148 147
149err_mce_kobj: 148err_mce_kobj:
150 edac_put_sysfs_class(); 149 edac_put_sysfs_subsys();
151 150
152 return err; 151 return err;
153} 152}
@@ -161,7 +160,7 @@ static void __exit edac_exit_mce_inject(void)
161 160
162 kobject_del(mce_kobj); 161 kobject_del(mce_kobj);
163 162
164 edac_put_sysfs_class(); 163 edac_put_sysfs_subsys();
165} 164}
166 165
167module_init(edac_init_mce_inject); 166module_init(edac_init_mce_inject);
diff --git a/include/linux/edac.h b/include/linux/edac.h
index 055b248bdd53..1cd3947987e5 100644
--- a/include/linux/edac.h
+++ b/include/linux/edac.h
@@ -13,7 +13,7 @@
13#define _LINUX_EDAC_H_ 13#define _LINUX_EDAC_H_
14 14
15#include <linux/atomic.h> 15#include <linux/atomic.h>
16#include <linux/sysdev.h> 16#include <linux/device.h>
17 17
18#define EDAC_OPSTATE_INVAL -1 18#define EDAC_OPSTATE_INVAL -1
19#define EDAC_OPSTATE_POLL 0 19#define EDAC_OPSTATE_POLL 0
@@ -23,12 +23,12 @@
23extern int edac_op_state; 23extern int edac_op_state;
24extern int edac_err_assert; 24extern int edac_err_assert;
25extern atomic_t edac_handlers; 25extern atomic_t edac_handlers;
26extern struct sysdev_class edac_class; 26extern struct bus_type edac_subsys;
27 27
28extern int edac_handler_set(void); 28extern int edac_handler_set(void);
29extern void edac_atomic_assert_error(void); 29extern void edac_atomic_assert_error(void);
30extern struct sysdev_class *edac_get_sysfs_class(void); 30extern struct bus_type *edac_get_sysfs_subsys(void);
31extern void edac_put_sysfs_class(void); 31extern void edac_put_sysfs_subsys(void);
32 32
33static inline void opstate_init(void) 33static inline void opstate_init(void)
34{ 34{