public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Helgaas <bjorn.helgaas@hp.com>
To: Len Brown <lenb@kernel.org>
Cc: Karol Kozimor <sziwan@users.sourceforge.net>,
	Corentin Chary <corentincj@iksaif.net>,
	acpi4asus-user@lists.sourceforge.net, linux-acpi@vger.kernel.org,
	Alexey Starikovskiy <alexey.y.starikovskiy@linux.intel.com>,
	Matthew Garrett <mjg@redhat.com>
Subject: [PATCH 1/6] ACPI: allow drivers to request both device and system notify events
Date: Thu, 30 Apr 2009 09:35:37 -0600	[thread overview]
Message-ID: <20090430153537.12628.5751.stgit@bob.kio> (raw)
In-Reply-To: <20090430153419.12628.91088.stgit@bob.kio>

System notify events (0x00-0x7f) are common across all device types
and should be handled in Linux/ACPI, not in drivers.  However, some
BIOSes use system notify events in device-specific ways that require
the driver to be involved.

This patch adds a ACPI_DRIVER_ALL_NOTIFY_EVENTS driver flag.  When a
driver sets this flag and supplies a .notify method, Linux/ACPI calls
the .notify method for ALL notify events on the device, not just the
device-specific (0x80-0xff) events.

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
---
 drivers/acpi/bus.c      |    6 +++++-
 include/acpi/acpi_bus.h |    3 +++
 2 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index e8f7b64..fd6a930 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -549,6 +549,7 @@ static void acpi_bus_notify(acpi_handle handle, u32 type, void *data)
 {
 	int result = 0;
 	struct acpi_device *device = NULL;
+	struct acpi_driver *driver;
 
 	blocking_notifier_call_chain(&acpi_bus_notify_list,
 		type, (void *)handle);
@@ -629,7 +630,10 @@ static void acpi_bus_notify(acpi_handle handle, u32 type, void *data)
 		break;
 	}
 
-	return;
+	driver = device->driver;
+	if (driver && driver->ops.notify &&
+	    (driver->flags & ACPI_DRIVER_ALL_NOTIFY_EVENTS))
+		driver->ops.notify(device, type);
 }
 
 /* --------------------------------------------------------------------------
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index c34b110..84e35d5 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -114,10 +114,13 @@ struct acpi_device_ops {
 	acpi_op_notify notify;
 };
 
+#define ACPI_DRIVER_ALL_NOTIFY_EVENTS	0x1	/* system AND device events */
+
 struct acpi_driver {
 	char name[80];
 	char class[80];
 	const struct acpi_device_id *ids; /* Supported Hardware IDs */
+	unsigned int flags;
 	struct acpi_device_ops ops;
 	struct device_driver drv;
 	struct module *owner;


  reply	other threads:[~2009-04-30 15:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-30 15:35 [PATCH 0/6] ACPI: support system events for .notify Bjorn Helgaas
2009-04-30 15:35 ` Bjorn Helgaas [this message]
2009-05-27 22:41   ` [PATCH 1/6] ACPI: allow drivers to request both device and system notify events Len Brown
2009-05-28  0:02     ` Bjorn Helgaas
2009-04-30 15:35 ` [PATCH 3/6] ACPI: battery: use .notify method instead of installing handler directly Bjorn Helgaas
     [not found] ` <20090430153419.12628.91088.stgit-tBlMHHroXgg@public.gmane.org>
2009-04-30 15:35   ` [PATCH 2/6] ACPI: ac: " Bjorn Helgaas
2009-04-30 15:35   ` [PATCH 4/6] ACPI: asus-laptop: " Bjorn Helgaas
2009-04-30 15:35   ` [PATCH 5/6] ACPI: asus-acpi: " Bjorn Helgaas
2009-04-30 15:36   ` [PATCH 6/6] ACPI: eeepc-laptop: " Bjorn Helgaas
2009-05-27 22:47     ` Len Brown
2009-05-27 22:51   ` [PATCH 0/6] ACPI: support system events for .notify Len Brown

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=20090430153537.12628.5751.stgit@bob.kio \
    --to=bjorn.helgaas@hp.com \
    --cc=acpi4asus-user@lists.sourceforge.net \
    --cc=alexey.y.starikovskiy@linux.intel.com \
    --cc=corentincj@iksaif.net \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=mjg@redhat.com \
    --cc=sziwan@users.sourceforge.net \
    /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