From patchwork Thu Apr 30 15:35:37 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 21076 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n3UFajhW006042 for ; Thu, 30 Apr 2009 15:36:46 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1763962AbZD3Pfj (ORCPT ); Thu, 30 Apr 2009 11:35:39 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1763590AbZD3Pfj (ORCPT ); Thu, 30 Apr 2009 11:35:39 -0400 Received: from g5t0007.atlanta.hp.com ([15.192.0.44]:20013 "EHLO g5t0007.atlanta.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1763969AbZD3Pfi (ORCPT ); Thu, 30 Apr 2009 11:35:38 -0400 Received: from smtp1.fc.hp.com (smtp1.fc.hp.com [15.15.136.127]) by g5t0007.atlanta.hp.com (Postfix) with ESMTP id 5B62E1425C; Thu, 30 Apr 2009 15:35:38 +0000 (UTC) Received: from localhost.localdomain (lart.fc.hp.com [15.11.146.31]) by smtp1.fc.hp.com (Postfix) with ESMTP id 92B8D253AFF; Thu, 30 Apr 2009 15:03:49 +0000 (UTC) Received: from bob.kio (localhost [127.0.0.1]) by localhost.localdomain (Postfix) with ESMTP id BF864260C5; Thu, 30 Apr 2009 09:35:37 -0600 (MDT) Subject: [PATCH 1/6] ACPI: allow drivers to request both device and system notify events To: Len Brown From: Bjorn Helgaas Cc: Karol Kozimor , Corentin Chary , acpi4asus-user@lists.sourceforge.net, linux-acpi@vger.kernel.org, Alexey Starikovskiy , Matthew Garrett Date: Thu, 30 Apr 2009 09:35:37 -0600 Message-ID: <20090430153537.12628.5751.stgit@bob.kio> In-Reply-To: <20090430153419.12628.91088.stgit@bob.kio> References: <20090430153419.12628.91088.stgit@bob.kio> User-Agent: StGit/0.14.3.347.g594a MIME-Version: 1.0 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org 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 --- drivers/acpi/bus.c | 6 +++++- include/acpi/acpi_bus.h | 3 +++ 2 files changed, 8 insertions(+), 1 deletions(-) -- 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 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;