2022-06-10 09:06:57

by Serge Semin

[permalink] [raw]
Subject: [PATCH 1/2] bus: bt1-apb: Don't print error on -EPROBE_DEFER

The Baikal-T1 APB bus driver correctly handles the deferred probe
situation, but still pollutes the system log with a misleading error
message. Let's fix that by using the dev_err_probe() method to print the
log message in case of the clocks/resets request errors.

Signed-off-by: Serge Semin <[email protected]>
---
drivers/bus/bt1-apb.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/bus/bt1-apb.c b/drivers/bus/bt1-apb.c
index b25ff941e7c7..ac13b5b97107 100644
--- a/drivers/bus/bt1-apb.c
+++ b/drivers/bus/bt1-apb.c
@@ -176,7 +176,8 @@ static int bt1_apb_request_rst(struct bt1_apb *apb)

apb->prst = devm_reset_control_get_optional_exclusive(apb->dev, "prst");
if (IS_ERR(apb->prst)) {
- dev_warn(apb->dev, "Couldn't get reset control line\n");
+ dev_err_probe(apb->dev, PTR_ERR(apb->prst),
+ "Couldn't get reset control line\n");
return PTR_ERR(apb->prst);
}

@@ -200,7 +201,8 @@ static int bt1_apb_request_clk(struct bt1_apb *apb)

apb->pclk = devm_clk_get(apb->dev, "pclk");
if (IS_ERR(apb->pclk)) {
- dev_err(apb->dev, "Couldn't get APB clock descriptor\n");
+ dev_err_probe(apb->dev, PTR_ERR(apb->pclk),
+ "Couldn't get APB clock descriptor\n");
return PTR_ERR(apb->pclk);
}

--
2.35.1


2022-06-10 09:09:02

by Serge Semin

[permalink] [raw]
Subject: [PATCH 2/2] bus: bt1-axi: Don't print error on -EPROBE_DEFER

The Baikal-T1 AXI bus driver correctly handles the deferred probe
situation, but still pollutes the system log with a misleading error
message. Let's fix that by using the dev_err_probe() method to print the
log message in case of the clocks/resets request errors.

Signed-off-by: Serge Semin <[email protected]>
---
drivers/bus/bt1-axi.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/bus/bt1-axi.c b/drivers/bus/bt1-axi.c
index e7a6744acc7b..47bcf18f3115 100644
--- a/drivers/bus/bt1-axi.c
+++ b/drivers/bus/bt1-axi.c
@@ -136,7 +136,8 @@ static int bt1_axi_request_rst(struct bt1_axi *axi)

axi->arst = devm_reset_control_get_optional_exclusive(axi->dev, "arst");
if (IS_ERR(axi->arst)) {
- dev_warn(axi->dev, "Couldn't get reset control line\n");
+ dev_err_probe(axi->dev, PTR_ERR(axi->arst),
+ "Couldn't get reset control line\n");
return PTR_ERR(axi->arst);
}

@@ -160,7 +161,8 @@ static int bt1_axi_request_clk(struct bt1_axi *axi)

axi->aclk = devm_clk_get(axi->dev, "aclk");
if (IS_ERR(axi->aclk)) {
- dev_err(axi->dev, "Couldn't get AXI Interconnect clock\n");
+ dev_err_probe(axi->dev, PTR_ERR(axi->aclk),
+ "Couldn't get AXI Interconnect clock\n");
return PTR_ERR(axi->aclk);
}

--
2.35.1

2022-06-10 10:09:29

by Philipp Zabel

[permalink] [raw]
Subject: Re: [PATCH 1/2] bus: bt1-apb: Don't print error on -EPROBE_DEFER

Hi Serge,

On Fr, 2022-06-10 at 11:01 +0300, Serge Semin wrote:
> The Baikal-T1 APB bus driver correctly handles the deferred probe
> situation, but still pollutes the system log with a misleading error
> message. Let's fix that by using the dev_err_probe() method to print the
> log message in case of the clocks/resets request errors.
>
> Signed-off-by: Serge Semin <[email protected]>
> ---
>  drivers/bus/bt1-apb.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/bus/bt1-apb.c b/drivers/bus/bt1-apb.c
> index b25ff941e7c7..ac13b5b97107 100644
> --- a/drivers/bus/bt1-apb.c
> +++ b/drivers/bus/bt1-apb.c
> @@ -176,7 +176,8 @@ static int bt1_apb_request_rst(struct bt1_apb *apb)
>  
>
>
>
>   apb->prst = devm_reset_control_get_optional_exclusive(apb->dev, "prst");
>   if (IS_ERR(apb->prst)) {
> - dev_warn(apb->dev, "Couldn't get reset control line\n");
> + dev_err_probe(apb->dev, PTR_ERR(apb->prst),
> + "Couldn't get reset control line\n");
>   return PTR_ERR(apb->prst);

This could be shortened to

- dev_warn(apb->dev, "Couldn't get reset control line\n");
+ return dev_err_probe(apb->dev, PTR_ERR(apb->prst),
+ "Couldn't get reset control line\n");
- return PTR_ERR(apb->prst);

regards
Philipp

2022-06-10 10:10:27

by Serge Semin

[permalink] [raw]
Subject: Re: [PATCH 1/2] bus: bt1-apb: Don't print error on -EPROBE_DEFER

On Fri, Jun 10, 2022 at 11:35:36AM +0200, Philipp Zabel wrote:
> Hi Serge,
>
> On Fr, 2022-06-10 at 11:01 +0300, Serge Semin wrote:
> > The Baikal-T1 APB bus driver correctly handles the deferred probe
> > situation, but still pollutes the system log with a misleading error
> > message. Let's fix that by using the dev_err_probe() method to print the
> > log message in case of the clocks/resets request errors.
> >
> > Signed-off-by: Serge Semin <[email protected]>
> > ---
> > ?drivers/bus/bt1-apb.c | 6 ++++--
> > ?1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/bus/bt1-apb.c b/drivers/bus/bt1-apb.c
> > index b25ff941e7c7..ac13b5b97107 100644
> > --- a/drivers/bus/bt1-apb.c
> > +++ b/drivers/bus/bt1-apb.c
> > @@ -176,7 +176,8 @@ static int bt1_apb_request_rst(struct bt1_apb *apb)
> > ?
> >
> >
> >
> > ? apb->prst = devm_reset_control_get_optional_exclusive(apb->dev, "prst");
> > ? if (IS_ERR(apb->prst)) {
> > - dev_warn(apb->dev, "Couldn't get reset control line\n");
> > + dev_err_probe(apb->dev, PTR_ERR(apb->prst),
> > + "Couldn't get reset control line\n");
> > ? return PTR_ERR(apb->prst);
>

> This could be shortened to
>
> - dev_warn(apb->dev, "Couldn't get reset control line\n");
> + return dev_err_probe(apb->dev, PTR_ERR(apb->prst),
> + "Couldn't get reset control line\n");
> - return PTR_ERR(apb->prst);

You are absolutely right. Thanks. I'll fix it in the v2 in both
patches.

-Sergey

>
> regards
> Philipp
>