From: Preeti U Murthy <preeti@linux.vnet.ibm.com>
To: Vaishali Thakkar <vthakkar1994@gmail.com>,
Julia Lawall <julia.lawall@lip6.fr>
Cc: outreachy-kernel@googlegroups.com
Subject: Re: [Outreachy kernel] [PATCH v3 2/2] Staging: rtl8723au: Use put_unaligned_le16
Date: Fri, 20 Feb 2015 13:08:25 +0530 [thread overview]
Message-ID: <54E6E471.8090107@linux.vnet.ibm.com> (raw)
In-Reply-To: <CAK-LDbKo2E2gua_=z+5ibpnY-Qf3qnzaJZLW6AdG_KekBH9BZQ@mail.gmail.com>
On 02/20/2015 12:54 PM, Vaishali Thakkar wrote:
> On Fri, Feb 20, 2015 at 12:47 PM, Julia Lawall <julia.lawall@lip6.fr> wrote:
>> On Fri, 20 Feb 2015, Vaishali Thakkar wrote:
>>
>>> Using byte ordering functions and then memcpy() is risky and
>>> prone to hide errors which are hard to track down. So, this
>>> patch introduces the use of function put_unaligned_le16 which
>>> makes the code clear. Here, use of variable tim_bitmap_le
>>> and variable itself is removed. Also, to be compatible with the
>>> changes header file is added too.
>>>
>>> Coccinelle is used to do this change and semantic patch used for
>>> this is as follows:
>>>
>>> @a@
>>> typedef __le16;
>>> __le16 e16;
>>> identifier tmp;
>>> expression ptr;
>>> expression y,e;
>>> type T;
>>> @@
>>>
>>> - tmp = cpu_to_le16(y);
>>>
>>> <+... when != tmp
>>> (
>>> - memcpy(ptr, (T)&tmp, \(2\|sizeof(__le16)\|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>
>>> ---
>>> Changes since v1:
>>> -Edit commit log
>>> -Merge this patch in a patch series
>>
>> So in this case there is no change since v2? Maybe it would be better to
>> make that explicit.
>
> Actually there is no v2 of this patch but as this patch is merged in a
> series with
> v3 of patch Staging: rtl8188eu: Use put_unaligned_le16 it comes as a v3.
>
> Should I clear this in a cover letter and then resend the patch series?
Yes I would suggest that. I missed this. Additionally I would recommend
in this case to not prefix any version number to the cover letter.
Instead prefix the appropriate version numbers to the individual patches
mentioning the changes from the previous versions.
Regards
Preeti U Murthy
>
>> julia
>>
>>
>>> drivers/staging/rtl8723au/core/rtw_ap.c | 8 +++-----
>>> 1 file changed, 3 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/drivers/staging/rtl8723au/core/rtw_ap.c b/drivers/staging/rtl8723au/core/rtw_ap.c
>>> index c6327c0..7fa4352 100644
>>> --- a/drivers/staging/rtl8723au/core/rtw_ap.c
>>> +++ b/drivers/staging/rtl8723au/core/rtw_ap.c
>>> @@ -20,6 +20,7 @@
>>> #include <wifi.h>
>>> #include <rtl8723a_cmd.h>
>>> #include <rtl8723a_hal.h>
>>> +#include <asm/unaligned.h>
>>>
>>> extern unsigned char WMM_OUI23A[];
>>> extern unsigned char WPS_OUI23A[];
>>> @@ -72,11 +73,8 @@ static void update_BCNTIM(struct rtw_adapter *padapter)
>>> struct wlan_bssid_ex *pnetwork_mlmeext = &pmlmeinfo->network;
>>> unsigned char *pie = pnetwork_mlmeext->IEs;
>>> u8 *p, *dst_ie, *premainder_ie = NULL, *pbackup_remainder_ie = NULL;
>>> - __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_ie23a(pie, WLAN_EID_TIM, &tim_ielen,
>>> pnetwork_mlmeext->IELength);
>>> if (p != NULL && tim_ielen > 0) {
>>> @@ -143,9 +141,9 @@ static void update_BCNTIM(struct rtw_adapter *padapter)
>>> *dst_ie++ = 0;
>>>
>>> if (tim_ielen == 4) {
>>> - *dst_ie++ = *(u8 *)&tim_bitmap_le;
>>> + *dst_ie++ = pstapriv->tim_bitmap & 0xff;
>>> } 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
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
>>> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
>>> To post to this group, send email to outreachy-kernel@googlegroups.com.
>>> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/9defe79e0f212c883f260e27a67bff9f9ba013ba.1424402536.git.vthakkar1994%40gmail.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>
>
>
next prev parent reply other threads:[~2015-02-20 7:38 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-20 3:30 [PATCH v3 0/2] Staging: Use put_unaligned_le16 Vaishali Thakkar
2015-02-20 3:30 ` [PATCH v3 1/2] Staging: rtl8188eu: " Vaishali Thakkar
2015-02-20 7:24 ` [Outreachy kernel] " Preeti U Murthy
2015-02-20 7:26 ` Vaishali Thakkar
2015-02-20 3:31 ` [PATCH v3 2/2] Staging: rtl8723au: " Vaishali Thakkar
2015-02-20 7:17 ` [Outreachy kernel] " Julia Lawall
2015-02-20 7:24 ` Vaishali Thakkar
2015-02-20 7:38 ` Preeti U Murthy [this message]
2015-02-20 7:50 ` Vaishali Thakkar
2015-02-20 8:02 ` Preeti U Murthy
2015-02-20 8:27 ` Vaishali Thakkar
2015-02-20 7:25 ` Preeti U Murthy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54E6E471.8090107@linux.vnet.ibm.com \
--to=preeti@linux.vnet.ibm.com \
--cc=julia.lawall@lip6.fr \
--cc=outreachy-kernel@googlegroups.com \
--cc=vthakkar1994@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.