summaryrefslogtreecommitdiffstats
path: root/package/triggerhappy/0001-eventtable.h-use-correct-array-sizes-to-fix-building.patch
blob: 80f264037f3efc305581ca933af0ac87be910e86 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
From d3cfa80631a7e314fee9b2e0822e403fcf2a5c5c Mon Sep 17 00:00:00 2001
From: Peter Korsgaard <peter@korsgaard.com>
Date: Sun, 31 Jul 2016 10:28:43 +0200
Subject: [PATCH] eventtable.h: use correct array sizes to fix building against
 4.7+ headers
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

During the 4.7 development cycle, commit 9a9b6aa6a8 (Input: add
SW_PEN_INSERTED define) got added, which has the same numerical value as
SW_MAX:

+#define SW_PEN_INSERTED                0x0f  /* set = pen inserted */
+#define SW_MAX                 0x0f

This breaks the build as the SW_NAME array is sized using the SW_MAX macro:

In file included from eventtable.h:21:0,
                 from eventnames.c:11:
evtable_SW.inc:17:1: error: array index in initializer exceeds array bounds
 EV_MAP(SW_PEN_INSERTED),
 ^
evtable_SW.inc:17:1: error: (near initialization for ‘SW_NAME’)

The arrays should be sized using the <foo>_CNT (which is MAX+1) macros
instead of <foo>_MAX.  These got added during the 2.6.24 development cycle,
so it should be safe to do so unconditially:

commit 7b19ada2ed3c1eccb9fe94d74b05e1428224663d
Author: Jiri Slaby <jirislaby@gmail.com>
Date:   Thu Oct 18 23:40:32 2007 -0700

    get rid of input BIT* duplicate defines

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
---
 eventtable.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/eventtable.h b/eventtable.h
index 349d9d7..7cd99aa 100644
--- a/eventtable.h
+++ b/eventtable.h
@@ -8,15 +8,15 @@
 
 #define EV_MAP( N ) [ N ] = #N
 
-static const char *EV_NAME[EV_MAX] = {
+static const char *EV_NAME[EV_CNT] = {
 #include "evtable_EV.inc"
 };
 
-static const char *KEY_NAME[KEY_MAX] = {
+static const char *KEY_NAME[KEY_CNT] = {
 #include "evtable_KEY.inc"
 #include "evtable_BTN.inc"
 };
 
-static const char *SW_NAME[SW_MAX] = {
+static const char *SW_NAME[SW_CNT] = {
 #include "evtable_SW.inc"
 };
-- 
2.8.1

OpenPOWER on IntegriCloud