2021-02-13 16:49:23

by Dejin Zheng

[permalink] [raw]
Subject: [PATCH mtd/next 4/8] mtd: mtdblock: Use module_mtd_blktrans to register driver

Removing some boilerplate by using module_mtd_blktrans instead of calling
register and unregister in the otherwise empty init/exit functions.

Signed-off-by: Dejin Zheng <[email protected]>
---
drivers/mtd/mtdblock.c | 14 +-------------
1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/drivers/mtd/mtdblock.c b/drivers/mtd/mtdblock.c
index 32e52d83b961..a80809543793 100644
--- a/drivers/mtd/mtdblock.c
+++ b/drivers/mtd/mtdblock.c
@@ -346,19 +346,7 @@ static struct mtd_blktrans_ops mtdblock_tr = {
.owner = THIS_MODULE,
};

-static int __init init_mtdblock(void)
-{
- return register_mtd_blktrans(&mtdblock_tr);
-}
-
-static void __exit cleanup_mtdblock(void)
-{
- deregister_mtd_blktrans(&mtdblock_tr);
-}
-
-module_init(init_mtdblock);
-module_exit(cleanup_mtdblock);
-
+module_mtd_blktrans(mtdblock_tr);

MODULE_LICENSE("GPL");
MODULE_AUTHOR("Nicolas Pitre <[email protected]> et al.");
--
2.25.0


2021-03-04 06:38:53

by Miquel Raynal

[permalink] [raw]
Subject: Re: [PATCH mtd/next 4/8] mtd: mtdblock: Use module_mtd_blktrans to register driver

On Sat, 2021-02-13 at 16:45:56 UTC, Dejin Zheng wrote:
> Removing some boilerplate by using module_mtd_blktrans instead of calling
> register and unregister in the otherwise empty init/exit functions.
>
> Signed-off-by: Dejin Zheng <[email protected]>

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/next, thanks.

Miquel