diff options
Diffstat (limited to 'include/linux/input.h')
-rw-r--r-- | include/linux/input.h | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/include/linux/input.h b/include/linux/input.h index 219d220d185b..62268929856c 100644 --- a/include/linux/input.h +++ b/include/linux/input.h | |||
@@ -98,6 +98,7 @@ struct input_absinfo { | |||
98 | #define EV_PWR 0x16 | 98 | #define EV_PWR 0x16 |
99 | #define EV_FF_STATUS 0x17 | 99 | #define EV_FF_STATUS 0x17 |
100 | #define EV_MAX 0x1f | 100 | #define EV_MAX 0x1f |
101 | #define EV_CNT (EV_MAX+1) | ||
101 | 102 | ||
102 | /* | 103 | /* |
103 | * Synchronization events. | 104 | * Synchronization events. |
@@ -567,6 +568,7 @@ struct input_absinfo { | |||
567 | /* We avoid low common keys in module aliases so they don't get huge. */ | 568 | /* We avoid low common keys in module aliases so they don't get huge. */ |
568 | #define KEY_MIN_INTERESTING KEY_MUTE | 569 | #define KEY_MIN_INTERESTING KEY_MUTE |
569 | #define KEY_MAX 0x1ff | 570 | #define KEY_MAX 0x1ff |
571 | #define KEY_CNT (KEY_MAX+1) | ||
570 | 572 | ||
571 | /* | 573 | /* |
572 | * Relative axes | 574 | * Relative axes |
@@ -583,6 +585,7 @@ struct input_absinfo { | |||
583 | #define REL_WHEEL 0x08 | 585 | #define REL_WHEEL 0x08 |
584 | #define REL_MISC 0x09 | 586 | #define REL_MISC 0x09 |
585 | #define REL_MAX 0x0f | 587 | #define REL_MAX 0x0f |
588 | #define REL_CNT (REL_MAX+1) | ||
586 | 589 | ||
587 | /* | 590 | /* |
588 | * Absolute axes | 591 | * Absolute axes |
@@ -615,6 +618,7 @@ struct input_absinfo { | |||
615 | #define ABS_VOLUME 0x20 | 618 | #define ABS_VOLUME 0x20 |
616 | #define ABS_MISC 0x28 | 619 | #define ABS_MISC 0x28 |
617 | #define ABS_MAX 0x3f | 620 | #define ABS_MAX 0x3f |
621 | #define ABS_CNT (ABS_MAX+1) | ||
618 | 622 | ||
619 | /* | 623 | /* |
620 | * Switch events | 624 | * Switch events |
@@ -625,6 +629,7 @@ struct input_absinfo { | |||
625 | #define SW_HEADPHONE_INSERT 0x02 /* set = inserted */ | 629 | #define SW_HEADPHONE_INSERT 0x02 /* set = inserted */ |
626 | #define SW_RADIO 0x03 /* set = radio enabled */ | 630 | #define SW_RADIO 0x03 /* set = radio enabled */ |
627 | #define SW_MAX 0x0f | 631 | #define SW_MAX 0x0f |
632 | #define SW_CNT (SW_MAX+1) | ||
628 | 633 | ||
629 | /* | 634 | /* |
630 | * Misc events | 635 | * Misc events |
@@ -636,6 +641,7 @@ struct input_absinfo { | |||
636 | #define MSC_RAW 0x03 | 641 | #define MSC_RAW 0x03 |
637 | #define MSC_SCAN 0x04 | 642 | #define MSC_SCAN 0x04 |
638 | #define MSC_MAX 0x07 | 643 | #define MSC_MAX 0x07 |
644 | #define MSC_CNT (MSC_MAX+1) | ||
639 | 645 | ||
640 | /* | 646 | /* |
641 | * LEDs | 647 | * LEDs |
@@ -653,6 +659,7 @@ struct input_absinfo { | |||
653 | #define LED_MAIL 0x09 | 659 | #define LED_MAIL 0x09 |
654 | #define LED_CHARGING 0x0a | 660 | #define LED_CHARGING 0x0a |
655 | #define LED_MAX 0x0f | 661 | #define LED_MAX 0x0f |
662 | #define LED_CNT (LED_MAX+1) | ||
656 | 663 | ||
657 | /* | 664 | /* |
658 | * Autorepeat values | 665 | * Autorepeat values |
@@ -670,6 +677,7 @@ struct input_absinfo { | |||
670 | #define SND_BELL 0x01 | 677 | #define SND_BELL 0x01 |
671 | #define SND_TONE 0x02 | 678 | #define SND_TONE 0x02 |
672 | #define SND_MAX 0x07 | 679 | #define SND_MAX 0x07 |
680 | #define SND_CNT (SND_MAX+1) | ||
673 | 681 | ||
674 | /* | 682 | /* |
675 | * IDs. | 683 | * IDs. |
@@ -920,6 +928,7 @@ struct ff_effect { | |||
920 | #define FF_AUTOCENTER 0x61 | 928 | #define FF_AUTOCENTER 0x61 |
921 | 929 | ||
922 | #define FF_MAX 0x7f | 930 | #define FF_MAX 0x7f |
931 | #define FF_CNT (FF_MAX+1) | ||
923 | 932 | ||
924 | #ifdef __KERNEL__ | 933 | #ifdef __KERNEL__ |
925 | 934 | ||
@@ -932,10 +941,6 @@ struct ff_effect { | |||
932 | #include <linux/timer.h> | 941 | #include <linux/timer.h> |
933 | #include <linux/mod_devicetable.h> | 942 | #include <linux/mod_devicetable.h> |
934 | 943 | ||
935 | #define NBITS(x) (((x)/BITS_PER_LONG)+1) | ||
936 | #define BIT(x) (1UL<<((x)%BITS_PER_LONG)) | ||
937 | #define LONG(x) ((x)/BITS_PER_LONG) | ||
938 | |||
939 | /** | 944 | /** |
940 | * struct input_dev - represents an input device | 945 | * struct input_dev - represents an input device |
941 | * @name: name of the device | 946 | * @name: name of the device |
@@ -1020,15 +1025,15 @@ struct input_dev { | |||
1020 | const char *uniq; | 1025 | const char *uniq; |
1021 | struct input_id id; | 1026 | struct input_id id; |
1022 | 1027 | ||
1023 | unsigned long evbit[NBITS(EV_MAX)]; | 1028 | unsigned long evbit[BITS_TO_LONGS(EV_CNT)]; |
1024 | unsigned long keybit[NBITS(KEY_MAX)]; | 1029 | unsigned long keybit[BITS_TO_LONGS(KEY_CNT)]; |
1025 | unsigned long relbit[NBITS(REL_MAX)]; | 1030 | unsigned long relbit[BITS_TO_LONGS(REL_CNT)]; |
1026 | unsigned long absbit[NBITS(ABS_MAX)]; | 1031 | unsigned long absbit[BITS_TO_LONGS(ABS_CNT)]; |
1027 | unsigned long mscbit[NBITS(MSC_MAX)]; | 1032 | unsigned long mscbit[BITS_TO_LONGS(MSC_CNT)]; |
1028 | unsigned long ledbit[NBITS(LED_MAX)]; | 1033 | unsigned long ledbit[BITS_TO_LONGS(LED_CNT)]; |
1029 | unsigned long sndbit[NBITS(SND_MAX)]; | 1034 | unsigned long sndbit[BITS_TO_LONGS(SND_CNT)]; |
1030 | unsigned long ffbit[NBITS(FF_MAX)]; | 1035 | unsigned long ffbit[BITS_TO_LONGS(FF_CNT)]; |
1031 | unsigned long swbit[NBITS(SW_MAX)]; | 1036 | unsigned long swbit[BITS_TO_LONGS(SW_CNT)]; |
1032 | 1037 | ||
1033 | unsigned int keycodemax; | 1038 | unsigned int keycodemax; |
1034 | unsigned int keycodesize; | 1039 | unsigned int keycodesize; |
@@ -1046,10 +1051,10 @@ struct input_dev { | |||
1046 | int abs[ABS_MAX + 1]; | 1051 | int abs[ABS_MAX + 1]; |
1047 | int rep[REP_MAX + 1]; | 1052 | int rep[REP_MAX + 1]; |
1048 | 1053 | ||
1049 | unsigned long key[NBITS(KEY_MAX)]; | 1054 | unsigned long key[BITS_TO_LONGS(KEY_CNT)]; |
1050 | unsigned long led[NBITS(LED_MAX)]; | 1055 | unsigned long led[BITS_TO_LONGS(LED_CNT)]; |
1051 | unsigned long snd[NBITS(SND_MAX)]; | 1056 | unsigned long snd[BITS_TO_LONGS(SND_CNT)]; |
1052 | unsigned long sw[NBITS(SW_MAX)]; | 1057 | unsigned long sw[BITS_TO_LONGS(SW_CNT)]; |
1053 | 1058 | ||
1054 | int absmax[ABS_MAX + 1]; | 1059 | int absmax[ABS_MAX + 1]; |
1055 | int absmin[ABS_MAX + 1]; | 1060 | int absmin[ABS_MAX + 1]; |
@@ -1293,7 +1298,7 @@ static inline void input_set_abs_params(struct input_dev *dev, int axis, int min | |||
1293 | dev->absfuzz[axis] = fuzz; | 1298 | dev->absfuzz[axis] = fuzz; |
1294 | dev->absflat[axis] = flat; | 1299 | dev->absflat[axis] = flat; |
1295 | 1300 | ||
1296 | dev->absbit[LONG(axis)] |= BIT(axis); | 1301 | dev->absbit[BIT_WORD(axis)] |= BIT_MASK(axis); |
1297 | } | 1302 | } |
1298 | 1303 | ||
1299 | extern struct class input_class; | 1304 | extern struct class input_class; |
@@ -1334,7 +1339,7 @@ struct ff_device { | |||
1334 | 1339 | ||
1335 | void *private; | 1340 | void *private; |
1336 | 1341 | ||
1337 | unsigned long ffbit[NBITS(FF_MAX)]; | 1342 | unsigned long ffbit[BITS_TO_LONGS(FF_CNT)]; |
1338 | 1343 | ||
1339 | struct mutex mutex; | 1344 | struct mutex mutex; |
1340 | 1345 | ||