* [PATCH 0/4] ACPI: use handle, not device, in system notification path
@ 2009-05-22 17:43 Bjorn Helgaas
2009-05-22 17:43 ` [PATCH 1/4] ACPI: simplify notification debug messages Bjorn Helgaas
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Bjorn Helgaas @ 2009-05-22 17:43 UTC (permalink / raw)
To: Len Brown; +Cc: linux-acpi
Currently, ACPI hotplug is mostly handled in drivers. I'm working on moving
that hotplug support out of drivers and into the Linux/ACPI core.
These patches change the Linux/ACPI notify handling to use the
acpi_handle a bit longer before looking up an acpi_device.
System notifications often deal with device presence and status change.
In these cases, we may not have an acpi_device. For example, we may
get a Device Check notification on an object that previously was not
present. Since the object was not present, we would not have had an
acpi_device for it.
Note: The last patch in this series depends on this previous patch
that is not upstream yet:
http://patchwork.kernel.org/patch/21076/
Comments welcome.
---
Bjorn Helgaas (4):
ACPI: use handle, not device, in system notification path
ACPI: remove unused return values from Bus Check & Device Check handling
ACPI: remove unused "status_changed" return value from Check Device handling
ACPI: simplify notification debug messages
drivers/acpi/bus.c | 93 +++++++++++++---------------------------------------
1 files changed, 23 insertions(+), 70 deletions(-)
--
Bjorn
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/4] ACPI: simplify notification debug messages
2009-05-22 17:43 [PATCH 0/4] ACPI: use handle, not device, in system notification path Bjorn Helgaas
@ 2009-05-22 17:43 ` Bjorn Helgaas
2009-05-22 17:43 ` [PATCH 2/4] ACPI: remove unused "status_changed" return value from Check Device handling Bjorn Helgaas
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Bjorn Helgaas @ 2009-05-22 17:43 UTC (permalink / raw)
To: Len Brown; +Cc: linux-acpi
This replaces several messages that depend on the acpi_device struct
with a single message that uses just the acpi_handle. We should be
able to deal with notifications to objects that do not yet have an
acpi_device struct.
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
---
drivers/acpi/bus.c | 27 +++------------------------
1 files changed, 3 insertions(+), 24 deletions(-)
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index cdfecc0..eb98638 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -551,6 +551,9 @@ static void acpi_bus_notify(acpi_handle handle, u32 type, void *data)
struct acpi_device *device = NULL;
struct acpi_driver *driver;
+ ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Notification %#02x to handle %p\n",
+ type, handle));
+
blocking_notifier_call_chain(&acpi_bus_notify_list,
type, (void *)handle);
@@ -560,9 +563,6 @@ static void acpi_bus_notify(acpi_handle handle, u32 type, void *data)
switch (type) {
case ACPI_NOTIFY_BUS_CHECK:
- ACPI_DEBUG_PRINT((ACPI_DB_INFO,
- "Received BUS CHECK notification for device [%s]\n",
- device->pnp.bus_id));
result = acpi_bus_check_scope(device);
/*
* TBD: We'll need to outsource certain events to non-ACPI
@@ -571,9 +571,6 @@ static void acpi_bus_notify(acpi_handle handle, u32 type, void *data)
break;
case ACPI_NOTIFY_DEVICE_CHECK:
- ACPI_DEBUG_PRINT((ACPI_DB_INFO,
- "Received DEVICE CHECK notification for device [%s]\n",
- device->pnp.bus_id));
result = acpi_bus_check_device(device, NULL);
/*
* TBD: We'll need to outsource certain events to non-ACPI
@@ -582,44 +579,26 @@ static void acpi_bus_notify(acpi_handle handle, u32 type, void *data)
break;
case ACPI_NOTIFY_DEVICE_WAKE:
- ACPI_DEBUG_PRINT((ACPI_DB_INFO,
- "Received DEVICE WAKE notification for device [%s]\n",
- device->pnp.bus_id));
/* TBD */
break;
case ACPI_NOTIFY_EJECT_REQUEST:
- ACPI_DEBUG_PRINT((ACPI_DB_INFO,
- "Received EJECT REQUEST notification for device [%s]\n",
- device->pnp.bus_id));
/* TBD */
break;
case ACPI_NOTIFY_DEVICE_CHECK_LIGHT:
- ACPI_DEBUG_PRINT((ACPI_DB_INFO,
- "Received DEVICE CHECK LIGHT notification for device [%s]\n",
- device->pnp.bus_id));
/* TBD: Exactly what does 'light' mean? */
break;
case ACPI_NOTIFY_FREQUENCY_MISMATCH:
- ACPI_DEBUG_PRINT((ACPI_DB_INFO,
- "Received FREQUENCY MISMATCH notification for device [%s]\n",
- device->pnp.bus_id));
/* TBD */
break;
case ACPI_NOTIFY_BUS_MODE_MISMATCH:
- ACPI_DEBUG_PRINT((ACPI_DB_INFO,
- "Received BUS MODE MISMATCH notification for device [%s]\n",
- device->pnp.bus_id));
/* TBD */
break;
case ACPI_NOTIFY_POWER_FAULT:
- ACPI_DEBUG_PRINT((ACPI_DB_INFO,
- "Received POWER FAULT notification for device [%s]\n",
- device->pnp.bus_id));
/* TBD */
break;
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/4] ACPI: remove unused "status_changed" return value from Check Device handling
2009-05-22 17:43 [PATCH 0/4] ACPI: use handle, not device, in system notification path Bjorn Helgaas
2009-05-22 17:43 ` [PATCH 1/4] ACPI: simplify notification debug messages Bjorn Helgaas
@ 2009-05-22 17:43 ` Bjorn Helgaas
2009-05-22 17:43 ` [PATCH 3/4] ACPI: remove unused return values from Bus Check & Device Check handling Bjorn Helgaas
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Bjorn Helgaas @ 2009-05-22 17:43 UTC (permalink / raw)
To: Len Brown; +Cc: linux-acpi
Remove "status_changed" return from acpi_bus_check_device(). Nobody
does anything useful based on its value.
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
---
drivers/acpi/bus.c | 22 +++-------------------
1 files changed, 3 insertions(+), 19 deletions(-)
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index eb98638..19e78fb 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -450,8 +450,7 @@ int acpi_bus_receive_event(struct acpi_bus_event *event)
Notification Handling
-------------------------------------------------------------------------- */
-static int
-acpi_bus_check_device(struct acpi_device *device, int *status_changed)
+static int acpi_bus_check_device(struct acpi_device *device)
{
acpi_status status = 0;
struct acpi_device_status old_status;
@@ -460,9 +459,6 @@ acpi_bus_check_device(struct acpi_device *device, int *status_changed)
if (!device)
return -EINVAL;
- if (status_changed)
- *status_changed = 0;
-
old_status = device->status;
/*
@@ -471,10 +467,6 @@ acpi_bus_check_device(struct acpi_device *device, int *status_changed)
*/
if (device->parent && !device->parent->status.present) {
device->status = device->parent->status;
- if (STRUCT_TO_INT(old_status) != STRUCT_TO_INT(device->status)) {
- if (status_changed)
- *status_changed = 1;
- }
return 0;
}
@@ -485,9 +477,6 @@ acpi_bus_check_device(struct acpi_device *device, int *status_changed)
if (STRUCT_TO_INT(old_status) == STRUCT_TO_INT(device->status))
return 0;
- if (status_changed)
- *status_changed = 1;
-
/*
* Device Insertion/Removal
*/
@@ -505,20 +494,15 @@ acpi_bus_check_device(struct acpi_device *device, int *status_changed)
static int acpi_bus_check_scope(struct acpi_device *device)
{
int result = 0;
- int status_changed = 0;
-
if (!device)
return -EINVAL;
/* Status Change? */
- result = acpi_bus_check_device(device, &status_changed);
+ result = acpi_bus_check_device(device);
if (result)
return result;
- if (!status_changed)
- return 0;
-
/*
* TBD: Enumerate child devices within this device's scope and
* run acpi_bus_check_device()'s on them.
@@ -571,7 +555,7 @@ static void acpi_bus_notify(acpi_handle handle, u32 type, void *data)
break;
case ACPI_NOTIFY_DEVICE_CHECK:
- result = acpi_bus_check_device(device, NULL);
+ result = acpi_bus_check_device(device);
/*
* TBD: We'll need to outsource certain events to non-ACPI
* drivers via the device manager (device.c).
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/4] ACPI: remove unused return values from Bus Check & Device Check handling
2009-05-22 17:43 [PATCH 0/4] ACPI: use handle, not device, in system notification path Bjorn Helgaas
2009-05-22 17:43 ` [PATCH 1/4] ACPI: simplify notification debug messages Bjorn Helgaas
2009-05-22 17:43 ` [PATCH 2/4] ACPI: remove unused "status_changed" return value from Check Device handling Bjorn Helgaas
@ 2009-05-22 17:43 ` Bjorn Helgaas
2009-05-22 17:43 ` [PATCH 4/4] ACPI: use handle, not device, in system notification path Bjorn Helgaas
2009-05-28 1:32 ` [PATCH 0/4] " Len Brown
4 siblings, 0 replies; 6+ messages in thread
From: Bjorn Helgaas @ 2009-05-22 17:43 UTC (permalink / raw)
To: Len Brown; +Cc: linux-acpi
Remove return values from acpi_bus_check_device() and acpi_bus_check_scope()
since nobody looks at them.
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
---
drivers/acpi/bus.c | 32 +++++++++++---------------------
1 files changed, 11 insertions(+), 21 deletions(-)
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index 19e78fb..2b08c3d 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -450,14 +450,13 @@ int acpi_bus_receive_event(struct acpi_bus_event *event)
Notification Handling
-------------------------------------------------------------------------- */
-static int acpi_bus_check_device(struct acpi_device *device)
+static void acpi_bus_check_device(struct acpi_device *device)
{
- acpi_status status = 0;
+ acpi_status status;
struct acpi_device_status old_status;
-
if (!device)
- return -EINVAL;
+ return;
old_status = device->status;
@@ -467,15 +466,15 @@ static int acpi_bus_check_device(struct acpi_device *device)
*/
if (device->parent && !device->parent->status.present) {
device->status = device->parent->status;
- return 0;
+ return;
}
status = acpi_bus_get_status(device);
if (ACPI_FAILURE(status))
- return -ENODEV;
+ return;
if (STRUCT_TO_INT(old_status) == STRUCT_TO_INT(device->status))
- return 0;
+ return;
/*
* Device Insertion/Removal
@@ -487,28 +486,20 @@ static int acpi_bus_check_device(struct acpi_device *device)
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device removal detected\n"));
/* TBD: Handle device removal */
}
-
- return 0;
}
-static int acpi_bus_check_scope(struct acpi_device *device)
+static void acpi_bus_check_scope(struct acpi_device *device)
{
- int result = 0;
-
if (!device)
- return -EINVAL;
+ return;
/* Status Change? */
- result = acpi_bus_check_device(device);
- if (result)
- return result;
+ acpi_bus_check_device(device);
/*
* TBD: Enumerate child devices within this device's scope and
* run acpi_bus_check_device()'s on them.
*/
-
- return 0;
}
static BLOCKING_NOTIFIER_HEAD(acpi_bus_notify_list);
@@ -531,7 +522,6 @@ EXPORT_SYMBOL_GPL(unregister_acpi_bus_notifier);
*/
static void acpi_bus_notify(acpi_handle handle, u32 type, void *data)
{
- int result = 0;
struct acpi_device *device = NULL;
struct acpi_driver *driver;
@@ -547,7 +537,7 @@ static void acpi_bus_notify(acpi_handle handle, u32 type, void *data)
switch (type) {
case ACPI_NOTIFY_BUS_CHECK:
- result = acpi_bus_check_scope(device);
+ acpi_bus_check_scope(device);
/*
* TBD: We'll need to outsource certain events to non-ACPI
* drivers via the device manager (device.c).
@@ -555,7 +545,7 @@ static void acpi_bus_notify(acpi_handle handle, u32 type, void *data)
break;
case ACPI_NOTIFY_DEVICE_CHECK:
- result = acpi_bus_check_device(device);
+ acpi_bus_check_device(device);
/*
* TBD: We'll need to outsource certain events to non-ACPI
* drivers via the device manager (device.c).
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 4/4] ACPI: use handle, not device, in system notification path
2009-05-22 17:43 [PATCH 0/4] ACPI: use handle, not device, in system notification path Bjorn Helgaas
` (2 preceding siblings ...)
2009-05-22 17:43 ` [PATCH 3/4] ACPI: remove unused return values from Bus Check & Device Check handling Bjorn Helgaas
@ 2009-05-22 17:43 ` Bjorn Helgaas
2009-05-28 1:32 ` [PATCH 0/4] " Len Brown
4 siblings, 0 replies; 6+ messages in thread
From: Bjorn Helgaas @ 2009-05-22 17:43 UTC (permalink / raw)
To: Len Brown; +Cc: linux-acpi
This patch changes the global system notification path so it uses the
acpi_handle, not the acpi_device.
System notifications often deal with device presence and status change.
In these cases, we may not have an acpi_device. For example, we may
get a Device Check notification on an object that previously was not
present. Since the object was not present, we would not have had an
acpi_device for it.
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
---
drivers/acpi/bus.c | 30 +++++++++++++++---------------
1 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index 2b08c3d..2876fc7 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -450,11 +450,14 @@ int acpi_bus_receive_event(struct acpi_bus_event *event)
Notification Handling
-------------------------------------------------------------------------- */
-static void acpi_bus_check_device(struct acpi_device *device)
+static void acpi_bus_check_device(acpi_handle handle)
{
+ struct acpi_device *device;
acpi_status status;
struct acpi_device_status old_status;
+ if (acpi_bus_get_device(handle, &device))
+ return;
if (!device)
return;
@@ -488,13 +491,10 @@ static void acpi_bus_check_device(struct acpi_device *device)
}
}
-static void acpi_bus_check_scope(struct acpi_device *device)
+static void acpi_bus_check_scope(acpi_handle handle)
{
- if (!device)
- return;
-
/* Status Change? */
- acpi_bus_check_device(device);
+ acpi_bus_check_device(handle);
/*
* TBD: Enumerate child devices within this device's scope and
@@ -531,13 +531,10 @@ static void acpi_bus_notify(acpi_handle handle, u32 type, void *data)
blocking_notifier_call_chain(&acpi_bus_notify_list,
type, (void *)handle);
- if (acpi_bus_get_device(handle, &device))
- return;
-
switch (type) {
case ACPI_NOTIFY_BUS_CHECK:
- acpi_bus_check_scope(device);
+ acpi_bus_check_scope(handle);
/*
* TBD: We'll need to outsource certain events to non-ACPI
* drivers via the device manager (device.c).
@@ -545,7 +542,7 @@ static void acpi_bus_notify(acpi_handle handle, u32 type, void *data)
break;
case ACPI_NOTIFY_DEVICE_CHECK:
- acpi_bus_check_device(device);
+ acpi_bus_check_device(handle);
/*
* TBD: We'll need to outsource certain events to non-ACPI
* drivers via the device manager (device.c).
@@ -583,10 +580,13 @@ static void acpi_bus_notify(acpi_handle handle, u32 type, void *data)
break;
}
- driver = device->driver;
- if (driver && driver->ops.notify &&
- (driver->flags & ACPI_DRIVER_ALL_NOTIFY_EVENTS))
- driver->ops.notify(device, type);
+ acpi_bus_get_device(handle, &device);
+ if (device) {
+ driver = device->driver;
+ if (driver && driver->ops.notify &&
+ (driver->flags & ACPI_DRIVER_ALL_NOTIFY_EVENTS))
+ driver->ops.notify(device, type);
+ }
}
/* --------------------------------------------------------------------------
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 0/4] ACPI: use handle, not device, in system notification path
2009-05-22 17:43 [PATCH 0/4] ACPI: use handle, not device, in system notification path Bjorn Helgaas
` (3 preceding siblings ...)
2009-05-22 17:43 ` [PATCH 4/4] ACPI: use handle, not device, in system notification path Bjorn Helgaas
@ 2009-05-28 1:32 ` Len Brown
4 siblings, 0 replies; 6+ messages in thread
From: Len Brown @ 2009-05-28 1:32 UTC (permalink / raw)
To: Bjorn Helgaas; +Cc: linux-acpi
applied to acpi-test
thanks,
Len Brown, Intel Open Source Technology Center
On Fri, 22 May 2009, Bjorn Helgaas wrote:
> Currently, ACPI hotplug is mostly handled in drivers. I'm working on moving
> that hotplug support out of drivers and into the Linux/ACPI core.
>
> These patches change the Linux/ACPI notify handling to use the
> acpi_handle a bit longer before looking up an acpi_device.
>
> System notifications often deal with device presence and status change.
> In these cases, we may not have an acpi_device. For example, we may
> get a Device Check notification on an object that previously was not
> present. Since the object was not present, we would not have had an
> acpi_device for it.
>
> Note: The last patch in this series depends on this previous patch
> that is not upstream yet:
> http://patchwork.kernel.org/patch/21076/
>
> Comments welcome.
>
> ---
>
> Bjorn Helgaas (4):
> ACPI: use handle, not device, in system notification path
> ACPI: remove unused return values from Bus Check & Device Check handling
> ACPI: remove unused "status_changed" return value from Check Device handling
> ACPI: simplify notification debug messages
>
>
> drivers/acpi/bus.c | 93 +++++++++++++---------------------------------------
> 1 files changed, 23 insertions(+), 70 deletions(-)
>
> --
> Bjorn
> --
> 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
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-05-28 1:32 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-22 17:43 [PATCH 0/4] ACPI: use handle, not device, in system notification path Bjorn Helgaas
2009-05-22 17:43 ` [PATCH 1/4] ACPI: simplify notification debug messages Bjorn Helgaas
2009-05-22 17:43 ` [PATCH 2/4] ACPI: remove unused "status_changed" return value from Check Device handling Bjorn Helgaas
2009-05-22 17:43 ` [PATCH 3/4] ACPI: remove unused return values from Bus Check & Device Check handling Bjorn Helgaas
2009-05-22 17:43 ` [PATCH 4/4] ACPI: use handle, not device, in system notification path Bjorn Helgaas
2009-05-28 1:32 ` [PATCH 0/4] " 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).