diff options
author | Yangtao Li <frank.li@vivo.com> | 2023-04-09 18:43:37 +0200 |
---|---|---|
committer | Mike Snitzer <snitzer@kernel.org> | 2023-04-11 18:09:08 +0200 |
commit | 3664ff82dae1ef9f14f7763d3dd30565e7ef9e14 (patch) | |
tree | b18b6bec1dd93c543024e7943349fb3e239767d7 /drivers/md/dm-zero.c | |
parent | dm raid: remove unused d variable (diff) | |
download | linux-3664ff82dae1ef9f14f7763d3dd30565e7ef9e14.tar.xz linux-3664ff82dae1ef9f14f7763d3dd30565e7ef9e14.zip |
dm: add helper macro for simple DM target module init and exit
Eliminate duplicate boilerplate code for simple modules that contain
a single DM target driver without any additional setup code.
Add a new module_dm() macro, which replaces the module_init() and
module_exit() with template functions that call dm_register_target()
and dm_unregister_target() respectively.
Signed-off-by: Yangtao Li <frank.li@vivo.com>
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Diffstat (limited to 'drivers/md/dm-zero.c')
-rw-r--r-- | drivers/md/dm-zero.c | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/drivers/md/dm-zero.c b/drivers/md/dm-zero.c index 884ac726a743..3b13e6eb1aa4 100644 --- a/drivers/md/dm-zero.c +++ b/drivers/md/dm-zero.c @@ -75,19 +75,7 @@ static struct target_type zero_target = { .map = zero_map, .io_hints = zero_io_hints, }; - -static int __init dm_zero_init(void) -{ - return dm_register_target(&zero_target); -} - -static void __exit dm_zero_exit(void) -{ - dm_unregister_target(&zero_target); -} - -module_init(dm_zero_init) -module_exit(dm_zero_exit) +module_dm(zero); MODULE_AUTHOR("Jana Saout <jana@saout.de>"); MODULE_DESCRIPTION(DM_NAME " dummy target returning zeros"); |