Staging: rtl8192u: Use put_unaligned_le16 in rtl819x_BAProc.c
authorVaishali Thakkar <vthakkar1994@gmail.com>
Tue, 27 Jan 2015 18:11:13 +0000 (23:41 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 28 Jan 2015 19:12:35 +0000 (11:12 -0800)
commit9c18a05c454e8a6436352842e56fb1dd2760b13b
tree2aff01603ec3ec8291d3ad3d6aafdcfb0c2f2932
parentf0e0f8cffa73d5922b8e356c64d9238302763e07
Staging: rtl8192u: Use put_unaligned_le16 in rtl819x_BAProc.c

This patch introduces the use of function put_unaligned_le16.

This is done using Coccinelle and semantic patch used is as follows:

@a@
typedef u16, __le16, uint16_t;
{u16,__le16,uint16_t} e16;
identifier tmp;
expression ptr;
expression y,e;
type T;
type T;
@@

- tmp = cpu_to_le16(y);

<+... when != tmp
(
- memcpy(ptr, (T)&tmp, \(2\|sizeof(u16)\|sizeof(__le16)\|sizeof(uint16_t)\|sizeof(e16)\));
+ put_unaligned_le16(y,ptr);
|
- memcpy(ptr, (T)&tmp, ...);
+ put_unaligned_le16(y,ptr);
)
...+>
? tmp = e

@@ type T; identifier a.tmp; @@

- T tmp;
...when != tmp

Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c