[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <29d67963-c110-553a-fec4-b972953987b1@roeck-us.net>
Date: Thu, 2 Apr 2020 07:52:19 -0700
From: Guenter Roeck <linux@...ck-us.net>
To: Michał Mirosław <mirq-linux@...e.qmqm.pl>,
Sebastian Reichel "(maintainer:POWER" SUPPLY CLASS/SUBSYSTEM
and "DRIVERS,blamed_fixes:1/1=100%)"
<sebastian.reichel@...labora.com>,
"Andrey Smirnov (blamed_fixes:1/1=100%)" <andrew.smirnov@...il.com>
Cc: "open list:POWER SUPPLY CLASS/SUBSYSTEM and DRIVERS"
<linux-pm@...r.kernel.org>,
open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 3/7] power: supply: core: fix HWMON temperature labels
On 4/2/20 7:46 AM, Michał Mirosław wrote:
> tempX_label files are swapped compared to what
> power_supply_hwmon_temp_to_property() uses. Make them match.
> While at it, make room for labeling other channels.
>
> Fixes: e67d4dfc9ff1 ("power: supply: Add HWMON compatibility layer")
> Signed-off-by: Michał Mirosław <mirq-linux@...e.qmqm.pl>
> ---
> drivers/power/supply/power_supply_hwmon.c | 14 +++++++++++++-
> 1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/power/supply/power_supply_hwmon.c b/drivers/power/supply/power_supply_hwmon.c
> index 75cf861ba492..83318a21fb52 100644
> --- a/drivers/power/supply/power_supply_hwmon.c
> +++ b/drivers/power/supply/power_supply_hwmon.c
> @@ -43,6 +43,11 @@ static int power_supply_hwmon_curr_to_property(u32 attr)
> }
> }
>
> +static const char *const ps_temp_label[] = {
> + "temp",
> + "ambient temp",
> +};
> +
> static int power_supply_hwmon_temp_to_property(u32 attr, int channel)
> {
> if (channel) {
> @@ -144,7 +149,14 @@ static int power_supply_hwmon_read_string(struct device *dev,
> u32 attr, int channel,
> const char **str)
> {
> - *str = channel ? "temp" : "temp ambient";
> + switch (type) {
> + case hwmon_temp:
> + *str = ps_temp_label[channel];
> + break;
> + default:
> + break;
That returns "no error" without setting *str, which is really asking for trouble.
Guenter
> + }
> +
> return 0;
> }
>
>
Powered by blists - more mailing lists