Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1599345 > unrolled thread

[PATCH 1/2] staging: wlan-ng: introduce a macro read_u16

Started byGioh Kim <gi-oh.kim@profitbricks.com>
First post2017-03-13 14:20 +0100
Last post2017-03-14 01:10 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 1/2] staging: wlan-ng: introduce a macro read_u16 Gioh Kim <gi-oh.kim@profitbricks.com> - 2017-03-13 14:20 +0100
    Re: [PATCH 1/2] staging: wlan-ng: introduce a macro read_u16 Greg KH <gregkh@linuxfoundation.org> - 2017-03-14 01:10 +0100

#1599345 — [PATCH 1/2] staging: wlan-ng: introduce a macro read_u16

FromGioh Kim <gi-oh.kim@profitbricks.com>
Date2017-03-13 14:20 +0100
Subject[PATCH 1/2] staging: wlan-ng: introduce a macro read_u16
Message-ID<tky3g-12m-7@gated-at.bofh.it>
read_u16 is wrapper of le16_to_cpu to read u16 variable,
rather than __le16.

Signed-off-by: Gioh Kim <gi-oh.kim@profitbricks.com>
---
 drivers/staging/wlan-ng/prism2mgmt.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/staging/wlan-ng/prism2mgmt.h b/drivers/staging/wlan-ng/prism2mgmt.h
index 88b979f..97ede25 100644
--- a/drivers/staging/wlan-ng/prism2mgmt.h
+++ b/drivers/staging/wlan-ng/prism2mgmt.h
@@ -63,6 +63,9 @@
 extern int prism2_reset_holdtime;
 extern int prism2_reset_settletime;
 
+#define read_u16(x) ({ u32 __r = (u32)le16_to_cpu((__force __le16)(x)); \
+			__r; })
+
 u32 prism2sta_ifstate(struct wlandevice *wlandev, u32 ifstate);
 
 void prism2sta_ev_info(struct wlandevice *wlandev,
-- 
2.5.0

[toc] | [next] | [standalone]


#1599938

FromGreg KH <gregkh@linuxfoundation.org>
Date2017-03-14 01:10 +0100
Message-ID<tkIch-iT-7@gated-at.bofh.it>
In reply to#1599345
On Mon, Mar 13, 2017 at 02:14:25PM +0100, Gioh Kim wrote:
> read_u16 is wrapper of le16_to_cpu to read u16 variable,
> rather than __le16.
> 
> Signed-off-by: Gioh Kim <gi-oh.kim@profitbricks.com>
> ---
>  drivers/staging/wlan-ng/prism2mgmt.h | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/staging/wlan-ng/prism2mgmt.h b/drivers/staging/wlan-ng/prism2mgmt.h
> index 88b979f..97ede25 100644
> --- a/drivers/staging/wlan-ng/prism2mgmt.h
> +++ b/drivers/staging/wlan-ng/prism2mgmt.h
> @@ -63,6 +63,9 @@
>  extern int prism2_reset_holdtime;
>  extern int prism2_reset_settletime;
>  
> +#define read_u16(x) ({ u32 __r = (u32)le16_to_cpu((__force __le16)(x)); \
> +			__r; })
> +

Eeek, no, this should not be needed at all, if the code is written
correctly.  Please fix things up to work properly, don't paper over them
with forced casts.

thanks,

greg k-h

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web