Skip to contentSkip to conversation

power: supply: gpio-charger: mark gpio_charger_properties as __maybe_unused

PATCH In review Sasha Levin 3 participants 3 messages Nov 16 – Nov 17 Power supply

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 power: supply: gpio-charger: mark gpio_charger_properties as __maybe_unused

Commit fad4655224f60 ("power: supply: gpio-charger: Keep properties per device") keeps gpio_charger_properties[] only to size the per-device array with ARRAY_SIZE(). clang sees that the array itself is never emitted and warns, which fails the build with CONFIG_WERROR:

drivers/power/supply/gpio-charger.c:26:35: error: variable 'gpio_charger_properties' is not needed and will not be emitted [-Werror,-Wunneeded-internal-declaration]

Mark the array __maybe_unused.

Fixes fad4655224f60 ("power: supply: gpio-charger: Keep properties per device")

---
fad4655224f60 is the tip of power-supply's for-next.

 drivers/power/supply/gpio-charger.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/supply/gpio-charger.c +1 -1
index c90c824382c62..647f5bde38c7c 100644
@@ -23,7 +23,7 @@ struct gpio_mapping {
 } __packed;
 
 /* This list ensures, that the array is big enough for all optional features. */
-static enum power_supply_property gpio_charger_properties[] = {
+static enum power_supply_property gpio_charger_properties[] __maybe_unused = {
 	POWER_SUPPLY_PROP_ONLINE,
 	POWER_SUPPLY_PROP_STATUS,
 	POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX,

base-commit: fad4655224f60328cc9bcf4399eda8f6d7a587a6

Signature · 1 line
2.53.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Sasha Levin

Commit fad4655224f60 ("power: supply: gpio-charger: Keep properties per device") keeps gpio_charger_properties[] only to size the per-device array with ARRAY_SIZE(). clang sees that the array itself is never emitted and warns, which fails the build with CONFIG_WERROR:

Quoted 8 lines

drivers/power/supply/gpio-charger.c:26:35: error: variable 'gpio_charger_properties' is not needed and will not be emitted [-Werror,-Wunneeded-internal-declaration]

Mark the array __maybe_unused.

Fixes fad4655224f60 ("power: supply: gpio-charger: Keep properties per device")

---
fad4655224f60 is the tip of power-supply's for-next.

Since the Fixes has 'Cc: stable', this one should too (unless this is just going to be squashed in).

Quoted 21 lines
 drivers/power/supply/gpio-charger.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/supply/gpio-charger.c +1 -1
index c90c824382c62..647f5bde38c7c 100644
@@ -23,7 +23,7 @@ struct gpio_mapping {
 } __packed;
 
 /* This list ensures, that the array is big enough for all optional features. */
-static enum power_supply_property gpio_charger_properties[] = {
+static enum power_supply_property gpio_charger_properties[] __maybe_unused = {
 	POWER_SUPPLY_PROP_ONLINE,
 	POWER_SUPPLY_PROP_STATUS,
 	POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX,

base-commit: fad4655224f60328cc9bcf4399eda8f6d7a587a6

Signature · 1 line
2.53.0
Signature · 2 lines
Cheers,
Nathan
#2 lore raw

Hi,

Quoted 15 lines · Nathan Chancellor
Quoted 5 lines · Sasha Levin

Commit fad4655224f60 ("power: supply: gpio-charger: Keep properties per device") keeps gpio_charger_properties[] only to size the per-device array with ARRAY_SIZE(). clang sees that the array itself is never emitted and warns, which fails the build with CONFIG_WERROR:

Quoted 8 lines

drivers/power/supply/gpio-charger.c:26:35: error: variable 'gpio_charger_properties' is not needed and will not be emitted [-Werror,-Wunneeded-internal-declaration]

Mark the array __maybe_unused.

Fixes fad4655224f60 ("power: supply: gpio-charger: Keep properties per device")

---
fad4655224f60 is the tip of power-supply's for-next.

Quoted 4 lines

Since the Fixes has 'Cc: stable', this one should too (unless this is just going to be squashed in).

Thanks, I indeed just squashed this into the original commit. It's the tip anyways and compile errors are always annoying in git bisect.

Greetings,

-- Sebastian

Quoted 26 lines
Quoted 22 lines
 drivers/power/supply/gpio-charger.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/supply/gpio-charger.c +1 -1
index c90c824382c62..647f5bde38c7c 100644
@@ -23,7 +23,7 @@ struct gpio_mapping {
 } __packed;
 
 /* This list ensures, that the array is big enough for all optional features. */
-static enum power_supply_property gpio_charger_properties[] = {
+static enum power_supply_property gpio_charger_properties[] __maybe_unused = {
 	POWER_SUPPLY_PROP_ONLINE,
 	POWER_SUPPLY_PROP_STATUS,
 	POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX,

base-commit: fad4655224f60328cc9bcf4399eda8f6d7a587a6

Signature · 1 line
2.53.0
Signature · 2 lines
Cheers,
Nathan