acpi: Fix unused variable warning in sbs.c
PATCH 1/1 acpi: Fix unused variable warning in sbs.c
Fix unused variabled warning.
When CONFIG_ACPI_SYSFS_POWER=n and CONFIG_ACPI_PROCFS_POWER=n, then we're warned by the following warning:
drivers/acpi/sbs.c: In function `acpi_battery_remove':drivers/acpi/sbs.c:825: warning: unused variable `battery'
---
drivers/acpi/sbs.c +3 -0
@@ -822,7 +822,10 @@ static int acpi_battery_add(struct acpi_static void acpi_battery_remove (struct acpi_sbs *sbs,int id) { +#if defined(CONFIG_ACPI_SYSFS_POWER ) || defined(CONFIG_ACPI_PROCFS_POWER )struct acpi_battery *battery = &sbs->battery[id]; +#endif +#ifdef CONFIG_ACPI_SYSFS_POWER if (battery->bat.dev) {if (battery->have_sysfs_alarm)
Quoted 15 lines · On Sun, 3 Jan 2010 19:27:56 +0600 Rakib Mullick <[email protected]> wrote:
Fix unused variabled warning.
When
CONFIG_ACPI_SYSFS_POWER=nandCONFIG_ACPI_PROCFS_POWER=n, then we're warned by the following warning:
drivers/acpi/sbs.c: In function `acpi_battery_remove':drivers/acpi/sbs.c:825: warning: unused variable `battery'Signed-off-by Rakib Mullick <[email protected]>---
drivers/acpi/sbs.c static int acpi_battery_add(struct acpi_ · line 831
Quoted 10 lines
drivers/acpi/sbs.c +3
-0@@ -822,7 +822,10 @@ static int acpi_battery_add(struct acpi_static void acpi_battery_remove (struct acpi_sbs *sbs,int id) { +#if defined(CONFIG_ACPI_SYSFS_POWER ) || defined(CONFIG_ACPI_PROCFS_POWER )struct acpi_battery *battery = &sbs->battery[id]; +#endif +#ifdef CONFIG_ACPI_SYSFS_POWER if (battery->bat.dev) {if (battery->have_sysfs_alarm)
Rather an unpleasant patch to a rather unpleasant function :( Oh well, it's better than a warning.
I wonder if it can be fixed in Kconfig. Is there any sane use of this code when CONFIG_ACPI_SYSFS_POWER=n && CONFIG_ACPI_PROCFS_POWER=n?
Quoted 4 lines · Andrew Morton
I wonder if it can be fixed in
Kconfig. Is there any sane use of this code whenCONFIG_ACPI_SYSFS_POWER=n&&CONFIG_ACPI_PROCFS_POWER=n?
No. Making it depend on CONFIG_ACPI_SYSFS_POWER || CONFIG_ACPI_PROCFS_POWER, doesn't make sense too. What about wrapping around acpi_battery_remove with #ifdef from it's calling point.
Andrew Morton пишет:
Quoted 2 lines
I wonder if it can be fixed in
Kconfig. Is there any sane use of this code whenCONFIG_ACPI_SYSFS_POWER=n&&CONFIG_ACPI_PROCFS_POWER=n?
No, this driver is useless in such a case. It can not output any info (and this is all it does).
Regards,
Alex.
Len Brown
reviewerQuoted 5 lines · Alexey Starikovskiy
Andrew Morton пишет:
Quoted 2 lines
I wonder if it can be fixed in
Kconfig. Is there any sane use of this code whenCONFIG_ACPI_SYSFS_POWER=n&&CONFIG_ACPI_PROCFS_POWER=n?No, this driver is useless in such a case. It can not output any info (and this is all it does).
Hi Alex,
Probably the code can lose some ifdefs by doing things like making acpi_battery_remove_fs() a static inline when !CONFIG_ACPI_PROCFS_POWER.
cheers,
-Len