]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net: mdio: use macro module_driver to avoid boilerplate code
authorHeiner Kallweit <hkallweit1@gmail.com>
Mon, 13 Oct 2025 20:50:27 +0000 (22:50 +0200)
committerJakub Kicinski <kuba@kernel.org>
Wed, 15 Oct 2025 02:16:13 +0000 (19:16 -0700)
Use macro module_driver to avoid boilerplate code.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Link: https://patch.msgid.link/e5c37417-4984-4b57-8154-264deef61e0d@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
include/linux/mdio.h

index c640ba44dd6eed4cf9521aea1bff2cbf4cd1cea7..42d6d47e445b75e6d28c6c5896de6e6537b5cc7d 100644 (file)
@@ -689,16 +689,7 @@ struct phy_device *mdiobus_get_phy(struct mii_bus *bus, int addr);
  * init/exit. Each module may only use this macro once, and calling it
  * replaces module_init() and module_exit().
  */
-#define mdio_module_driver(_mdio_driver)                               \
-static int __init mdio_module_init(void)                               \
-{                                                                      \
-       return mdio_driver_register(&_mdio_driver);                     \
-}                                                                      \
-module_init(mdio_module_init);                                         \
-static void __exit mdio_module_exit(void)                              \
-{                                                                      \
-       mdio_driver_unregister(&_mdio_driver);                          \
-}                                                                      \
-module_exit(mdio_module_exit)
+#define mdio_module_driver(_mdio_driver) \
+       module_driver(_mdio_driver, mdio_driver_register, mdio_driver_unregister)
 
 #endif /* __LINUX_MDIO_H__ */