Re: [PATCH v2 1/9] power: supply: core: Add power_supply_has_property_direct()

From: Armin Wolf

Date: Tue Dec 01 2026 - 09:00:14 EST


Am 01.12.26 um 13:29 schrieb Ilpo Järvinen:
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@xxxxxx>
---
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@xxxxxxxxxxxxxxx>


Sorry for wasting your time, i assumed that complains from Sashiko are delivered via mail. It seems that only some mailing list have this, so
i wrongly thought that everything was fine :/

I will fix any findings and send a v3 series.

Thanks,
Armin Wolf