Skip to content

Commit 517bf3c

Browse files
Christoph Hellwigaxboe
authored andcommitted
block: don't look at the struct device dev_t in disk_devt
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 <[email protected]> Reviewed-by: Johannes Thumshirn <[email protected]> Reviewed-by: Hannes Reinecke <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent ef71de8 commit 517bf3c

File tree

2 files changed

+1
-5
lines changed

2 files changed

+1
-5
lines changed

block/genhd.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -649,10 +649,6 @@ void device_add_disk(struct device *parent, struct gendisk *disk)
649649
return;
650650
}
651651
disk_to_dev(disk)->devt = devt;
652-
653-
/* ->major and ->first_minor aren't supposed to be
654-
* dereferenced from here on, but set them just in case.
655-
*/
656652
disk->major = MAJOR(devt);
657653
disk->first_minor = MINOR(devt);
658654

include/linux/genhd.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ static inline bool disk_part_scan_enabled(struct gendisk *disk)
234234

235235
static inline dev_t disk_devt(struct gendisk *disk)
236236
{
237-
return disk_to_dev(disk)->devt;
237+
return MKDEV(disk->major, disk->first_minor);
238238
}
239239

240240
static inline dev_t part_devt(struct hd_struct *part)

0 commit comments

Comments
 (0)