aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/sonypi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/sonypi.c')
-rw-r--r--drivers/char/sonypi.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c
index 9e6efb1f029f..dbcb3bd192c7 100644
--- a/drivers/char/sonypi.c
+++ b/drivers/char/sonypi.c
@@ -777,8 +777,9 @@ static void input_keyrelease(struct work_struct *work)
777{ 777{
778 struct sonypi_keypress kp; 778 struct sonypi_keypress kp;
779 779
780 while (kfifo_get(&sonypi_device.input_fifo, (unsigned char *)&kp, 780 while (kfifo_get_locked(&sonypi_device.input_fifo, (unsigned char *)&kp,
781 sizeof(kp)) == sizeof(kp)) { 781 sizeof(kp), &sonypi_device.input_fifo_lock)
782 == sizeof(kp)) {
782 msleep(10); 783 msleep(10);
783 input_report_key(kp.dev, kp.key, 0); 784 input_report_key(kp.dev, kp.key, 0);
784 input_sync(kp.dev); 785 input_sync(kp.dev);
@@ -827,8 +828,9 @@ static void sonypi_report_input_event(u8 event)
827 if (kp.dev) { 828 if (kp.dev) {
828 input_report_key(kp.dev, kp.key, 1); 829 input_report_key(kp.dev, kp.key, 1);
829 input_sync(kp.dev); 830 input_sync(kp.dev);
830 kfifo_put(&sonypi_device.input_fifo, 831 kfifo_put_locked(&sonypi_device.input_fifo,
831 (unsigned char *)&kp, sizeof(kp)); 832 (unsigned char *)&kp, sizeof(kp),
833 &sonypi_device.input_fifo_lock);
832 schedule_work(&sonypi_device.input_work); 834 schedule_work(&sonypi_device.input_work);
833 } 835 }
834} 836}
@@ -880,7 +882,8 @@ found:
880 acpi_bus_generate_proc_event(sonypi_acpi_device, 1, event); 882 acpi_bus_generate_proc_event(sonypi_acpi_device, 1, event);
881#endif 883#endif
882 884
883 kfifo_put(&sonypi_device.fifo, (unsigned char *)&event, sizeof(event)); 885 kfifo_put_locked(&sonypi_device.fifo, (unsigned char *)&event,
886 sizeof(event), &sonypi_device.fifo_lock);
884 kill_fasync(&sonypi_device.fifo_async, SIGIO, POLL_IN); 887 kill_fasync(&sonypi_device.fifo_async, SIGIO, POLL_IN);
885 wake_up_interruptible(&sonypi_device.fifo_proc_list); 888 wake_up_interruptible(&sonypi_device.fifo_proc_list);
886 889
@@ -929,7 +932,8 @@ static ssize_t sonypi_misc_read(struct file *file, char __user *buf,
929 return ret; 932 return ret;
930 933
931 while (ret < count && 934 while (ret < count &&
932 (kfifo_get(&sonypi_device.fifo, &c, sizeof(c)) == sizeof(c))) { 935 (kfifo_get_locked(&sonypi_device.fifo, &c, sizeof(c),
936 &sonypi_device.fifo_lock) == sizeof(c))) {
933 if (put_user(c, buf++)) 937 if (put_user(c, buf++))
934 return -EFAULT; 938 return -EFAULT;
935 ret++; 939 ret++;
@@ -1313,8 +1317,7 @@ static int __devinit sonypi_probe(struct platform_device *dev)
1313 "http://www.linux.it/~malattia/wiki/index.php/Sony_drivers\n"); 1317 "http://www.linux.it/~malattia/wiki/index.php/Sony_drivers\n");
1314 1318
1315 spin_lock_init(&sonypi_device.fifo_lock); 1319 spin_lock_init(&sonypi_device.fifo_lock);
1316 error = kfifo_alloc(&sonypi_device.fifo, SONYPI_BUF_SIZE, GFP_KERNEL, 1320 error = kfifo_alloc(&sonypi_device.fifo, SONYPI_BUF_SIZE, GFP_KERNEL);
1317 &sonypi_device.fifo_lock);
1318 if (error) { 1321 if (error) {
1319 printk(KERN_ERR "sonypi: kfifo_alloc failed\n"); 1322 printk(KERN_ERR "sonypi: kfifo_alloc failed\n");
1320 return error; 1323 return error;
@@ -1394,7 +1397,7 @@ static int __devinit sonypi_probe(struct platform_device *dev)
1394 1397
1395 spin_lock_init(&sonypi_device.input_fifo_lock); 1398 spin_lock_init(&sonypi_device.input_fifo_lock);
1396 error = kfifo_alloc(&sonypi_device.input_fifo, SONYPI_BUF_SIZE, 1399 error = kfifo_alloc(&sonypi_device.input_fifo, SONYPI_BUF_SIZE,
1397 GFP_KERNEL, &sonypi_device.input_fifo_lock); 1400 GFP_KERNEL);
1398 if (error) { 1401 if (error) {
1399 printk(KERN_ERR "sonypi: kfifo_alloc failed\n"); 1402 printk(KERN_ERR "sonypi: kfifo_alloc failed\n");
1400 goto err_inpdev_unregister; 1403 goto err_inpdev_unregister;