diff options
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 | 46 |
2 files changed, 31 insertions, 33 deletions
diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c index bcd4ba8be7db..f999fba0e25e 100644 --- a/drivers/platform/x86/fujitsu-laptop.c +++ b/drivers/platform/x86/fujitsu-laptop.c | |||
@@ -164,7 +164,7 @@ struct fujitsu_hotkey_t { | |||
164 | struct input_dev *input; | 164 | struct input_dev *input; |
165 | char phys[32]; | 165 | char phys[32]; |
166 | struct platform_device *pf_device; | 166 | struct platform_device *pf_device; |
167 | struct kfifo *fifo; | 167 | struct kfifo fifo; |
168 | spinlock_t fifo_lock; | 168 | spinlock_t fifo_lock; |
169 | int rfkill_supported; | 169 | int rfkill_supported; |
170 | int rfkill_state; | 170 | int rfkill_state; |
@@ -824,12 +824,10 @@ static int acpi_fujitsu_hotkey_add(struct acpi_device *device) | |||
824 | 824 | ||
825 | /* kfifo */ | 825 | /* kfifo */ |
826 | spin_lock_init(&fujitsu_hotkey->fifo_lock); | 826 | spin_lock_init(&fujitsu_hotkey->fifo_lock); |
827 | fujitsu_hotkey->fifo = | 827 | error = kfifo_alloc(&fujitsu_hotkey->fifo, RINGBUFFERSIZE * sizeof(int), |
828 | kfifo_alloc(RINGBUFFERSIZE * sizeof(int), GFP_KERNEL, | 828 | GFP_KERNEL, &fujitsu_hotkey->fifo_lock); |
829 | &fujitsu_hotkey->fifo_lock); | 829 | if (error) { |
830 | if (IS_ERR(fujitsu_hotkey->fifo)) { | ||
831 | printk(KERN_ERR "kfifo_alloc failed\n"); | 830 | printk(KERN_ERR "kfifo_alloc failed\n"); |
832 | error = PTR_ERR(fujitsu_hotkey->fifo); | ||
833 | goto err_stop; | 831 | goto err_stop; |
834 | } | 832 | } |
835 | 833 | ||
@@ -934,7 +932,7 @@ err_unregister_input_dev: | |||
934 | err_free_input_dev: | 932 | err_free_input_dev: |
935 | input_free_device(input); | 933 | input_free_device(input); |
936 | err_free_fifo: | 934 | err_free_fifo: |
937 | kfifo_free(fujitsu_hotkey->fifo); | 935 | kfifo_free(&fujitsu_hotkey->fifo); |
938 | err_stop: | 936 | err_stop: |
939 | return result; | 937 | return result; |
940 | } | 938 | } |
@@ -956,7 +954,7 @@ static int acpi_fujitsu_hotkey_remove(struct acpi_device *device, int type) | |||
956 | 954 | ||
957 | input_free_device(input); | 955 | input_free_device(input); |
958 | 956 | ||
959 | kfifo_free(fujitsu_hotkey->fifo); | 957 | kfifo_free(&fujitsu_hotkey->fifo); |
960 | 958 | ||
961 | fujitsu_hotkey->acpi_handle = NULL; | 959 | fujitsu_hotkey->acpi_handle = NULL; |
962 | 960 | ||
@@ -1008,7 +1006,7 @@ static void acpi_fujitsu_hotkey_notify(struct acpi_device *device, u32 event) | |||
1008 | vdbg_printk(FUJLAPTOP_DBG_TRACE, | 1006 | vdbg_printk(FUJLAPTOP_DBG_TRACE, |
1009 | "Push keycode into ringbuffer [%d]\n", | 1007 | "Push keycode into ringbuffer [%d]\n", |
1010 | keycode); | 1008 | keycode); |
1011 | status = kfifo_put(fujitsu_hotkey->fifo, | 1009 | status = kfifo_put(&fujitsu_hotkey->fifo, |
1012 | (unsigned char *)&keycode, | 1010 | (unsigned char *)&keycode, |
1013 | sizeof(keycode)); | 1011 | sizeof(keycode)); |
1014 | if (status != sizeof(keycode)) { | 1012 | if (status != sizeof(keycode)) { |
@@ -1022,7 +1020,7 @@ static void acpi_fujitsu_hotkey_notify(struct acpi_device *device, u32 event) | |||
1022 | } else if (keycode == 0) { | 1020 | } else if (keycode == 0) { |
1023 | while ((status = | 1021 | while ((status = |
1024 | kfifo_get | 1022 | kfifo_get |
1025 | (fujitsu_hotkey->fifo, (unsigned char *) | 1023 | (&fujitsu_hotkey->fifo, (unsigned char *) |
1026 | &keycode_r, | 1024 | &keycode_r, |
1027 | sizeof | 1025 | sizeof |
1028 | (keycode_r))) == sizeof(keycode_r)) { | 1026 | (keycode_r))) == sizeof(keycode_r)) { |
diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c index 7a2cc8a5c975..04625a048e74 100644 --- a/drivers/platform/x86/sony-laptop.c +++ b/drivers/platform/x86/sony-laptop.c | |||
@@ -142,7 +142,7 @@ struct sony_laptop_input_s { | |||
142 | atomic_t users; | 142 | atomic_t users; |
143 | struct input_dev *jog_dev; | 143 | struct input_dev *jog_dev; |
144 | struct input_dev *key_dev; | 144 | struct input_dev *key_dev; |
145 | struct kfifo *fifo; | 145 | struct kfifo fifo; |
146 | spinlock_t fifo_lock; | 146 | spinlock_t fifo_lock; |
147 | struct workqueue_struct *wq; | 147 | struct workqueue_struct *wq; |
148 | }; | 148 | }; |
@@ -300,7 +300,7 @@ 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(&sony_laptop_input.fifo, (unsigned char *)&kp, |
304 | sizeof(kp)) == sizeof(kp)) { | 304 | sizeof(kp)) == sizeof(kp)) { |
305 | msleep(10); | 305 | msleep(10); |
306 | input_report_key(kp.dev, kp.key, 0); | 306 | input_report_key(kp.dev, kp.key, 0); |
@@ -362,7 +362,7 @@ static void sony_laptop_report_input_event(u8 event) | |||
362 | /* we emit the scancode so we can always remap the key */ | 362 | /* we emit the scancode so we can always remap the key */ |
363 | input_event(kp.dev, EV_MSC, MSC_SCAN, event); | 363 | input_event(kp.dev, EV_MSC, MSC_SCAN, event); |
364 | input_sync(kp.dev); | 364 | input_sync(kp.dev); |
365 | kfifo_put(sony_laptop_input.fifo, | 365 | kfifo_put(&sony_laptop_input.fifo, |
366 | (unsigned char *)&kp, sizeof(kp)); | 366 | (unsigned char *)&kp, sizeof(kp)); |
367 | 367 | ||
368 | if (!work_pending(&sony_laptop_release_key_work)) | 368 | if (!work_pending(&sony_laptop_release_key_work)) |
@@ -385,12 +385,11 @@ static int sony_laptop_setup_input(struct acpi_device *acpi_device) | |||
385 | 385 | ||
386 | /* kfifo */ | 386 | /* kfifo */ |
387 | spin_lock_init(&sony_laptop_input.fifo_lock); | 387 | spin_lock_init(&sony_laptop_input.fifo_lock); |
388 | sony_laptop_input.fifo = | 388 | error = |
389 | kfifo_alloc(SONY_LAPTOP_BUF_SIZE, GFP_KERNEL, | 389 | kfifo_alloc(&sony_laptop_input.fifo, SONY_LAPTOP_BUF_SIZE, GFP_KERNEL, |
390 | &sony_laptop_input.fifo_lock); | 390 | &sony_laptop_input.fifo_lock); |
391 | if (IS_ERR(sony_laptop_input.fifo)) { | 391 | if (error) { |
392 | printk(KERN_ERR DRV_PFX "kfifo_alloc failed\n"); | 392 | printk(KERN_ERR DRV_PFX "kfifo_alloc failed\n"); |
393 | error = PTR_ERR(sony_laptop_input.fifo); | ||
394 | goto err_dec_users; | 393 | goto err_dec_users; |
395 | } | 394 | } |
396 | 395 | ||
@@ -474,7 +473,7 @@ err_destroy_wq: | |||
474 | destroy_workqueue(sony_laptop_input.wq); | 473 | destroy_workqueue(sony_laptop_input.wq); |
475 | 474 | ||
476 | err_free_kfifo: | 475 | err_free_kfifo: |
477 | kfifo_free(sony_laptop_input.fifo); | 476 | kfifo_free(&sony_laptop_input.fifo); |
478 | 477 | ||
479 | err_dec_users: | 478 | err_dec_users: |
480 | atomic_dec(&sony_laptop_input.users); | 479 | atomic_dec(&sony_laptop_input.users); |
@@ -500,7 +499,7 @@ static void sony_laptop_remove_input(void) | |||
500 | } | 499 | } |
501 | 500 | ||
502 | destroy_workqueue(sony_laptop_input.wq); | 501 | destroy_workqueue(sony_laptop_input.wq); |
503 | kfifo_free(sony_laptop_input.fifo); | 502 | kfifo_free(&sony_laptop_input.fifo); |
504 | } | 503 | } |
505 | 504 | ||
506 | /*********** Platform Device ***********/ | 505 | /*********** Platform Device ***********/ |
@@ -2079,7 +2078,7 @@ static struct attribute_group spic_attribute_group = { | |||
2079 | 2078 | ||
2080 | struct sonypi_compat_s { | 2079 | struct sonypi_compat_s { |
2081 | struct fasync_struct *fifo_async; | 2080 | struct fasync_struct *fifo_async; |
2082 | struct kfifo *fifo; | 2081 | struct kfifo fifo; |
2083 | spinlock_t fifo_lock; | 2082 | spinlock_t fifo_lock; |
2084 | wait_queue_head_t fifo_proc_list; | 2083 | wait_queue_head_t fifo_proc_list; |
2085 | atomic_t open_count; | 2084 | atomic_t open_count; |
@@ -2104,12 +2103,12 @@ static int sonypi_misc_open(struct inode *inode, struct file *file) | |||
2104 | /* Flush input queue on first open */ | 2103 | /* Flush input queue on first open */ |
2105 | unsigned long flags; | 2104 | unsigned long flags; |
2106 | 2105 | ||
2107 | spin_lock_irqsave(sonypi_compat.fifo->lock, flags); | 2106 | spin_lock_irqsave(&sonypi_compat.fifo_lock, flags); |
2108 | 2107 | ||
2109 | if (atomic_inc_return(&sonypi_compat.open_count) == 1) | 2108 | if (atomic_inc_return(&sonypi_compat.open_count) == 1) |
2110 | __kfifo_reset(sonypi_compat.fifo); | 2109 | __kfifo_reset(&sonypi_compat.fifo); |
2111 | 2110 | ||
2112 | spin_unlock_irqrestore(sonypi_compat.fifo->lock, flags); | 2111 | spin_unlock_irqrestore(&sonypi_compat.fifo_lock, flags); |
2113 | 2112 | ||
2114 | return 0; | 2113 | return 0; |
2115 | } | 2114 | } |
@@ -2120,17 +2119,17 @@ static ssize_t sonypi_misc_read(struct file *file, char __user *buf, | |||
2120 | ssize_t ret; | 2119 | ssize_t ret; |
2121 | unsigned char c; | 2120 | unsigned char c; |
2122 | 2121 | ||
2123 | if ((kfifo_len(sonypi_compat.fifo) == 0) && | 2122 | if ((kfifo_len(&sonypi_compat.fifo) == 0) && |
2124 | (file->f_flags & O_NONBLOCK)) | 2123 | (file->f_flags & O_NONBLOCK)) |
2125 | return -EAGAIN; | 2124 | return -EAGAIN; |
2126 | 2125 | ||
2127 | ret = wait_event_interruptible(sonypi_compat.fifo_proc_list, | 2126 | ret = wait_event_interruptible(sonypi_compat.fifo_proc_list, |
2128 | kfifo_len(sonypi_compat.fifo) != 0); | 2127 | kfifo_len(&sonypi_compat.fifo) != 0); |
2129 | if (ret) | 2128 | if (ret) |
2130 | return ret; | 2129 | return ret; |
2131 | 2130 | ||
2132 | while (ret < count && | 2131 | while (ret < count && |
2133 | (kfifo_get(sonypi_compat.fifo, &c, sizeof(c)) == sizeof(c))) { | 2132 | (kfifo_get(&sonypi_compat.fifo, &c, sizeof(c)) == sizeof(c))) { |
2134 | if (put_user(c, buf++)) | 2133 | if (put_user(c, buf++)) |
2135 | return -EFAULT; | 2134 | return -EFAULT; |
2136 | ret++; | 2135 | ret++; |
@@ -2147,7 +2146,7 @@ static ssize_t sonypi_misc_read(struct file *file, char __user *buf, | |||
2147 | static unsigned int sonypi_misc_poll(struct file *file, poll_table *wait) | 2146 | static unsigned int sonypi_misc_poll(struct file *file, poll_table *wait) |
2148 | { | 2147 | { |
2149 | poll_wait(file, &sonypi_compat.fifo_proc_list, wait); | 2148 | poll_wait(file, &sonypi_compat.fifo_proc_list, wait); |
2150 | if (kfifo_len(sonypi_compat.fifo)) | 2149 | if (kfifo_len(&sonypi_compat.fifo)) |
2151 | return POLLIN | POLLRDNORM; | 2150 | return POLLIN | POLLRDNORM; |
2152 | return 0; | 2151 | return 0; |
2153 | } | 2152 | } |
@@ -2309,7 +2308,7 @@ static struct miscdevice sonypi_misc_device = { | |||
2309 | 2308 | ||
2310 | static void sonypi_compat_report_event(u8 event) | 2309 | static void sonypi_compat_report_event(u8 event) |
2311 | { | 2310 | { |
2312 | kfifo_put(sonypi_compat.fifo, (unsigned char *)&event, sizeof(event)); | 2311 | kfifo_put(&sonypi_compat.fifo, (unsigned char *)&event, sizeof(event)); |
2313 | kill_fasync(&sonypi_compat.fifo_async, SIGIO, POLL_IN); | 2312 | kill_fasync(&sonypi_compat.fifo_async, SIGIO, POLL_IN); |
2314 | wake_up_interruptible(&sonypi_compat.fifo_proc_list); | 2313 | wake_up_interruptible(&sonypi_compat.fifo_proc_list); |
2315 | } | 2314 | } |
@@ -2319,11 +2318,12 @@ static int sonypi_compat_init(void) | |||
2319 | int error; | 2318 | int error; |
2320 | 2319 | ||
2321 | spin_lock_init(&sonypi_compat.fifo_lock); | 2320 | spin_lock_init(&sonypi_compat.fifo_lock); |
2322 | sonypi_compat.fifo = kfifo_alloc(SONY_LAPTOP_BUF_SIZE, GFP_KERNEL, | 2321 | error = |
2322 | kfifo_alloc(&sonypi_compat.fifo, SONY_LAPTOP_BUF_SIZE, GFP_KERNEL, | ||
2323 | &sonypi_compat.fifo_lock); | 2323 | &sonypi_compat.fifo_lock); |
2324 | if (IS_ERR(sonypi_compat.fifo)) { | 2324 | if (error) { |
2325 | printk(KERN_ERR DRV_PFX "kfifo_alloc failed\n"); | 2325 | printk(KERN_ERR DRV_PFX "kfifo_alloc failed\n"); |
2326 | return PTR_ERR(sonypi_compat.fifo); | 2326 | return error; |
2327 | } | 2327 | } |
2328 | 2328 | ||
2329 | init_waitqueue_head(&sonypi_compat.fifo_proc_list); | 2329 | init_waitqueue_head(&sonypi_compat.fifo_proc_list); |
@@ -2342,14 +2342,14 @@ static int sonypi_compat_init(void) | |||
2342 | return 0; | 2342 | return 0; |
2343 | 2343 | ||
2344 | err_free_kfifo: | 2344 | err_free_kfifo: |
2345 | kfifo_free(sonypi_compat.fifo); | 2345 | kfifo_free(&sonypi_compat.fifo); |
2346 | return error; | 2346 | return error; |
2347 | } | 2347 | } |
2348 | 2348 | ||
2349 | static void sonypi_compat_exit(void) | 2349 | static void sonypi_compat_exit(void) |
2350 | { | 2350 | { |
2351 | misc_deregister(&sonypi_misc_device); | 2351 | misc_deregister(&sonypi_misc_device); |
2352 | kfifo_free(sonypi_compat.fifo); | 2352 | kfifo_free(&sonypi_compat.fifo); |
2353 | } | 2353 | } |
2354 | #else | 2354 | #else |
2355 | static int sonypi_compat_init(void) { return 0; } | 2355 | static int sonypi_compat_init(void) { return 0; } |