From: Heiner Kallweit Date: Mon, 13 Oct 2025 20:50:27 +0000 (+0200) Subject: net: mdio: use macro module_driver to avoid boilerplate code X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=10c4b4f60f5d0dbd29fa819be76e888501c7b729;p=thirdparty%2Fkernel%2Flinux.git net: mdio: use macro module_driver to avoid boilerplate code Use macro module_driver to avoid boilerplate code. Signed-off-by: Heiner Kallweit Link: https://patch.msgid.link/e5c37417-4984-4b57-8154-264deef61e0d@gmail.com Signed-off-by: Jakub Kicinski --- diff --git a/include/linux/mdio.h b/include/linux/mdio.h index c640ba44dd6ee..42d6d47e445b7 100644 --- a/include/linux/mdio.h +++ b/include/linux/mdio.h @@ -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__ */