* [PATCH] power: supply: core: Move psy_has_property() to fix build
@ 2021-09-28 12:00 Geert Uytterhoeven
2021-09-29 16:02 ` Matthias Kaehlcke
0 siblings, 1 reply; 3+ messages in thread
From: Geert Uytterhoeven @ 2021-09-28 12:00 UTC (permalink / raw)
To: Matthias Kaehlcke, Sebastian Reichel
Cc: linux-pm, linux-kernel, Geert Uytterhoeven
If CONFIG_THERMAL=n:
drivers/power/supply/power_supply_core.c: In function ‘__power_supply_register’:
drivers/power/supply/power_supply_core.c:1137:6: error: implicit declaration of function ‘psy_has_property’ [-Werror=implicit-function-declaration]
1137 | if (psy_has_property(desc, POWER_SUPPLY_PROP_USB_TYPE) &&
| ^~~~~~~~~~~~~~~~
Fix this by moving psy_has_property() outside the section protected by
CONFIG_THERMAL.
Fixes: 9ba533eb99bb2acf ("power: supply: core: Add psy_has_property()")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
drivers/power/supply/power_supply_core.c | 32 ++++++++++++------------
1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c
index 75575ea45f21ddc7..fc12a4f407f431a6 100644
--- a/drivers/power/supply/power_supply_core.c
+++ b/drivers/power/supply/power_supply_core.c
@@ -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;
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] power: supply: core: Move psy_has_property() to fix build
2021-09-28 12:00 [PATCH] power: supply: core: Move psy_has_property() to fix build Geert Uytterhoeven
@ 2021-09-29 16:02 ` Matthias Kaehlcke
2021-09-30 10:50 ` Sebastian Reichel
0 siblings, 1 reply; 3+ messages in thread
From: Matthias Kaehlcke @ 2021-09-29 16:02 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Sebastian Reichel, linux-pm, linux-kernel, Tom Rix, SeongJae Park
On Tue, Sep 28, 2021 at 02:00:19PM +0200, Geert Uytterhoeven wrote:
> If CONFIG_THERMAL=n:
>
> drivers/power/supply/power_supply_core.c: In function ‘__power_supply_register’:
> drivers/power/supply/power_supply_core.c:1137:6: error: implicit declaration of function ‘psy_has_property’ [-Werror=implicit-function-declaration]
> 1137 | if (psy_has_property(desc, POWER_SUPPLY_PROP_USB_TYPE) &&
> | ^~~~~~~~~~~~~~~~
>
> Fix this by moving psy_has_property() outside the section protected by
> CONFIG_THERMAL.
>
> Fixes: 9ba533eb99bb2acf ("power: supply: core: Add psy_has_property()")
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
> drivers/power/supply/power_supply_core.c | 32 ++++++++++++------------
> 1 file changed, 16 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c
> index 75575ea45f21ddc7..fc12a4f407f431a6 100644
> --- a/drivers/power/supply/power_supply_core.c
> +++ b/drivers/power/supply/power_supply_core.c
> @@ -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;
Thanks for the fix!
Reviewed-by: Matthias Kaehlcke <mka@chromium.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] power: supply: core: Move psy_has_property() to fix build
2021-09-29 16:02 ` Matthias Kaehlcke
@ 2021-09-30 10:50 ` Sebastian Reichel
0 siblings, 0 replies; 3+ messages in thread
From: Sebastian Reichel @ 2021-09-30 10:50 UTC (permalink / raw)
To: Matthias Kaehlcke
Cc: Geert Uytterhoeven, linux-pm, linux-kernel, Tom Rix, SeongJae Park
[-- Attachment #1: Type: text/plain, Size: 2586 bytes --]
Hi,
On Wed, Sep 29, 2021 at 09:02:17AM -0700, Matthias Kaehlcke wrote:
> On Tue, Sep 28, 2021 at 02:00:19PM +0200, Geert Uytterhoeven wrote:
> > If CONFIG_THERMAL=n:
> >
> > drivers/power/supply/power_supply_core.c: In function ‘__power_supply_register’:
> > drivers/power/supply/power_supply_core.c:1137:6: error: implicit declaration of function ‘psy_has_property’ [-Werror=implicit-function-declaration]
> > 1137 | if (psy_has_property(desc, POWER_SUPPLY_PROP_USB_TYPE) &&
> > | ^~~~~~~~~~~~~~~~
> >
> > Fix this by moving psy_has_property() outside the section protected by
> > CONFIG_THERMAL.
> >
> > Fixes: 9ba533eb99bb2acf ("power: supply: core: Add psy_has_property()")
> > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > ---
Thanks, queued.
-- Sebastian
> > drivers/power/supply/power_supply_core.c | 32 ++++++++++++------------
> > 1 file changed, 16 insertions(+), 16 deletions(-)
> >
> > diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c
> > index 75575ea45f21ddc7..fc12a4f407f431a6 100644
> > --- a/drivers/power/supply/power_supply_core.c
> > +++ b/drivers/power/supply/power_supply_core.c
> > @@ -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;
>
> Thanks for the fix!
>
> Reviewed-by: Matthias Kaehlcke <mka@chromium.org>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-09-30 10:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-28 12:00 [PATCH] power: supply: core: Move psy_has_property() to fix build Geert Uytterhoeven
2021-09-29 16:02 ` Matthias Kaehlcke
2021-09-30 10:50 ` Sebastian Reichel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).