[PATCH V2 9/9] null_blk: avoid use global modparam g_irq_mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The reference to module parameter is already present in the
struct kernel_param dp->arg include/linux/moduleparam.h :-

device_param_cb(name, ops, arg, perm)
 level_param_cb(name, ops, arg, perm, level)
   __module_param_call(prefix, name, ops, arg, perm, level, flags)
288         /* Default value instead of permissions? */                     \
289         static const char __param_str_##name[] = prefix #name;          \
290         static struct kernel_param __moduleparam_const __param_##name   \
291         __used __section("__param")                                     \
292         __aligned(__alignof__(struct kernel_param))                     \
293         = { __param_str_##name, THIS_MODULE, ops,                       \
294             VERIFY_OCTAL_PERMISSIONS(perm), level, flags, { arg } }

Replace global reference to the g_irq_mode in null_set_irq_mode()
with the function parameter kp-arg and rearrage code that matches
nicely with this patch series.

Also, use this opportunity to print the error message with valid range.

Signed-off-by: Chaitanya Kulkarni <kch@xxxxxxxxxx>
---
 drivers/block/null_blk/main.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c
index 5325ec57287d..f34a147e0fa7 100644
--- a/drivers/block/null_blk/main.c
+++ b/drivers/block/null_blk/main.c
@@ -249,12 +249,14 @@ static bool g_shared_tag_bitmap;
 module_param_named(shared_tag_bitmap, g_shared_tag_bitmap, bool, 0444);
 MODULE_PARM_DESC(shared_tag_bitmap, "Use shared tag bitmap for all submission queues for blk-mq");
 
-static int g_irqmode = NULL_IRQ_SOFTIRQ;
-
 static int null_set_irqmode(const char *str, const struct kernel_param *kp)
 {
-	return null_param_store_int(str, &g_irqmode, NULL_IRQ_NONE,
-					NULL_IRQ_TIMER);
+	int ret;
+
+	ret = null_param_store_int(str, kp->arg, NULL_IRQ_NONE, NULL_IRQ_TIMER);
+	if (ret)
+		pr_err("irqmode valid values 0-none, 1-softirq, 2-timer\n");
+	return ret;
 }
 
 static const struct kernel_param_ops null_irqmode_param_ops = {
@@ -262,6 +264,7 @@ static const struct kernel_param_ops null_irqmode_param_ops = {
 	.get	= param_get_int,
 };
 
+static int g_irqmode = NULL_IRQ_SOFTIRQ;
 device_param_cb(irqmode, &null_irqmode_param_ops, &g_irqmode, 0444);
 MODULE_PARM_DESC(irqmode, "IRQ completion handler. 0-none, 1-softirq, 2-timer");
 
-- 
2.29.0




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux