]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
net: dsa: mv88e6xxx: pass directly chip structure to mv88e6xxx_phy_is_internal
authorAlexis Lothoré <alexis.lothore@bootlin.com>
Mon, 29 May 2023 08:02:41 +0000 (10:02 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 2 May 2025 05:46:50 +0000 (07:46 +0200)
[ Upstream commit ca345931907ff1893f02f5fe1349b16c9fc27e4c ]

Since this function is a simple helper, we do not need to pass a full
dsa_switch structure, we can directly pass the mv88e6xxx_chip structure.
Doing so will allow to share this function with any other function
not manipulating dsa_switch structure but needing info about number of
internal phys

Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Stable-dep-of: 52fdc41c3278 ("net: dsa: mv88e6xxx: fix internal PHYs for 6320 family")
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/dsa/mv88e6xxx/chip.c

index b3744f2ea0f481fc3422c6af99d62c3fb473fd46..cabf97a902b52f46af46e5c271a7eaa91ea2ce1f 100644 (file)
@@ -470,10 +470,8 @@ restore_link:
        return err;
 }
 
-static int mv88e6xxx_phy_is_internal(struct dsa_switch *ds, int port)
+static int mv88e6xxx_phy_is_internal(struct mv88e6xxx_chip *chip, int port)
 {
-       struct mv88e6xxx_chip *chip = ds->priv;
-
        return port < chip->info->num_internal_phys;
 }
 
@@ -591,7 +589,7 @@ static void mv88e6095_phylink_get_caps(struct mv88e6xxx_chip *chip, int port,
 
        config->mac_capabilities = MAC_SYM_PAUSE | MAC_10 | MAC_100;
 
-       if (mv88e6xxx_phy_is_internal(chip->ds, port)) {
+       if (mv88e6xxx_phy_is_internal(chip, port)) {
                __set_bit(PHY_INTERFACE_MODE_MII, config->supported_interfaces);
        } else {
                if (cmode < ARRAY_SIZE(mv88e6185_phy_interface_modes) &&
@@ -839,7 +837,7 @@ static void mv88e6xxx_get_caps(struct dsa_switch *ds, int port,
        chip->info->ops->phylink_get_caps(chip, port, config);
        mv88e6xxx_reg_unlock(chip);
 
-       if (mv88e6xxx_phy_is_internal(ds, port)) {
+       if (mv88e6xxx_phy_is_internal(chip, port)) {
                __set_bit(PHY_INTERFACE_MODE_INTERNAL,
                          config->supported_interfaces);
                /* Internal ports with no phy-mode need GMII for PHYLIB */
@@ -879,7 +877,7 @@ static void mv88e6xxx_mac_config(struct dsa_switch *ds, int port,
 
        mv88e6xxx_reg_lock(chip);
 
-       if (mode != MLO_AN_PHY || !mv88e6xxx_phy_is_internal(ds, port)) {
+       if (mode != MLO_AN_PHY || !mv88e6xxx_phy_is_internal(chip, port)) {
                err = mv88e6xxx_port_config_interface(chip, port,
                                                      state->interface);
                if (err && err != -EOPNOTSUPP)