David Shaohua Li | 4e10d12 | 2005-03-18 18:45:35 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Link physical devices with ACPI devices support |
| 3 | * |
| 4 | * Copyright (c) 2005 David Shaohua Li <shaohua.li@intel.com> |
| 5 | * Copyright (c) 2005 Intel Corp. |
| 6 | * |
| 7 | * This file is released under the GPLv2. |
| 8 | */ |
Paul Gortmaker | 214f2c9 | 2011-10-26 16:22:14 -0400 | [diff] [blame] | 9 | #include <linux/export.h> |
David Shaohua Li | 4e10d12 | 2005-03-18 18:45:35 -0500 | [diff] [blame] | 10 | #include <linux/init.h> |
| 11 | #include <linux/list.h> |
| 12 | #include <linux/device.h> |
Tejun Heo | 5a0e3ad | 2010-03-24 17:04:11 +0900 | [diff] [blame] | 13 | #include <linux/slab.h> |
David Shaohua Li | 4e10d12 | 2005-03-18 18:45:35 -0500 | [diff] [blame] | 14 | #include <linux/rwsem.h> |
| 15 | #include <linux/acpi.h> |
| 16 | |
Len Brown | a192a95 | 2009-07-28 16:45:54 -0400 | [diff] [blame] | 17 | #include "internal.h" |
| 18 | |
David Shaohua Li | 4e10d12 | 2005-03-18 18:45:35 -0500 | [diff] [blame] | 19 | #define ACPI_GLUE_DEBUG 0 |
| 20 | #if ACPI_GLUE_DEBUG |
Joe Perches | 23415eb | 2012-12-18 06:31:30 +0000 | [diff] [blame] | 21 | #define DBG(fmt, ...) \ |
| 22 | printk(KERN_DEBUG PREFIX fmt, ##__VA_ARGS__) |
David Shaohua Li | 4e10d12 | 2005-03-18 18:45:35 -0500 | [diff] [blame] | 23 | #else |
Joe Perches | 23415eb | 2012-12-18 06:31:30 +0000 | [diff] [blame] | 24 | #define DBG(fmt, ...) \ |
| 25 | do { \ |
| 26 | if (0) \ |
| 27 | printk(KERN_DEBUG PREFIX fmt, ##__VA_ARGS__); \ |
| 28 | } while (0) |
David Shaohua Li | 4e10d12 | 2005-03-18 18:45:35 -0500 | [diff] [blame] | 29 | #endif |
| 30 | static LIST_HEAD(bus_type_list); |
| 31 | static DECLARE_RWSEM(bus_type_sem); |
| 32 | |
Lan Tianyu | 1033f90 | 2012-08-17 14:44:09 +0800 | [diff] [blame] | 33 | #define PHYSICAL_NODE_STRING "physical_node" |
| 34 | |
David Shaohua Li | 4e10d12 | 2005-03-18 18:45:35 -0500 | [diff] [blame] | 35 | int register_acpi_bus_type(struct acpi_bus_type *type) |
| 36 | { |
| 37 | if (acpi_disabled) |
| 38 | return -ENODEV; |
| 39 | if (type && type->bus && type->find_device) { |
| 40 | down_write(&bus_type_sem); |
| 41 | list_add_tail(&type->list, &bus_type_list); |
| 42 | up_write(&bus_type_sem); |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 43 | printk(KERN_INFO PREFIX "bus type %s registered\n", |
| 44 | type->bus->name); |
David Shaohua Li | 4e10d12 | 2005-03-18 18:45:35 -0500 | [diff] [blame] | 45 | return 0; |
| 46 | } |
| 47 | return -ENODEV; |
| 48 | } |
Jeff Garzik | 91e4d5a | 2012-07-25 14:24:13 -0400 | [diff] [blame] | 49 | EXPORT_SYMBOL_GPL(register_acpi_bus_type); |
David Shaohua Li | 4e10d12 | 2005-03-18 18:45:35 -0500 | [diff] [blame] | 50 | |
David Shaohua Li | 4e10d12 | 2005-03-18 18:45:35 -0500 | [diff] [blame] | 51 | int unregister_acpi_bus_type(struct acpi_bus_type *type) |
| 52 | { |
| 53 | if (acpi_disabled) |
| 54 | return 0; |
| 55 | if (type) { |
| 56 | down_write(&bus_type_sem); |
| 57 | list_del_init(&type->list); |
| 58 | up_write(&bus_type_sem); |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 59 | printk(KERN_INFO PREFIX "ACPI bus type %s unregistered\n", |
| 60 | type->bus->name); |
David Shaohua Li | 4e10d12 | 2005-03-18 18:45:35 -0500 | [diff] [blame] | 61 | return 0; |
| 62 | } |
| 63 | return -ENODEV; |
| 64 | } |
Jeff Garzik | 91e4d5a | 2012-07-25 14:24:13 -0400 | [diff] [blame] | 65 | EXPORT_SYMBOL_GPL(unregister_acpi_bus_type); |
David Shaohua Li | 4e10d12 | 2005-03-18 18:45:35 -0500 | [diff] [blame] | 66 | |
David Shaohua Li | 4e10d12 | 2005-03-18 18:45:35 -0500 | [diff] [blame] | 67 | static struct acpi_bus_type *acpi_get_bus_type(struct bus_type *type) |
| 68 | { |
| 69 | struct acpi_bus_type *tmp, *ret = NULL; |
| 70 | |
| 71 | down_read(&bus_type_sem); |
| 72 | list_for_each_entry(tmp, &bus_type_list, list) { |
| 73 | if (tmp->bus == type) { |
| 74 | ret = tmp; |
| 75 | break; |
| 76 | } |
| 77 | } |
| 78 | up_read(&bus_type_sem); |
| 79 | return ret; |
| 80 | } |
| 81 | |
| 82 | static int acpi_find_bridge_device(struct device *dev, acpi_handle * handle) |
| 83 | { |
| 84 | struct acpi_bus_type *tmp; |
| 85 | int ret = -ENODEV; |
| 86 | |
| 87 | down_read(&bus_type_sem); |
| 88 | list_for_each_entry(tmp, &bus_type_list, list) { |
| 89 | if (tmp->find_bridge && !tmp->find_bridge(dev, handle)) { |
| 90 | ret = 0; |
| 91 | break; |
| 92 | } |
| 93 | } |
| 94 | up_read(&bus_type_sem); |
| 95 | return ret; |
| 96 | } |
| 97 | |
Rafael J. Wysocki | 33f767d | 2013-01-10 13:13:49 +0100 | [diff] [blame^] | 98 | static acpi_status do_acpi_find_child(acpi_handle handle, u32 lvl_not_used, |
| 99 | void *addr_p, void **ret_p) |
David Shaohua Li | 4e10d12 | 2005-03-18 18:45:35 -0500 | [diff] [blame] | 100 | { |
Rafael J. Wysocki | 33f767d | 2013-01-10 13:13:49 +0100 | [diff] [blame^] | 101 | unsigned long long addr; |
David Shaohua Li | 4e10d12 | 2005-03-18 18:45:35 -0500 | [diff] [blame] | 102 | acpi_status status; |
David Shaohua Li | 4e10d12 | 2005-03-18 18:45:35 -0500 | [diff] [blame] | 103 | |
Rafael J. Wysocki | 33f767d | 2013-01-10 13:13:49 +0100 | [diff] [blame^] | 104 | status = acpi_evaluate_integer(handle, METHOD_NAME__ADR, NULL, &addr); |
| 105 | if (ACPI_SUCCESS(status) && addr == *((u64 *)addr_p)) { |
| 106 | *ret_p = handle; |
| 107 | return AE_CTRL_TERMINATE; |
David Shaohua Li | 4e10d12 | 2005-03-18 18:45:35 -0500 | [diff] [blame] | 108 | } |
| 109 | return AE_OK; |
| 110 | } |
| 111 | |
Lin Ming | 439913f | 2010-01-28 10:53:19 +0800 | [diff] [blame] | 112 | acpi_handle acpi_get_child(acpi_handle parent, u64 address) |
David Shaohua Li | 4e10d12 | 2005-03-18 18:45:35 -0500 | [diff] [blame] | 113 | { |
Rafael J. Wysocki | 33f767d | 2013-01-10 13:13:49 +0100 | [diff] [blame^] | 114 | void *ret = NULL; |
David Shaohua Li | 4e10d12 | 2005-03-18 18:45:35 -0500 | [diff] [blame] | 115 | |
| 116 | if (!parent) |
| 117 | return NULL; |
David Shaohua Li | 4e10d12 | 2005-03-18 18:45:35 -0500 | [diff] [blame] | 118 | |
Rafael J. Wysocki | 33f767d | 2013-01-10 13:13:49 +0100 | [diff] [blame^] | 119 | acpi_walk_namespace(ACPI_TYPE_DEVICE, parent, 1, NULL, |
| 120 | do_acpi_find_child, &address, &ret); |
| 121 | return (acpi_handle)ret; |
| 122 | } |
David Shaohua Li | 4e10d12 | 2005-03-18 18:45:35 -0500 | [diff] [blame] | 123 | EXPORT_SYMBOL(acpi_get_child); |
| 124 | |
David Shaohua Li | 4e10d12 | 2005-03-18 18:45:35 -0500 | [diff] [blame] | 125 | static int acpi_bind_one(struct device *dev, acpi_handle handle) |
| 126 | { |
David Brownell | 1071695 | 2008-02-22 21:54:24 -0800 | [diff] [blame] | 127 | struct acpi_device *acpi_dev; |
David Shaohua Li | 4e10d12 | 2005-03-18 18:45:35 -0500 | [diff] [blame] | 128 | acpi_status status; |
Rafael J. Wysocki | f3fd0c8 | 2012-11-21 00:21:39 +0100 | [diff] [blame] | 129 | struct acpi_device_physical_node *physical_node, *pn; |
Lan Tianyu | 1033f90 | 2012-08-17 14:44:09 +0800 | [diff] [blame] | 130 | char physical_node_name[sizeof(PHYSICAL_NODE_STRING) + 2]; |
| 131 | int retval = -EINVAL; |
David Shaohua Li | 4e10d12 | 2005-03-18 18:45:35 -0500 | [diff] [blame] | 132 | |
Rafael J. Wysocki | 95f8a08 | 2012-11-21 00:21:50 +0100 | [diff] [blame] | 133 | if (ACPI_HANDLE(dev)) { |
Rafael J. Wysocki | f3fd0c8 | 2012-11-21 00:21:39 +0100 | [diff] [blame] | 134 | if (handle) { |
| 135 | dev_warn(dev, "ACPI handle is already set\n"); |
| 136 | return -EINVAL; |
| 137 | } else { |
Rafael J. Wysocki | 95f8a08 | 2012-11-21 00:21:50 +0100 | [diff] [blame] | 138 | handle = ACPI_HANDLE(dev); |
Rafael J. Wysocki | f3fd0c8 | 2012-11-21 00:21:39 +0100 | [diff] [blame] | 139 | } |
David Shaohua Li | 4e10d12 | 2005-03-18 18:45:35 -0500 | [diff] [blame] | 140 | } |
Rafael J. Wysocki | f3fd0c8 | 2012-11-21 00:21:39 +0100 | [diff] [blame] | 141 | if (!handle) |
| 142 | return -EINVAL; |
Lan Tianyu | 1033f90 | 2012-08-17 14:44:09 +0800 | [diff] [blame] | 143 | |
David Shaohua Li | 4e10d12 | 2005-03-18 18:45:35 -0500 | [diff] [blame] | 144 | get_device(dev); |
Lan Tianyu | 1033f90 | 2012-08-17 14:44:09 +0800 | [diff] [blame] | 145 | status = acpi_bus_get_device(handle, &acpi_dev); |
| 146 | if (ACPI_FAILURE(status)) |
| 147 | goto err; |
| 148 | |
Rafael J. Wysocki | f3fd0c8 | 2012-11-21 00:21:39 +0100 | [diff] [blame] | 149 | physical_node = kzalloc(sizeof(*physical_node), GFP_KERNEL); |
Lan Tianyu | 1033f90 | 2012-08-17 14:44:09 +0800 | [diff] [blame] | 150 | if (!physical_node) { |
| 151 | retval = -ENOMEM; |
| 152 | goto err; |
David Shaohua Li | 4e10d12 | 2005-03-18 18:45:35 -0500 | [diff] [blame] | 153 | } |
Lan Tianyu | 1033f90 | 2012-08-17 14:44:09 +0800 | [diff] [blame] | 154 | |
| 155 | mutex_lock(&acpi_dev->physical_node_lock); |
Rafael J. Wysocki | f3fd0c8 | 2012-11-21 00:21:39 +0100 | [diff] [blame] | 156 | |
| 157 | /* Sanity check. */ |
| 158 | list_for_each_entry(pn, &acpi_dev->physical_node_list, node) |
| 159 | if (pn->dev == dev) { |
| 160 | dev_warn(dev, "Already associated with ACPI node\n"); |
| 161 | goto err_free; |
| 162 | } |
| 163 | |
Lan Tianyu | 1033f90 | 2012-08-17 14:44:09 +0800 | [diff] [blame] | 164 | /* allocate physical node id according to physical_node_id_bitmap */ |
| 165 | physical_node->node_id = |
| 166 | find_first_zero_bit(acpi_dev->physical_node_id_bitmap, |
| 167 | ACPI_MAX_PHYSICAL_NODE); |
| 168 | if (physical_node->node_id >= ACPI_MAX_PHYSICAL_NODE) { |
| 169 | retval = -ENOSPC; |
Rafael J. Wysocki | f3fd0c8 | 2012-11-21 00:21:39 +0100 | [diff] [blame] | 170 | goto err_free; |
Lan Tianyu | 1033f90 | 2012-08-17 14:44:09 +0800 | [diff] [blame] | 171 | } |
| 172 | |
| 173 | set_bit(physical_node->node_id, acpi_dev->physical_node_id_bitmap); |
| 174 | physical_node->dev = dev; |
| 175 | list_add_tail(&physical_node->node, &acpi_dev->physical_node_list); |
| 176 | acpi_dev->physical_node_count++; |
Rafael J. Wysocki | f3fd0c8 | 2012-11-21 00:21:39 +0100 | [diff] [blame] | 177 | |
Lan Tianyu | 1033f90 | 2012-08-17 14:44:09 +0800 | [diff] [blame] | 178 | mutex_unlock(&acpi_dev->physical_node_lock); |
| 179 | |
Rafael J. Wysocki | 95f8a08 | 2012-11-21 00:21:50 +0100 | [diff] [blame] | 180 | if (!ACPI_HANDLE(dev)) |
| 181 | ACPI_HANDLE_SET(dev, acpi_dev->handle); |
David Shaohua Li | 4e10d12 | 2005-03-18 18:45:35 -0500 | [diff] [blame] | 182 | |
Lan Tianyu | 1033f90 | 2012-08-17 14:44:09 +0800 | [diff] [blame] | 183 | if (!physical_node->node_id) |
| 184 | strcpy(physical_node_name, PHYSICAL_NODE_STRING); |
| 185 | else |
| 186 | sprintf(physical_node_name, |
| 187 | "physical_node%d", physical_node->node_id); |
| 188 | retval = sysfs_create_link(&acpi_dev->dev.kobj, &dev->kobj, |
| 189 | physical_node_name); |
| 190 | retval = sysfs_create_link(&dev->kobj, &acpi_dev->dev.kobj, |
| 191 | "firmware_node"); |
David Brownell | 1071695 | 2008-02-22 21:54:24 -0800 | [diff] [blame] | 192 | |
Lan Tianyu | 1033f90 | 2012-08-17 14:44:09 +0800 | [diff] [blame] | 193 | if (acpi_dev->wakeup.flags.valid) |
| 194 | device_set_wakeup_capable(dev, true); |
David Brownell | 1071695 | 2008-02-22 21:54:24 -0800 | [diff] [blame] | 195 | |
David Shaohua Li | 4e10d12 | 2005-03-18 18:45:35 -0500 | [diff] [blame] | 196 | return 0; |
Lan Tianyu | 1033f90 | 2012-08-17 14:44:09 +0800 | [diff] [blame] | 197 | |
| 198 | err: |
Rafael J. Wysocki | 95f8a08 | 2012-11-21 00:21:50 +0100 | [diff] [blame] | 199 | ACPI_HANDLE_SET(dev, NULL); |
Lan Tianyu | 1033f90 | 2012-08-17 14:44:09 +0800 | [diff] [blame] | 200 | put_device(dev); |
| 201 | return retval; |
Rafael J. Wysocki | f3fd0c8 | 2012-11-21 00:21:39 +0100 | [diff] [blame] | 202 | |
| 203 | err_free: |
| 204 | mutex_unlock(&acpi_dev->physical_node_lock); |
| 205 | kfree(physical_node); |
| 206 | goto err; |
David Shaohua Li | 4e10d12 | 2005-03-18 18:45:35 -0500 | [diff] [blame] | 207 | } |
| 208 | |
| 209 | static int acpi_unbind_one(struct device *dev) |
| 210 | { |
Lan Tianyu | 1033f90 | 2012-08-17 14:44:09 +0800 | [diff] [blame] | 211 | struct acpi_device_physical_node *entry; |
| 212 | struct acpi_device *acpi_dev; |
| 213 | acpi_status status; |
| 214 | struct list_head *node, *next; |
| 215 | |
Rafael J. Wysocki | 95f8a08 | 2012-11-21 00:21:50 +0100 | [diff] [blame] | 216 | if (!ACPI_HANDLE(dev)) |
David Shaohua Li | 4e10d12 | 2005-03-18 18:45:35 -0500 | [diff] [blame] | 217 | return 0; |
David Brownell | 1071695 | 2008-02-22 21:54:24 -0800 | [diff] [blame] | 218 | |
Rafael J. Wysocki | 95f8a08 | 2012-11-21 00:21:50 +0100 | [diff] [blame] | 219 | status = acpi_bus_get_device(ACPI_HANDLE(dev), &acpi_dev); |
Lan Tianyu | 1033f90 | 2012-08-17 14:44:09 +0800 | [diff] [blame] | 220 | if (ACPI_FAILURE(status)) |
| 221 | goto err; |
David Brownell | 1071695 | 2008-02-22 21:54:24 -0800 | [diff] [blame] | 222 | |
Lan Tianyu | 1033f90 | 2012-08-17 14:44:09 +0800 | [diff] [blame] | 223 | mutex_lock(&acpi_dev->physical_node_lock); |
| 224 | list_for_each_safe(node, next, &acpi_dev->physical_node_list) { |
| 225 | char physical_node_name[sizeof(PHYSICAL_NODE_STRING) + 2]; |
David Brownell | 1071695 | 2008-02-22 21:54:24 -0800 | [diff] [blame] | 226 | |
Lan Tianyu | 1033f90 | 2012-08-17 14:44:09 +0800 | [diff] [blame] | 227 | entry = list_entry(node, struct acpi_device_physical_node, |
| 228 | node); |
| 229 | if (entry->dev != dev) |
| 230 | continue; |
| 231 | |
| 232 | list_del(node); |
| 233 | clear_bit(entry->node_id, acpi_dev->physical_node_id_bitmap); |
| 234 | |
| 235 | acpi_dev->physical_node_count--; |
| 236 | |
| 237 | if (!entry->node_id) |
| 238 | strcpy(physical_node_name, PHYSICAL_NODE_STRING); |
| 239 | else |
| 240 | sprintf(physical_node_name, |
| 241 | "physical_node%d", entry->node_id); |
| 242 | |
| 243 | sysfs_remove_link(&acpi_dev->dev.kobj, physical_node_name); |
| 244 | sysfs_remove_link(&dev->kobj, "firmware_node"); |
Rafael J. Wysocki | 95f8a08 | 2012-11-21 00:21:50 +0100 | [diff] [blame] | 245 | ACPI_HANDLE_SET(dev, NULL); |
David Shaohua Li | 4e10d12 | 2005-03-18 18:45:35 -0500 | [diff] [blame] | 246 | /* acpi_bind_one increase refcnt by one */ |
| 247 | put_device(dev); |
Lan Tianyu | 1033f90 | 2012-08-17 14:44:09 +0800 | [diff] [blame] | 248 | kfree(entry); |
David Shaohua Li | 4e10d12 | 2005-03-18 18:45:35 -0500 | [diff] [blame] | 249 | } |
Lan Tianyu | 1033f90 | 2012-08-17 14:44:09 +0800 | [diff] [blame] | 250 | mutex_unlock(&acpi_dev->physical_node_lock); |
| 251 | |
David Shaohua Li | 4e10d12 | 2005-03-18 18:45:35 -0500 | [diff] [blame] | 252 | return 0; |
Lan Tianyu | 1033f90 | 2012-08-17 14:44:09 +0800 | [diff] [blame] | 253 | |
| 254 | err: |
| 255 | dev_err(dev, "Oops, 'acpi_handle' corrupt\n"); |
| 256 | return -EINVAL; |
David Shaohua Li | 4e10d12 | 2005-03-18 18:45:35 -0500 | [diff] [blame] | 257 | } |
| 258 | |
| 259 | static int acpi_platform_notify(struct device *dev) |
| 260 | { |
| 261 | struct acpi_bus_type *type; |
| 262 | acpi_handle handle; |
| 263 | int ret = -EINVAL; |
| 264 | |
Rafael J. Wysocki | f3fd0c8 | 2012-11-21 00:21:39 +0100 | [diff] [blame] | 265 | ret = acpi_bind_one(dev, NULL); |
| 266 | if (!ret) |
| 267 | goto out; |
| 268 | |
David Shaohua Li | 4e10d12 | 2005-03-18 18:45:35 -0500 | [diff] [blame] | 269 | if (!dev->bus || !dev->parent) { |
| 270 | /* bridge devices genernally haven't bus or parent */ |
| 271 | ret = acpi_find_bridge_device(dev, &handle); |
| 272 | goto end; |
| 273 | } |
| 274 | type = acpi_get_bus_type(dev->bus); |
| 275 | if (!type) { |
Kay Sievers | db1461a | 2009-01-25 23:40:56 +0100 | [diff] [blame] | 276 | DBG("No ACPI bus support for %s\n", dev_name(dev)); |
David Shaohua Li | 4e10d12 | 2005-03-18 18:45:35 -0500 | [diff] [blame] | 277 | ret = -EINVAL; |
| 278 | goto end; |
| 279 | } |
| 280 | if ((ret = type->find_device(dev, &handle)) != 0) |
Kay Sievers | db1461a | 2009-01-25 23:40:56 +0100 | [diff] [blame] | 281 | DBG("Can't get handler for %s\n", dev_name(dev)); |
Rafael J. Wysocki | f3fd0c8 | 2012-11-21 00:21:39 +0100 | [diff] [blame] | 282 | end: |
David Shaohua Li | 4e10d12 | 2005-03-18 18:45:35 -0500 | [diff] [blame] | 283 | if (!ret) |
| 284 | acpi_bind_one(dev, handle); |
| 285 | |
Rafael J. Wysocki | f3fd0c8 | 2012-11-21 00:21:39 +0100 | [diff] [blame] | 286 | out: |
David Shaohua Li | 4e10d12 | 2005-03-18 18:45:35 -0500 | [diff] [blame] | 287 | #if ACPI_GLUE_DEBUG |
| 288 | if (!ret) { |
| 289 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; |
| 290 | |
Yinghai Lu | a412a11 | 2013-01-12 14:00:06 +0100 | [diff] [blame] | 291 | acpi_get_name(ACPI_HANDLE(dev), ACPI_FULL_PATHNAME, &buffer); |
Kay Sievers | db1461a | 2009-01-25 23:40:56 +0100 | [diff] [blame] | 292 | DBG("Device %s -> %s\n", dev_name(dev), (char *)buffer.pointer); |
Len Brown | 02438d8 | 2006-06-30 03:19:10 -0400 | [diff] [blame] | 293 | kfree(buffer.pointer); |
David Shaohua Li | 4e10d12 | 2005-03-18 18:45:35 -0500 | [diff] [blame] | 294 | } else |
Kay Sievers | db1461a | 2009-01-25 23:40:56 +0100 | [diff] [blame] | 295 | DBG("Device %s -> No ACPI support\n", dev_name(dev)); |
David Shaohua Li | 4e10d12 | 2005-03-18 18:45:35 -0500 | [diff] [blame] | 296 | #endif |
| 297 | |
| 298 | return ret; |
| 299 | } |
| 300 | |
| 301 | static int acpi_platform_notify_remove(struct device *dev) |
| 302 | { |
| 303 | acpi_unbind_one(dev); |
| 304 | return 0; |
| 305 | } |
| 306 | |
Bjorn Helgaas | 0e46517d | 2009-03-24 16:50:09 -0600 | [diff] [blame] | 307 | int __init init_acpi_device_notify(void) |
David Shaohua Li | 4e10d12 | 2005-03-18 18:45:35 -0500 | [diff] [blame] | 308 | { |
David Shaohua Li | 4e10d12 | 2005-03-18 18:45:35 -0500 | [diff] [blame] | 309 | if (platform_notify || platform_notify_remove) { |
| 310 | printk(KERN_ERR PREFIX "Can't use platform_notify\n"); |
| 311 | return 0; |
| 312 | } |
| 313 | platform_notify = acpi_platform_notify; |
| 314 | platform_notify_remove = acpi_platform_notify_remove; |
| 315 | return 0; |
| 316 | } |