From 0d1feb72ffd8578f6f167ca15b2096c276c1f6df Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Fri, 21 May 2021 07:50:53 +0200 Subject: block: automatically enable GENHD_FL_EXT_DEVT Automatically set the GENHD_FL_EXT_DEVT flag for all disks allocated without an explicit number of minors. This is what all new block drivers should do, so make sure it is the default without boilerplate code. Signed-off-by: Christoph Hellwig Reviewed-by: Hannes Reinecke Reviewed-by: Luis Chamberlain Reviewed-by: Ulf Hansson Link: https://lore.kernel.org/r/20210521055116.1053587-4-hch@lst.de Signed-off-by: Jens Axboe --- block/genhd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'block/genhd.c') diff --git a/block/genhd.c b/block/genhd.c index 8c1816d2929e..9fa734cb9cbd 100644 --- a/block/genhd.c +++ b/block/genhd.c @@ -497,7 +497,6 @@ static void __device_add_disk(struct device *parent, struct gendisk *disk, } } else { WARN_ON(disk->minors); - WARN_ON(!(disk->flags & (GENHD_FL_EXT_DEVT | GENHD_FL_HIDDEN))); ret = blk_alloc_ext_minor(); if (ret < 0) { @@ -506,6 +505,7 @@ static void __device_add_disk(struct device *parent, struct gendisk *disk, } disk->major = BLOCK_EXT_MAJOR; disk->first_minor = MINOR(ret); + disk->flags |= GENHD_FL_EXT_DEVT; } disk->flags |= GENHD_FL_UP; -- cgit v1.2.3