Message ID | 20240104140037.374166-9-vladimir.oltean@nxp.com (mailing list archive) |
---|---|
State | Accepted |
Commit | c4a1cefdf3bceb69359bddb997bf593717465ea1 |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | ds->user_mii_bus cleanup (part 1) | expand |
On Thu, Jan 04, 2024 at 04:00:35PM +0200, Vladimir Oltean wrote: > Accessed either through priv->dev or ds->dev, it is the same device > structure. Keep a single variable which holds a reference to it, and use > it consistently. > > Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Reviewed-by: Alvin Šipraga <alsi@bang-olufsen.dk> > --- > drivers/net/dsa/qca/qca8k-8xxx.c | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-)
On 1/4/24 06:00, Vladimir Oltean wrote: > Accessed either through priv->dev or ds->dev, it is the same device > structure. Keep a single variable which holds a reference to it, and use > it consistently. > > Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
On Thu, Jan 04, 2024 at 04:00:35PM +0200, Vladimir Oltean wrote: > Accessed either through priv->dev or ds->dev, it is the same device > structure. Keep a single variable which holds a reference to it, and use > it consistently. > > Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Reviewed-by: Christian Marangi <ansuelsmth@gmail.com>
> Accessed either through priv->dev or ds->dev, it is the same device > structure. Keep a single variable which holds a reference to it, and use > it consistently. > > Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Reviewed-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
diff --git a/drivers/net/dsa/qca/qca8k-8xxx.c b/drivers/net/dsa/qca/qca8k-8xxx.c index f12bdb30796f..c51f40960961 100644 --- a/drivers/net/dsa/qca/qca8k-8xxx.c +++ b/drivers/net/dsa/qca/qca8k-8xxx.c @@ -947,15 +947,16 @@ static int qca8k_mdio_register(struct qca8k_priv *priv) { struct dsa_switch *ds = priv->ds; + struct device *dev = ds->dev; struct device_node *mdio; struct mii_bus *bus; int err = 0; - mdio = of_get_child_by_name(priv->dev->of_node, "mdio"); + mdio = of_get_child_by_name(dev->of_node, "mdio"); if (mdio && !of_device_is_available(mdio)) goto out; - bus = devm_mdiobus_alloc(ds->dev); + bus = devm_mdiobus_alloc(dev); if (!bus) { err = -ENOMEM; goto out_put_node; @@ -965,7 +966,7 @@ qca8k_mdio_register(struct qca8k_priv *priv) bus->priv = (void *)priv; snprintf(bus->id, MII_BUS_ID_SIZE, "qca8k-%d.%d", ds->dst->index, ds->index); - bus->parent = ds->dev; + bus->parent = dev; if (mdio) { /* Check if the device tree declares the port:phy mapping */ @@ -983,7 +984,7 @@ qca8k_mdio_register(struct qca8k_priv *priv) bus->write = qca8k_legacy_mdio_write; } - err = devm_of_mdiobus_register(priv->dev, bus, mdio); + err = devm_of_mdiobus_register(dev, bus, mdio); out_put_node: of_node_put(mdio);
Accessed either through priv->dev or ds->dev, it is the same device structure. Keep a single variable which holds a reference to it, and use it consistently. Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> --- drivers/net/dsa/qca/qca8k-8xxx.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)