mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: "Thomas Weißschuh" <linux@weissschuh.net>,
	"Sebastian Reichel" <sre@kernel.org>,
	"Konrad Dybcio" <konradybcio@kernel.org>
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	Sebastian Reichel <sebastian.reichel@collabora.com>
Subject: Re: [PATCH 4/4] power: supply: core: drop workaround for missing POWER_SUPPLY_PROP_CHARGE_BEHAVIOUR_AVAILABLE
Date: Mon, 5 Feb 2024 10:58:49 +0100	[thread overview]
Message-ID: <a1035d98-31b3-4926-b7d7-676bf18a4311@redhat.com> (raw)
In-Reply-To: <20240204-power_supply-charge_behaviour_prop-v1-4-06a20c958f96@weissschuh.net>

Hi Thomas,

On 2/4/24 18:26, Thomas Weißschuh wrote:
> As the mm8013 driver was extended to also report that property the
> workaround is not needed anymore.
> 
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
> ---
>  drivers/power/supply/power_supply_sysfs.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/power/supply/power_supply_sysfs.c b/drivers/power/supply/power_supply_sysfs.c
> index 3680cfc2e908..3804a3bbed24 100644
> --- a/drivers/power/supply/power_supply_sysfs.c
> +++ b/drivers/power/supply/power_supply_sysfs.c
> @@ -273,7 +273,6 @@ static ssize_t power_supply_show_usb_type(struct device *dev,
>  
>  static ssize_t power_supply_show_charge_behaviour(struct device *dev,
>  						  struct power_supply *psy,
> -						  struct power_supply_attr *ps_attr,
>  						  union power_supply_propval *value,
>  						  char *buf)
>  {
> @@ -289,9 +288,7 @@ static ssize_t power_supply_show_charge_behaviour(struct device *dev,
>  	ret = power_supply_get_property(psy,
>  					POWER_SUPPLY_PROP_CHARGE_BEHAVIOUR_AVAILABLE,
>  					&available);
> -	if (ret == -EINVAL)
> -		return sysfs_emit(buf, "%s\n", ps_attr->text_values[value->intval]);

More of a remark on patch 1 really, note that if you use
POWER_SUPPLY_CHARGE_BEHAVIOUR_TEXT[] here in patch 1, e.g. :

		return sysfs_emit(buf, "%s\n",
				  POWER_SUPPLY_CHARGE_BEHAVIOUR_TEXT[value->intval]);

then you can omit the ps_attr argument in patch 1 already, which in turn
will cause this patch to be simpler / smaller.

Regards,

Hans





> -	else if (ret < 0)
> +	if (ret < 0)
>  		return ret;
>  
>  	return power_supply_charge_behaviour_show(dev, available.intval, value->intval, buf);
> @@ -337,8 +334,7 @@ static ssize_t power_supply_show_property(struct device *dev,
>  						&value, buf);
>  		break;
>  	case POWER_SUPPLY_PROP_CHARGE_BEHAVIOUR:
> -		ret = power_supply_show_charge_behaviour(dev, psy, ps_attr,
> -							 &value, buf);
> +		ret = power_supply_show_charge_behaviour(dev, psy, &value, buf);
>  		break;
>  	case POWER_SUPPLY_PROP_MODEL_NAME ... POWER_SUPPLY_PROP_SERIAL_NUMBER:
>  		ret = sysfs_emit(buf, "%s\n", value.strval);
> 


      reply	other threads:[~2024-02-05  9:58 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-04 17:26 [PATCH 0/4] power: supply: core: align charge_behaviour format with docs Thomas Weißschuh
2024-02-04 17:26 ` [PATCH 1/4] power: supply: core: fix charge_behaviour formatting Thomas Weißschuh
2024-02-05  9:52   ` Hans de Goede
2024-02-05 11:43     ` Hans de Goede
2024-02-19 23:19       ` Sebastian Reichel
2024-02-04 17:26 ` [PATCH 2/4] power: supply: test-power: implement charge_behaviour property Thomas Weißschuh
2024-02-05  9:59   ` Hans de Goede
2024-02-04 17:26 ` [PATCH 3/4] power: supply: mm8013: implement POWER_SUPPLY_PROP_CHARGE_BEHAVIOUR_AVAILABLE Thomas Weißschuh
2024-02-05 10:00   ` Hans de Goede
2024-02-05 11:21     ` Thomas Weißschuh
2024-02-12 13:22       ` Konrad Dybcio
2024-02-05 11:41   ` Konrad Dybcio
2024-02-04 17:26 ` [PATCH 4/4] power: supply: core: drop workaround for missing POWER_SUPPLY_PROP_CHARGE_BEHAVIOUR_AVAILABLE Thomas Weißschuh
2024-02-05  9:58   ` Hans de Goede [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a1035d98-31b3-4926-b7d7-676bf18a4311@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=konradybcio@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux@weissschuh.net \
    --cc=sebastian.reichel@collabora.com \
    --cc=sre@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®