2020-03-08 21:53:24

by Dmitry Osipenko

[permalink] [raw]
Subject: [PATCH v1] power: supply: bq27xxx_battery: Silence deferred-probe error

The driver fails to probe with -EPROBE_DEFER if battery's power supply
(charger driver) isn't ready yet and this results in a bit noisy error
message in KMSG during kernel's boot up. Let's silence the harmless
error message.

Signed-off-by: Dmitry Osipenko <[email protected]>
---
drivers/power/supply/bq27xxx_battery.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
index 195c18c2f426..664e50103eaa 100644
--- a/drivers/power/supply/bq27xxx_battery.c
+++ b/drivers/power/supply/bq27xxx_battery.c
@@ -1885,7 +1885,10 @@ int bq27xxx_battery_setup(struct bq27xxx_device_info *di)

di->bat = power_supply_register_no_ws(di->dev, psy_desc, &psy_cfg);
if (IS_ERR(di->bat)) {
- dev_err(di->dev, "failed to register battery\n");
+ if (PTR_ERR(di->bat) == -EPROBE_DEFER)
+ dev_dbg(di->dev, "failed to register battery, deferring probe\n");
+ else
+ dev_err(di->dev, "failed to register battery\n");
return PTR_ERR(di->bat);
}

--
2.25.1


2020-03-09 12:54:38

by Andrew Davis

[permalink] [raw]
Subject: Re: [PATCH v1] power: supply: bq27xxx_battery: Silence deferred-probe error

On 3/8/20 5:51 PM, Dmitry Osipenko wrote:
> The driver fails to probe with -EPROBE_DEFER if battery's power supply
> (charger driver) isn't ready yet and this results in a bit noisy error
> message in KMSG during kernel's boot up. Let's silence the harmless
> error message.
>
> Signed-off-by: Dmitry Osipenko <[email protected]>
> ---


Reviewed-by: Andrew F. Davis <[email protected]>


> drivers/power/supply/bq27xxx_battery.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
> index 195c18c2f426..664e50103eaa 100644
> --- a/drivers/power/supply/bq27xxx_battery.c
> +++ b/drivers/power/supply/bq27xxx_battery.c
> @@ -1885,7 +1885,10 @@ int bq27xxx_battery_setup(struct bq27xxx_device_info *di)
>
> di->bat = power_supply_register_no_ws(di->dev, psy_desc, &psy_cfg);
> if (IS_ERR(di->bat)) {
> - dev_err(di->dev, "failed to register battery\n");
> + if (PTR_ERR(di->bat) == -EPROBE_DEFER)
> + dev_dbg(di->dev, "failed to register battery, deferring probe\n");
> + else
> + dev_err(di->dev, "failed to register battery\n");
> return PTR_ERR(di->bat);
> }
>
>

2020-03-09 23:08:13

by Pali Rohár

[permalink] [raw]
Subject: Re: [PATCH v1] power: supply: bq27xxx_battery: Silence deferred-probe error

On Monday 09 March 2020 00:51:43 Dmitry Osipenko wrote:
> The driver fails to probe with -EPROBE_DEFER if battery's power supply
> (charger driver) isn't ready yet and this results in a bit noisy error
> message in KMSG during kernel's boot up. Let's silence the harmless
> error message.
>
> Signed-off-by: Dmitry Osipenko <[email protected]>

Hello Dmitry! This change make sense, it is really not an error when
bq27k device registration is deferred. You can add my:

Reviewed-by: Pali Rohár <[email protected]>

> ---
> drivers/power/supply/bq27xxx_battery.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
> index 195c18c2f426..664e50103eaa 100644
> --- a/drivers/power/supply/bq27xxx_battery.c
> +++ b/drivers/power/supply/bq27xxx_battery.c
> @@ -1885,7 +1885,10 @@ int bq27xxx_battery_setup(struct bq27xxx_device_info *di)
>
> di->bat = power_supply_register_no_ws(di->dev, psy_desc, &psy_cfg);
> if (IS_ERR(di->bat)) {
> - dev_err(di->dev, "failed to register battery\n");
> + if (PTR_ERR(di->bat) == -EPROBE_DEFER)
> + dev_dbg(di->dev, "failed to register battery, deferring probe\n");
> + else
> + dev_err(di->dev, "failed to register battery\n");
> return PTR_ERR(di->bat);
> }
>

2020-03-10 13:42:57

by Dmitry Osipenko

[permalink] [raw]
Subject: Re: [PATCH v1] power: supply: bq27xxx_battery: Silence deferred-probe error

10.03.2020 02:06, Pali Rohár пишет:
> On Monday 09 March 2020 00:51:43 Dmitry Osipenko wrote:
>> The driver fails to probe with -EPROBE_DEFER if battery's power supply
>> (charger driver) isn't ready yet and this results in a bit noisy error
>> message in KMSG during kernel's boot up. Let's silence the harmless
>> error message.
>>
>> Signed-off-by: Dmitry Osipenko <[email protected]>
>
> Hello Dmitry! This change make sense, it is really not an error when
> bq27k device registration is deferred. You can add my:
>
> Reviewed-by: Pali Rohár <[email protected]>

Thank you and Andrew for taking a look at this patch!

2020-03-11 22:15:41

by Sebastian Reichel

[permalink] [raw]
Subject: Re: [PATCH v1] power: supply: bq27xxx_battery: Silence deferred-probe error

Hi,

On Mon, Mar 09, 2020 at 12:51:43AM +0300, Dmitry Osipenko wrote:
> The driver fails to probe with -EPROBE_DEFER if battery's power supply
> (charger driver) isn't ready yet and this results in a bit noisy error
> message in KMSG during kernel's boot up. Let's silence the harmless
> error message.
>
> Signed-off-by: Dmitry Osipenko <[email protected]>
> ---

Thanks, queued.

-- Sebastian

> drivers/power/supply/bq27xxx_battery.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
> index 195c18c2f426..664e50103eaa 100644
> --- a/drivers/power/supply/bq27xxx_battery.c
> +++ b/drivers/power/supply/bq27xxx_battery.c
> @@ -1885,7 +1885,10 @@ int bq27xxx_battery_setup(struct bq27xxx_device_info *di)
>
> di->bat = power_supply_register_no_ws(di->dev, psy_desc, &psy_cfg);
> if (IS_ERR(di->bat)) {
> - dev_err(di->dev, "failed to register battery\n");
> + if (PTR_ERR(di->bat) == -EPROBE_DEFER)
> + dev_dbg(di->dev, "failed to register battery, deferring probe\n");
> + else
> + dev_err(di->dev, "failed to register battery\n");
> return PTR_ERR(di->bat);
> }
>
> --
> 2.25.1
>


Attachments:
(No filename) (1.22 kB)
signature.asc (849.00 B)
Download all attachments