diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2007-11-06 13:36:58 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-01-24 23:40:23 -0500 |
commit | 830d3cfb16728e2496edc2985ad8f68025135e37 (patch) | |
tree | 11541c0ac058745a2ab4269b84669a8341ece7ce /block | |
parent | c60b71787982cefcf9fa09aa281fa8c4c685d557 (diff) |
kset: convert block_subsys to use kset_create
Dynamically create the kset instead of declaring it statically. We also
rename block_subsys to block_kset to catch all users of this symbol
with a build error instead of an easy-to-ignore build warning.
Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'block')
-rw-r--r-- | block/genhd.c | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/block/genhd.c b/block/genhd.c index 32227b7ecd17..69aa7389d484 100644 --- a/block/genhd.c +++ b/block/genhd.c | |||
@@ -17,7 +17,8 @@ | |||
17 | #include <linux/buffer_head.h> | 17 | #include <linux/buffer_head.h> |
18 | #include <linux/mutex.h> | 18 | #include <linux/mutex.h> |
19 | 19 | ||
20 | struct kset block_subsys; | 20 | struct kset *block_kset; |
21 | static struct kset_uevent_ops block_uevent_ops; | ||
21 | static DEFINE_MUTEX(block_subsys_lock); | 22 | static DEFINE_MUTEX(block_subsys_lock); |
22 | 23 | ||
23 | /* | 24 | /* |
@@ -221,7 +222,7 @@ void __init printk_all_partitions(void) | |||
221 | 222 | ||
222 | mutex_lock(&block_subsys_lock); | 223 | mutex_lock(&block_subsys_lock); |
223 | /* For each block device... */ | 224 | /* For each block device... */ |
224 | list_for_each_entry(sgp, &block_subsys.list, kobj.entry) { | 225 | list_for_each_entry(sgp, &block_kset->list, kobj.entry) { |
225 | char buf[BDEVNAME_SIZE]; | 226 | char buf[BDEVNAME_SIZE]; |
226 | /* | 227 | /* |
227 | * Don't show empty devices or things that have been surpressed | 228 | * Don't show empty devices or things that have been surpressed |
@@ -270,7 +271,7 @@ static void *part_start(struct seq_file *part, loff_t *pos) | |||
270 | loff_t l = *pos; | 271 | loff_t l = *pos; |
271 | 272 | ||
272 | mutex_lock(&block_subsys_lock); | 273 | mutex_lock(&block_subsys_lock); |
273 | list_for_each(p, &block_subsys.list) | 274 | list_for_each(p, &block_kset->list) |
274 | if (!l--) | 275 | if (!l--) |
275 | return list_entry(p, struct gendisk, kobj.entry); | 276 | return list_entry(p, struct gendisk, kobj.entry); |
276 | return NULL; | 277 | return NULL; |
@@ -280,7 +281,7 @@ static void *part_next(struct seq_file *part, void *v, loff_t *pos) | |||
280 | { | 281 | { |
281 | struct list_head *p = ((struct gendisk *)v)->kobj.entry.next; | 282 | struct list_head *p = ((struct gendisk *)v)->kobj.entry.next; |
282 | ++*pos; | 283 | ++*pos; |
283 | return p==&block_subsys.list ? NULL : | 284 | return p==&block_kset->list ? NULL : |
284 | list_entry(p, struct gendisk, kobj.entry); | 285 | list_entry(p, struct gendisk, kobj.entry); |
285 | } | 286 | } |
286 | 287 | ||
@@ -295,7 +296,7 @@ static int show_partition(struct seq_file *part, void *v) | |||
295 | int n; | 296 | int n; |
296 | char buf[BDEVNAME_SIZE]; | 297 | char buf[BDEVNAME_SIZE]; |
297 | 298 | ||
298 | if (&sgp->kobj.entry == block_subsys.list.next) | 299 | if (&sgp->kobj.entry == block_kset->list.next) |
299 | seq_puts(part, "major minor #blocks name\n\n"); | 300 | seq_puts(part, "major minor #blocks name\n\n"); |
300 | 301 | ||
301 | /* Don't show non-partitionable removeable devices or empty devices */ | 302 | /* Don't show non-partitionable removeable devices or empty devices */ |
@@ -345,15 +346,14 @@ static struct kobject *base_probe(dev_t dev, int *part, void *data) | |||
345 | 346 | ||
346 | static int __init genhd_device_init(void) | 347 | static int __init genhd_device_init(void) |
347 | { | 348 | { |
348 | int err; | ||
349 | |||
350 | bdev_map = kobj_map_init(base_probe, &block_subsys_lock); | 349 | bdev_map = kobj_map_init(base_probe, &block_subsys_lock); |
351 | blk_dev_init(); | 350 | blk_dev_init(); |
352 | err = subsystem_register(&block_subsys); | 351 | block_kset = kset_create_and_add("block", &block_uevent_ops, NULL); |
353 | if (err < 0) | 352 | if (!block_kset) { |
354 | printk(KERN_WARNING "%s: subsystem_register error: %d\n", | 353 | printk(KERN_WARNING "%s: kset_create error\n", __FUNCTION__); |
355 | __FUNCTION__, err); | 354 | return -ENOMEM; |
356 | return err; | 355 | } |
356 | return 0; | ||
357 | } | 357 | } |
358 | 358 | ||
359 | subsys_initcall(genhd_device_init); | 359 | subsys_initcall(genhd_device_init); |
@@ -584,8 +584,6 @@ static struct kset_uevent_ops block_uevent_ops = { | |||
584 | .uevent = block_uevent, | 584 | .uevent = block_uevent, |
585 | }; | 585 | }; |
586 | 586 | ||
587 | decl_subsys(block, &block_uevent_ops); | ||
588 | |||
589 | /* | 587 | /* |
590 | * aggregate disk stat collector. Uses the same stats that the sysfs | 588 | * aggregate disk stat collector. Uses the same stats that the sysfs |
591 | * entries do, above, but makes them available through one seq_file. | 589 | * entries do, above, but makes them available through one seq_file. |
@@ -603,7 +601,7 @@ static void *diskstats_start(struct seq_file *part, loff_t *pos) | |||
603 | struct list_head *p; | 601 | struct list_head *p; |
604 | 602 | ||
605 | mutex_lock(&block_subsys_lock); | 603 | mutex_lock(&block_subsys_lock); |
606 | list_for_each(p, &block_subsys.list) | 604 | list_for_each(p, &block_kset->list) |
607 | if (!k--) | 605 | if (!k--) |
608 | return list_entry(p, struct gendisk, kobj.entry); | 606 | return list_entry(p, struct gendisk, kobj.entry); |
609 | return NULL; | 607 | return NULL; |
@@ -613,7 +611,7 @@ static void *diskstats_next(struct seq_file *part, void *v, loff_t *pos) | |||
613 | { | 611 | { |
614 | struct list_head *p = ((struct gendisk *)v)->kobj.entry.next; | 612 | struct list_head *p = ((struct gendisk *)v)->kobj.entry.next; |
615 | ++*pos; | 613 | ++*pos; |
616 | return p==&block_subsys.list ? NULL : | 614 | return p==&block_kset->list ? NULL : |
617 | list_entry(p, struct gendisk, kobj.entry); | 615 | list_entry(p, struct gendisk, kobj.entry); |
618 | } | 616 | } |
619 | 617 | ||
@@ -629,7 +627,7 @@ static int diskstats_show(struct seq_file *s, void *v) | |||
629 | int n = 0; | 627 | int n = 0; |
630 | 628 | ||
631 | /* | 629 | /* |
632 | if (&sgp->kobj.entry == block_subsys.kset.list.next) | 630 | if (&sgp->kobj.entry == block_kset->list.next) |
633 | seq_puts(s, "major minor name" | 631 | seq_puts(s, "major minor name" |
634 | " rio rmerge rsect ruse wio wmerge " | 632 | " rio rmerge rsect ruse wio wmerge " |
635 | "wsect wuse running use aveq" | 633 | "wsect wuse running use aveq" |
@@ -721,7 +719,7 @@ struct gendisk *alloc_disk_node(int minors, int node_id) | |||
721 | } | 719 | } |
722 | } | 720 | } |
723 | disk->minors = minors; | 721 | disk->minors = minors; |
724 | disk->kobj.kset = &block_subsys; | 722 | disk->kobj.kset = block_kset; |
725 | disk->kobj.ktype = &ktype_block; | 723 | disk->kobj.ktype = &ktype_block; |
726 | kobject_init(&disk->kobj); | 724 | kobject_init(&disk->kobj); |
727 | rand_initialize_disk(disk); | 725 | rand_initialize_disk(disk); |