aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/scan.c
diff options
context:
space:
mode:
authorShaohua Li <shaohua.li@intel.com>2009-04-06 22:24:29 -0400
committerLen Brown <len.brown@intel.com>2009-04-07 00:02:40 -0400
commit9090589d87506c578ea1523ffd7ae7fd9424fb28 (patch)
tree215163d13dbfa514a4121594cd4c6e27fde9b911 /drivers/acpi/scan.c
parentd508afb437daee7cf07da085b635c44a4ebf9b38 (diff)
ACPI: convert acpi_device_lock spinlock to mutex
Convert acpi_device_lock to a mutex to avoid a potential race upon access to /proc/acpi/wakeup Delete the lock entirely in wakeup.c since it is not necessary (and can not sleep) Found-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Shaohua Li <shaohua.li@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/scan.c')
-rw-r--r--drivers/acpi/scan.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 20c23c049207..e63f2febad84 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -24,7 +24,7 @@ extern struct acpi_device *acpi_root;
24 24
25static LIST_HEAD(acpi_device_list); 25static LIST_HEAD(acpi_device_list);
26static LIST_HEAD(acpi_bus_id_list); 26static LIST_HEAD(acpi_bus_id_list);
27DEFINE_SPINLOCK(acpi_device_lock); 27DEFINE_MUTEX(acpi_device_lock);
28LIST_HEAD(acpi_wakeup_device_list); 28LIST_HEAD(acpi_wakeup_device_list);
29 29
30struct acpi_device_bus_id{ 30struct acpi_device_bus_id{
@@ -500,7 +500,7 @@ static int acpi_device_register(struct acpi_device *device,
500 return -ENOMEM; 500 return -ENOMEM;
501 } 501 }
502 502
503 spin_lock(&acpi_device_lock); 503 mutex_lock(&acpi_device_lock);
504 /* 504 /*
505 * Find suitable bus_id and instance number in acpi_bus_id_list 505 * Find suitable bus_id and instance number in acpi_bus_id_list
506 * If failed, create one and link it into acpi_bus_id_list 506 * If failed, create one and link it into acpi_bus_id_list
@@ -528,7 +528,7 @@ static int acpi_device_register(struct acpi_device *device,
528 list_add_tail(&device->g_list, &acpi_device_list); 528 list_add_tail(&device->g_list, &acpi_device_list);
529 if (device->wakeup.flags.valid) 529 if (device->wakeup.flags.valid)
530 list_add_tail(&device->wakeup_list, &acpi_wakeup_device_list); 530 list_add_tail(&device->wakeup_list, &acpi_wakeup_device_list);
531 spin_unlock(&acpi_device_lock); 531 mutex_unlock(&acpi_device_lock);
532 532
533 if (device->parent) 533 if (device->parent)
534 device->dev.parent = &parent->dev; 534 device->dev.parent = &parent->dev;
@@ -549,20 +549,20 @@ static int acpi_device_register(struct acpi_device *device,
549 device->removal_type = ACPI_BUS_REMOVAL_NORMAL; 549 device->removal_type = ACPI_BUS_REMOVAL_NORMAL;
550 return 0; 550 return 0;
551 end: 551 end:
552 spin_lock(&acpi_device_lock); 552 mutex_lock(&acpi_device_lock);
553 if (device->parent) { 553 if (device->parent) {
554 list_del(&device->node); 554 list_del(&device->node);
555 list_del(&device->g_list); 555 list_del(&device->g_list);
556 } else 556 } else
557 list_del(&device->g_list); 557 list_del(&device->g_list);
558 list_del(&device->wakeup_list); 558 list_del(&device->wakeup_list);
559 spin_unlock(&acpi_device_lock); 559 mutex_unlock(&acpi_device_lock);
560 return result; 560 return result;
561} 561}
562 562
563static void acpi_device_unregister(struct acpi_device *device, int type) 563static void acpi_device_unregister(struct acpi_device *device, int type)
564{ 564{
565 spin_lock(&acpi_device_lock); 565 mutex_lock(&acpi_device_lock);
566 if (device->parent) { 566 if (device->parent) {
567 list_del(&device->node); 567 list_del(&device->node);
568 list_del(&device->g_list); 568 list_del(&device->g_list);
@@ -570,7 +570,7 @@ static void acpi_device_unregister(struct acpi_device *device, int type)
570 list_del(&device->g_list); 570 list_del(&device->g_list);
571 571
572 list_del(&device->wakeup_list); 572 list_del(&device->wakeup_list);
573 spin_unlock(&acpi_device_lock); 573 mutex_unlock(&acpi_device_lock);
574 574
575 acpi_detach_data(device->handle, acpi_bus_data_handler); 575 acpi_detach_data(device->handle, acpi_bus_data_handler);
576 576