1
0

Merge branch 'net-phy-fixed_phy-simplifications-and-improvements'

Heiner Kallweit says:

====================
net: phy: fixed_phy: simplifications and improvements

This series includes two types of changes:
- All callers pass PHY_POLL, therefore remove irq argument
- constify the passed struct fixed_phy_status *status
====================

Link: https://patch.msgid.link/4d4c468e-300d-42c7-92a1-eabbdb6be748@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Jakub Kicinski
2025-05-20 18:17:45 -07:00
10 changed files with 21 additions and 25 deletions

View File

@@ -119,7 +119,7 @@ static struct fixed_phy_status nettel_fixed_phy_status __initdata = {
static int __init init_BSP(void)
{
m5272_uarts_init();
fixed_phy_add(PHY_POLL, 0, &nettel_fixed_phy_status);
fixed_phy_add(0, &nettel_fixed_phy_status);
clkdev_add_table(m5272_clk_lookup, ARRAY_SIZE(m5272_clk_lookup));
return 0;
}

View File

@@ -282,7 +282,7 @@ static int __init bcm47xx_register_bus_complete(void)
bcm47xx_leds_register();
bcm47xx_workarounds();
fixed_phy_add(PHY_POLL, 0, &bcm47xx_fixed_phy_status);
fixed_phy_add(0, &bcm47xx_fixed_phy_status);
return 0;
}
device_initcall(bcm47xx_register_bus_complete);

View File

@@ -405,7 +405,7 @@ static int __init dsa_loop_init(void)
unsigned int i, ret;
for (i = 0; i < NUM_FIXED_PHYS; i++)
phydevs[i] = fixed_phy_register(PHY_POLL, &status, NULL);
phydevs[i] = fixed_phy_register(&status, NULL);
ret = mdio_driver_register(&dsa_loop_drv);
if (ret)

View File

@@ -1446,7 +1446,7 @@ int bgmac_phy_connect_direct(struct bgmac *bgmac)
struct phy_device *phy_dev;
int err;
phy_dev = fixed_phy_register(PHY_POLL, &fphy_status, NULL);
phy_dev = fixed_phy_register(&fphy_status, NULL);
if (IS_ERR(phy_dev)) {
dev_err(bgmac->dev, "Failed to register fixed PHY device\n");
return PTR_ERR(phy_dev);

View File

@@ -625,7 +625,7 @@ static int bcmgenet_mii_pd_init(struct bcmgenet_priv *priv)
.asym_pause = 0,
};
phydev = fixed_phy_register(PHY_POLL, &fphy_status, NULL);
phydev = fixed_phy_register(&fphy_status, NULL);
if (IS_ERR(phydev)) {
dev_err(kdev, "failed to register fixed PHY device\n");
return PTR_ERR(phydev);

View File

@@ -1906,7 +1906,7 @@ static int ftgmac100_probe(struct platform_device *pdev)
goto err_phy_connect;
}
phydev = fixed_phy_register(PHY_POLL, &ncsi_phy_status, np);
phydev = fixed_phy_register(&ncsi_phy_status, np);
if (IS_ERR(phydev)) {
dev_err(&pdev->dev, "failed to register fixed PHY device\n");
err = PTR_ERR(phydev);

View File

@@ -458,7 +458,7 @@ int of_phy_register_fixed_link(struct device_node *np)
return -ENODEV;
register_phy:
return PTR_ERR_OR_ZERO(fixed_phy_register(PHY_POLL, &status, np));
return PTR_ERR_OR_ZERO(fixed_phy_register(&status, np));
}
EXPORT_SYMBOL(of_phy_register_fixed_link);

View File

@@ -131,7 +131,7 @@ int fixed_phy_set_link_update(struct phy_device *phydev,
EXPORT_SYMBOL_GPL(fixed_phy_set_link_update);
static int fixed_phy_add_gpiod(unsigned int irq, int phy_addr,
struct fixed_phy_status *status,
const struct fixed_phy_status *status,
struct gpio_desc *gpiod)
{
int ret;
@@ -160,10 +160,9 @@ static int fixed_phy_add_gpiod(unsigned int irq, int phy_addr,
return 0;
}
int fixed_phy_add(unsigned int irq, int phy_addr,
struct fixed_phy_status *status)
int fixed_phy_add(int phy_addr, const struct fixed_phy_status *status)
{
return fixed_phy_add_gpiod(irq, phy_addr, status, NULL);
return fixed_phy_add_gpiod(PHY_POLL, phy_addr, status, NULL);
}
EXPORT_SYMBOL_GPL(fixed_phy_add);
@@ -223,8 +222,7 @@ static struct gpio_desc *fixed_phy_get_gpiod(struct device_node *np)
}
#endif
struct phy_device *fixed_phy_register(unsigned int irq,
struct fixed_phy_status *status,
struct phy_device *fixed_phy_register(const struct fixed_phy_status *status,
struct device_node *np)
{
struct fixed_mdio_bus *fmb = &platform_fmb;
@@ -246,7 +244,7 @@ struct phy_device *fixed_phy_register(unsigned int irq,
if (phy_addr < 0)
return ERR_PTR(phy_addr);
ret = fixed_phy_add_gpiod(irq, phy_addr, status, gpiod);
ret = fixed_phy_add_gpiod(PHY_POLL, phy_addr, status, gpiod);
if (ret < 0) {
ida_free(&phy_fixed_ida, phy_addr);
return ERR_PTR(ret);

View File

@@ -2640,7 +2640,7 @@ static struct phy_device *lan78xx_register_fixed_phy(struct lan78xx_net *dev)
netdev_info(dev->net,
"No PHY found on LAN7801 registering fixed PHY (e.g. EVB-KSZ9897-1)\n");
return fixed_phy_register(PHY_POLL, &fphy_status, NULL);
return fixed_phy_register(&fphy_status, NULL);
}
/**

View File

@@ -17,25 +17,23 @@ struct net_device;
#if IS_ENABLED(CONFIG_FIXED_PHY)
extern int fixed_phy_change_carrier(struct net_device *dev, bool new_carrier);
extern int fixed_phy_add(unsigned int irq, int phy_id,
struct fixed_phy_status *status);
extern struct phy_device *fixed_phy_register(unsigned int irq,
struct fixed_phy_status *status,
struct device_node *np);
int fixed_phy_add(int phy_id, const struct fixed_phy_status *status);
struct phy_device *fixed_phy_register(const struct fixed_phy_status *status,
struct device_node *np);
extern void fixed_phy_unregister(struct phy_device *phydev);
extern int fixed_phy_set_link_update(struct phy_device *phydev,
int (*link_update)(struct net_device *,
struct fixed_phy_status *));
#else
static inline int fixed_phy_add(unsigned int irq, int phy_id,
struct fixed_phy_status *status)
static inline int fixed_phy_add(int phy_id,
const struct fixed_phy_status *status)
{
return -ENODEV;
}
static inline struct phy_device *fixed_phy_register(unsigned int irq,
struct fixed_phy_status *status,
struct device_node *np)
static inline struct phy_device *
fixed_phy_register(const struct fixed_phy_status *status,
struct device_node *np)
{
return ERR_PTR(-ENODEV);
}