summaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2007-11-05 11:43:32 -0500
committerLen Brown <len.brown@intel.com>2007-11-14 12:17:41 -0500
commitbbac81f5487175e4bd5602a80c17689d8f82a63e (patch)
tree7d2673fe27d2b2beeca481b08a14b3862de65ab5 /drivers/acpi
parentff102ea99099c36250e93a87a9794b5233801020 (diff)
downloadop-kernel-dev-bbac81f5487175e4bd5602a80c17689d8f82a63e.zip
op-kernel-dev-bbac81f5487175e4bd5602a80c17689d8f82a63e.tar.gz
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')
-rw-r--r--drivers/acpi/video.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index 36b64a7..d54c83d 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -29,6 +29,7 @@
#include <linux/init.h>
#include <linux/types.h>
#include <linux/list.h>
+#include <linux/mutex.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/input.h>
@@ -135,8 +136,8 @@ struct acpi_video_bus {
u8 attached_count;
struct acpi_video_bus_cap cap;
struct acpi_video_bus_flags flags;
- struct semaphore sem;
struct list_head video_device_list;
+ struct mutex device_list_lock; /* protects video_device_list */
struct proc_dir_entry *dir;
struct input_dev *input;
char phys[32]; /* for input device */
@@ -1436,9 +1437,9 @@ acpi_video_bus_get_one_device(struct acpi_device *device,
return -ENODEV;
}
- down(&video->sem);
+ mutex_lock(&video->device_list_lock);
list_add_tail(&data->entry, &video->video_device_list);
- up(&video->sem);
+ mutex_unlock(&video->device_list_lock);
acpi_video_device_add_fs(device);
@@ -1464,12 +1465,12 @@ static void acpi_video_device_rebind(struct acpi_video_bus *video)
{
struct acpi_video_device *dev;
- down(&video->sem);
+ mutex_lock(&video->device_list_lock);
list_for_each_entry(dev, &video->video_device_list, entry)
acpi_video_device_bind(video, dev);
- up(&video->sem);
+ mutex_unlock(&video->device_list_lock);
}
/*
@@ -1601,7 +1602,7 @@ static int acpi_video_switch_output(struct acpi_video_bus *video, int event)
unsigned long state;
int status = 0;
- down(&video->sem);
+ mutex_lock(&video->device_list_lock);
list_for_each(node, &video->video_device_list) {
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)
dev_prev = container_of(node->prev, struct acpi_video_device, entry);
out:
- up(&video->sem);
+ mutex_unlock(&video->device_list_lock);
switch (event) {
case ACPI_VIDEO_NOTIFY_CYCLE:
@@ -1738,7 +1739,7 @@ static int acpi_video_bus_put_devices(struct acpi_video_bus *video)
int status;
struct acpi_video_device *dev, *next;
- down(&video->sem);
+ mutex_lock(&video->device_list_lock);
list_for_each_entry_safe(dev, next, &video->video_device_list, entry) {
@@ -1755,7 +1756,7 @@ static int acpi_video_bus_put_devices(struct acpi_video_bus *video)
kfree(dev);
}
- up(&video->sem);
+ mutex_unlock(&video->device_list_lock);
return 0;
}
@@ -1924,7 +1925,7 @@ static int acpi_video_bus_add(struct acpi_device *device)
if (error)
goto err_free_video;
- init_MUTEX(&video->sem);
+ mutex_init(&video->device_list_lock);
INIT_LIST_HEAD(&video->video_device_list);
acpi_video_bus_get_devices(video, device);
OpenPOWER on IntegriCloud