Skip to content

Commit

Permalink
Merge branch 'net-phy-fixed_phy-simplifications-and-improvements'
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jakub Kicinski committed May 21, 2025
2 parents 4c2bd79 + 4ba1c5b commit 04ff99f
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 25 deletions.
2 changes: 1 addition & 1 deletion arch/m68k/coldfire/m5272.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/bcm47xx/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
2 changes: 1 addition & 1 deletion drivers/net/dsa/dsa_loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/broadcom/bgmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/broadcom/genet/bcmmii.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/faraday/ftgmac100.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/mdio/of_mdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
12 changes: 5 additions & 7 deletions drivers/net/phy/fixed_phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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;
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/usb/lan78xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down
18 changes: 8 additions & 10 deletions include/linux/phy_fixed.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 04ff99f

Please sign in to comment.