1 From 36b8af12f424e7a7f60a935c60a0fd4aa0822378 Mon Sep 17 00:00:00 2001
2 From: Ansuel Smith <ansuelsmth@gmail.com>
3 Date: Mon, 22 Nov 2021 16:23:43 +0100
4 Subject: net: dsa: qca8k: move regmap init in probe and set it mandatory
6 In preparation for regmap conversion, move regmap init in the probe
7 function and make it mandatory as any read/write/rmw operation will be
8 converted to regmap API.
10 Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
11 Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
12 Signed-off-by: David S. Miller <davem@davemloft.net>
14 drivers/net/dsa/qca8k.c | 14 ++++++++------
15 1 file changed, 8 insertions(+), 6 deletions(-)
17 diff --git a/drivers/net/dsa/qca8k.c b/drivers/net/dsa/qca8k.c
18 index ae02043a52079..f63a432916360 100644
19 --- a/drivers/net/dsa/qca8k.c
20 +++ b/drivers/net/dsa/qca8k.c
21 @@ -1086,12 +1086,6 @@ qca8k_setup(struct dsa_switch *ds)
25 - /* Start by setting up the register mapping */
26 - priv->regmap = devm_regmap_init(ds->dev, NULL, priv,
27 - &qca8k_regmap_config);
28 - if (IS_ERR(priv->regmap))
29 - dev_warn(priv->dev, "regmap initialization failed");
31 ret = qca8k_setup_mdio_bus(priv);
34 @@ -2073,6 +2067,14 @@ qca8k_sw_probe(struct mdio_device *mdiodev)
35 gpiod_set_value_cansleep(priv->reset_gpio, 0);
38 + /* Start by setting up the register mapping */
39 + priv->regmap = devm_regmap_init(&mdiodev->dev, NULL, priv,
40 + &qca8k_regmap_config);
41 + if (IS_ERR(priv->regmap)) {
42 + dev_err(priv->dev, "regmap initialization failed");
43 + return PTR_ERR(priv->regmap);
46 /* Check the detected switch id */
47 ret = qca8k_read_switch_id(priv);