net: pcs: xpcs: pass xpcs instead of xpcs->id to xpcs_find_compat()
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Fri, 4 Oct 2024 10:20:51 +0000 (11:20 +0100)
committerDavid S. Miller <davem@davemloft.net>
Wed, 9 Oct 2024 11:13:11 +0000 (12:13 +0100)
xpcs_find_compat() is now always passed xpcs->id. Rather than always
dereferencing this in the caller, move it into xpcs_find_compat(),
thus making this function consistent with most of the other xpcs
functions in taking an xpcs pointer.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/pcs/pcs-xpcs.c

index 4fbf7c816ed53bb52737272f7123521e115979db..8bde87ab971f6fe5b9300633e0d1d379ce604c69 100644 (file)
@@ -121,11 +121,11 @@ struct dw_xpcs_desc {
 };
 
 static const struct dw_xpcs_compat *
-xpcs_find_compat(const struct dw_xpcs_desc *desc, phy_interface_t interface)
+xpcs_find_compat(struct dw_xpcs *xpcs, phy_interface_t interface)
 {
        const struct dw_xpcs_compat *compat;
 
-       for (compat = desc->compat; compat->supported; compat++)
+       for (compat = xpcs->desc->compat; compat->supported; compat++)
                if (compat->interface == interface)
                        return compat;
 
@@ -136,7 +136,7 @@ int xpcs_get_an_mode(struct dw_xpcs *xpcs, phy_interface_t interface)
 {
        const struct dw_xpcs_compat *compat;
 
-       compat = xpcs_find_compat(xpcs->desc, interface);
+       compat = xpcs_find_compat(xpcs, interface);
        if (!compat)
                return -ENODEV;
 
@@ -548,7 +548,7 @@ static int xpcs_validate(struct phylink_pcs *pcs, unsigned long *supported,
        int i;
 
        xpcs = phylink_pcs_to_xpcs(pcs);
-       compat = xpcs_find_compat(xpcs->desc, state->interface);
+       compat = xpcs_find_compat(xpcs, state->interface);
        if (!compat)
                return -EINVAL;
 
@@ -620,7 +620,7 @@ static void xpcs_pre_config(struct phylink_pcs *pcs, phy_interface_t interface)
        if (!xpcs->need_reset)
                return;
 
-       compat = xpcs_find_compat(xpcs->desc, interface);
+       compat = xpcs_find_compat(xpcs, interface);
        if (!compat) {
                dev_err(&xpcs->mdiodev->dev, "unsupported interface %s\n",
                        phy_modes(interface));
@@ -810,7 +810,7 @@ static int xpcs_do_config(struct dw_xpcs *xpcs, phy_interface_t interface,
        const struct dw_xpcs_compat *compat;
        int ret;
 
-       compat = xpcs_find_compat(xpcs->desc, interface);
+       compat = xpcs_find_compat(xpcs, interface);
        if (!compat)
                return -ENODEV;
 
@@ -1074,7 +1074,7 @@ static void xpcs_get_state(struct phylink_pcs *pcs,
        const struct dw_xpcs_compat *compat;
        int ret;
 
-       compat = xpcs_find_compat(xpcs->desc, state->interface);
+       compat = xpcs_find_compat(xpcs, state->interface);
        if (!compat)
                return;