Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: phy: fixed: let fixed_phy_add always use addr 0 and remove return value

We have only two users of fixed_phy_add(), both use address 0 and
ignore the return value. So simplify fixed_phy_add() accordingly.

Whilst at it, constify the fixed_phy_status configs.

Note:
fixed_phy_add() is a legacy function which shouldn't be used in new
code, as it's use may be problematic:
- No check whether a fixed phy exists already at the given address
- If fixed_phy_register() is called afterwards by any other driver,
then it will also use phy_addr 0, because fixed_phy_add() ignores
the ida which manages address assignment
Drivers using a fixed phy created by fixed_phy_add() in platform code,
should dynamically create a fixed phy with fixed_phy_register()
instead.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Link: https://patch.msgid.link/762700e5-a0b1-41af-aa03-929822a39475@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Heiner Kallweit and committed by
Jakub Kicinski
39e94fdc 7e484a97

+8 -12
+2 -2
arch/m68k/coldfire/m5272.c
··· 108 108 * an ethernet switch. In this case we need to use the fixed phy type, 109 109 * and we need to declare it early in boot. 110 110 */ 111 - static struct fixed_phy_status nettel_fixed_phy_status __initdata = { 111 + static const struct fixed_phy_status nettel_fixed_phy_status __initconst = { 112 112 .link = 1, 113 113 .speed = 100, 114 114 .duplex = 0, ··· 119 119 static int __init init_BSP(void) 120 120 { 121 121 m5272_uarts_init(); 122 - fixed_phy_add(0, &nettel_fixed_phy_status); 122 + fixed_phy_add(&nettel_fixed_phy_status); 123 123 clkdev_add_table(m5272_clk_lookup, ARRAY_SIZE(m5272_clk_lookup)); 124 124 return 0; 125 125 }
+2 -2
arch/mips/bcm47xx/setup.c
··· 256 256 } 257 257 arch_initcall(bcm47xx_cpu_fixes); 258 258 259 - static struct fixed_phy_status bcm47xx_fixed_phy_status __initdata = { 259 + static const struct fixed_phy_status bcm47xx_fixed_phy_status __initconst = { 260 260 .link = 1, 261 261 .speed = SPEED_100, 262 262 .duplex = DUPLEX_FULL, ··· 282 282 bcm47xx_leds_register(); 283 283 bcm47xx_workarounds(); 284 284 285 - fixed_phy_add(0, &bcm47xx_fixed_phy_status); 285 + fixed_phy_add(&bcm47xx_fixed_phy_status); 286 286 return 0; 287 287 } 288 288 device_initcall(bcm47xx_register_bus_complete);
+2 -2
drivers/net/phy/fixed_phy.c
··· 158 158 return 0; 159 159 } 160 160 161 - int fixed_phy_add(int phy_addr, const struct fixed_phy_status *status) 161 + void fixed_phy_add(const struct fixed_phy_status *status) 162 162 { 163 - return fixed_phy_add_gpiod(PHY_POLL, phy_addr, status, NULL); 163 + fixed_phy_add_gpiod(PHY_POLL, 0, status, NULL); 164 164 } 165 165 EXPORT_SYMBOL_GPL(fixed_phy_add); 166 166
+2 -6
include/linux/phy_fixed.h
··· 17 17 18 18 #if IS_ENABLED(CONFIG_FIXED_PHY) 19 19 extern int fixed_phy_change_carrier(struct net_device *dev, bool new_carrier); 20 - int fixed_phy_add(int phy_id, const struct fixed_phy_status *status); 20 + void fixed_phy_add(const struct fixed_phy_status *status); 21 21 struct phy_device *fixed_phy_register(const struct fixed_phy_status *status, 22 22 struct device_node *np); 23 23 ··· 26 26 int (*link_update)(struct net_device *, 27 27 struct fixed_phy_status *)); 28 28 #else 29 - static inline int fixed_phy_add(int phy_id, 30 - const struct fixed_phy_status *status) 31 - { 32 - return -ENODEV; 33 - } 29 + static inline void fixed_phy_add(const struct fixed_phy_status *status) {} 34 30 static inline struct phy_device * 35 31 fixed_phy_register(const struct fixed_phy_status *status, 36 32 struct device_node *np)