aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform/x86/sony-laptop.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/platform/x86/sony-laptop.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/platform/x86/sony-laptop.c')
-rw-r--r--drivers/platform/x86/sony-laptop.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
index 04625a048e74..1538a0a3c0af 100644
--- a/drivers/platform/x86/sony-laptop.c
+++ b/drivers/platform/x86/sony-laptop.c
@@ -300,8 +300,9 @@ static void do_sony_laptop_release_key(struct work_struct *work)
300{ 300{
301 struct sony_laptop_keypress kp; 301 struct sony_laptop_keypress kp;
302 302
303 while (kfifo_get(&sony_laptop_input.fifo, (unsigned char *)&kp, 303 while (kfifo_get_locked(&sony_laptop_input.fifo, (unsigned char *)&kp,
304 sizeof(kp)) == sizeof(kp)) { 304 sizeof(kp), &sony_laptop_input.fifo_lock)
305 == sizeof(kp)) {
305 msleep(10); 306 msleep(10);
306 input_report_key(kp.dev, kp.key, 0); 307 input_report_key(kp.dev, kp.key, 0);
307 input_sync(kp.dev); 308 input_sync(kp.dev);
@@ -362,8 +363,9 @@ static void sony_laptop_report_input_event(u8 event)
362 /* we emit the scancode so we can always remap the key */ 363 /* we emit the scancode so we can always remap the key */
363 input_event(kp.dev, EV_MSC, MSC_SCAN, event); 364 input_event(kp.dev, EV_MSC, MSC_SCAN, event);
364 input_sync(kp.dev); 365 input_sync(kp.dev);
365 kfifo_put(&sony_laptop_input.fifo, 366 kfifo_put_locked(&sony_laptop_input.fifo,
366 (unsigned char *)&kp, sizeof(kp)); 367 (unsigned char *)&kp, sizeof(kp),
368 &sony_laptop_input.fifo_lock);
367 369
368 if (!work_pending(&sony_laptop_release_key_work)) 370 if (!work_pending(&sony_laptop_release_key_work))
369 queue_work(sony_laptop_input.wq, 371 queue_work(sony_laptop_input.wq,
@@ -386,8 +388,7 @@ static int sony_laptop_setup_input(struct acpi_device *acpi_device)
386 /* kfifo */ 388 /* kfifo */
387 spin_lock_init(&sony_laptop_input.fifo_lock); 389 spin_lock_init(&sony_laptop_input.fifo_lock);
388 error = 390 error =
389 kfifo_alloc(&sony_laptop_input.fifo, SONY_LAPTOP_BUF_SIZE, GFP_KERNEL, 391 kfifo_alloc(&sony_laptop_input.fifo, SONY_LAPTOP_BUF_SIZE, GFP_KERNEL);
390 &sony_laptop_input.fifo_lock);
391 if (error) { 392 if (error) {
392 printk(KERN_ERR DRV_PFX "kfifo_alloc failed\n"); 393 printk(KERN_ERR DRV_PFX "kfifo_alloc failed\n");
393 goto err_dec_users; 394 goto err_dec_users;
@@ -2129,7 +2130,8 @@ static ssize_t sonypi_misc_read(struct file *file, char __user *buf,
2129 return ret; 2130 return ret;
2130 2131
2131 while (ret < count && 2132 while (ret < count &&
2132 (kfifo_get(&sonypi_compat.fifo, &c, sizeof(c)) == sizeof(c))) { 2133 (kfifo_get_locked(&sonypi_compat.fifo, &c, sizeof(c),
2134 &sonypi_compat.fifo_lock) == sizeof(c))) {
2133 if (put_user(c, buf++)) 2135 if (put_user(c, buf++))
2134 return -EFAULT; 2136 return -EFAULT;
2135 ret++; 2137 ret++;
@@ -2308,7 +2310,8 @@ static struct miscdevice sonypi_misc_device = {
2308 2310
2309static void sonypi_compat_report_event(u8 event) 2311static void sonypi_compat_report_event(u8 event)
2310{ 2312{
2311 kfifo_put(&sonypi_compat.fifo, (unsigned char *)&event, sizeof(event)); 2313 kfifo_put_locked(&sonypi_compat.fifo, (unsigned char *)&event,
2314 sizeof(event), &sonypi_compat.fifo_lock);
2312 kill_fasync(&sonypi_compat.fifo_async, SIGIO, POLL_IN); 2315 kill_fasync(&sonypi_compat.fifo_async, SIGIO, POLL_IN);
2313 wake_up_interruptible(&sonypi_compat.fifo_proc_list); 2316 wake_up_interruptible(&sonypi_compat.fifo_proc_list);
2314} 2317}
@@ -2319,8 +2322,7 @@ static int sonypi_compat_init(void)
2319 2322
2320 spin_lock_init(&sonypi_compat.fifo_lock); 2323 spin_lock_init(&sonypi_compat.fifo_lock);
2321 error = 2324 error =
2322 kfifo_alloc(&sonypi_compat.fifo, SONY_LAPTOP_BUF_SIZE, GFP_KERNEL, 2325 kfifo_alloc(&sonypi_compat.fifo, SONY_LAPTOP_BUF_SIZE, GFP_KERNEL);
2323 &sonypi_compat.fifo_lock);
2324 if (error) { 2326 if (error) {
2325 printk(KERN_ERR DRV_PFX "kfifo_alloc failed\n"); 2327 printk(KERN_ERR DRV_PFX "kfifo_alloc failed\n");
2326 return error; 2328 return error;