net: phy: bcm87xx: simplify .match_phy_device OP
authorChristian Marangi <ansuelsmth@gmail.com>
Sat, 17 May 2025 20:13:46 +0000 (22:13 +0200)
committerJakub Kicinski <kuba@kernel.org>
Wed, 21 May 2025 22:56:09 +0000 (15:56 -0700)
Simplify .match_phy_device OP by using a generic function and using the
new phy_id PHY driver info instead of hardcoding the matching PHY ID.

Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Link: https://patch.msgid.link/20250517201353.5137-3-ansuelsmth@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/phy/bcm87xx.c

index 1e1e2259fc2b5a86fb359e8e899f5c3b321e07d9..299f9a8f30f49cf11dad118e95da4a55d5046bc6 100644 (file)
@@ -185,16 +185,10 @@ static irqreturn_t bcm87xx_handle_interrupt(struct phy_device *phydev)
        return IRQ_HANDLED;
 }
 
-static int bcm8706_match_phy_device(struct phy_device *phydev,
+static int bcm87xx_match_phy_device(struct phy_device *phydev,
                                    const struct phy_driver *phydrv)
 {
-       return phydev->c45_ids.device_ids[4] == PHY_ID_BCM8706;
-}
-
-static int bcm8727_match_phy_device(struct phy_device *phydev,
-                                   const struct phy_driver *phydrv)
-{
-       return phydev->c45_ids.device_ids[4] == PHY_ID_BCM8727;
+       return phydev->c45_ids.device_ids[4] == phydrv->phy_id;
 }
 
 static struct phy_driver bcm87xx_driver[] = {
@@ -208,7 +202,7 @@ static struct phy_driver bcm87xx_driver[] = {
        .read_status    = bcm87xx_read_status,
        .config_intr    = bcm87xx_config_intr,
        .handle_interrupt = bcm87xx_handle_interrupt,
-       .match_phy_device = bcm8706_match_phy_device,
+       .match_phy_device = bcm87xx_match_phy_device,
 }, {
        .phy_id         = PHY_ID_BCM8727,
        .phy_id_mask    = 0xffffffff,
@@ -219,7 +213,7 @@ static struct phy_driver bcm87xx_driver[] = {
        .read_status    = bcm87xx_read_status,
        .config_intr    = bcm87xx_config_intr,
        .handle_interrupt = bcm87xx_handle_interrupt,
-       .match_phy_device = bcm8727_match_phy_device,
+       .match_phy_device = bcm87xx_match_phy_device,
 } };
 
 module_phy_driver(bcm87xx_driver);