From 595772a0510324bb67d7fe21ccbece97a844659a Mon Sep 17 00:00:00 2001 From: Michael Forney Date: Sat, 1 Feb 2020 00:41:40 -0800 Subject: mtdev: Update to 1.1.6 --- pkg/mtdev/patch/0001-Avoid-__builtin_ffs.patch | 44 +++++++++++++++++ ...-for-nlongs-so-it-can-be-used-in-constant.patch | 55 ---------------------- pkg/mtdev/patch/0002-Avoid-__builtin_ffs.patch | 44 ----------------- pkg/mtdev/src | 2 +- pkg/mtdev/ver | 2 +- 5 files changed, 46 insertions(+), 101 deletions(-) create mode 100644 pkg/mtdev/patch/0001-Avoid-__builtin_ffs.patch delete mode 100644 pkg/mtdev/patch/0001-Use-a-macro-for-nlongs-so-it-can-be-used-in-constant.patch delete mode 100644 pkg/mtdev/patch/0002-Avoid-__builtin_ffs.patch (limited to 'pkg/mtdev') diff --git a/pkg/mtdev/patch/0001-Avoid-__builtin_ffs.patch b/pkg/mtdev/patch/0001-Avoid-__builtin_ffs.patch new file mode 100644 index 00000000..749bda56 --- /dev/null +++ b/pkg/mtdev/patch/0001-Avoid-__builtin_ffs.patch @@ -0,0 +1,44 @@ +From 09e21bb5d6714687705dc8f2d00a09b3ff3b2436 Mon Sep 17 00:00:00 2001 +From: Michael Forney +Date: Fri, 7 Jun 2019 11:55:26 -0700 +Subject: [PATCH] Avoid __builtin_ffs + +--- + src/common.h | 5 +---- + src/core.c | 2 +- + 2 files changed, 2 insertions(+), 5 deletions(-) + +diff --git a/src/common.h b/src/common.h +index 80a3d6e..3c77f48 100644 +--- a/src/common.h ++++ b/src/common.h +@@ -77,12 +77,9 @@ static inline int bitcount(unsigned v) + return (((v + (v>>4)) & 0xF0F0F0F) * 0x1010101) >> 24; + } + +-/* Return index of first bit [0-31], -1 on zero */ +-#define firstbit(v) (__builtin_ffs(v) - 1) +- + /* boost-style foreach bit */ + #define foreach_bit(i, m) \ +- for (i = firstbit(m); i >= 0; i = firstbit((m) & (~0U << (i + 1)))) ++ for (i = -1; (m) & ~0U << (i + 1);) if ((m) & 1U << ++i) + + /* robust system ioctl calls */ + #define SYSCALL(call) while (((call) == -1) && (errno == EINTR)) +diff --git a/src/core.c b/src/core.c +index 0d91c0b..20ce0c6 100644 +--- a/src/core.c ++++ b/src/core.c +@@ -304,7 +304,7 @@ static void apply_typeA_changes(struct mtdev_state *state, + break; + } + if (id != MT_ID_NULL) { +- slot = firstbit(unused); ++ foreach_bit(slot, unused) break; + push_slot_changes(state, &data[i], prop[i], slot, syn); + SETBIT(used, slot); + CLEARBIT(unused, slot); +-- +2.25.0 + diff --git a/pkg/mtdev/patch/0001-Use-a-macro-for-nlongs-so-it-can-be-used-in-constant.patch b/pkg/mtdev/patch/0001-Use-a-macro-for-nlongs-so-it-can-be-used-in-constant.patch deleted file mode 100644 index 4e3f53ec..00000000 --- a/pkg/mtdev/patch/0001-Use-a-macro-for-nlongs-so-it-can-be-used-in-constant.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 43c6faf96712324bea4121157d292b84a86b0d45 Mon Sep 17 00:00:00 2001 -From: Michael Forney -Date: Fri, 7 Jun 2019 10:36:05 -0700 -Subject: [PATCH] Use a macro for `nlongs` so it can be used in constant - expression - -This way, it can be used to specify the `absbits` array size (in -`mtdev_configure`) without making it a VLA. - -VLAs are an optional feature in C11, and in this case we can determine -the array size statically. - -This also matches the macros used in libevdev and libinput. - -Signed-off-by: Michael Forney ---- - src/caps.c | 12 ++++-------- - 1 file changed, 4 insertions(+), 8 deletions(-) - -diff --git a/src/caps.c b/src/caps.c -index 2e6b0d4..b493425 100644 ---- a/src/caps.c -+++ b/src/caps.c -@@ -32,16 +32,12 @@ static const int SN_COORD = 250; /* coordinate signal-to-noise ratio */ - static const int SN_WIDTH = 100; /* width signal-to-noise ratio */ - static const int SN_ORIENT = 10; /* orientation signal-to-noise ratio */ - --static const int bits_per_long = 8 * sizeof(long); -- --static inline int nlongs(int nbit) --{ -- return (nbit + bits_per_long - 1) / bits_per_long; --} -+#define LONG_BITS (sizeof(long) * 8) -+#define NLONGS(x) (((x) + LONG_BITS - 1) / LONG_BITS) - - static inline int getbit(const unsigned long *map, int key) - { -- return (map[key / bits_per_long] >> (key % bits_per_long)) & 0x01; -+ return (map[key / LONG_BITS] >> (key % LONG_BITS)) & 0x01; - } - - static int getabs(struct input_absinfo *abs, int key, int fd) -@@ -106,7 +102,7 @@ int mtdev_set_slots(struct mtdev *dev, int fd) - - int mtdev_configure(struct mtdev *dev, int fd) - { -- unsigned long absbits[nlongs(ABS_MAX)]; -+ unsigned long absbits[NLONGS(ABS_MAX)]; - int rc, i; - - SYSCALL(rc = ioctl(fd, EVIOCGBIT(EV_ABS, sizeof(absbits)), absbits)); --- -2.20.1 - diff --git a/pkg/mtdev/patch/0002-Avoid-__builtin_ffs.patch b/pkg/mtdev/patch/0002-Avoid-__builtin_ffs.patch deleted file mode 100644 index 37a14ae7..00000000 --- a/pkg/mtdev/patch/0002-Avoid-__builtin_ffs.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 365d628a9c944989cab0bfa6ae39d1df0ec5a905 Mon Sep 17 00:00:00 2001 -From: Michael Forney -Date: Fri, 7 Jun 2019 11:55:26 -0700 -Subject: [PATCH] Avoid __builtin_ffs - ---- - src/common.h | 5 +---- - src/core.c | 2 +- - 2 files changed, 2 insertions(+), 5 deletions(-) - -diff --git a/src/common.h b/src/common.h -index 80a3d6e..3c77f48 100644 ---- a/src/common.h -+++ b/src/common.h -@@ -77,12 +77,9 @@ static inline int bitcount(unsigned v) - return (((v + (v>>4)) & 0xF0F0F0F) * 0x1010101) >> 24; - } - --/* Return index of first bit [0-31], -1 on zero */ --#define firstbit(v) (__builtin_ffs(v) - 1) -- - /* boost-style foreach bit */ - #define foreach_bit(i, m) \ -- for (i = firstbit(m); i >= 0; i = firstbit((m) & (~0U << (i + 1)))) -+ for (i = -1; (m) & ~0U << (i + 1);) if ((m) & 1U << ++i) - - /* robust system ioctl calls */ - #define SYSCALL(call) while (((call) == -1) && (errno == EINTR)) -diff --git a/src/core.c b/src/core.c -index 87ef420..f5b6272 100644 ---- a/src/core.c -+++ b/src/core.c -@@ -298,7 +298,7 @@ static void apply_typeA_changes(struct mtdev_state *state, - break; - } - if (id != MT_ID_NULL) { -- slot = firstbit(unused); -+ foreach_bit(slot, unused) break; - push_slot_changes(state, &data[i], prop[i], slot, syn); - SETBIT(used, slot); - CLEARBIT(unused, slot); --- -2.20.1 - diff --git a/pkg/mtdev/src b/pkg/mtdev/src index 4381b78f..25d541d2 160000 --- a/pkg/mtdev/src +++ b/pkg/mtdev/src @@ -1 +1 @@ -Subproject commit 4381b78fea54de0e775bf54952b2f95e5a06c57d +Subproject commit 25d541d2b0b526eba58fee99ceac202acca6d4a2 diff --git a/pkg/mtdev/ver b/pkg/mtdev/ver index 9208c440..c875bb12 100644 --- a/pkg/mtdev/ver +++ b/pkg/mtdev/ver @@ -1 +1 @@ -1.1.5 r1 +1.1.6 r0 -- cgit v1.2.3