aboutsummaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
Diffstat (limited to 'block')
-rw-r--r--block/blk-integrity.c5
-rw-r--r--block/blk-sysfs.c4
-rw-r--r--block/genhd.c27
3 files changed, 19 insertions, 17 deletions
diff --git a/block/blk-integrity.c b/block/blk-integrity.c
index d87606eaca1d..69023da63151 100644
--- a/block/blk-integrity.c
+++ b/block/blk-integrity.c
@@ -331,7 +331,8 @@ int blk_integrity_register(struct gendisk *disk, struct blk_integrity *template)
331 return -1; 331 return -1;
332 332
333 if (kobject_init_and_add(&bi->kobj, &integrity_ktype, 333 if (kobject_init_and_add(&bi->kobj, &integrity_ktype,
334 &disk->dev.kobj, "%s", "integrity")) { 334 &disk_to_dev(disk)->kobj,
335 "%s", "integrity")) {
335 kmem_cache_free(integrity_cachep, bi); 336 kmem_cache_free(integrity_cachep, bi);
336 return -1; 337 return -1;
337 } 338 }
@@ -375,7 +376,7 @@ void blk_integrity_unregister(struct gendisk *disk)
375 376
376 kobject_uevent(&bi->kobj, KOBJ_REMOVE); 377 kobject_uevent(&bi->kobj, KOBJ_REMOVE);
377 kobject_del(&bi->kobj); 378 kobject_del(&bi->kobj);
378 kobject_put(&disk->dev.kobj); 379 kobject_put(&disk_to_dev(disk)->kobj);
379 kmem_cache_free(integrity_cachep, bi); 380 kmem_cache_free(integrity_cachep, bi);
380} 381}
381EXPORT_SYMBOL(blk_integrity_unregister); 382EXPORT_SYMBOL(blk_integrity_unregister);
diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
index 304ec73ab821..b9a6ed166649 100644
--- a/block/blk-sysfs.c
+++ b/block/blk-sysfs.c
@@ -310,7 +310,7 @@ int blk_register_queue(struct gendisk *disk)
310 if (!q->request_fn) 310 if (!q->request_fn)
311 return 0; 311 return 0;
312 312
313 ret = kobject_add(&q->kobj, kobject_get(&disk->dev.kobj), 313 ret = kobject_add(&q->kobj, kobject_get(&disk_to_dev(disk)->kobj),
314 "%s", "queue"); 314 "%s", "queue");
315 if (ret < 0) 315 if (ret < 0)
316 return ret; 316 return ret;
@@ -339,6 +339,6 @@ void blk_unregister_queue(struct gendisk *disk)
339 339
340 kobject_uevent(&q->kobj, KOBJ_REMOVE); 340 kobject_uevent(&q->kobj, KOBJ_REMOVE);
341 kobject_del(&q->kobj); 341 kobject_del(&q->kobj);
342 kobject_put(&disk->dev.kobj); 342 kobject_put(&disk_to_dev(disk)->kobj);
343 } 343 }
344} 344}
diff --git a/block/genhd.c b/block/genhd.c
index 67e5a59ced2a..0a2f16bd54b7 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -59,7 +59,7 @@ struct hd_struct *disk_get_part(struct gendisk *disk, int partno)
59 rcu_read_lock(); 59 rcu_read_lock();
60 part = rcu_dereference(disk->__part[partno - 1]); 60 part = rcu_dereference(disk->__part[partno - 1]);
61 if (part) 61 if (part)
62 get_device(&part->dev); 62 get_device(part_to_dev(part));
63 rcu_read_unlock(); 63 rcu_read_unlock();
64 64
65 return part; 65 return part;
@@ -130,7 +130,7 @@ struct hd_struct *disk_part_iter_next(struct disk_part_iter *piter)
130 if (!(piter->flags & DISK_PITER_INCL_EMPTY) && !part->nr_sects) 130 if (!(piter->flags & DISK_PITER_INCL_EMPTY) && !part->nr_sects)
131 continue; 131 continue;
132 132
133 get_device(&part->dev); 133 get_device(part_to_dev(part));
134 piter->part = part; 134 piter->part = part;
135 piter->idx += inc; 135 piter->idx += inc;
136 break; 136 break;
@@ -435,7 +435,7 @@ static struct kobject *exact_match(dev_t devt, int *partno, void *data)
435{ 435{
436 struct gendisk *p = data; 436 struct gendisk *p = data;
437 437
438 return &p->dev.kobj; 438 return &disk_to_dev(p)->kobj;
439} 439}
440 440
441static int exact_lock(dev_t devt, void *data) 441static int exact_lock(dev_t devt, void *data)
@@ -460,7 +460,7 @@ void add_disk(struct gendisk *disk)
460 int retval; 460 int retval;
461 461
462 disk->flags |= GENHD_FL_UP; 462 disk->flags |= GENHD_FL_UP;
463 disk->dev.devt = MKDEV(disk->major, disk->first_minor); 463 disk_to_dev(disk)->devt = MKDEV(disk->major, disk->first_minor);
464 blk_register_region(disk_devt(disk), disk->minors, NULL, 464 blk_register_region(disk_devt(disk), disk->minors, NULL,
465 exact_match, exact_lock, disk); 465 exact_match, exact_lock, disk);
466 register_disk(disk); 466 register_disk(disk);
@@ -468,7 +468,8 @@ void add_disk(struct gendisk *disk)
468 468
469 bdi = &disk->queue->backing_dev_info; 469 bdi = &disk->queue->backing_dev_info;
470 bdi_register_dev(bdi, disk_devt(disk)); 470 bdi_register_dev(bdi, disk_devt(disk));
471 retval = sysfs_create_link(&disk->dev.kobj, &bdi->dev->kobj, "bdi"); 471 retval = sysfs_create_link(&disk_to_dev(disk)->kobj, &bdi->dev->kobj,
472 "bdi");
472 WARN_ON(retval); 473 WARN_ON(retval);
473} 474}
474 475
@@ -477,7 +478,7 @@ EXPORT_SYMBOL(del_gendisk); /* in partitions/check.c */
477 478
478void unlink_gendisk(struct gendisk *disk) 479void unlink_gendisk(struct gendisk *disk)
479{ 480{
480 sysfs_remove_link(&disk->dev.kobj, "bdi"); 481 sysfs_remove_link(&disk_to_dev(disk)->kobj, "bdi");
481 bdi_unregister(&disk->queue->backing_dev_info); 482 bdi_unregister(&disk->queue->backing_dev_info);
482 blk_unregister_queue(disk); 483 blk_unregister_queue(disk);
483 blk_unregister_region(disk_devt(disk), disk->minors); 484 blk_unregister_region(disk_devt(disk), disk->minors);
@@ -903,7 +904,7 @@ static int diskstats_show(struct seq_file *seqf, void *v)
903 int cpu; 904 int cpu;
904 905
905 /* 906 /*
906 if (&gp->dev.kobj.entry == block_class.devices.next) 907 if (&disk_to_dev(gp)->kobj.entry == block_class.devices.next)
907 seq_puts(seqf, "major minor name" 908 seq_puts(seqf, "major minor name"
908 " rio rmerge rsect ruse wio wmerge " 909 " rio rmerge rsect ruse wio wmerge "
909 "wsect wuse running use aveq" 910 "wsect wuse running use aveq"
@@ -972,7 +973,7 @@ static void media_change_notify_thread(struct work_struct *work)
972 * set enviroment vars to indicate which event this is for 973 * set enviroment vars to indicate which event this is for
973 * so that user space will know to go check the media status. 974 * so that user space will know to go check the media status.
974 */ 975 */
975 kobject_uevent_env(&gd->dev.kobj, KOBJ_CHANGE, envp); 976 kobject_uevent_env(&disk_to_dev(gd)->kobj, KOBJ_CHANGE, envp);
976 put_device(gd->driverfs_dev); 977 put_device(gd->driverfs_dev);
977} 978}
978 979
@@ -1062,9 +1063,9 @@ struct gendisk *alloc_disk_ext_node(int minors, int ext_minors, int node_id)
1062 disk->minors = minors; 1063 disk->minors = minors;
1063 disk->ext_minors = ext_minors; 1064 disk->ext_minors = ext_minors;
1064 rand_initialize_disk(disk); 1065 rand_initialize_disk(disk);
1065 disk->dev.class = &block_class; 1066 disk_to_dev(disk)->class = &block_class;
1066 disk->dev.type = &disk_type; 1067 disk_to_dev(disk)->type = &disk_type;
1067 device_initialize(&disk->dev); 1068 device_initialize(disk_to_dev(disk));
1068 INIT_WORK(&disk->async_notify, 1069 INIT_WORK(&disk->async_notify,
1069 media_change_notify_thread); 1070 media_change_notify_thread);
1070 } 1071 }
@@ -1086,7 +1087,7 @@ struct kobject *get_disk(struct gendisk *disk)
1086 owner = disk->fops->owner; 1087 owner = disk->fops->owner;
1087 if (owner && !try_module_get(owner)) 1088 if (owner && !try_module_get(owner))
1088 return NULL; 1089 return NULL;
1089 kobj = kobject_get(&disk->dev.kobj); 1090 kobj = kobject_get(&disk_to_dev(disk)->kobj);
1090 if (kobj == NULL) { 1091 if (kobj == NULL) {
1091 module_put(owner); 1092 module_put(owner);
1092 return NULL; 1093 return NULL;
@@ -1100,7 +1101,7 @@ EXPORT_SYMBOL(get_disk);
1100void put_disk(struct gendisk *disk) 1101void put_disk(struct gendisk *disk)
1101{ 1102{
1102 if (disk) 1103 if (disk)
1103 kobject_put(&disk->dev.kobj); 1104 kobject_put(&disk_to_dev(disk)->kobj);
1104} 1105}
1105 1106
1106EXPORT_SYMBOL(put_disk); 1107EXPORT_SYMBOL(put_disk);