Introduces the module_mtd_blktrans macro
cover Introduces the module_mtd_blktrans macro
This patchset introduces the module_mtd_blktrans macro which is a convenience macro for mtd blktrans modules similar to module_platform_driver. It is intended to be used by drivers which init/exit section does nothing but register/unregister the mtd blktrans driver. By using this macro it is possible to eliminate a few lines of boilerplate code per mtd blktrans driver.
Dejin Zheng (8):
mtd: Add helper macro for register_mtd_blktrans boilerplate
mtd: ftl: Use module_mtd_blktrans to register driver
mtd: inftlcore: Use module_mtd_blktrans to register driver
mtd: mtdblock: Use module_mtd_blktrans to register driver
mtd: mtdblock_ro: Use module_mtd_blktrans to register driver
mtd: mtdswap: Use module_mtd_blktrans to register driver
mtd: nftlcore: Use module_mtd_blktrans to register driver
mtd: rfd_ftl: Use module_mtd_blktrans to register driver
drivers/mtd/ftl.c | 14 +------------- drivers/mtd/inftlcore.c | 13 +------------ drivers/mtd/mtdblock.c | 14 +------------- drivers/mtd/mtdblock_ro.c | 13 +------------ drivers/mtd/mtdswap.c | 14 +------------- drivers/mtd/nftlcore.c | 13 +------------ drivers/mtd/rfd_ftl.c | 13 +------------ include/linux/mtd/blktrans.h | 11 +++++++++++ 8 files changed, 18 insertions(+), 87 deletions(-)
Signature · 1 line
2.25.0
PATCH 1/8 mtd: Add helper macro for register_mtd_blktrans boilerplate
This patch introduces the module_mtd_blktrans macro which is a convenience macro for mtd blktrans modules similar to module_platform_driver. It is intended to be used by drivers which init/exit section does nothing but register/unregister the mtd blktrans driver. By using this macro it is possible to eliminate a few lines of boilerplate code per mtd blktrans driver.
--- include/linux/mtd/blktrans.h | 11 +++++++++++ 1 file changed, 11 insertions(+)
include/linux/mtd/blktrans.h +11 -0
@@ -77,5 +77,16 @@ extern int add_mtd_blktrans_dev(struct mtd_blktrans_dev *dev);extern int del_mtd_blktrans_dev (struct mtd_blktrans_dev *dev);extern int mtd_blktrans_cease_background (struct mtd_blktrans_dev *dev); +/** +* module_mtd_blktrans() - Helper macro for registering a mtd blktrans driver +* @__mtd_blktrans: mtd_blktrans_ops struct +* +* Helper macro for mtd blktrans drivers which do not do anything special in +* module init/exit. This eliminates a lot of boilerplate. Each module may only +* use this macro once, and calling it replaces module_init() and module_exit() +*/ +#define module_mtd_blktrans (__mtd_blktrans) \ + module_driver(__mtd_blktrans, register_mtd_blktrans, \ + deregister_mtd_blktrans)#endif /* __MTD_TRANS_H__ */
Signature · 1 line
2.25.0
Re: [PATCH mtd/next 1/8] mtd: Add helper macro for register_mtd_blktrans boilerplate
Quoted 8 lines · Dejin Zheng
This patch introduces the
module_mtd_blktransmacro which is a convenience macro for mtd blktrans modules similar tomodule_platform_driver. It is intended to be used by drivers which init/exit section does nothing but register/unregister the mtd blktrans driver. By using this macro it is possible to eliminate a few lines of boilerplate code per mtd blktrans driver.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
PATCH 2/8 mtd: ftl: Use module_mtd_blktrans to register driver
In reply to Dejin ZhengRemoving some boilerplate by using module_mtd_blktrans instead of calling register and unregister in the otherwise empty init/exit functions.
--- drivers/mtd/ftl.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-)
drivers/mtd/ftl.c +1 -13
@@ -1056,19 +1056,7 @@ static struct mtd_blktrans_ops ftl_tr = { .owner = THIS_MODULE, }; -static int __init init_ftl (void ) -{ -return register_mtd_blktrans (&ftl_tr); -} - -static void __exit cleanup_ftl(void) -{ -deregister_mtd_blktrans (&ftl_tr); -} - -module_init (init_ftl); -module_exit (cleanup_ftl); - +module_mtd_blktrans (ftl_tr);MODULE_LICENSE ("Dual MPL/GPL" );MODULE_AUTHOR ("David Hinds <[email protected]>" );
Signature · 1 line
2.25.0
Re: [PATCH mtd/next 2/8] mtd: ftl: Use module_mtd_blktrans to register driver
Quoted 4 lines · Dejin Zheng
Removing some boilerplate by using
module_mtd_blktransinstead 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
PATCH 3/8 mtd: inftlcore: Use module_mtd_blktrans to register driver
In reply to Dejin ZhengRemoving some boilerplate by using module_mtd_blktrans instead of calling register and unregister in the otherwise empty init/exit functions.
--- drivers/mtd/inftlcore.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-)
drivers/mtd/inftlcore.c +1 -12
@@ -937,18 +937,7 @@ static struct mtd_blktrans_ops inftl_tr = { .owner = THIS_MODULE, }; -static int __init init_inftl (void ) -{ -return register_mtd_blktrans (&inftl_tr); -} - -static void __exit cleanup_inftl(void) -{ -deregister_mtd_blktrans (&inftl_tr); -} - -module_init (init_inftl); -module_exit (cleanup_inftl); +module_mtd_blktrans (inftl_tr);MODULE_LICENSE ("GPL" );MODULE_AUTHOR ("Greg Ungerer <[email protected]>, David Woodhouse <[email protected]>, Fabrice Bellard <[email protected]> et al." );
Signature · 6 lines
2.25.0 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
Re: [PATCH mtd/next 3/8] mtd: inftlcore: Use module_mtd_blktrans to register driver
Quoted 4 lines · Dejin Zheng
Removing some boilerplate by using
module_mtd_blktransinstead 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
PATCH 4/8 mtd: mtdblock: Use module_mtd_blktrans to register driver
In reply to Dejin ZhengRemoving some boilerplate by using module_mtd_blktrans instead of calling register and unregister in the otherwise empty init/exit functions.
--- drivers/mtd/mtdblock.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-)
drivers/mtd/mtdblock.c +1 -13
@@ -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." );
Signature · 6 lines
2.25.0 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
Re: [PATCH mtd/next 4/8] mtd: mtdblock: Use module_mtd_blktrans to register driver
Quoted 4 lines · Dejin Zheng
Removing some boilerplate by using
module_mtd_blktransinstead 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
PATCH 5/8 mtd: mtdblock_ro: Use module_mtd_blktrans to register driver
In reply to Dejin ZhengRemoving some boilerplate by using module_mtd_blktrans instead of calling register and unregister in the otherwise empty init/exit functions.
--- drivers/mtd/mtdblock_ro.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-)
drivers/mtd/mtdblock_ro.c +1 -12
@@ -67,18 +67,7 @@ static struct mtd_blktrans_ops mtdblock_tr = { .owner = THIS_MODULE, }; -static int __init mtdblock_init (void ) -{ -return register_mtd_blktrans (&mtdblock_tr); -} - -static void __exit mtdblock_exit(void) -{ -deregister_mtd_blktrans (&mtdblock_tr); -} - -module_init (mtdblock_init); -module_exit (mtdblock_exit); +module_mtd_blktrans (mtdblock_tr);MODULE_LICENSE ("GPL" );MODULE_AUTHOR ("David Woodhouse <[email protected]>" );
Signature · 6 lines
2.25.0 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
Re: [PATCH mtd/next 5/8] mtd: mtdblock_ro: Use module_mtd_blktrans to register driver
Quoted 4 lines · Dejin Zheng
Removing some boilerplate by using
module_mtd_blktransinstead 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
PATCH 6/8 mtd: mtdswap: Use module_mtd_blktrans to register driver
In reply to Dejin ZhengRemoving some boilerplate by using module_mtd_blktrans instead of calling register and unregister in the otherwise empty init/exit functions.
--- drivers/mtd/mtdswap.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-)
drivers/mtd/mtdswap.c +1 -13
@@ -1484,19 +1484,7 @@ static struct mtd_blktrans_ops mtdswap_ops = { .owner = THIS_MODULE, }; -static int __init mtdswap_modinit (void ) -{ -return register_mtd_blktrans (&mtdswap_ops); -} - -static void __exit mtdswap_modexit(void) -{ -deregister_mtd_blktrans (&mtdswap_ops); -} - -module_init (mtdswap_modinit); -module_exit (mtdswap_modexit); - +module_mtd_blktrans (mtdswap_ops);MODULE_LICENSE ("GPL" );MODULE_AUTHOR ("Jarkko Lavinen <[email protected]>" );
Signature · 6 lines
2.25.0 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
Re: [PATCH mtd/next 6/8] mtd: mtdswap: Use module_mtd_blktrans to register driver
Quoted 4 lines · Dejin Zheng
Removing some boilerplate by using
module_mtd_blktransinstead 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
PATCH 7/8 mtd: nftlcore: Use module_mtd_blktrans to register driver
In reply to Dejin ZhengRemoving some boilerplate by using module_mtd_blktrans instead of calling register and unregister in the otherwise empty init/exit functions.
--- drivers/mtd/nftlcore.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-)
drivers/mtd/nftlcore.c +1 -12
@@ -797,18 +797,7 @@ static struct mtd_blktrans_ops nftl_tr = { .owner = THIS_MODULE, }; -static int __init init_nftl (void ) -{ -return register_mtd_blktrans (&nftl_tr); -} - -static void __exit cleanup_nftl(void) -{ -deregister_mtd_blktrans (&nftl_tr); -} - -module_init (init_nftl); -module_exit (cleanup_nftl); +module_mtd_blktrans (nftl_tr);MODULE_LICENSE ("GPL" );MODULE_AUTHOR ("David Woodhouse <[email protected]>, Fabrice Bellard <[email protected]> et al." );
Signature · 6 lines
2.25.0 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
Re: [PATCH mtd/next 7/8] mtd: nftlcore: Use module_mtd_blktrans to register driver
Quoted 4 lines · Dejin Zheng
Removing some boilerplate by using
module_mtd_blktransinstead 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
PATCH 8/8 mtd: rfd_ftl: Use module_mtd_blktrans to register driver
In reply to Dejin ZhengRemoving some boilerplate by using module_mtd_blktrans instead of calling register and unregister in the otherwise empty init/exit functions.
--- drivers/mtd/rfd_ftl.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-)
drivers/mtd/rfd_ftl.c +1 -12
@@ -794,18 +794,7 @@ static struct mtd_blktrans_ops rfd_ftl_tr = { .owner = THIS_MODULE, }; -static int __init init_rfd_ftl (void ) -{ -return register_mtd_blktrans (&rfd_ftl_tr); -} - -static void __exit cleanup_rfd_ftl(void) -{ -deregister_mtd_blktrans (&rfd_ftl_tr); -} - -module_init (init_rfd_ftl); -module_exit (cleanup_rfd_ftl); +module_mtd_blktrans (rfd_ftl_tr);MODULE_LICENSE ("GPL" );MODULE_AUTHOR ("Sean Young <[email protected]>" );
Signature · 6 lines
2.25.0 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
Re: [PATCH mtd/next 8/8] mtd: rfd_ftl: Use module_mtd_blktrans to register driver
Quoted 4 lines · Dejin Zheng
Removing some boilerplate by using
module_mtd_blktransinstead 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