lkml.org 
[lkml]   [2017]   [Feb]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [PATCH] staging: r8712u: use __le32 type for little-endian data
From
Date
On 02/10/2017 12:23 PM, Perry Hooker wrote:
> This patch fixes the following sparse warning:
> drivers/staging/rtl8712/usb_ops_linux.c:212:33: warning: cast to restricted __le32
>
> Signed-off-by: Perry Hooker <perry.hooker@gmail.com>
> ---
> drivers/staging/rtl8712/usb_ops_linux.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)

Are you using the staging branch of Greg's tree? If so, you should be using
staging-next. The exact patch that you submitted has already been applied as
commit 6839bc81478f entitled "staging: rtl8712: changed uint to __le32" and
authored by Jannik Becher <becher.jannik@gmail.com>. The patch was applied on
Tue Dec 20.

Sorry that I did not remember about that earlier patch with the first reply;
however, you did get the fix right this time. Congratulations as these endian
issues can be difficult.

In a quick look at the code, I see that there are a number of endian problems in
the headers for the 802.11 packets, and in the macros that read and write the TX
and RX descriptors. It is surprising that the driver actually works on
big-endian hardware. I do not know how much experience you have, but the macros
are tricky. I will try to get them cleaned up.

Larry


staging: rtl8712: changed uint to __le32

>
> diff --git a/drivers/staging/rtl8712/usb_ops_linux.c b/drivers/staging/rtl8712/usb_ops_linux.c
> index fc6bb0b..df7c1aa 100644
> --- a/drivers/staging/rtl8712/usb_ops_linux.c
> +++ b/drivers/staging/rtl8712/usb_ops_linux.c
> @@ -192,7 +192,8 @@ void r8712_usb_write_mem(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *wmem)
>
> static void r8712_usb_read_port_complete(struct urb *purb)
> {
> - uint isevt, *pbuf;
> + __le32 *pbuf;
> + uint isevt;
> struct recv_buf *precvbuf = (struct recv_buf *)purb->context;
> struct _adapter *padapter = (struct _adapter *)precvbuf->adapter;
> struct recv_priv *precvpriv = &padapter->recvpriv;
> @@ -208,7 +209,7 @@ static void r8712_usb_read_port_complete(struct urb *purb)
> _pkt *pskb = precvbuf->pskb;
>
> precvbuf->transfer_len = purb->actual_length;
> - pbuf = (uint *)precvbuf->pbuf;
> + pbuf = (__le32 *)precvbuf->pbuf;
> isevt = le32_to_cpu(*(pbuf + 1)) & 0x1ff;
> if ((isevt & 0x1ff) == 0x1ff) {
> r8712_rxcmd_event_hdl(padapter, pbuf);
>

\
 
 \ /
  Last update: 2017-02-10 21:56    [W:0.256 / U:0.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site