]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
block: don't look at the struct device dev_t in disk_devt
authorChristoph Hellwig <hch@lst.de>
Thu, 2 Nov 2017 18:29:52 +0000 (21:29 +0300)
committerJens Axboe <axboe@kernel.dk>
Fri, 3 Nov 2017 16:31:48 +0000 (10:31 -0600)
The hidden gendisks introduced in the next patch need to keep the dev
field in their struct device empty so that udev won't try to create
block device nodes for them.  To support that rewrite disk_devt to
look at the major and first_minor fields in the gendisk itself instead
of looking into the struct device.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/genhd.c
include/linux/genhd.h

index dd305c65ffb05d5016f1c602e65849a2fbf8e418..1174d24e405eed36a23658221a6b72591fb42ce4 100644 (file)
@@ -649,10 +649,6 @@ void device_add_disk(struct device *parent, struct gendisk *disk)
                return;
        }
        disk_to_dev(disk)->devt = devt;
-
-       /* ->major and ->first_minor aren't supposed to be
-        * dereferenced from here on, but set them just in case.
-        */
        disk->major = MAJOR(devt);
        disk->first_minor = MINOR(devt);
 
index ea652bfcd6756ff382e54a7f209043d9217e3608..5c0ed5db33c2d3e729eb3473a628787c4b9fcddf 100644 (file)
@@ -234,7 +234,7 @@ static inline bool disk_part_scan_enabled(struct gendisk *disk)
 
 static inline dev_t disk_devt(struct gendisk *disk)
 {
-       return disk_to_dev(disk)->devt;
+       return MKDEV(disk->major, disk->first_minor);
 }
 
 static inline dev_t part_devt(struct hd_struct *part)