--- zzzz-none-000/linux-3.10.107/drivers/input/joystick/zhenhua.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/drivers/input/joystick/zhenhua.c 2021-02-04 17:41:59.000000000 +0000 @@ -47,9 +47,9 @@ #include #include #include +#include #include #include -#include #define DRIVER_DESC "RC transmitter with 5-byte Zhen Hua protocol joystick driver" @@ -73,16 +73,6 @@ char phys[32]; }; - -/* bits in all incoming bytes needs to be "reversed" */ -static int zhenhua_bitreverse(int x) -{ - x = ((x & 0xaa) >> 1) | ((x & 0x55) << 1); - x = ((x & 0xcc) >> 2) | ((x & 0x33) << 2); - x = ((x & 0xf0) >> 4) | ((x & 0x0f) << 4); - return x; -} - /* * zhenhua_process_packet() decodes packets the driver receives from the * RC transmitter. It updates the data accordingly. @@ -121,7 +111,7 @@ return IRQ_HANDLED; /* wrong MSB -- ignore this byte */ if (zhenhua->idx < ZHENHUA_MAX_LENGTH) - zhenhua->data[zhenhua->idx++] = zhenhua_bitreverse(data); + zhenhua->data[zhenhua->idx++] = bitrev8(data); if (zhenhua->idx == ZHENHUA_MAX_LENGTH) { zhenhua_process_packet(zhenhua);