diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2007-11-05 11:43:32 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2007-11-14 12:17:41 -0500 |
commit | bbac81f5487175e4bd5602a80c17689d8f82a63e (patch) | |
tree | 7d2673fe27d2b2beeca481b08a14b3862de65ab5 /drivers/acpi/video.c | |
parent | ff102ea99099c36250e93a87a9794b5233801020 (diff) |
ACPI: video - convert semaphore to a mutex
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Acked-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/video.c')
-rw-r--r-- | drivers/acpi/video.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 36b64a751676..d54c83d70532 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/init.h> | 29 | #include <linux/init.h> |
30 | #include <linux/types.h> | 30 | #include <linux/types.h> |
31 | #include <linux/list.h> | 31 | #include <linux/list.h> |
32 | #include <linux/mutex.h> | ||
32 | #include <linux/proc_fs.h> | 33 | #include <linux/proc_fs.h> |
33 | #include <linux/seq_file.h> | 34 | #include <linux/seq_file.h> |
34 | #include <linux/input.h> | 35 | #include <linux/input.h> |
@@ -135,8 +136,8 @@ struct acpi_video_bus { | |||
135 | u8 attached_count; | 136 | u8 attached_count; |
136 | struct acpi_video_bus_cap cap; | 137 | struct acpi_video_bus_cap cap; |
137 | struct acpi_video_bus_flags flags; | 138 | struct acpi_video_bus_flags flags; |
138 | struct semaphore sem; | ||
139 | struct list_head video_device_list; | 139 | struct list_head video_device_list; |
140 | struct mutex device_list_lock; /* protects video_device_list */ | ||
140 | struct proc_dir_entry *dir; | 141 | struct proc_dir_entry *dir; |
141 | struct input_dev *input; | 142 | struct input_dev *input; |
142 | char phys[32]; /* for input device */ | 143 | char phys[32]; /* for input device */ |
@@ -1436,9 +1437,9 @@ acpi_video_bus_get_one_device(struct acpi_device *device, | |||
1436 | return -ENODEV; | 1437 | return -ENODEV; |
1437 | } | 1438 | } |
1438 | 1439 | ||
1439 | down(&video->sem); | 1440 | mutex_lock(&video->device_list_lock); |
1440 | list_add_tail(&data->entry, &video->video_device_list); | 1441 | list_add_tail(&data->entry, &video->video_device_list); |
1441 | up(&video->sem); | 1442 | mutex_unlock(&video->device_list_lock); |
1442 | 1443 | ||
1443 | acpi_video_device_add_fs(device); | 1444 | acpi_video_device_add_fs(device); |
1444 | 1445 | ||
@@ -1464,12 +1465,12 @@ static void acpi_video_device_rebind(struct acpi_video_bus *video) | |||
1464 | { | 1465 | { |
1465 | struct acpi_video_device *dev; | 1466 | struct acpi_video_device *dev; |
1466 | 1467 | ||
1467 | down(&video->sem); | 1468 | mutex_lock(&video->device_list_lock); |
1468 | 1469 | ||
1469 | list_for_each_entry(dev, &video->video_device_list, entry) | 1470 | list_for_each_entry(dev, &video->video_device_list, entry) |
1470 | acpi_video_device_bind(video, dev); | 1471 | acpi_video_device_bind(video, dev); |
1471 | 1472 | ||
1472 | up(&video->sem); | 1473 | mutex_unlock(&video->device_list_lock); |
1473 | } | 1474 | } |
1474 | 1475 | ||
1475 | /* | 1476 | /* |
@@ -1601,7 +1602,7 @@ static int acpi_video_switch_output(struct acpi_video_bus *video, int event) | |||
1601 | unsigned long state; | 1602 | unsigned long state; |
1602 | int status = 0; | 1603 | int status = 0; |
1603 | 1604 | ||
1604 | down(&video->sem); | 1605 | mutex_lock(&video->device_list_lock); |
1605 | 1606 | ||
1606 | list_for_each(node, &video->video_device_list) { | 1607 | list_for_each(node, &video->video_device_list) { |
1607 | dev = container_of(node, struct acpi_video_device, entry); | 1608 | dev = container_of(node, struct acpi_video_device, entry); |
@@ -1619,7 +1620,7 @@ static int acpi_video_switch_output(struct acpi_video_bus *video, int event) | |||
1619 | dev_prev = container_of(node->prev, struct acpi_video_device, entry); | 1620 | dev_prev = container_of(node->prev, struct acpi_video_device, entry); |
1620 | 1621 | ||
1621 | out: | 1622 | out: |
1622 | up(&video->sem); | 1623 | mutex_unlock(&video->device_list_lock); |
1623 | 1624 | ||
1624 | switch (event) { | 1625 | switch (event) { |
1625 | case ACPI_VIDEO_NOTIFY_CYCLE: | 1626 | case ACPI_VIDEO_NOTIFY_CYCLE: |
@@ -1738,7 +1739,7 @@ static int acpi_video_bus_put_devices(struct acpi_video_bus *video) | |||
1738 | int status; | 1739 | int status; |
1739 | struct acpi_video_device *dev, *next; | 1740 | struct acpi_video_device *dev, *next; |
1740 | 1741 | ||
1741 | down(&video->sem); | 1742 | mutex_lock(&video->device_list_lock); |
1742 | 1743 | ||
1743 | list_for_each_entry_safe(dev, next, &video->video_device_list, entry) { | 1744 | list_for_each_entry_safe(dev, next, &video->video_device_list, entry) { |
1744 | 1745 | ||
@@ -1755,7 +1756,7 @@ static int acpi_video_bus_put_devices(struct acpi_video_bus *video) | |||
1755 | kfree(dev); | 1756 | kfree(dev); |
1756 | } | 1757 | } |
1757 | 1758 | ||
1758 | up(&video->sem); | 1759 | mutex_unlock(&video->device_list_lock); |
1759 | 1760 | ||
1760 | return 0; | 1761 | return 0; |
1761 | } | 1762 | } |
@@ -1924,7 +1925,7 @@ static int acpi_video_bus_add(struct acpi_device *device) | |||
1924 | if (error) | 1925 | if (error) |
1925 | goto err_free_video; | 1926 | goto err_free_video; |
1926 | 1927 | ||
1927 | init_MUTEX(&video->sem); | 1928 | mutex_init(&video->device_list_lock); |
1928 | INIT_LIST_HEAD(&video->video_device_list); | 1929 | INIT_LIST_HEAD(&video->video_device_list); |
1929 | 1930 | ||
1930 | acpi_video_bus_get_devices(video, device); | 1931 | acpi_video_bus_get_devices(video, device); |