From: "Gan, Yi Fang" <yi.fang.gan@intel.com>
To: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Andrew Halaney" <ahalaney@redhat.com>,
"Javier Martinez Canillas" <javierm@redhat.com>,
"John Stultz" <jstultz@google.com>,
"Rafael J . Wysocki" <rafael@kernel.org>,
"Gan Yi Fang" <yi.fang.gan@intel.com>,
"Jens Axboe" <axboe@kernel.dk>,
"Russell King" <linux@armlinux.org.uk>,
"Andrew Lunn" <andrew@lunn.ch>,
"Heiner Kallweit" <hkallweit1@gmail.com>,
"David S . Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
"Jakub Kicinski" <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>,
"Marek Behún" <kabel@kernel.org>,
netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Cc: Looi Hong Aun <hong.aun.looi@intel.com>,
Voon Weifeng <weifeng.voon@intel.com>,
Song Yoong Siang <yoong.siang.song@intel.com>,
Lai Peter Jun Ann <peter.jun.ann.lai@intel.com>,
Choong Yong Liang <yong.liang.choong@intel.com>
Subject: [PATCH net v2 1/2] driver.h: add helper macro for module_exit() boilerplate
Date: Thu, 21 Dec 2023 16:51:08 +0800 [thread overview]
Message-ID: <20231221085109.2830794-2-yi.fang.gan@intel.com> (raw)
In-Reply-To: <20231221085109.2830794-1-yi.fang.gan@intel.com>
For the modules need a module_init() but don't need to do
anything special in module_exit() might need to have an empty
module_exit(). This patch add a new macro module_exit_stub() to
replace the empty module_exit(). The macro is useful to remove
the module_exit() boilerplate.
Cc: <stable@vger.kernel.org> # 6.1+
Suggested-by: Lobakin, Aleksander <aleksander.lobakin@intel.com>
Signed-off-by: Gan, Yi Fang <yi.fang.gan@intel.com>
---
include/linux/device/driver.h | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/include/linux/device/driver.h b/include/linux/device/driver.h
index 7738f458995f..7d322eef501e 100644
--- a/include/linux/device/driver.h
+++ b/include/linux/device/driver.h
@@ -288,4 +288,18 @@ static int __init __driver##_init(void) \
} \
device_initcall(__driver##_init);
+/**
+ * module_exit_stub() - Helper macro for drivers that have init but don't
+ * do anything in exit. This eliminates some boilerplate.
+ * Each module may only use this macro once, and calling it replaces
+ * module_exit().
+ *
+ * @__driver: driver name
+ */
+#define module_exit_stub(__driver) \
+static void __exit __driver##_exit(void) \
+{ \
+} \
+module_exit(__driver##_exit)
+
#endif /* _DEVICE_DRIVER_H_ */
--
2.34.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2023-12-21 8:55 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-21 8:51 [PATCH net v2 0/2] Fix phylink unloadable issue Gan, Yi Fang
2023-12-21 8:51 ` Gan, Yi Fang [this message]
2023-12-21 8:51 ` [PATCH net v2 2/2] net: phylink: Add module_exit_stub() Gan, Yi Fang
2023-12-21 9:22 ` Andrew Lunn
2024-01-04 9:45 ` Gan, Yi Fang
2024-01-04 13:00 ` Andrew Lunn
2023-12-21 9:11 ` [PATCH net v2 0/2] Fix phylink unloadable issue Greg Kroah-Hartman
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=20231221085109.2830794-2-yi.fang.gan@intel.com \
--to=yi.fang.gan@intel.com \
--cc=ahalaney@redhat.com \
--cc=andrew@lunn.ch \
--cc=axboe@kernel.dk \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=hkallweit1@gmail.com \
--cc=hong.aun.looi@intel.com \
--cc=javierm@redhat.com \
--cc=jstultz@google.com \
--cc=kabel@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=peter.jun.ann.lai@intel.com \
--cc=rafael@kernel.org \
--cc=weifeng.voon@intel.com \
--cc=yong.liang.choong@intel.com \
--cc=yoong.siang.song@intel.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