Skip to content

Commit 33f782c

Browse files
arndbaxboe
authored andcommitted
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: 93b5704 ("null_blk: add option for managing IO timeouts") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent b7435db commit 33f782c

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

drivers/block/Kconfig

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ if BLK_DEV
1919
config BLK_DEV_NULL_BLK
2020
tristate "Null test block driver"
2121
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
2326

2427
config BLK_DEV_FD
2528
tristate "Normal floppy disk support"

drivers/block/null_blk.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@
2727
#define TICKS_PER_SEC 50ULL
2828
#define TIMER_INTERVAL (NSEC_PER_SEC / TICKS_PER_SEC)
2929

30+
#ifdef CONFIG_BLK_DEV_NULL_BLK_FAULT_INJECTION
3031
static DECLARE_FAULT_ATTR(null_timeout_attr);
32+
#endif
3133

3234
static inline u64 mb_per_tick(int mbps)
3335
{
@@ -165,8 +167,10 @@ static int g_home_node = NUMA_NO_NODE;
165167
module_param_named(home_node, g_home_node, int, S_IRUGO);
166168
MODULE_PARM_DESC(home_node, "Home node for the device");
167169

170+
#ifdef CONFIG_BLK_DEV_NULL_BLK_FAULT_INJECTION
168171
static char g_timeout_str[80];
169172
module_param_string(timeout, g_timeout_str, sizeof(g_timeout_str), S_IRUGO);
173+
#endif
170174

171175
static int g_queue_mode = NULL_Q_MQ;
172176

@@ -1372,8 +1376,10 @@ static int null_rq_prep_fn(struct request_queue *q, struct request *req)
13721376

13731377
static bool should_timeout_request(struct request *rq)
13741378
{
1379+
#ifdef CONFIG_BLK_DEV_NULL_BLK_FAULT_INJECTION
13751380
if (g_timeout_str[0])
13761381
return should_fail(&null_timeout_attr, 1);
1382+
#endif
13771383

13781384
return false;
13791385
}
@@ -1655,13 +1661,15 @@ static void null_validate_conf(struct nullb_device *dev)
16551661

16561662
static bool null_setup_fault(void)
16571663
{
1664+
#ifdef CONFIG_BLK_DEV_NULL_BLK_FAULT_INJECTION
16581665
if (!g_timeout_str[0])
16591666
return true;
16601667

16611668
if (!setup_fault_attr(&null_timeout_attr, g_timeout_str))
16621669
return false;
16631670

16641671
null_timeout_attr.verbose = 0;
1672+
#endif
16651673
return true;
16661674
}
16671675

0 commit comments

Comments
 (0)