All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Staging: rtl8188eu: Use put_unaligned_le16
@ 2015-02-17  4:42 Vaishali Thakkar
  2015-02-17  9:02 ` [Outreachy kernel] " Arnd Bergmann
  0 siblings, 1 reply; 13+ messages in thread
From: Vaishali Thakkar @ 2015-02-17  4:42 UTC (permalink / raw)
  To: outreachy-kernel

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>
---
 drivers/staging/rtl8188eu/core/rtw_ap.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_ap.c b/drivers/staging/rtl8188eu/core/rtw_ap.c
index da19145..0b7b156 100644
--- a/drivers/staging/rtl8188eu/core/rtw_ap.c
+++ b/drivers/staging/rtl8188eu/core/rtw_ap.c
@@ -81,8 +81,6 @@ static void update_BCNTIM(struct adapter *padapter)
 		__le16 tim_bitmap_le;
 		uint offset, tmp_len, tim_ielen, tim_ie_offset, remainder_ielen;
 
-		tim_bitmap_le = cpu_to_le16(pstapriv->tim_bitmap);
-
 		p = rtw_get_ie(pie + _FIXED_IE_LENGTH_, _TIM_IE_, &tim_ielen, pnetwork_mlmeext->IELength - _FIXED_IE_LENGTH_);
 		if (p != NULL && tim_ielen > 0) {
 			tim_ielen += 2;
@@ -139,7 +137,7 @@ static void update_BCNTIM(struct adapter *padapter)
 		if (tim_ielen == 4) {
 			*dst_ie++ = *(u8 *)&tim_bitmap_le;
 		} else if (tim_ielen == 5) {
-			memcpy(dst_ie, &tim_bitmap_le, 2);
+			put_unaligned_le16(pstapriv->tim_bitmap, dst_ie);
 			dst_ie += 2;
 		}
 
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2015-02-20 12:01 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-17  4:42 [PATCH] Staging: rtl8188eu: Use put_unaligned_le16 Vaishali Thakkar
2015-02-17  9:02 ` [Outreachy kernel] " Arnd Bergmann
2015-02-17 10:11   ` Vaishali Thakkar
2015-02-17 19:12     ` Jes Sorensen
2015-02-18  1:32       ` Vaishali Thakkar
2015-02-18 10:50         ` Arnd Bergmann
2015-02-18 17:10           ` Jes Sorensen
2015-02-18 18:08             ` Vaishali Thakkar
2015-02-18 22:31               ` Jes Sorensen
2015-02-19  3:05                 ` Vaishali Thakkar
2015-02-19  8:28                   ` Arnd Bergmann
2015-02-19  8:43                     ` Vaishali Thakkar
2015-02-20 12:01                       ` Jes Sorensen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.