diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2020-08-28 13:27:52 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2020-10-01 08:32:19 +0200 |
commit | 13f237e2d84c875d9f4bcbdfe513a18a269ceaee (patch) | |
tree | 29f527ac7038d43c95e29f605af681cece3f670e /include | |
parent | 788619897249e6ad55f2d879cbea58e737852372 (diff) | |
download | barebox-13f237e2d84c875d9f4bcbdfe513a18a269ceaee.tar.gz barebox-13f237e2d84c875d9f4bcbdfe513a18a269ceaee.tar.xz |
net: phy: Add and use driver register macro
Add driver registration macros for phy drivers similar to the existing
platform device macros. This also changes the initcall level from
fs_initcall to device_initcall for the phy drivers. It is not clear
why the phy driver have been at fs_initcall in the first place, changing
it shouldn't be a problem.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/phy.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/include/linux/phy.h b/include/linux/phy.h index cdcb7c24f2..a4cda3e28d 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -284,6 +284,26 @@ struct phy_device *get_phy_device(struct mii_bus *bus, int addr); int phy_init(void); int phy_init_hw(struct phy_device *phydev); +#define phy_register_drivers_macro(level, drvs) \ + static int __init drvs##_register(void) \ + { \ + return phy_drivers_register(drvs, ARRAY_SIZE(drvs)); \ + } \ + level##_initcall(drvs##_register) + +#define device_phy_drivers(drvs) \ + phy_register_drivers_macro(device, drvs) + +#define phy_register_driver_macro(level, drv) \ + static int __init drv##_register(void) \ + { \ + return phy_driver_register(&drv); \ + } \ + level##_initcall(drv##_register) + +#define device_phy_driver(drv) \ + phy_register_driver_macro(device, drv) + int phy_save_page(struct phy_device *phydev); int phy_select_page(struct phy_device *phydev, int page); int phy_restore_page(struct phy_device *phydev, int oldpage, int ret); |