diff mbox series

[v1,1/2] power: supply: sbs-battery: Silence warning about unknown chemistry

Message ID 20210510220827.11595-1-digetx@gmail.com
State New
Headers show
Series [v1,1/2] power: supply: sbs-battery: Silence warning about unknown chemistry | expand

Commit Message

Dmitry Osipenko May 10, 2021, 10:08 p.m. UTC
Older variants of controller don't support reporting type of the battery.
Make warning message about unknown chemistry to be printed only once in
order to stop flooding kernel log with the message on each request of the
property. This patch fixes the noisy messages on Asus Transformer TF101.

Tested-by: Antoni Aloy Torrens <aaloytorrens@gmail.com> # TF101
Tested-by: Nikola Milosavljević <mnidza@outlook.com> # TF101
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
 drivers/power/supply/sbs-battery.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Sebastian Reichel May 13, 2021, 3:11 p.m. UTC | #1
Hi,

On Tue, May 11, 2021 at 01:08:26AM +0300, Dmitry Osipenko wrote:
> Older variants of controller don't support reporting type of the battery.

> Make warning message about unknown chemistry to be printed only once in

> order to stop flooding kernel log with the message on each request of the

> property. This patch fixes the noisy messages on Asus Transformer TF101.

> 

> Tested-by: Antoni Aloy Torrens <aaloytorrens@gmail.com> # TF101

> Tested-by: Nikola Milosavljević <mnidza@outlook.com> # TF101

> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>

> ---


I believe the problem should be fixed as side-effect of the
following patch:

https://lore.kernel.org/linux-pm/20210513020308.4011440-1-ikjn@chromium.org/

With my suggested change the message is printed once for each
battery plug, so probably only once per boot for most users.

-- Sebastian

>  drivers/power/supply/sbs-battery.c | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)

> 

> diff --git a/drivers/power/supply/sbs-battery.c b/drivers/power/supply/sbs-battery.c

> index 8d7a10730e43..b71fbf543428 100644

> --- a/drivers/power/supply/sbs-battery.c

> +++ b/drivers/power/supply/sbs-battery.c

> @@ -814,7 +814,7 @@ static int sbs_get_chemistry(struct i2c_client *client,

>  		val->intval = POWER_SUPPLY_TECHNOLOGY_UNKNOWN;

>  

>  	if (val->intval == POWER_SUPPLY_TECHNOLOGY_UNKNOWN)

> -		dev_warn(&client->dev, "Unknown chemistry: %s\n", chemistry);

> +		dev_warn_once(&client->dev, "Unknown chemistry: %s\n", chemistry);

>  

>  	return 0;

>  }

> -- 

> 2.30.2

>
Dmitry Osipenko May 14, 2021, 1:13 p.m. UTC | #2
13.05.2021 18:11, Sebastian Reichel пишет:
> Hi,

> 

> On Tue, May 11, 2021 at 01:08:26AM +0300, Dmitry Osipenko wrote:

>> Older variants of controller don't support reporting type of the battery.

>> Make warning message about unknown chemistry to be printed only once in

>> order to stop flooding kernel log with the message on each request of the

>> property. This patch fixes the noisy messages on Asus Transformer TF101.

>>

>> Tested-by: Antoni Aloy Torrens <aaloytorrens@gmail.com> # TF101

>> Tested-by: Nikola Milosavljević <mnidza@outlook.com> # TF101

>> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>

>> ---

> 

> I believe the problem should be fixed as side-effect of the

> following patch:

> 

> https://lore.kernel.org/linux-pm/20210513020308.4011440-1-ikjn@chromium.org/

> 

> With my suggested change the message is printed once for each

> battery plug, so probably only once per boot for most users.


Looks like that patch indeed should work too, thank you.
diff mbox series

Patch

diff --git a/drivers/power/supply/sbs-battery.c b/drivers/power/supply/sbs-battery.c
index 8d7a10730e43..b71fbf543428 100644
--- a/drivers/power/supply/sbs-battery.c
+++ b/drivers/power/supply/sbs-battery.c
@@ -814,7 +814,7 @@  static int sbs_get_chemistry(struct i2c_client *client,
 		val->intval = POWER_SUPPLY_TECHNOLOGY_UNKNOWN;
 
 	if (val->intval == POWER_SUPPLY_TECHNOLOGY_UNKNOWN)
-		dev_warn(&client->dev, "Unknown chemistry: %s\n", chemistry);
+		dev_warn_once(&client->dev, "Unknown chemistry: %s\n", chemistry);
 
 	return 0;
 }