From: Dejin Zheng <zhengdejin5@gmail.com> To: miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com, nixiaoming@huawei.com Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Dejin Zheng <zhengdejin5@gmail.com> Subject: [PATCH mtd/next 1/8] mtd: Add helper macro for register_mtd_blktrans boilerplate Date: Sun, 14 Feb 2021 00:45:53 +0800 [thread overview] Message-ID: <20210213164600.409061-2-zhengdejin5@gmail.com> (raw) In-Reply-To: <20210213164600.409061-1-zhengdejin5@gmail.com> 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. Signed-off-by: Dejin Zheng <zhengdejin5@gmail.com> --- include/linux/mtd/blktrans.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/linux/mtd/blktrans.h b/include/linux/mtd/blktrans.h index 3c668cb1e344..15cc9b95e32b 100644 --- a/include/linux/mtd/blktrans.h +++ b/include/linux/mtd/blktrans.h @@ -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__ */ -- 2.25.0
WARNING: multiple messages have this Message-ID (diff)
From: Dejin Zheng <zhengdejin5@gmail.com> To: miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com, nixiaoming@huawei.com Cc: Dejin Zheng <zhengdejin5@gmail.com>, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH mtd/next 1/8] mtd: Add helper macro for register_mtd_blktrans boilerplate Date: Sun, 14 Feb 2021 00:45:53 +0800 [thread overview] Message-ID: <20210213164600.409061-2-zhengdejin5@gmail.com> (raw) In-Reply-To: <20210213164600.409061-1-zhengdejin5@gmail.com> 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. Signed-off-by: Dejin Zheng <zhengdejin5@gmail.com> --- include/linux/mtd/blktrans.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/linux/mtd/blktrans.h b/include/linux/mtd/blktrans.h index 3c668cb1e344..15cc9b95e32b 100644 --- a/include/linux/mtd/blktrans.h +++ b/include/linux/mtd/blktrans.h @@ -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__ */ -- 2.25.0 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
next prev parent reply other threads:[~2021-02-13 16:52 UTC|newest] Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-02-13 16:45 [PATCH mtd/next 0/8] Introduces the module_mtd_blktrans macro Dejin Zheng 2021-02-13 16:45 ` Dejin Zheng 2021-02-13 16:45 ` Dejin Zheng [this message] 2021-02-13 16:45 ` [PATCH mtd/next 1/8] mtd: Add helper macro for register_mtd_blktrans boilerplate Dejin Zheng 2021-03-02 17:14 ` Miquel Raynal 2021-03-02 17:14 ` Miquel Raynal 2021-02-13 16:45 ` [PATCH mtd/next 2/8] mtd: ftl: Use module_mtd_blktrans to register driver Dejin Zheng 2021-02-13 16:45 ` Dejin Zheng 2021-03-02 17:14 ` Miquel Raynal 2021-03-02 17:14 ` Miquel Raynal 2021-02-13 16:45 ` [PATCH mtd/next 3/8] mtd: inftlcore: " Dejin Zheng 2021-02-13 16:45 ` Dejin Zheng 2021-03-02 17:14 ` Miquel Raynal 2021-03-02 17:14 ` Miquel Raynal 2021-02-13 16:45 ` [PATCH mtd/next 4/8] mtd: mtdblock: " Dejin Zheng 2021-02-13 16:45 ` Dejin Zheng 2021-03-02 17:14 ` Miquel Raynal 2021-03-02 17:14 ` Miquel Raynal 2021-02-13 16:45 ` [PATCH mtd/next 5/8] mtd: mtdblock_ro: " Dejin Zheng 2021-02-13 16:45 ` Dejin Zheng 2021-03-02 17:14 ` Miquel Raynal 2021-03-02 17:14 ` Miquel Raynal 2021-02-13 16:45 ` [PATCH mtd/next 6/8] mtd: mtdswap: " Dejin Zheng 2021-02-13 16:45 ` Dejin Zheng 2021-03-02 17:14 ` Miquel Raynal 2021-03-02 17:14 ` Miquel Raynal 2021-02-13 16:45 ` [PATCH mtd/next 7/8] mtd: nftlcore: " Dejin Zheng 2021-02-13 16:45 ` Dejin Zheng 2021-03-02 17:14 ` Miquel Raynal 2021-03-02 17:14 ` Miquel Raynal 2021-02-13 16:46 ` [PATCH mtd/next 8/8] mtd: rfd_ftl: " Dejin Zheng 2021-02-13 16:46 ` Dejin Zheng 2021-03-02 17:14 ` Miquel Raynal 2021-03-02 17:14 ` Miquel Raynal
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20210213164600.409061-2-zhengdejin5@gmail.com \ --to=zhengdejin5@gmail.com \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-mtd@lists.infradead.org \ --cc=miquel.raynal@bootlin.com \ --cc=nixiaoming@huawei.com \ --cc=richard@nod.at \ --cc=vigneshr@ti.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.