mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Armin Wolf <W_Armin@gmx.de>
Cc: Hans de Goede <hansg@kernel.org>,
	platform-driver-x86@vger.kernel.org,
	 LKML <linux-kernel@vger.kernel.org>,
	bifangknt@qq.com,  nicokessler@icloud.com, sre@kernel.org,
	linux-pm@vger.kernel.org,  wse@tuxedocomputers.com
Subject: Re: [PATCH v2 1/9] power: supply: core: Add power_supply_has_property_direct()
Date: Tue, 1 Dec 2026 14:29:38 +0200 (EET)	[thread overview]
Message-ID: <1bea8907-a958-0f4c-3340-f7b0bde58435@linux.intel.com> (raw)
In-Reply-To: <20261110165318.631010-2-W_Armin@gmx.de>

[-- Attachment #1: Type: text/plain, Size: 3384 bytes --]

On Tue, 10 Nov 2026, Armin Wolf wrote:

> Providers of power supply extensions might want to check if a given
> power supply supports a given property in order to select a suitable
> extension to load.
> 
> Add power_supply_has_property_direct() to enable such use cases.
> 
> Signed-off-by: Armin Wolf <W_Armin@gmx.de>
> ---
>  drivers/power/supply/power_supply_core.c | 26 ++++++++++++++++++++----
>  include/linux/power_supply.h             |  1 +
>  2 files changed, 23 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c
> index 1cc203f2780b..75b53aec5db4 100644
> --- a/drivers/power/supply/power_supply_core.c
> +++ b/drivers/power/supply/power_supply_core.c
> @@ -1367,17 +1367,35 @@ bool power_supply_ext_has_property(const struct power_supply_ext *psy_ext,
>  	return false;
>  }
>  
> -bool power_supply_has_property(struct power_supply *psy,
> -			       enum power_supply_property psp)
> +/**
> + * power_supply_has_property_direct - Check if a power supply property exists without checking
> + *				      for extensions
> + * @psy: The power supply
> + * @psp: The power supply property to check
> + *
> + * Check if a given power supply support a given power supply property without taking into account
> + * any power supply extesions registered on said power supply. This is mostly useful for determining
> + * if a power supply extension should be registered for the power supply or not.

Please fix the minor errors mentioned by sashiko.

It would save me some time if you'd proactively look at sashiko's 
reports for your own work and fix obvious findings without me having to 
specifically ask for that. It's much more useful way to spend time when
than pinging me. ;-)

I'd also prefer the comment is limited to 80 chars.

For the entire series once this is fixed:

Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

-- 
 i.

> + */
> +bool power_supply_has_property_direct(struct power_supply *psy, enum power_supply_property psp)
>  {
> -	struct power_supply_ext_registration *reg;
> -
>  	if (psy_desc_has_property(psy->desc, psp))
>  		return true;
>  
>  	if (power_supply_battery_info_has_prop(psy->battery_info, psp))
>  		return true;
>  
> +	return false;
> +}
> +EXPORT_SYMBOL_GPL(power_supply_has_property_direct);
> +
> +bool power_supply_has_property(struct power_supply *psy, enum power_supply_property psp)
> +{
> +	struct power_supply_ext_registration *reg;
> +
> +	if (power_supply_has_property_direct(psy, psp))
> +		return true;
> +
>  	power_supply_for_each_extension(reg, psy) {
>  		if (power_supply_ext_has_property(reg->ext, psp))
>  			return true;
> diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
> index cce61137aef4..73bcb127d0fc 100644
> --- a/include/linux/power_supply.h
> +++ b/include/linux/power_supply.h
> @@ -934,6 +934,7 @@ extern int power_supply_is_system_supplied(void);
>  static inline int power_supply_is_system_supplied(void) { return -ENOSYS; }
>  #endif
>  
> +bool power_supply_has_property_direct(struct power_supply *psy, enum power_supply_property psp);
>  extern int power_supply_get_property(struct power_supply *psy,
>  			    enum power_supply_property psp,
>  			    union power_supply_propval *val);
> 

  parent reply	other threads:[~2026-12-01 12:29 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-10 16:50 [PATCH v2 0/9] platform/x86: uniwill-laptop: Complete battery support Armin Wolf
2026-11-10 16:50 ` [PATCH v2 1/9] power: supply: core: Add power_supply_has_property_direct() Armin Wolf
2026-11-30 18:10   ` Sebastian Reichel
2026-12-01 12:29   ` Ilpo Järvinen [this message]
2026-11-10 16:50 ` [PATCH v2 2/9] power: supply: Enable struct power_supply_ext to be construct dynamically Armin Wolf
2026-11-30 18:11   ` Sebastian Reichel
2026-11-10 16:50 ` [PATCH v2 3/9] platform/x86: uniwill-laptop: Report battery cycle count Armin Wolf
2026-11-10 16:50 ` [PATCH v2 4/9] platform/x86: uniwill-laptop: Expose battery health and cycle count on all devices Armin Wolf
2026-11-10 16:50 ` [PATCH v2 5/9] platform/x86: uniwill-laptop: Expose raw battery capacity to userspace Armin Wolf
2026-11-10 16:50 ` [PATCH v2 6/9] platform/x86: uniwill-laptop: Mark sysfs attributes as const Armin Wolf
2026-11-10 16:50 ` [PATCH v2 7/9] platform/x86: uniwill-laptop: Add support for MECHREVO Yilong15Pro Armin Wolf
2026-11-10 16:50 ` [PATCH v2 8/9] platform/x86: uniwill-laptop: Add MECHREVO JIAOLONG Series-X6xR55xK Armin Wolf
2026-11-10 16:50 ` [PATCH v2 9/9] platform/x86: uniwill-laptop: Add support for XMG EVO 14 (E25) Armin Wolf
2026-11-20 20:53 ` [PATCH v2 0/9] platform/x86: uniwill-laptop: Complete battery support Armin Wolf

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=1bea8907-a958-0f4c-3340-f7b0bde58435@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=W_Armin@gmx.de \
    --cc=bifangknt@qq.com \
    --cc=hansg@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=nicokessler@icloud.com \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=sre@kernel.org \
    --cc=wse@tuxedocomputers.com \
    /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®