Do not issue "can't read the data register offset!" when gpio,syscon-dev
is not set albeit unneeded. gpio-syscon is used with rk3328 chip, but
this iomem region is documented in
Documentation/devicetree/bindings/gpio/rockchip,rk3328-grf-gpio.yaml and
does not require gpio,syscon-dev setting.
v3:
- moved from flag to parent regmap detection
Signed-off-by: Etienne Buira <[email protected]>
---
drivers/gpio/gpio-syscon.c | 27 ++++++++++++++++-----------
1 file changed, 16 insertions(+), 11 deletions(-)
diff --git a/drivers/gpio/gpio-syscon.c b/drivers/gpio/gpio-syscon.c
index 6e1a2581e6ae..3a90a3a1caea 100644
--- a/drivers/gpio/gpio-syscon.c
+++ b/drivers/gpio/gpio-syscon.c
@@ -208,6 +208,7 @@ static int syscon_gpio_probe(struct platform_device *pdev)
struct syscon_gpio_priv *priv;
struct device_node *np = dev->of_node;
int ret;
+ bool use_parent_regmap = false;
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
@@ -216,24 +217,28 @@ static int syscon_gpio_probe(struct platform_device *pdev)
priv->data = of_device_get_match_data(dev);
priv->syscon = syscon_regmap_lookup_by_phandle(np, "gpio,syscon-dev");
- if (IS_ERR(priv->syscon) && np->parent)
+ if (IS_ERR(priv->syscon) && np->parent) {
priv->syscon = syscon_node_to_regmap(np->parent);
+ use_parent_regmap = true;
+ }
if (IS_ERR(priv->syscon))
return PTR_ERR(priv->syscon);
- ret = of_property_read_u32_index(np, "gpio,syscon-dev", 1,
- &priv->dreg_offset);
- if (ret)
- dev_err(dev, "can't read the data register offset!\n");
+ if (!use_parent_regmap) {
+ ret = of_property_read_u32_index(np, "gpio,syscon-dev", 1,
+ &priv->dreg_offset);
+ if (ret)
+ dev_err(dev, "can't read the data register offset!\n");
- priv->dreg_offset <<= 3;
+ priv->dreg_offset <<= 3;
- ret = of_property_read_u32_index(np, "gpio,syscon-dev", 2,
- &priv->dir_reg_offset);
- if (ret)
- dev_dbg(dev, "can't read the dir register offset!\n");
+ ret = of_property_read_u32_index(np, "gpio,syscon-dev", 2,
+ &priv->dir_reg_offset);
+ if (ret)
+ dev_dbg(dev, "can't read the dir register offset!\n");
- priv->dir_reg_offset <<= 3;
+ priv->dir_reg_offset <<= 3;
+ }
priv->chip.parent = dev;
priv->chip.owner = THIS_MODULE;
base-commit: 4cece764965020c22cff7665b18a012006359095
--
2.43.0
On Mon, May 20, 2024 at 5:48 PM Etienne Buira <[email protected]> wrote:
> Do not issue "can't read the data register offset!" when gpio,syscon-dev
> is not set albeit unneeded. gpio-syscon is used with rk3328 chip, but
> this iomem region is documented in
> Documentation/devicetree/bindings/gpio/rockchip,rk3328-grf-gpio.yaml and
> does not require gpio,syscon-dev setting.
>
> v3:
> - moved from flag to parent regmap detection
>
> Signed-off-by: Etienne Buira <[email protected]>
Reviewed-by: Linus Walleij <[email protected]>
Yours,
Linus Walleij
From: Bartosz Golaszewski <[email protected]>
On Mon, 20 May 2024 17:47:03 +0200, Etienne Buira wrote:
> Do not issue "can't read the data register offset!" when gpio,syscon-dev
> is not set albeit unneeded. gpio-syscon is used with rk3328 chip, but
> this iomem region is documented in
> Documentation/devicetree/bindings/gpio/rockchip,rk3328-grf-gpio.yaml and
> does not require gpio,syscon-dev setting.
>
> v3:
> - moved from flag to parent regmap detection
>
> [...]
Applied, thanks!
[1/1] gpio-syscon: do not report bogus error
commit: ca09ce254a65fa0c09f3369724ee0477a7246247
Best regards,
--
Bartosz Golaszewski <[email protected]>
On Mon, May 20, 2024 at 5:48 PM Etienne Buira <[email protected]> wrote:
>
> Do not issue "can't read the data register offset!" when gpio,syscon-dev
> is not set albeit unneeded. gpio-syscon is used with rk3328 chip, but
> this iomem region is documented in
> Documentation/devicetree/bindings/gpio/rockchip,rk3328-grf-gpio.yaml and
> does not require gpio,syscon-dev setting.
>
> v3:
> - moved from flag to parent regmap detection
>
Don't make the changelog part of the commit message, please.
Bart
> Signed-off-by: Etienne Buira <[email protected]>
> ---
> drivers/gpio/gpio-syscon.c | 27 ++++++++++++++++-----------
> 1 file changed, 16 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/gpio/gpio-syscon.c b/drivers/gpio/gpio-syscon.c
> index 6e1a2581e6ae..3a90a3a1caea 100644
> --- a/drivers/gpio/gpio-syscon.c
> +++ b/drivers/gpio/gpio-syscon.c
> @@ -208,6 +208,7 @@ static int syscon_gpio_probe(struct platform_device *pdev)
> struct syscon_gpio_priv *priv;
> struct device_node *np = dev->of_node;
> int ret;
> + bool use_parent_regmap = false;
>
> priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
> if (!priv)
> @@ -216,24 +217,28 @@ static int syscon_gpio_probe(struct platform_device *pdev)
> priv->data = of_device_get_match_data(dev);
>
> priv->syscon = syscon_regmap_lookup_by_phandle(np, "gpio,syscon-dev");
> - if (IS_ERR(priv->syscon) && np->parent)
> + if (IS_ERR(priv->syscon) && np->parent) {
> priv->syscon = syscon_node_to_regmap(np->parent);
> + use_parent_regmap = true;
> + }
> if (IS_ERR(priv->syscon))
> return PTR_ERR(priv->syscon);
>
> - ret = of_property_read_u32_index(np, "gpio,syscon-dev", 1,
> - &priv->dreg_offset);
> - if (ret)
> - dev_err(dev, "can't read the data register offset!\n");
> + if (!use_parent_regmap) {
> + ret = of_property_read_u32_index(np, "gpio,syscon-dev", 1,
> + &priv->dreg_offset);
> + if (ret)
> + dev_err(dev, "can't read the data register offset!\n");
>
> - priv->dreg_offset <<= 3;
> + priv->dreg_offset <<= 3;
>
> - ret = of_property_read_u32_index(np, "gpio,syscon-dev", 2,
> - &priv->dir_reg_offset);
> - if (ret)
> - dev_dbg(dev, "can't read the dir register offset!\n");
> + ret = of_property_read_u32_index(np, "gpio,syscon-dev", 2,
> + &priv->dir_reg_offset);
> + if (ret)
> + dev_dbg(dev, "can't read the dir register offset!\n");
>
> - priv->dir_reg_offset <<= 3;
> + priv->dir_reg_offset <<= 3;
> + }
>
> priv->chip.parent = dev;
> priv->chip.owner = THIS_MODULE;
>
> base-commit: 4cece764965020c22cff7665b18a012006359095
> --
> 2.43.0
>