756-net-next-net-dsa-qca8k-move-regmap-init-in-probe-and-set-it.patch 1.5 KB

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