diff mbox series

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

Message ID 20230330055203.43064-10-kch@nvidia.com (mailing list archive)
State New, archived
Headers show
Series null_blk: add modparam checks | expand

Commit Message

Chaitanya Kulkarni March 30, 2023, 5:52 a.m. UTC
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.

No functional change in this patch.

Signed-off-by: Chaitanya Kulkarni <kch@nvidia.com>
---
 drivers/block/null_blk/main.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c
index 69f2d68ba14f..d0d7c52b0f81 100644
--- a/drivers/block/null_blk/main.c
+++ b/drivers/block/null_blk/main.c
@@ -222,11 +222,9 @@  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,
+	return null_param_store_int(str, kp->arg, NULL_IRQ_NONE,
 					NULL_IRQ_TIMER);
 }
 
@@ -235,6 +233,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");