aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/sonypi.c
diff options
context:
space:
mode:
authorStefani Seibold <stefani@seibold.net>2009-12-21 17:37:27 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-12-22 17:17:56 -0500
commitc1e13f25674ed564948ecb7dfe5f83e578892896 (patch)
tree24fac07b3e2b66dff01c3127b34077de1de4c101 /drivers/char/sonypi.c
parent45465487897a1c6d508b14b904dc5777f7ec7e04 (diff)
kfifo: move out spinlock
Move the pointer to the spinlock out of struct kfifo. Most users in tree do not actually use a spinlock, so the few exceptions now have to call kfifo_{get,put}_locked, which takes an extra argument to a spinlock. Signed-off-by: Stefani Seibold <stefani@seibold.net> Acked-by: Greg Kroah-Hartman <gregkh@suse.de> Acked-by: Mauro Carvalho Chehab <mchehab@redhat.com> Acked-by: Andi Kleen <ak@linux.intel.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
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;