Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: dsa: qca8k: use "dev" consistently within qca8k_mdio_register()

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>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Reviewed-by: Christian Marangi <ansuelsmth@gmail.com>
Reviewed-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Vladimir Oltean and committed by
David S. Miller
c4a1cefd 5c5d6b34

+5 -4
+5 -4
drivers/net/dsa/qca/qca8k-8xxx.c
··· 947 947 qca8k_mdio_register(struct qca8k_priv *priv) 948 948 { 949 949 struct dsa_switch *ds = priv->ds; 950 + struct device *dev = ds->dev; 950 951 struct device_node *mdio; 951 952 struct mii_bus *bus; 952 953 int err = 0; 953 954 954 - mdio = of_get_child_by_name(priv->dev->of_node, "mdio"); 955 + mdio = of_get_child_by_name(dev->of_node, "mdio"); 955 956 if (mdio && !of_device_is_available(mdio)) 956 957 goto out; 957 958 958 - bus = devm_mdiobus_alloc(ds->dev); 959 + bus = devm_mdiobus_alloc(dev); 959 960 if (!bus) { 960 961 err = -ENOMEM; 961 962 goto out_put_node; ··· 966 965 bus->priv = (void *)priv; 967 966 snprintf(bus->id, MII_BUS_ID_SIZE, "qca8k-%d.%d", 968 967 ds->dst->index, ds->index); 969 - bus->parent = ds->dev; 968 + bus->parent = dev; 970 969 971 970 if (mdio) { 972 971 /* Check if the device tree declares the port:phy mapping */ ··· 984 983 bus->write = qca8k_legacy_mdio_write; 985 984 } 986 985 987 - err = devm_of_mdiobus_register(priv->dev, bus, mdio); 986 + err = devm_of_mdiobus_register(dev, bus, mdio); 988 987 989 988 out_put_node: 990 989 of_node_put(mdio);