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 5/5] ACPI / ia64 / sba_iommu: Use ACPI scan handler for discovery
Date: Thu, 13 Jun 2013 01:26:45 +0200 [thread overview]
Message-ID: <2429621.vqKFZEI7Ma@vostro.rjw.lan> (raw)
In-Reply-To: <1417592.vuSG0cUIGo@vostro.rjw.lan>
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
The IA64 System Bus Adapter (SBA) I/O MMU driver uses an ACPI driver
object to look for device objects it needs in the ACPI namespace, but
the way that driver object is used by it is kind of abusive.
First of all, the ACPI driver is registered with the assumption that
its .add() routine (an equivalent of .probe()) will run immediately
during the registration, which in principle may or may not happen (it
happens in practice due to the way the kernel is built, but that's
not actually guaranteed). Second, .add() is the only functionality
provided by that driver object (which means that it probes devices
without really doing anything with them afterward) and that .add() is
only supposed to run during system initialization, so having the
driver object registered (and present in sysfs) throughout the
system's life time isn't particularly useful.
A cleaner way to achieve the same goal that driver object is for
is to use an ACPI scan handler instead of it, which at least
prevents sysfs from being littered with useless data and causes
an improved algorithm of matching ACPI device IDs to be used.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
arch/ia64/hp/common/sba_iommu.c | 24 ++++++++++++++++--------
1 file changed, 16 insertions(+), 8 deletions(-)
Index: linux-pm/arch/ia64/hp/common/sba_iommu.c
===================================================================
--- linux-pm.orig/arch/ia64/hp/common/sba_iommu.c
+++ linux-pm/arch/ia64/hp/common/sba_iommu.c
@@ -2042,7 +2042,8 @@ sba_map_ioc_to_node(struct ioc *ioc, acp
#endif
static int __init
-acpi_sba_ioc_add(struct acpi_device *device)
+acpi_sba_ioc_add(struct acpi_device *device,
+ const struct acpi_device_id *not_used)
{
struct ioc *ioc;
acpi_status status;
@@ -2090,14 +2091,18 @@ static const struct acpi_device_id hp_io
{"HWP0004", 0},
{"", 0},
};
-static struct acpi_driver acpi_sba_ioc_driver = {
- .name = "IOC IOMMU Driver",
- .ids = hp_ioc_iommu_device_ids,
- .ops = {
- .add = acpi_sba_ioc_add,
- },
+static struct acpi_scan_handler acpi_sba_ioc_handler = {
+ .ids = hp_ioc_iommu_device_ids,
+ .attach = acpi_sba_ioc_add,
};
+static int __init acpi_sba_ioc_init_acpi(void)
+{
+ return acpi_scan_add_handler(&acpi_sba_ioc_handler);
+}
+/* This has to run before acpi_scan_init(). */
+arch_initcall(acpi_sba_ioc_init_acpi);
+
extern struct dma_map_ops swiotlb_dma_ops;
static int __init
@@ -2122,7 +2127,10 @@ sba_init(void)
}
#endif
- acpi_bus_register_driver(&acpi_sba_ioc_driver);
+ /*
+ * ioc_list should be populated by the acpi_sba_ioc_handler's .attach()
+ * routine, but that only happens if acpi_scan_init() has already run.
+ */
if (!ioc_list) {
#ifdef CONFIG_IA64_GENERIC
/*
next prev parent reply other threads:[~2013-06-12 23:18 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 ` [PATCH 3/5] ACPI / scan: Add hotplug profile pointer to struct acpi_device Rafael J. Wysocki
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 ` Rafael J. Wysocki [this message]
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=2429621.vqKFZEI7Ma@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
all inboxes | Powered by JetHome®