diff options
author | Yangtao Li <frank.li@vivo.com> | 2023-04-10 00:43:37 +0800 |
---|---|---|
committer | Mike Snitzer <snitzer@kernel.org> | 2023-04-11 12:09:08 -0400 |
commit | 3664ff82dae1ef9f14f7763d3dd30565e7ef9e14 (patch) | |
tree | b18b6bec1dd93c543024e7943349fb3e239767d7 /drivers/md/dm-zoned-target.c | |
parent | 306fbc2e041c227be7c934efe8a49ddb87bd31f1 (diff) | |
download | lwn-3664ff82dae1ef9f14f7763d3dd30565e7ef9e14.tar.gz lwn-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-zoned-target.c')
-rw-r--r-- | drivers/md/dm-zoned-target.c | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/drivers/md/dm-zoned-target.c b/drivers/md/dm-zoned-target.c index ad4764dcd013..ad8e670a2f9b 100644 --- a/drivers/md/dm-zoned-target.c +++ b/drivers/md/dm-zoned-target.c @@ -1138,7 +1138,7 @@ static int dmz_message(struct dm_target *ti, unsigned int argc, char **argv, return r; } -static struct target_type dmz_type = { +static struct target_type zoned_target = { .name = "zoned", .version = {2, 0, 0}, .features = DM_TARGET_SINGLETON | DM_TARGET_MIXED_ZONED_MODEL, @@ -1154,19 +1154,7 @@ static struct target_type dmz_type = { .status = dmz_status, .message = dmz_message, }; - -static int __init dmz_init(void) -{ - return dm_register_target(&dmz_type); -} - -static void __exit dmz_exit(void) -{ - dm_unregister_target(&dmz_type); -} - -module_init(dmz_init); -module_exit(dmz_exit); +module_dm(zoned); MODULE_DESCRIPTION(DM_NAME " target for zoned block devices"); MODULE_AUTHOR("Damien Le Moal <damien.lemoal@wdc.com>"); |