* [PATCH] acpi: Fix unused variable warning in sbs.c
@ 2010-01-03 13:27 Rakib Mullick
2010-01-07 22:51 ` Andrew Morton
0 siblings, 1 reply; 5+ messages in thread
From: Rakib Mullick @ 2010-01-03 13:27 UTC (permalink / raw)
To: LKML; +Cc: Len Brown, Andrew Morton, Alexey Starikovskiy
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'
Signed-off-by: Rakib Mullick <rakib.mullick@gmail.com>
---
--- linus/drivers/acpi/sbs.c 2009-12-28 12:37:29.000000000 +0600
+++ rakib/drivers/acpi/sbs.c 2010-01-03 11:29:07.000000000 +0600
@@ -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)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] acpi: Fix unused variable warning in sbs.c
2010-01-03 13:27 [PATCH] acpi: Fix unused variable warning in sbs.c Rakib Mullick
@ 2010-01-07 22:51 ` Andrew Morton
2010-01-08 7:04 ` Rakib Mullick
2010-01-09 14:04 ` Alexey Starikovskiy
0 siblings, 2 replies; 5+ messages in thread
From: Andrew Morton @ 2010-01-07 22:51 UTC (permalink / raw)
To: Rakib Mullick; +Cc: LKML, Len Brown, Alexey Starikovskiy
On Sun, 3 Jan 2010 19:27:56 +0600
Rakib Mullick <rakib.mullick@gmail.com> wrote:
> 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'
>
>
> Signed-off-by: Rakib Mullick <rakib.mullick@gmail.com>
> ---
>
> --- linus/drivers/acpi/sbs.c 2009-12-28 12:37:29.000000000 +0600
> +++ rakib/drivers/acpi/sbs.c 2010-01-03 11:29:07.000000000 +0600
> @@ -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?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] acpi: Fix unused variable warning in sbs.c
2010-01-07 22:51 ` Andrew Morton
@ 2010-01-08 7:04 ` Rakib Mullick
2010-01-09 14:04 ` Alexey Starikovskiy
1 sibling, 0 replies; 5+ messages in thread
From: Rakib Mullick @ 2010-01-08 7:04 UTC (permalink / raw)
To: Andrew Morton; +Cc: LKML, Len Brown, Alexey Starikovskiy
On 1/8/10, Andrew Morton <akpm@linux-foundation.org> wrote:
>
> 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?
>
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.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] acpi: Fix unused variable warning in sbs.c
2010-01-07 22:51 ` Andrew Morton
2010-01-08 7:04 ` Rakib Mullick
@ 2010-01-09 14:04 ` Alexey Starikovskiy
2010-01-16 21:03 ` Len Brown
1 sibling, 1 reply; 5+ messages in thread
From: Alexey Starikovskiy @ 2010-01-09 14:04 UTC (permalink / raw)
To: Andrew Morton; +Cc: Rakib Mullick, LKML, Len Brown
Andrew Morton пишет:
> 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?
No, this driver is useless in such a case. It can not output any info (and this is all it does).
Regards,
Alex.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] acpi: Fix unused variable warning in sbs.c
2010-01-09 14:04 ` Alexey Starikovskiy
@ 2010-01-16 21:03 ` Len Brown
0 siblings, 0 replies; 5+ messages in thread
From: Len Brown @ 2010-01-16 21:03 UTC (permalink / raw)
To: Alexey Starikovskiy; +Cc: Andrew Morton, Rakib Mullick, LKML
[-- Attachment #1: Type: TEXT/PLAIN, Size: 488 bytes --]
On Sat, 9 Jan 2010, Alexey Starikovskiy wrote:
> Andrew Morton пишет:
> > 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?
> 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
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-01-16 21:03 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-03 13:27 [PATCH] acpi: Fix unused variable warning in sbs.c Rakib Mullick
2010-01-07 22:51 ` Andrew Morton
2010-01-08 7:04 ` Rakib Mullick
2010-01-09 14:04 ` Alexey Starikovskiy
2010-01-16 21:03 ` Len Brown
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).