summaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2020-03-24 08:25:19 +0100
committerJens Axboe <axboe@kernel.dk>2020-03-24 07:57:08 -0600
commit74cc979c3c7f8328b24651daf15280f07533e735 (patch)
treeda9360a167996f90b39acd5bf67e22f96128338d /block
parent1a9fba3a77a5b39d1c9e1611758303f2649474e9 (diff)
downloadlinux-74cc979c3c7f8328b24651daf15280f07533e735.tar.bz2
block: cleanup how md_autodetect_dev is called
Add a new include/linux/raid/detect.h header to declare the md_autodetect_dev prototype which can be shared between md and the partition code. Then use IS_BUILTIN to call it instead of the ifdef magic. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block')
-rw-r--r--block/partition-generic.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/block/partition-generic.c b/block/partition-generic.c
index fef6bacb2bbb..4d771ae835ed 100644
--- a/block/partition-generic.c
+++ b/block/partition-generic.c
@@ -18,14 +18,11 @@
#include <linux/ctype.h>
#include <linux/genhd.h>
#include <linux/blktrace_api.h>
+#include <linux/raid/detect.h>
#include "blk.h"
#include "partitions/check.h"
-#ifdef CONFIG_BLK_DEV_MD
-extern void md_autodetect_dev(dev_t dev);
-#endif
-
static ssize_t part_partition_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
@@ -407,10 +404,10 @@ static bool blk_add_partition(struct gendisk *disk, struct block_device *bdev,
return true;
}
-#ifdef CONFIG_BLK_DEV_MD
- if (state->parts[p].flags & ADDPART_FLAG_RAID)
+ if (IS_BUILTIN(CONFIG_BLK_DEV_MD) &&
+ (state->parts[p].flags & ADDPART_FLAG_RAID))
md_autodetect_dev(part_to_dev(part)->devt);
-#endif
+
return true;
}