summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnsuel Smith <ansuelsmth@gmail.com>2021-11-22 16:23:43 +0100
committerDavid S. Miller <davem@davemloft.net>2021-11-22 15:35:16 +0000
commit36b8af12f424e7a7f60a935c60a0fd4aa0822378 (patch)
tree4b5e9f4e70ab49e9e1adc139a4cb5a8eccf6777a
parent994c28b6f971fa5db8ae977daea37eee87d93d51 (diff)
downloadlinux-36b8af12f424e7a7f60a935c60a0fd4aa0822378.tar.bz2
net: dsa: qca8k: move regmap init in probe and set it mandatory
In preparation for regmap conversion, move regmap init in the probe function and make it mandatory as any read/write/rmw operation will be converted to regmap API. Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com> Reviewed-by: Vladimir Oltean <olteanv@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/dsa/qca8k.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/net/dsa/qca8k.c b/drivers/net/dsa/qca8k.c
index ae02043a5207..f63a43291636 100644
--- a/drivers/net/dsa/qca8k.c
+++ b/drivers/net/dsa/qca8k.c
@@ -1086,12 +1086,6 @@ qca8k_setup(struct dsa_switch *ds)
if (ret)
return ret;
- /* Start by setting up the register mapping */
- priv->regmap = devm_regmap_init(ds->dev, NULL, priv,
- &qca8k_regmap_config);
- if (IS_ERR(priv->regmap))
- dev_warn(priv->dev, "regmap initialization failed");
-
ret = qca8k_setup_mdio_bus(priv);
if (ret)
return ret;
@@ -2073,6 +2067,14 @@ qca8k_sw_probe(struct mdio_device *mdiodev)
gpiod_set_value_cansleep(priv->reset_gpio, 0);
}
+ /* Start by setting up the register mapping */
+ priv->regmap = devm_regmap_init(&mdiodev->dev, NULL, priv,
+ &qca8k_regmap_config);
+ if (IS_ERR(priv->regmap)) {
+ dev_err(priv->dev, "regmap initialization failed");
+ return PTR_ERR(priv->regmap);
+ }
+
/* Check the detected switch id */
ret = qca8k_read_switch_id(priv);
if (ret)