From: Harshal Chaudhari <harshalchau04@gmail.com>
To: derek.kiernan@xilinx.com, dragan.cvetic@xilinx.com,
arnd@arndb.de, gregkh@linuxfoundation.org,
michal.simek@xilinx.com
Cc: linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, harshalchau04@gmail.com
Subject: [PATCH] Driver: Adding helper macro for platform_driver boilerplate.
Date: Sat, 9 May 2020 15:37:16 +0530 [thread overview]
Message-ID: <20200509100716.11044-1-harshalchau04@gmail.com> (raw)
From: Harshal <harshalchau04@gmail.com>
For simple module that contain a single platform_driver without any additional setup code then ends up being a block
of duplicated boilerplate.
This patch add a new micro, module_platform_driver(), which replace the module_init()/module_exit() registrations
with template functions.
Signed-off-by: harshal chaudhari <harshalchau04@gmail.com>
---
drivers/misc/xilinx_sdfec.c | 20 +-------------------
1 file changed, 1 insertion(+), 19 deletions(-)
diff --git a/drivers/misc/xilinx_sdfec.c b/drivers/misc/xilinx_sdfec.c
index 71bbaa56bdb5..db16a42c66f4 100644
--- a/drivers/misc/xilinx_sdfec.c
+++ b/drivers/misc/xilinx_sdfec.c
@@ -1484,25 +1484,7 @@ static struct platform_driver xsdfec_driver = {
.remove = xsdfec_remove,
};
-static int __init xsdfec_init(void)
-{
- int err;
-
- err = platform_driver_register(&xsdfec_driver);
- if (err < 0) {
- pr_err("%s Unabled to register SDFEC driver", __func__);
- return err;
- }
- return 0;
-}
-
-static void __exit xsdfec_exit(void)
-{
- platform_driver_unregister(&xsdfec_driver);
-}
-
-module_init(xsdfec_init);
-module_exit(xsdfec_exit);
+module_platform_driver(xsdfec_driver);
MODULE_AUTHOR("Xilinx, Inc");
MODULE_DESCRIPTION("Xilinx SD-FEC16 Driver");
--
2.17.1
next reply other threads:[~2020-05-09 10:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-09 10:07 Harshal Chaudhari [this message]
2020-05-09 17:05 ` Greg KH
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=20200509100716.11044-1-harshalchau04@gmail.com \
--to=harshalchau04@gmail.com \
--cc=arnd@arndb.de \
--cc=derek.kiernan@xilinx.com \
--cc=dragan.cvetic@xilinx.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.simek@xilinx.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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®