diff options
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/xen/xen-acpi-cpuhotplug.c | 34 | ||||
| -rw-r--r-- | drivers/xen/xen-acpi-memhotplug.c | 52 | ||||
| -rw-r--r-- | drivers/xen/xenbus/xenbus_client.c | 1 |
3 files changed, 39 insertions, 48 deletions
diff --git a/drivers/xen/xen-acpi-cpuhotplug.c b/drivers/xen/xen-acpi-cpuhotplug.c index 757827966e34..18c742bec91b 100644 --- a/drivers/xen/xen-acpi-cpuhotplug.c +++ b/drivers/xen/xen-acpi-cpuhotplug.c | |||
| @@ -239,24 +239,6 @@ static acpi_status xen_acpi_cpu_hotadd(struct acpi_processor *pr) | |||
| 239 | return AE_OK; | 239 | return AE_OK; |
| 240 | } | 240 | } |
| 241 | 241 | ||
| 242 | static | ||
| 243 | int acpi_processor_device_add(acpi_handle handle, struct acpi_device **device) | ||
| 244 | { | ||
| 245 | acpi_handle phandle; | ||
| 246 | struct acpi_device *pdev; | ||
| 247 | |||
| 248 | if (acpi_get_parent(handle, &phandle)) | ||
| 249 | return -ENODEV; | ||
| 250 | |||
| 251 | if (acpi_bus_get_device(phandle, &pdev)) | ||
| 252 | return -ENODEV; | ||
| 253 | |||
| 254 | if (acpi_bus_scan(handle)) | ||
| 255 | return -ENODEV; | ||
| 256 | |||
| 257 | return 0; | ||
| 258 | } | ||
| 259 | |||
| 260 | static int acpi_processor_device_remove(struct acpi_device *device) | 242 | static int acpi_processor_device_remove(struct acpi_device *device) |
| 261 | { | 243 | { |
| 262 | pr_debug(PREFIX "Xen does not support CPU hotremove\n"); | 244 | pr_debug(PREFIX "Xen does not support CPU hotremove\n"); |
| @@ -272,6 +254,8 @@ static void acpi_processor_hotplug_notify(acpi_handle handle, | |||
| 272 | u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; /* default */ | 254 | u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; /* default */ |
| 273 | int result; | 255 | int result; |
| 274 | 256 | ||
| 257 | acpi_scan_lock_acquire(); | ||
| 258 | |||
| 275 | switch (event) { | 259 | switch (event) { |
| 276 | case ACPI_NOTIFY_BUS_CHECK: | 260 | case ACPI_NOTIFY_BUS_CHECK: |
| 277 | case ACPI_NOTIFY_DEVICE_CHECK: | 261 | case ACPI_NOTIFY_DEVICE_CHECK: |
| @@ -286,12 +270,16 @@ static void acpi_processor_hotplug_notify(acpi_handle handle, | |||
| 286 | if (!acpi_bus_get_device(handle, &device)) | 270 | if (!acpi_bus_get_device(handle, &device)) |
| 287 | break; | 271 | break; |
| 288 | 272 | ||
| 289 | result = acpi_processor_device_add(handle, &device); | 273 | result = acpi_bus_scan(handle); |
| 290 | if (result) { | 274 | if (result) { |
| 291 | pr_err(PREFIX "Unable to add the device\n"); | 275 | pr_err(PREFIX "Unable to add the device\n"); |
| 292 | break; | 276 | break; |
| 293 | } | 277 | } |
| 294 | 278 | result = acpi_bus_get_device(handle, &device); | |
| 279 | if (result) { | ||
| 280 | pr_err(PREFIX "Missing device object\n"); | ||
| 281 | break; | ||
| 282 | } | ||
| 295 | ost_code = ACPI_OST_SC_SUCCESS; | 283 | ost_code = ACPI_OST_SC_SUCCESS; |
| 296 | break; | 284 | break; |
| 297 | 285 | ||
| @@ -321,11 +309,13 @@ static void acpi_processor_hotplug_notify(acpi_handle handle, | |||
| 321 | "Unsupported event [0x%x]\n", event)); | 309 | "Unsupported event [0x%x]\n", event)); |
| 322 | 310 | ||
| 323 | /* non-hotplug event; possibly handled by other handler */ | 311 | /* non-hotplug event; possibly handled by other handler */ |
| 324 | return; | 312 | goto out; |
| 325 | } | 313 | } |
| 326 | 314 | ||
| 327 | (void) acpi_evaluate_hotplug_ost(handle, event, ost_code, NULL); | 315 | (void) acpi_evaluate_hotplug_ost(handle, event, ost_code, NULL); |
| 328 | return; | 316 | |
| 317 | out: | ||
| 318 | acpi_scan_lock_release(); | ||
| 329 | } | 319 | } |
| 330 | 320 | ||
| 331 | static acpi_status is_processor_device(acpi_handle handle) | 321 | static acpi_status is_processor_device(acpi_handle handle) |
diff --git a/drivers/xen/xen-acpi-memhotplug.c b/drivers/xen/xen-acpi-memhotplug.c index 853b12dba5bb..faef5b396051 100644 --- a/drivers/xen/xen-acpi-memhotplug.c +++ b/drivers/xen/xen-acpi-memhotplug.c | |||
| @@ -158,31 +158,17 @@ acpi_memory_get_device_resources(struct acpi_memory_device *mem_device) | |||
| 158 | return 0; | 158 | return 0; |
| 159 | } | 159 | } |
| 160 | 160 | ||
| 161 | static int | 161 | static int acpi_memory_get_device(acpi_handle handle, |
| 162 | acpi_memory_get_device(acpi_handle handle, | 162 | struct acpi_memory_device **mem_device) |
| 163 | struct acpi_memory_device **mem_device) | ||
| 164 | { | 163 | { |
| 165 | acpi_status status; | ||
| 166 | acpi_handle phandle; | ||
| 167 | struct acpi_device *device = NULL; | 164 | struct acpi_device *device = NULL; |
| 168 | struct acpi_device *pdevice = NULL; | 165 | int result = 0; |
| 169 | int result; | ||
| 170 | 166 | ||
| 171 | if (!acpi_bus_get_device(handle, &device) && device) | 167 | acpi_scan_lock_acquire(); |
| 172 | goto end; | ||
| 173 | 168 | ||
| 174 | status = acpi_get_parent(handle, &phandle); | 169 | acpi_bus_get_device(handle, &device); |
| 175 | if (ACPI_FAILURE(status)) { | 170 | if (device) |
| 176 | pr_warn(PREFIX "Cannot find acpi parent\n"); | 171 | goto end; |
| 177 | return -EINVAL; | ||
| 178 | } | ||
| 179 | |||
| 180 | /* Get the parent device */ | ||
| 181 | result = acpi_bus_get_device(phandle, &pdevice); | ||
| 182 | if (result) { | ||
| 183 | pr_warn(PREFIX "Cannot get acpi bus device\n"); | ||
| 184 | return -EINVAL; | ||
| 185 | } | ||
| 186 | 172 | ||
| 187 | /* | 173 | /* |
| 188 | * Now add the notified device. This creates the acpi_device | 174 | * Now add the notified device. This creates the acpi_device |
| @@ -190,18 +176,28 @@ acpi_memory_get_device(acpi_handle handle, | |||
| 190 | */ | 176 | */ |
| 191 | result = acpi_bus_scan(handle); | 177 | result = acpi_bus_scan(handle); |
| 192 | if (result) { | 178 | if (result) { |
| 193 | pr_warn(PREFIX "Cannot add acpi bus\n"); | 179 | pr_warn(PREFIX "ACPI namespace scan failed\n"); |
| 194 | return -EINVAL; | 180 | result = -EINVAL; |
| 181 | goto out; | ||
| 182 | } | ||
| 183 | result = acpi_bus_get_device(handle, &device); | ||
| 184 | if (result) { | ||
| 185 | pr_warn(PREFIX "Missing device object\n"); | ||
| 186 | result = -EINVAL; | ||
| 187 | goto out; | ||
| 195 | } | 188 | } |
| 196 | 189 | ||
| 197 | end: | 190 | end: |
| 198 | *mem_device = acpi_driver_data(device); | 191 | *mem_device = acpi_driver_data(device); |
| 199 | if (!(*mem_device)) { | 192 | if (!(*mem_device)) { |
| 200 | pr_err(PREFIX "Driver data not found\n"); | 193 | pr_err(PREFIX "driver data not found\n"); |
| 201 | return -ENODEV; | 194 | result = -ENODEV; |
| 195 | goto out; | ||
| 202 | } | 196 | } |
| 203 | 197 | ||
| 204 | return 0; | 198 | out: |
| 199 | acpi_scan_lock_release(); | ||
| 200 | return result; | ||
| 205 | } | 201 | } |
| 206 | 202 | ||
| 207 | static int acpi_memory_check_device(struct acpi_memory_device *mem_device) | 203 | static int acpi_memory_check_device(struct acpi_memory_device *mem_device) |
| @@ -259,12 +255,15 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data) | |||
| 259 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 255 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
| 260 | "\nReceived EJECT REQUEST notification for device\n")); | 256 | "\nReceived EJECT REQUEST notification for device\n")); |
| 261 | 257 | ||
| 258 | acpi_scan_lock_acquire(); | ||
| 262 | if (acpi_bus_get_device(handle, &device)) { | 259 | if (acpi_bus_get_device(handle, &device)) { |
| 260 | acpi_scan_lock_release(); | ||
| 263 | pr_err(PREFIX "Device doesn't exist\n"); | 261 | pr_err(PREFIX "Device doesn't exist\n"); |
| 264 | break; | 262 | break; |
| 265 | } | 263 | } |
| 266 | mem_device = acpi_driver_data(device); | 264 | mem_device = acpi_driver_data(device); |
| 267 | if (!mem_device) { | 265 | if (!mem_device) { |
| 266 | acpi_scan_lock_release(); | ||
| 268 | pr_err(PREFIX "Driver Data is NULL\n"); | 267 | pr_err(PREFIX "Driver Data is NULL\n"); |
| 269 | break; | 268 | break; |
| 270 | } | 269 | } |
| @@ -274,6 +273,7 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data) | |||
| 274 | * acpi_bus_remove if Xen support hotremove in the future | 273 | * acpi_bus_remove if Xen support hotremove in the future |
| 275 | */ | 274 | */ |
| 276 | acpi_memory_disable_device(mem_device); | 275 | acpi_memory_disable_device(mem_device); |
| 276 | acpi_scan_lock_release(); | ||
| 277 | break; | 277 | break; |
| 278 | 278 | ||
| 279 | default: | 279 | default: |
diff --git a/drivers/xen/xenbus/xenbus_client.c b/drivers/xen/xenbus/xenbus_client.c index bcf3ba4a6ec1..61786be9138b 100644 --- a/drivers/xen/xenbus/xenbus_client.c +++ b/drivers/xen/xenbus/xenbus_client.c | |||
| @@ -30,6 +30,7 @@ | |||
| 30 | * IN THE SOFTWARE. | 30 | * IN THE SOFTWARE. |
| 31 | */ | 31 | */ |
| 32 | 32 | ||
| 33 | #include <linux/mm.h> | ||
| 33 | #include <linux/slab.h> | 34 | #include <linux/slab.h> |
| 34 | #include <linux/types.h> | 35 | #include <linux/types.h> |
| 35 | #include <linux/spinlock.h> | 36 | #include <linux/spinlock.h> |
