aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/joydev.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-03-01 13:38:09 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2010-03-01 13:38:09 -0500
commit8724fdb53d27d7b59b60c8a399cc67f9abfabb33 (patch)
treeda2de791ed4845780376a5e6f844ab69957d565f /drivers/input/joydev.c
parentbc535154137601400ffe44c2a7be047ca041fe06 (diff)
parent35858adbfca13678af99fb31618ef4428d6dedb0 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (62 commits) Input: atkbd - release previously reserved keycodes 248 - 254 Input: add KEY_WPS_BUTTON definition Input: ads7846 - add regulator support Input: winbond-cir - fix suspend/resume Input: gamecon - use pr_err() and friends Input: gamecon - constify some of the setup structures Input: gamecon - simplify pad type handling Input: gamecon - simplify coordinate calculation for PSX Input: gamecon - fix some formatting issues Input: gamecon - add rumble support for N64 pads Input: wacom - add device type to device name string Input: s3c24xx_ts - report touch only when stylus is down Input: s3c24xx_ts - re-enable IRQ on resume Input: wacom - constify product features data Input: wacom - use per-device instance of wacom_features Input: sh_keysc - enable building on SH-Mobile ARM Input: wacom - get features from driver info Input: rotary-encoder - set gpio direction for each requested gpio Input: sh_keysc - update the driver with mode 6 Input: sh_keysc - switch to using bitmaps ...
Diffstat (limited to 'drivers/input/joydev.c')
-rw-r--r--drivers/input/joydev.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c
index b1bd6dd32286..c52bec4d0530 100644
--- a/drivers/input/joydev.c
+++ b/drivers/input/joydev.c
@@ -286,6 +286,8 @@ static int joydev_open(struct inode *inode, struct file *file)
286 goto err_free_client; 286 goto err_free_client;
287 287
288 file->private_data = client; 288 file->private_data = client;
289 nonseekable_open(inode, file);
290
289 return 0; 291 return 0;
290 292
291 err_free_client: 293 err_free_client:
@@ -775,6 +777,20 @@ static void joydev_cleanup(struct joydev *joydev)
775 input_close_device(handle); 777 input_close_device(handle);
776} 778}
777 779
780
781static bool joydev_match(struct input_handler *handler, struct input_dev *dev)
782{
783 /* Avoid touchpads and touchscreens */
784 if (test_bit(EV_KEY, dev->evbit) && test_bit(BTN_TOUCH, dev->keybit))
785 return false;
786
787 /* Avoid tablets, digitisers and similar devices */
788 if (test_bit(EV_KEY, dev->evbit) && test_bit(BTN_DIGI, dev->keybit))
789 return false;
790
791 return true;
792}
793
778static int joydev_connect(struct input_handler *handler, struct input_dev *dev, 794static int joydev_connect(struct input_handler *handler, struct input_dev *dev,
779 const struct input_device_id *id) 795 const struct input_device_id *id)
780{ 796{
@@ -894,22 +910,6 @@ static void joydev_disconnect(struct input_handle *handle)
894 put_device(&joydev->dev); 910 put_device(&joydev->dev);
895} 911}
896 912
897static const struct input_device_id joydev_blacklist[] = {
898 {
899 .flags = INPUT_DEVICE_ID_MATCH_EVBIT |
900 INPUT_DEVICE_ID_MATCH_KEYBIT,
901 .evbit = { BIT_MASK(EV_KEY) },
902 .keybit = { [BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH) },
903 }, /* Avoid itouchpads and touchscreens */
904 {
905 .flags = INPUT_DEVICE_ID_MATCH_EVBIT |
906 INPUT_DEVICE_ID_MATCH_KEYBIT,
907 .evbit = { BIT_MASK(EV_KEY) },
908 .keybit = { [BIT_WORD(BTN_DIGI)] = BIT_MASK(BTN_DIGI) },
909 }, /* Avoid tablets, digitisers and similar devices */
910 { } /* Terminating entry */
911};
912
913static const struct input_device_id joydev_ids[] = { 913static const struct input_device_id joydev_ids[] = {
914 { 914 {
915 .flags = INPUT_DEVICE_ID_MATCH_EVBIT | 915 .flags = INPUT_DEVICE_ID_MATCH_EVBIT |
@@ -936,13 +936,13 @@ MODULE_DEVICE_TABLE(input, joydev_ids);
936 936
937static struct input_handler joydev_handler = { 937static struct input_handler joydev_handler = {
938 .event = joydev_event, 938 .event = joydev_event,
939 .match = joydev_match,
939 .connect = joydev_connect, 940 .connect = joydev_connect,
940 .disconnect = joydev_disconnect, 941 .disconnect = joydev_disconnect,
941 .fops = &joydev_fops, 942 .fops = &joydev_fops,
942 .minor = JOYDEV_MINOR_BASE, 943 .minor = JOYDEV_MINOR_BASE,
943 .name = "joydev", 944 .name = "joydev",
944 .id_table = joydev_ids, 945 .id_table = joydev_ids,
945 .blacklist = joydev_blacklist,
946}; 946};
947 947
948static int __init joydev_init(void) 948static int __init joydev_init(void)