aboutsummaryrefslogtreecommitdiffstats
path: root/block/genhd.c
diff options
context:
space:
mode:
Diffstat (limited to 'block/genhd.c')
-rw-r--r--block/genhd.c27
1 files changed, 14 insertions, 13 deletions
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);