diff options
author | Stefani Seibold <stefani@seibold.net> | 2009-12-21 17:37:27 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-22 17:17:56 -0500 |
commit | c1e13f25674ed564948ecb7dfe5f83e578892896 (patch) | |
tree | 24fac07b3e2b66dff01c3127b34077de1de4c101 /drivers/platform/x86 | |
parent | 45465487897a1c6d508b14b904dc5777f7ec7e04 (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')
-rw-r--r-- | drivers/platform/x86/fujitsu-laptop.c | 18 | ||||
-rw-r--r-- | drivers/platform/x86/sony-laptop.c | 22 |
2 files changed, 22 insertions, 18 deletions
diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c index f999fba0e25e..13dc7bedcfce 100644 --- a/drivers/platform/x86/fujitsu-laptop.c +++ b/drivers/platform/x86/fujitsu-laptop.c | |||
@@ -825,7 +825,7 @@ static int acpi_fujitsu_hotkey_add(struct acpi_device *device) | |||
825 | /* kfifo */ | 825 | /* kfifo */ |
826 | spin_lock_init(&fujitsu_hotkey->fifo_lock); | 826 | spin_lock_init(&fujitsu_hotkey->fifo_lock); |
827 | error = kfifo_alloc(&fujitsu_hotkey->fifo, RINGBUFFERSIZE * sizeof(int), | 827 | error = kfifo_alloc(&fujitsu_hotkey->fifo, RINGBUFFERSIZE * sizeof(int), |
828 | GFP_KERNEL, &fujitsu_hotkey->fifo_lock); | 828 | GFP_KERNEL); |
829 | if (error) { | 829 | if (error) { |
830 | printk(KERN_ERR "kfifo_alloc failed\n"); | 830 | printk(KERN_ERR "kfifo_alloc failed\n"); |
831 | goto err_stop; | 831 | goto err_stop; |
@@ -1006,9 +1006,10 @@ static void acpi_fujitsu_hotkey_notify(struct acpi_device *device, u32 event) | |||
1006 | vdbg_printk(FUJLAPTOP_DBG_TRACE, | 1006 | vdbg_printk(FUJLAPTOP_DBG_TRACE, |
1007 | "Push keycode into ringbuffer [%d]\n", | 1007 | "Push keycode into ringbuffer [%d]\n", |
1008 | keycode); | 1008 | keycode); |
1009 | status = kfifo_put(&fujitsu_hotkey->fifo, | 1009 | status = kfifo_put_locked(&fujitsu_hotkey->fifo, |
1010 | (unsigned char *)&keycode, | 1010 | (unsigned char *)&keycode, |
1011 | sizeof(keycode)); | 1011 | sizeof(keycode), |
1012 | &fujitsu_hotkey->fifo_lock); | ||
1012 | if (status != sizeof(keycode)) { | 1013 | if (status != sizeof(keycode)) { |
1013 | vdbg_printk(FUJLAPTOP_DBG_WARN, | 1014 | vdbg_printk(FUJLAPTOP_DBG_WARN, |
1014 | "Could not push keycode [0x%x]\n", | 1015 | "Could not push keycode [0x%x]\n", |
@@ -1019,11 +1020,12 @@ static void acpi_fujitsu_hotkey_notify(struct acpi_device *device, u32 event) | |||
1019 | } | 1020 | } |
1020 | } else if (keycode == 0) { | 1021 | } else if (keycode == 0) { |
1021 | while ((status = | 1022 | while ((status = |
1022 | kfifo_get | 1023 | kfifo_get_locked( |
1023 | (&fujitsu_hotkey->fifo, (unsigned char *) | 1024 | &fujitsu_hotkey->fifo, |
1024 | &keycode_r, | 1025 | (unsigned char *) &keycode_r, |
1025 | sizeof | 1026 | sizeof(keycode_r), |
1026 | (keycode_r))) == sizeof(keycode_r)) { | 1027 | &fujitsu_hotkey->fifo_lock)) |
1028 | == sizeof(keycode_r)) { | ||
1027 | input_report_key(input, keycode_r, 0); | 1029 | input_report_key(input, keycode_r, 0); |
1028 | input_sync(input); | 1030 | input_sync(input); |
1029 | vdbg_printk(FUJLAPTOP_DBG_TRACE, | 1031 | vdbg_printk(FUJLAPTOP_DBG_TRACE, |
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 | ||
2309 | static void sonypi_compat_report_event(u8 event) | 2311 | static 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; |