HID: cypress: use swap() in cp_report_fixup()
authorFabian Frederick <fabf@skynet.be>
Wed, 10 Jun 2015 16:32:05 +0000 (18:32 +0200)
committerJiri Kosina <jkosina@suse.cz>
Thu, 18 Jun 2015 09:00:42 +0000 (11:00 +0200)
Use kernel.h macro definition.

Thanks to Julia Lawall for Coccinelle scripting support.

Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/hid-cypress.c

index c4ef3bc726e34e5e08aa947b64ddfa4dc7f772b0..1b764d1745f3daa693a17ee706c302ff31ae0f0e 100644 (file)
@@ -41,13 +41,9 @@ static __u8 *cp_report_fixup(struct hid_device *hdev, __u8 *rdesc,
 
        for (i = 0; i < *rsize - 4; i++)
                if (rdesc[i] == 0x29 && rdesc[i + 2] == 0x19) {
-                       __u8 tmp;
-
                        rdesc[i] = 0x19;
                        rdesc[i + 2] = 0x29;
-                       tmp = rdesc[i + 3];
-                       rdesc[i + 3] = rdesc[i + 1];
-                       rdesc[i + 1] = tmp;
+                       swap(rdesc[i + 3], rdesc[i + 1]);
                }
        return rdesc;
 }