Commit ca345931 authored by Alexis Lothoré's avatar Alexis Lothoré Committed by Jakub Kicinski
Browse files

net: dsa: mv88e6xxx: pass directly chip structure to mv88e6xxx_phy_is_internal



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: default avatarAlexis Lothoré <alexis.lothore@bootlin.com>
Reviewed-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 9229a948
Loading
Loading
Loading
Loading
+4 −6
Original line number Diff line number Diff line
@@ -463,10 +463,8 @@ static int mv88e6xxx_port_setup_mac(struct mv88e6xxx_chip *chip, int port,
	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;
}

@@ -584,7 +582,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) &&
@@ -832,7 +830,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 */
@@ -872,7 +870,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)