public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Jesse Barnes <jbarnes@virtuousgeek.org>
To: ykzhao <yakui.zhao@intel.com>
Cc: "intel-gfx@lists.freedesktop.org"
	<intel-gfx@lists.freedesktop.org>,
	linux-acpi@vger.kernel.org, eric@anholt.net
Subject: [PATCH] ACPI: make ACPI button funcs no-ops if not built in
Date: Tue, 15 Sep 2009 16:57:24 -0700	[thread overview]
Message-ID: <20090915165724.4e4a1229@jbarnes-g45> (raw)
In-Reply-To: <1252630922.3609.200.camel@localhost.localdomain>

On Fri, 11 Sep 2009 09:02:02 +0800
ykzhao <yakui.zhao@intel.com> 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@intel.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>

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@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

      parent reply	other threads:[~2009-09-16  0:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1252621686-27307-1-git-send-email-jbarnes@virtuousgeek.org>
     [not found] ` <1252621686-27307-2-git-send-email-jbarnes@virtuousgeek.org>
2009-09-11  1:02   ` [Intel-gfx] [PATCH] ACPI button: provide lid status functions ykzhao
2009-09-11  1:08     ` Jesse Barnes
2009-09-15 23:57     ` Jesse Barnes [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090915165724.4e4a1229@jbarnes-g45 \
    --to=jbarnes@virtuousgeek.org \
    --cc=eric@anholt.net \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=yakui.zhao@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox