diff options
author | Arnd Bergmann <arnd@arndb.de> | 2018-01-11 05:31:25 -0500 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2018-01-11 09:58:31 -0500 |
commit | 33f782c49a95aac0c88203b29e4e276c2b12dad6 (patch) | |
tree | d7538a985bb09355f1e8d9477ab07bcd237df5d5 | |
parent | b7435db8b8d11df94453708295c2ea5b09caff5f (diff) |
null_blk: remove explicit 'select FAULT_INJECTION'
Selecting FAULT_INJECTION causes a Kconfig warning when CONFIG_DEBUG_KERNEL
is not set:
warning: (BLK_DEV_NULL_BLK && DRM_I915_SELFTEST) selects FAULT_INJECTION which has unmet direct dependencies (DEBUG_KERNEL)
The other drivers that use FAULT_INJECTION tend to have a separate
Kconfig symbol for turning on that feature, so let's do the same
thing here. This may add a bit more complexity than we like, but
it avoids the warning and is more consistent with the rest of the
kernel.
Fixes: 93b570464cce ("null_blk: add option for managing IO timeouts")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r-- | drivers/block/Kconfig | 5 | ||||
-rw-r--r-- | drivers/block/null_blk.c | 8 |
2 files changed, 12 insertions, 1 deletions
diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig index 622d9a2c8dae..ad9b687a236a 100644 --- a/drivers/block/Kconfig +++ b/drivers/block/Kconfig | |||
@@ -19,7 +19,10 @@ if BLK_DEV | |||
19 | config BLK_DEV_NULL_BLK | 19 | config BLK_DEV_NULL_BLK |
20 | tristate "Null test block driver" | 20 | tristate "Null test block driver" |
21 | select CONFIGFS_FS | 21 | select CONFIGFS_FS |
22 | select FAULT_INJECTION | 22 | |
23 | config BLK_DEV_NULL_BLK_FAULT_INJECTION | ||
24 | bool "Support fault injection for Null test block driver" | ||
25 | depends on BLK_DEV_NULL_BLK && FAULT_INJECTION | ||
23 | 26 | ||
24 | config BLK_DEV_FD | 27 | config BLK_DEV_FD |
25 | tristate "Normal floppy disk support" | 28 | tristate "Normal floppy disk support" |
diff --git a/drivers/block/null_blk.c b/drivers/block/null_blk.c index 30ec0ac11a47..5b94e530570c 100644 --- a/drivers/block/null_blk.c +++ b/drivers/block/null_blk.c | |||
@@ -27,7 +27,9 @@ | |||
27 | #define TICKS_PER_SEC 50ULL | 27 | #define TICKS_PER_SEC 50ULL |
28 | #define TIMER_INTERVAL (NSEC_PER_SEC / TICKS_PER_SEC) | 28 | #define TIMER_INTERVAL (NSEC_PER_SEC / TICKS_PER_SEC) |
29 | 29 | ||
30 | #ifdef CONFIG_BLK_DEV_NULL_BLK_FAULT_INJECTION | ||
30 | static DECLARE_FAULT_ATTR(null_timeout_attr); | 31 | static DECLARE_FAULT_ATTR(null_timeout_attr); |
32 | #endif | ||
31 | 33 | ||
32 | static inline u64 mb_per_tick(int mbps) | 34 | static inline u64 mb_per_tick(int mbps) |
33 | { | 35 | { |
@@ -165,8 +167,10 @@ static int g_home_node = NUMA_NO_NODE; | |||
165 | module_param_named(home_node, g_home_node, int, S_IRUGO); | 167 | module_param_named(home_node, g_home_node, int, S_IRUGO); |
166 | MODULE_PARM_DESC(home_node, "Home node for the device"); | 168 | MODULE_PARM_DESC(home_node, "Home node for the device"); |
167 | 169 | ||
170 | #ifdef CONFIG_BLK_DEV_NULL_BLK_FAULT_INJECTION | ||
168 | static char g_timeout_str[80]; | 171 | static char g_timeout_str[80]; |
169 | module_param_string(timeout, g_timeout_str, sizeof(g_timeout_str), S_IRUGO); | 172 | module_param_string(timeout, g_timeout_str, sizeof(g_timeout_str), S_IRUGO); |
173 | #endif | ||
170 | 174 | ||
171 | static int g_queue_mode = NULL_Q_MQ; | 175 | static int g_queue_mode = NULL_Q_MQ; |
172 | 176 | ||
@@ -1372,8 +1376,10 @@ static int null_rq_prep_fn(struct request_queue *q, struct request *req) | |||
1372 | 1376 | ||
1373 | static bool should_timeout_request(struct request *rq) | 1377 | static bool should_timeout_request(struct request *rq) |
1374 | { | 1378 | { |
1379 | #ifdef CONFIG_BLK_DEV_NULL_BLK_FAULT_INJECTION | ||
1375 | if (g_timeout_str[0]) | 1380 | if (g_timeout_str[0]) |
1376 | return should_fail(&null_timeout_attr, 1); | 1381 | return should_fail(&null_timeout_attr, 1); |
1382 | #endif | ||
1377 | 1383 | ||
1378 | return false; | 1384 | return false; |
1379 | } | 1385 | } |
@@ -1655,6 +1661,7 @@ static void null_validate_conf(struct nullb_device *dev) | |||
1655 | 1661 | ||
1656 | static bool null_setup_fault(void) | 1662 | static bool null_setup_fault(void) |
1657 | { | 1663 | { |
1664 | #ifdef CONFIG_BLK_DEV_NULL_BLK_FAULT_INJECTION | ||
1658 | if (!g_timeout_str[0]) | 1665 | if (!g_timeout_str[0]) |
1659 | return true; | 1666 | return true; |
1660 | 1667 | ||
@@ -1662,6 +1669,7 @@ static bool null_setup_fault(void) | |||
1662 | return false; | 1669 | return false; |
1663 | 1670 | ||
1664 | null_timeout_attr.verbose = 0; | 1671 | null_timeout_attr.verbose = 0; |
1672 | #endif | ||
1665 | return true; | 1673 | return true; |
1666 | } | 1674 | } |
1667 | 1675 | ||