9 #include <linux/export.h>
11 #include <linux/list.h>
12 #include <linux/device.h>
13 #include <linux/slab.h>
19 #define ACPI_GLUE_DEBUG 0
21 #define DBG(x...) printk(PREFIX x)
23 #define DBG(x...) do { } while(0)
28 #define PHYSICAL_NODE_STRING "physical_node"
34 if (type && type->bus && type->find_device) {
52 list_del_init(&type->list);
68 if (tmp->bus == type) {
84 if (tmp->find_bridge && !tmp->find_bridge(dev, handle)) {
123 1, do_acpi_find_child,
NULL, &find,
NULL);
131 struct acpi_device *acpi_dev;
133 struct acpi_device_physical_node *physical_node;
138 dev_warn(dev,
"Drivers changed 'acpi_handle'\n");
147 physical_node = kzalloc(
sizeof(
struct acpi_device_physical_node),
149 if (!physical_node) {
156 physical_node->node_id =
158 ACPI_MAX_PHYSICAL_NODE);
159 if (physical_node->node_id >= ACPI_MAX_PHYSICAL_NODE) {
162 kfree(physical_node);
166 set_bit(physical_node->node_id, acpi_dev->physical_node_id_bitmap);
167 physical_node->dev =
dev;
168 list_add_tail(&physical_node->node, &acpi_dev->physical_node_list);
169 acpi_dev->physical_node_count++;
174 if (!physical_node->node_id)
178 "physical_node%d", physical_node->node_id);
184 if (acpi_dev->wakeup.flags.valid)
194 static int acpi_unbind_one(
struct device *dev)
196 struct acpi_device_physical_node *
entry;
197 struct acpi_device *acpi_dev;
213 entry =
list_entry(node,
struct acpi_device_physical_node,
215 if (entry->dev != dev)
219 clear_bit(entry->node_id, acpi_dev->physical_node_id_bitmap);
221 acpi_dev->physical_node_count--;
227 "physical_node%d", entry->node_id);
241 dev_err(dev,
"Oops, 'acpi_handle' corrupt\n");
245 static int acpi_platform_notify(
struct device *dev)
253 ret = acpi_find_bridge_device(dev, &handle);
256 type = acpi_get_bus_type(dev->
bus);
258 DBG(
"No ACPI bus support for %s\n", dev_name(dev));
262 if ((ret = type->find_device(dev, &handle)) != 0)
263 DBG(
"Can't get handler for %s\n", dev_name(dev));
266 acpi_bind_one(dev, handle);
274 DBG(
"Device %s -> %s\n", dev_name(dev), (
char *)buffer.
pointer);
277 DBG(
"Device %s -> No ACPI support\n", dev_name(dev));
283 static int acpi_platform_notify_remove(
struct device *dev)
285 acpi_unbind_one(dev);