From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: ACPI Devel Maling List <linux-acpi@vger.kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
"Luck, Tony" <tony.luck@intel.com>,
Toshi Kani <toshi.kani@hp.com>, Aaron Lu <aaron.lu@intel.com>
Subject: [PATCH 3/5] ACPI / scan: Add hotplug profile pointer to struct acpi_device
Date: Thu, 13 Jun 2013 01:25:15 +0200 [thread overview]
Message-ID: <2104764.58TiduhPzb@vostro.rjw.lan> (raw)
In-Reply-To: <1417592.vuSG0cUIGo@vostro.rjw.lan>
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Since it generally make sense to combine different ACPI scan handlers
(that don't have their own hotplug profiles) with the container
hotplug profile, make it possible by adding a hotplug profile pointer
to struct acpi_device (so that the hotplug profile and scan handler
may be set for device objects independently of each other) and make
the generic hotplug code use the device object's hotplug profile
rather than the hotplug profile from its scan handler.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
drivers/acpi/scan.c | 24 +++++++++++++-----------
include/acpi/acpi_bus.h | 1 +
2 files changed, 14 insertions(+), 11 deletions(-)
Index: linux-pm/drivers/acpi/scan.c
===================================================================
--- linux-pm.orig/drivers/acpi/scan.c
+++ linux-pm/drivers/acpi/scan.c
@@ -296,7 +296,7 @@ static void acpi_bus_device_eject(void *
{
acpi_handle handle = context;
struct acpi_device *device = NULL;
- struct acpi_scan_handler *handler;
+ struct acpi_hotplug_profile *hotplug;
u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE;
mutex_lock(&acpi_scan_lock);
@@ -305,14 +305,14 @@ static void acpi_bus_device_eject(void *
if (!device)
goto err_out;
- handler = device->handler;
- if (!handler || !handler->hotplug || !handler->hotplug->enabled) {
+ hotplug = device->hotplug;
+ if (!hotplug || !hotplug->enabled) {
ost_code = ACPI_OST_SC_EJECT_NOT_SUPPORTED;
goto err_out;
}
acpi_evaluate_hotplug_ost(handle, ACPI_NOTIFY_EJECT_REQUEST,
ACPI_OST_SC_EJECT_IN_PROGRESS, NULL);
- if (handler->hotplug->mode == AHM_CONTAINER) {
+ if (hotplug->mode == AHM_CONTAINER) {
device->flags.eject_pending = true;
kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE);
} else {
@@ -361,8 +361,7 @@ static void acpi_scan_bus_device_check(a
goto out;
}
ost_code = ACPI_OST_SC_SUCCESS;
- if (device->handler && device->handler->hotplug
- && device->handler->hotplug->mode == AHM_CONTAINER)
+ if (device->hotplug && device->hotplug->mode == AHM_CONTAINER)
kobject_uevent(&device->dev.kobj, KOBJ_ONLINE);
out:
@@ -414,10 +413,10 @@ static void acpi_hotplug_unsupported(acp
static void acpi_hotplug_notify_cb(acpi_handle handle, u32 type, void *data)
{
acpi_osd_exec_callback callback;
- struct acpi_scan_handler *handler = data;
+ struct acpi_hotplug_profile *hotplug = data;
acpi_status status;
- if (!handler->hotplug || !handler->hotplug->enabled)
+ if (!hotplug || !hotplug->enabled)
return acpi_hotplug_unsupported(handle, type);
switch (type) {
@@ -512,8 +511,8 @@ acpi_eject_store(struct device *d, struc
if (!count || buf[0] != '1')
return -EINVAL;
- if ((!acpi_device->handler || !acpi_device->handler->hotplug
- || !acpi_device->handler->hotplug->enabled) && !acpi_device->driver)
+ if ((!acpi_device->hotplug || !acpi_device->hotplug->enabled)
+ && !acpi_device->driver)
return -ENODEV;
status = acpi_get_type(acpi_device->handle, ¬_used);
@@ -1876,7 +1875,8 @@ static void acpi_scan_init_hotplug(acpi_
handler = acpi_scan_match_handler(hwid->id, NULL);
if (handler && handler->hotplug) {
acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY,
- acpi_hotplug_notify_cb, handler);
+ acpi_hotplug_notify_cb,
+ handler->hotplug);
break;
}
}
@@ -1948,6 +1948,7 @@ static int acpi_scan_attach_handler(stru
ret = handler->attach(device, devid);
if (ret > 0) {
device->handler = handler;
+ device->hotplug = handler->hotplug;
break;
} else if (ret < 0) {
break;
@@ -2028,6 +2029,7 @@ static acpi_status acpi_bus_device_detac
dev_handler->detach(device);
device->handler = NULL;
+ device->hotplug = NULL;
} else {
device_release_driver(&device->dev);
}
Index: linux-pm/include/acpi/acpi_bus.h
===================================================================
--- linux-pm.orig/include/acpi/acpi_bus.h
+++ linux-pm/include/acpi/acpi_bus.h
@@ -300,6 +300,7 @@ struct acpi_device {
struct acpi_device_perf performance;
struct acpi_device_dir dir;
struct acpi_scan_handler *handler;
+ struct acpi_hotplug_profile *hotplug;
struct acpi_driver *driver;
void *driver_data;
struct device dev;
next prev parent reply other threads:[~2013-06-12 23:25 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-12 23:23 [PATCH 0/5] ACPI / scan: Make it possible to use the container hotplug with other scan handlers Rafael J. Wysocki
2013-06-12 23:23 ` [PATCH 1/5] ACPI / scan: Do not bind ACPI drivers to objects with " Rafael J. Wysocki
2013-06-12 23:24 ` [PATCH 2/5] ACPI / scan: Separate hotplug profiles from " Rafael J. Wysocki
2013-06-12 23:25 ` Rafael J. Wysocki [this message]
2013-06-12 23:26 ` [PATCH 4/5] ACPI / scan: Use container hotplug profile for matching device objects Rafael J. Wysocki
2013-06-12 23:26 ` [PATCH 5/5] ACPI / ia64 / sba_iommu: Use ACPI scan handler for discovery Rafael J. Wysocki
2013-06-13 21:28 ` [PATCH 0/5] ACPI / scan: Make it possible to use the container hotplug with other scan handlers Toshi Kani
2013-06-13 22:13 ` Rafael J. Wysocki
2013-06-13 22:23 ` Toshi Kani
2013-06-14 18:01 ` Luck, Tony
2013-06-14 22:23 ` Rafael J. Wysocki
2013-06-14 22:32 ` Tony Luck
2013-06-14 23:20 ` Rafael J. Wysocki
2013-06-19 17:37 ` Tony Luck
2013-06-19 22:24 ` Rafael J. Wysocki
2013-06-19 22:40 ` Tony Luck
2013-06-19 22:51 ` Rafael J. Wysocki
2013-06-19 23:22 ` Toshi Kani
2013-06-19 23:35 ` Rafael J. Wysocki
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=2104764.58TiduhPzb@vostro.rjw.lan \
--to=rjw@sisk.pl \
--cc=aaron.lu@intel.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tony.luck@intel.com \
--cc=toshi.kani@hp.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