diff mbox series

[5.10.y-cip,02/15] pinctrl: renesas: rzg2l: Use dev_err_probe()

Message ID 20241002170712.655449-3-biju.das.jz@bp.renesas.com (mailing list archive)
State New
Headers show
Series Full duplex audio + RZ/G2UL DU support | expand

Commit Message

Biju Das Oct. 2, 2024, 5:06 p.m. UTC
commit f73f63b24491fa43641daf3b6162d2a451bd8481 upstream.

Replace dev_err()->dev_err_probe() to simpilfy probe
helper functions.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/20240728090421.7136-1-biju.das.jz@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/pinctrl/renesas/pinctrl-rzg2l.c | 37 +++++++++----------------
 1 file changed, 13 insertions(+), 24 deletions(-)

Comments

Nobuhiro Iwamatsu Oct. 3, 2024, 6:02 a.m. UTC | #1
Hi Biju Das,

> -----Original Message-----
> From: Biju Das <biju.das.jz@bp.renesas.com>
> Sent: Thursday, October 3, 2024 2:07 AM
> To: cip-dev@lists.cip-project.org; iwamatsu nobuhiro(岩松 信洋 ○DITC□
> DIT○OST) <nobuhiro1.iwamatsu@toshiba.co.jp>; Pavel Machek
> <pavel@denx.de>
> Cc: Biju Das <biju.das.jz@bp.renesas.com>; Lad Prabhakar
> <prabhakar.mahadev-lad.rj@bp.renesas.com>
> Subject: [PATCH 5.10.y-cip 02/15] pinctrl: renesas: rzg2l: Use dev_err_probe()
> 
> commit f73f63b24491fa43641daf3b6162d2a451bd8481 upstream.
> 
> Replace dev_err()->dev_err_probe() to simpilfy probe helper functions.
> 
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
> Link:
> https://lore.kernel.org/20240728090421.7136-1-biju.das.jz@bp.renesas.com
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> ---
>  drivers/pinctrl/renesas/pinctrl-rzg2l.c | 37 +++++++++----------------
>  1 file changed, 13 insertions(+), 24 deletions(-)
> 
> diff --git a/drivers/pinctrl/renesas/pinctrl-rzg2l.c
> b/drivers/pinctrl/renesas/pinctrl-rzg2l.c
> index c4d9bcb6f80f..7306a100153f 100644
> --- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c
> +++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c
> @@ -2200,16 +2200,13 @@ static int rzg2l_gpio_register(struct rzg2l_pinctrl
> *pctrl)
>  		return -EPROBE_DEFER;
> 
>  	ret = of_parse_phandle_with_fixed_args(np, "gpio-ranges", 3, 0,
> &of_args);
> -	if (ret) {
> -		dev_err(pctrl->dev, "Unable to parse gpio-ranges\n");
> -		return ret;
> -	}
> +	if (ret)
> +		return dev_err_probe(pctrl->dev, ret, "Unable to parse
> +gpio-ranges\n");
> 
>  	if (of_args.args[0] != 0 || of_args.args[1] != 0 ||
> -	    of_args.args[2] != pctrl->data->n_port_pins) {
> -		dev_err(pctrl->dev, "gpio-ranges does not match selected
> SOC\n");
> -		return -EINVAL;
> -	}
> +	    of_args.args[2] != pctrl->data->n_port_pins)
> +		return dev_err_probe(pctrl->dev, -EINVAL,
> +				     "gpio-ranges does not match selected
> SOC\n");
> 
>  	chip->names = pctrl->data->port_pins;
>  	chip->request = rzg2l_gpio_request;
> @@ -2241,10 +2238,8 @@ static int rzg2l_gpio_register(struct rzg2l_pinctrl
> *pctrl)
>  	pctrl->gpio_range.name = chip->label;
>  	pctrl->gpio_range.gc = chip;
>  	ret = devm_gpiochip_add_data(pctrl->dev, chip, pctrl);
> -	if (ret) {
> -		dev_err(pctrl->dev, "failed to add GPIO controller\n");
> -		return ret;
> -	}
> +	if (ret)
> +		return dev_err_probe(pctrl->dev, ret, "failed to add GPIO
> +controller\n");
> 
>  	dev_dbg(pctrl->dev, "Registered gpio controller\n");
> 
> @@ -2325,22 +2320,16 @@ static int rzg2l_pinctrl_register(struct rzg2l_pinctrl
> *pctrl)
> 
>  	ret = devm_pinctrl_register_and_init(pctrl->dev, &pctrl->desc, pctrl,
>  					     &pctrl->pctl);
> -	if (ret) {
> -		dev_err(pctrl->dev, "pinctrl registration failed\n");
> -		return ret;
> -	}
> +	if (ret)
> +		return dev_err_probe(pctrl->dev, ret, "pinctrl registration
> +failed\n");
> 
>  	ret = pinctrl_enable(pctrl->pctl);
> -	if (ret) {
> -		dev_err(pctrl->dev, "pinctrl enable failed\n");
> -		return ret;
> -	}
> +	if (ret)
> +		dev_err_probe(pctrl->dev, ret, "pinctrl enable failed\n");
> 

return dev_err_probe ?

Best regards,
  Nobuhiro
Biju Das Oct. 3, 2024, 6:16 a.m. UTC | #2
Hi Nobuhiro-San,

> -----Original Message-----
> From: nobuhiro1.iwamatsu@toshiba.co.jp <nobuhiro1.iwamatsu@toshiba.co.jp>
> Subject: RE: [PATCH 5.10.y-cip 02/15] pinctrl: renesas: rzg2l: Use dev_err_probe()
> 
> Hi Biju Das,
> 
> > -----Original Message-----
> > From: Biju Das <biju.das.jz@bp.renesas.com>
> > Sent: Thursday, October 3, 2024 2:07 AM
> > To: cip-dev@lists.cip-project.org; iwamatsu nobuhiro(岩松 信洋 ○DITC□
> > DIT○OST) <nobuhiro1.iwamatsu@toshiba.co.jp>; Pavel Machek
> > <pavel@denx.de>
> > Cc: Biju Das <biju.das.jz@bp.renesas.com>; Lad Prabhakar
> > <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > Subject: [PATCH 5.10.y-cip 02/15] pinctrl: renesas: rzg2l: Use
> > dev_err_probe()
> >
> > commit f73f63b24491fa43641daf3b6162d2a451bd8481 upstream.
> >
> > Replace dev_err()->dev_err_probe() to simpilfy probe helper functions.
> >
> > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > Link:
> > https://lore.kernel.org/20240728090421.7136-1-biju.das.jz@bp.renesas.c
> > om
> > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > ---
> >  drivers/pinctrl/renesas/pinctrl-rzg2l.c | 37
> > +++++++++----------------
> >  1 file changed, 13 insertions(+), 24 deletions(-)
> >
> > diff --git a/drivers/pinctrl/renesas/pinctrl-rzg2l.c
> > b/drivers/pinctrl/renesas/pinctrl-rzg2l.c
> > index c4d9bcb6f80f..7306a100153f 100644
> > --- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c
> > +++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c
> > @@ -2200,16 +2200,13 @@ static int rzg2l_gpio_register(struct
> > rzg2l_pinctrl
> > *pctrl)
> >  		return -EPROBE_DEFER;
> >
> >  	ret = of_parse_phandle_with_fixed_args(np, "gpio-ranges", 3, 0,
> > &of_args);
> > -	if (ret) {
> > -		dev_err(pctrl->dev, "Unable to parse gpio-ranges\n");
> > -		return ret;
> > -	}
> > +	if (ret)
> > +		return dev_err_probe(pctrl->dev, ret, "Unable to parse
> > +gpio-ranges\n");
> >
> >  	if (of_args.args[0] != 0 || of_args.args[1] != 0 ||
> > -	    of_args.args[2] != pctrl->data->n_port_pins) {
> > -		dev_err(pctrl->dev, "gpio-ranges does not match selected
> > SOC\n");
> > -		return -EINVAL;
> > -	}
> > +	    of_args.args[2] != pctrl->data->n_port_pins)
> > +		return dev_err_probe(pctrl->dev, -EINVAL,
> > +				     "gpio-ranges does not match selected
> > SOC\n");
> >
> >  	chip->names = pctrl->data->port_pins;
> >  	chip->request = rzg2l_gpio_request;
> > @@ -2241,10 +2238,8 @@ static int rzg2l_gpio_register(struct
> > rzg2l_pinctrl
> > *pctrl)
> >  	pctrl->gpio_range.name = chip->label;
> >  	pctrl->gpio_range.gc = chip;
> >  	ret = devm_gpiochip_add_data(pctrl->dev, chip, pctrl);
> > -	if (ret) {
> > -		dev_err(pctrl->dev, "failed to add GPIO controller\n");
> > -		return ret;
> > -	}
> > +	if (ret)
> > +		return dev_err_probe(pctrl->dev, ret, "failed to add GPIO
> > +controller\n");
> >
> >  	dev_dbg(pctrl->dev, "Registered gpio controller\n");
> >
> > @@ -2325,22 +2320,16 @@ static int rzg2l_pinctrl_register(struct
> > rzg2l_pinctrl
> > *pctrl)
> >
> >  	ret = devm_pinctrl_register_and_init(pctrl->dev, &pctrl->desc, pctrl,
> >  					     &pctrl->pctl);
> > -	if (ret) {
> > -		dev_err(pctrl->dev, "pinctrl registration failed\n");
> > -		return ret;
> > -	}
> > +	if (ret)
> > +		return dev_err_probe(pctrl->dev, ret, "pinctrl registration
> > +failed\n");
> >
> >  	ret = pinctrl_enable(pctrl->pctl);
> > -	if (ret) {
> > -		dev_err(pctrl->dev, "pinctrl enable failed\n");
> > -		return ret;
> > -	}
> > +	if (ret)
> > +		dev_err_probe(pctrl->dev, ret, "pinctrl enable failed\n");
> >
> 
> return dev_err_probe ?

Good catch. Please drop this patch. I will fix it in mainline and then backport.

Cheers,
Biju
diff mbox series

Patch

diff --git a/drivers/pinctrl/renesas/pinctrl-rzg2l.c b/drivers/pinctrl/renesas/pinctrl-rzg2l.c
index c4d9bcb6f80f..7306a100153f 100644
--- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c
+++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c
@@ -2200,16 +2200,13 @@  static int rzg2l_gpio_register(struct rzg2l_pinctrl *pctrl)
 		return -EPROBE_DEFER;
 
 	ret = of_parse_phandle_with_fixed_args(np, "gpio-ranges", 3, 0, &of_args);
-	if (ret) {
-		dev_err(pctrl->dev, "Unable to parse gpio-ranges\n");
-		return ret;
-	}
+	if (ret)
+		return dev_err_probe(pctrl->dev, ret, "Unable to parse gpio-ranges\n");
 
 	if (of_args.args[0] != 0 || of_args.args[1] != 0 ||
-	    of_args.args[2] != pctrl->data->n_port_pins) {
-		dev_err(pctrl->dev, "gpio-ranges does not match selected SOC\n");
-		return -EINVAL;
-	}
+	    of_args.args[2] != pctrl->data->n_port_pins)
+		return dev_err_probe(pctrl->dev, -EINVAL,
+				     "gpio-ranges does not match selected SOC\n");
 
 	chip->names = pctrl->data->port_pins;
 	chip->request = rzg2l_gpio_request;
@@ -2241,10 +2238,8 @@  static int rzg2l_gpio_register(struct rzg2l_pinctrl *pctrl)
 	pctrl->gpio_range.name = chip->label;
 	pctrl->gpio_range.gc = chip;
 	ret = devm_gpiochip_add_data(pctrl->dev, chip, pctrl);
-	if (ret) {
-		dev_err(pctrl->dev, "failed to add GPIO controller\n");
-		return ret;
-	}
+	if (ret)
+		return dev_err_probe(pctrl->dev, ret, "failed to add GPIO controller\n");
 
 	dev_dbg(pctrl->dev, "Registered gpio controller\n");
 
@@ -2325,22 +2320,16 @@  static int rzg2l_pinctrl_register(struct rzg2l_pinctrl *pctrl)
 
 	ret = devm_pinctrl_register_and_init(pctrl->dev, &pctrl->desc, pctrl,
 					     &pctrl->pctl);
-	if (ret) {
-		dev_err(pctrl->dev, "pinctrl registration failed\n");
-		return ret;
-	}
+	if (ret)
+		return dev_err_probe(pctrl->dev, ret, "pinctrl registration failed\n");
 
 	ret = pinctrl_enable(pctrl->pctl);
-	if (ret) {
-		dev_err(pctrl->dev, "pinctrl enable failed\n");
-		return ret;
-	}
+	if (ret)
+		dev_err_probe(pctrl->dev, ret, "pinctrl enable failed\n");
 
 	ret = rzg2l_gpio_register(pctrl);
-	if (ret) {
-		dev_err(pctrl->dev, "failed to add GPIO chip: %i\n", ret);
-		return ret;
-	}
+	if (ret)
+		return dev_err_probe(pctrl->dev, ret, "failed to add GPIO chip\n");
 
 	return 0;
 }