power: supply: core: move psy_has_property()
PATCH 1/1 power: supply: core: move psy_has_property()
From: Tom Rix <[email protected]>
A ranconfig produces this error power_supply_core.c:1137:6: error: implicit declaration
of function 'psy_has_property'
1137 | if (psy_has_property(desc, POWER_SUPPLY_PROP_USB_TYPE) &&
psy_has_property() compiling is conditional on THERMAL. It is used in __power_supply_register() to check a non thermal property. So move psy_has_property() out of the THERMAL conditional.
--- drivers/power/supply/power_supply_core.c | 32 ++++++++++++------------ 1 file changed, 16 insertions(+), 16 deletions(-)
drivers/power/supply/power_supply_core.c +16 -16
@@ -951,6 +951,22 @@ void power_supply_unreg_notifier(struct notifier_block *nb) }EXPORT_SYMBOL_GPL (power_supply_unreg_notifier); +static bool psy_has_property (const struct power_supply_desc *psy_desc, +enum power_supply_property psp) +{ +bool found = false; +int i; + +for (i =0 ; i < psy_desc->num_properties; i++) { +if (psy_desc->properties[i] == psp) { + found = true; +break ; + } + } + +return found; +} +#ifdef CONFIG_THERMAL static int power_supply_read_temp (struct thermal_zone_device *tzd,int *temp)
@@ -975,22 +991,6 @@ static struct thermal_zone_device_ops psy_tzd_ops = { .get_temp = power_supply_read_temp, }; -static bool psy_has_property (const struct power_supply_desc *psy_desc, -enum power_supply_property psp) -{ -bool found = false; -int i; - -for (i =0 ; i < psy_desc->num_properties; i++) { -if (psy_desc->properties[i] == psp) { - found = true; -break ; - } - } - -return found; -} -static int psy_register_thermal (struct power_supply *psy) {int ret;
Signature · 1 line
2.26.3
Hi Tom,
thanks for the fix!
Geert sent a similar patch earlier:
Quoted 70 lines · On Tue, Sep 28, 2021 at 07:40:46AM -0700, [email protected] wrote:
From: Tom Rix <[email protected]>
A ranconfig produces this error power_supply_core.c:1137:6: error: implicit declaration
of function 'psy_has_property'
1137 | if (psy_has_property(desc, POWER_SUPPLY_PROP_USB_TYPE)&&
psy_has_property()compiling is conditional on THERMAL. It is used in__power_supply_register()to check a non thermal property. So movepsy_has_property()out of the THERMAL conditional.Fixes 9ba533eb99bb ("power: supply: core: Add psy_has_property()")Signed-off-by Tom Rix <[email protected]>--- drivers/power/supply/power_supply_core.c | 32 ++++++++++++------------ 1 file changed, 16 insertions(+), 16 deletions(-)drivers/power/supply/power_supply_core.c +16
-16@@ -951,6 +951,22 @@ void power_supply_unreg_notifier(struct notifier_block *nb) }EXPORT_SYMBOL_GPL (power_supply_unreg_notifier); +static bool psy_has_property (const struct power_supply_desc *psy_desc, +enum power_supply_property psp) +{ +bool found = false; +int i; + +for (i =0 ; i < psy_desc->num_properties; i++) { +if (psy_desc->properties[i] == psp) { + found = true; +break ; + } + } + +return found; +} +#ifdef CONFIG_THERMAL static int power_supply_read_temp (struct thermal_zone_device *tzd,int *temp)@@ -975,22 +991,6 @@ static struct thermal_zone_device_ops psy_tzd_ops = { .get_temp = power_supply_read_temp, }; -static bool psy_has_property (const struct power_supply_desc *psy_desc, -enum power_supply_property psp) -{ -bool found = false; -int i; - -for (i =0 ; i < psy_desc->num_properties; i++) { -if (psy_desc->properties[i] == psp) { - found = true; -break ; - } - } - -return found; -} -static int psy_register_thermal (struct power_supply *psy) {int ret;Signature · 1 line
2.26.3