Commit c6c60106b9584f17c55e4c5e0ce9b905a1a6cdb6

Authored by Matthias Kaehlcke
Committed by Len Brown
1 parent 1b20d34406

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>

Showing 1 changed file with 10 additions and 10 deletions Side-by-side Diff

drivers/char/sonypi.c
... ... @@ -484,7 +484,7 @@
484 484 u16 evtype_offset;
485 485 int camera_power;
486 486 int bluetooth_power;
487   - struct semaphore lock;
  487 + struct mutex lock;
488 488 struct kfifo *fifo;
489 489 spinlock_t fifo_lock;
490 490 wait_queue_head_t fifo_proc_list;
... ... @@ -891,7 +891,7 @@
891 891 if (!camera)
892 892 return -EIO;
893 893  
894   - down(&sonypi_device.lock);
  894 + mutex_lock(&sonypi_device.lock);
895 895  
896 896 switch (command) {
897 897 case SONYPI_COMMAND_SETCAMERA:
... ... @@ -926,7 +926,7 @@
926 926 command);
927 927 break;
928 928 }
929   - up(&sonypi_device.lock);
  929 + mutex_unlock(&sonypi_device.lock);
930 930 return 0;
931 931 }
932 932  
933 933  
934 934  
935 935  
... ... @@ -945,20 +945,20 @@
945 945 static int sonypi_misc_release(struct inode *inode, struct file *file)
946 946 {
947 947 sonypi_misc_fasync(-1, file, 0);
948   - down(&sonypi_device.lock);
  948 + mutex_lock(&sonypi_device.lock);
949 949 sonypi_device.open_count--;
950   - up(&sonypi_device.lock);
  950 + mutex_unlock(&sonypi_device.lock);
951 951 return 0;
952 952 }
953 953  
954 954 static int sonypi_misc_open(struct inode *inode, struct file *file)
955 955 {
956   - down(&sonypi_device.lock);
  956 + mutex_lock(&sonypi_device.lock);
957 957 /* Flush input queue on first open */
958 958 if (!sonypi_device.open_count)
959 959 kfifo_reset(sonypi_device.fifo);
960 960 sonypi_device.open_count++;
961   - up(&sonypi_device.lock);
  961 + mutex_unlock(&sonypi_device.lock);
962 962 return 0;
963 963 }
964 964  
... ... @@ -1008,7 +1008,7 @@
1008 1008 u8 val8;
1009 1009 u16 val16;
1010 1010  
1011   - down(&sonypi_device.lock);
  1011 + mutex_lock(&sonypi_device.lock);
1012 1012 switch (cmd) {
1013 1013 case SONYPI_IOCGBRT:
1014 1014 if (sonypi_ec_read(SONYPI_LCD_LIGHT, &val8)) {
... ... @@ -1108,7 +1108,7 @@
1108 1108 default:
1109 1109 ret = -EINVAL;
1110 1110 }
1111   - up(&sonypi_device.lock);
  1111 + mutex_unlock(&sonypi_device.lock);
1112 1112 return ret;
1113 1113 }
1114 1114  
... ... @@ -1363,7 +1363,7 @@
1363 1363 }
1364 1364  
1365 1365 init_waitqueue_head(&sonypi_device.fifo_proc_list);
1366   - init_MUTEX(&sonypi_device.lock);
  1366 + mutex_init(&sonypi_device.lock);
1367 1367 sonypi_device.bluetooth_power = -1;
1368 1368  
1369 1369 if ((pcidev = pci_get_device(PCI_VENDOR_ID_INTEL,