[PATCH] ACPI: make ACPI button funcs no-ops if not built in

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 11 Sep 2009 09:02:02 +0800
ykzhao <yakui.zhao@xxxxxxxxx> wrote:
> > +#ifndef ACPI_BUTTON_H
> > +#define ACPI_BUTTON_H
> It will be better that the function prototype is defined in the
> following:
> 
> #if (defined(CONFIG_ACPI_BUTTON) ||
> defined(CONFIG_ACPI_BUTTON_MODULE)) extern int
> acpi_lid_notifier_register(struct notifier_block *nb); extern int
> acpi_lid_notifier_unregister(struct notifier_block *nb); extern int
> acpi_lid_open(void); #else
> static inline int acpi_lid_notifier_register( ...)  { return 0;}
> static inline int acpi_lid_notifier_unregister(struct notifier_block
> *nb) { return 0; }
> static inline int acpi_lid_open(void) { return 1; }
> #endif

Here you go.

-- 
Jesse Barnes, Intel Open Source Technology Center

Yakui pointed out that we don't properly no-op the ACPI button routines
if the button driver isn't built in.  This will cause problems if ACPI
is disabled, so provide stub functions in that case.

Reported-by: ykzhao <yakui.zhao@xxxxxxxxx>
Signed-off-by: Jesse Barnes <jbarnes@xxxxxxxxxxxxxxxx>

diff --git a/include/acpi/button.h b/include/acpi/button.h
index bb643a7..97eea0e 100644
--- a/include/acpi/button.h
+++ b/include/acpi/button.h
@@ -3,8 +3,23 @@
 
 #include <linux/notifier.h>
 
+#if defined(CONFIG_ACPI_BUTTON) || defined(CONFIG_ACPI_BUTTON_MODULE)
 extern int acpi_lid_notifier_register(struct notifier_block *nb);
 extern int acpi_lid_notifier_unregister(struct notifier_block *nb);
 extern int acpi_lid_open(void);
+#else
+static inline int acpi_lid_notifier_register(struct notifier_block *nb)
+{
+	return 0;
+}
+static inline int acpi_lid_notifier_unregister(struct notifier_block *nb)
+{
+	return 0;
+}
+static inline int acpi_lid_open(void)
+{
+	return 1;
+}
+#endif /* defined(CONFIG_ACPI_BUTTON) || defined(CONFIG_ACPI_BUTTON_MODULE) */
 
 #endif /* ACPI_BUTTON_H */
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux