aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMatthias Kaehlcke <matthias.kaehlcke@gmail.com>2007-04-24 16:02:35 -0400
committerLen Brown <len.brown@intel.com>2007-04-28 22:13:34 -0400
commitc6c60106b9584f17c55e4c5e0ce9b905a1a6cdb6 (patch)
treee9c98eae19a6b1aa841e1834a6b6c682c6412bcd /drivers
parent1b20d34406775369d50fc2ffe27a64a0d6fd313e (diff)
sonypi: use mutex instead of semaphore
the Sony Programmable I/O Control driver uses a semaphore as mutex. use the mutex API instead of the (binary) semaphore Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com> Acked-by: Mattia Dongili <malattia@linux.it> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/char/sonypi.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c
index b6998906b214..3ef593a9015f 100644
--- a/drivers/char/sonypi.c
+++ b/drivers/char/sonypi.c
@@ -484,7 +484,7 @@ static struct sonypi_device {
484 u16 evtype_offset; 484 u16 evtype_offset;
485 int camera_power; 485 int camera_power;
486 int bluetooth_power; 486 int bluetooth_power;
487 struct semaphore lock; 487 struct mutex lock;
488 struct kfifo *fifo; 488 struct kfifo *fifo;
489 spinlock_t fifo_lock; 489 spinlock_t fifo_lock;
490 wait_queue_head_t fifo_proc_list; 490 wait_queue_head_t fifo_proc_list;
@@ -891,7 +891,7 @@ int sonypi_camera_command(int command, u8 value)
891 if (!camera) 891 if (!camera)
892 return -EIO; 892 return -EIO;
893 893
894 down(&sonypi_device.lock); 894 mutex_lock(&sonypi_device.lock);
895 895
896 switch (command) { 896 switch (command) {
897 case SONYPI_COMMAND_SETCAMERA: 897 case SONYPI_COMMAND_SETCAMERA:
@@ -926,7 +926,7 @@ int sonypi_camera_command(int command, u8 value)
926 command); 926 command);
927 break; 927 break;
928 } 928 }
929 up(&sonypi_device.lock); 929 mutex_unlock(&sonypi_device.lock);
930 return 0; 930 return 0;
931} 931}
932 932
@@ -945,20 +945,20 @@ static int sonypi_misc_fasync(int fd, struct file *filp, int on)
945static int sonypi_misc_release(struct inode *inode, struct file *file) 945static int sonypi_misc_release(struct inode *inode, struct file *file)
946{ 946{
947 sonypi_misc_fasync(-1, file, 0); 947 sonypi_misc_fasync(-1, file, 0);
948 down(&sonypi_device.lock); 948 mutex_lock(&sonypi_device.lock);
949 sonypi_device.open_count--; 949 sonypi_device.open_count--;
950 up(&sonypi_device.lock); 950 mutex_unlock(&sonypi_device.lock);
951 return 0; 951 return 0;
952} 952}
953 953
954static int sonypi_misc_open(struct inode *inode, struct file *file) 954static int sonypi_misc_open(struct inode *inode, struct file *file)
955{ 955{
956 down(&sonypi_device.lock); 956 mutex_lock(&sonypi_device.lock);
957 /* Flush input queue on first open */ 957 /* Flush input queue on first open */
958 if (!sonypi_device.open_count) 958 if (!sonypi_device.open_count)
959 kfifo_reset(sonypi_device.fifo); 959 kfifo_reset(sonypi_device.fifo);
960 sonypi_device.open_count++; 960 sonypi_device.open_count++;
961 up(&sonypi_device.lock); 961 mutex_unlock(&sonypi_device.lock);
962 return 0; 962 return 0;
963} 963}
964 964
@@ -1008,7 +1008,7 @@ static int sonypi_misc_ioctl(struct inode *ip, struct file *fp,
1008 u8 val8; 1008 u8 val8;
1009 u16 val16; 1009 u16 val16;
1010 1010
1011 down(&sonypi_device.lock); 1011 mutex_lock(&sonypi_device.lock);
1012 switch (cmd) { 1012 switch (cmd) {
1013 case SONYPI_IOCGBRT: 1013 case SONYPI_IOCGBRT:
1014 if (sonypi_ec_read(SONYPI_LCD_LIGHT, &val8)) { 1014 if (sonypi_ec_read(SONYPI_LCD_LIGHT, &val8)) {
@@ -1108,7 +1108,7 @@ static int sonypi_misc_ioctl(struct inode *ip, struct file *fp,
1108 default: 1108 default:
1109 ret = -EINVAL; 1109 ret = -EINVAL;
1110 } 1110 }
1111 up(&sonypi_device.lock); 1111 mutex_unlock(&sonypi_device.lock);
1112 return ret; 1112 return ret;
1113} 1113}
1114 1114
@@ -1363,7 +1363,7 @@ static int __devinit sonypi_probe(struct platform_device *dev)
1363 } 1363 }
1364 1364
1365 init_waitqueue_head(&sonypi_device.fifo_proc_list); 1365 init_waitqueue_head(&sonypi_device.fifo_proc_list);
1366 init_MUTEX(&sonypi_device.lock); 1366 mutex_init(&sonypi_device.lock);
1367 sonypi_device.bluetooth_power = -1; 1367 sonypi_device.bluetooth_power = -1;
1368 1368
1369 if ((pcidev = pci_get_device(PCI_VENDOR_ID_INTEL, 1369 if ((pcidev = pci_get_device(PCI_VENDOR_ID_INTEL,