linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Cc: gregkh@linuxfoundation.org, devel@driverdev.osuosl.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/4] staging: wlan-ng: use GENMASK macro in two bitwise operations in prism2sta.c
Date: Tue, 15 Nov 2016 15:34:49 +0300	[thread overview]
Message-ID: <20161115123448.GQ28701@mwanda> (raw)
In-Reply-To: <1478801802-7731-5-git-send-email-sergio.paracuellos@gmail.com>

On Thu, Nov 10, 2016 at 07:16:42PM +0100, Sergio Paracuellos wrote:
> This patch replace actual mask stuff using BIT macros with 
> or operators to make use of GENMASK macro which simplifies 
> code clearity and readibility.
> 
> It applies for two bitwise operations included in prism2sta.c source file.
> 
> Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
> ---
>  drivers/staging/wlan-ng/prism2sta.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/wlan-ng/prism2sta.c b/drivers/staging/wlan-ng/prism2sta.c
> index 351f08d..984804b 100644
> --- a/drivers/staging/wlan-ng/prism2sta.c
> +++ b/drivers/staging/wlan-ng/prism2sta.c
> @@ -654,8 +654,8 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev)
>  	hw->ident_sta_fw.minor = le16_to_cpu(hw->ident_sta_fw.minor);
>  
>  	/* strip out the 'special' variant bits */
> -	hw->mm_mods = hw->ident_sta_fw.variant & (BIT(14) | BIT(15));
> -	hw->ident_sta_fw.variant &= ~((u16)(BIT(14) | BIT(15)));
> +	hw->mm_mods = hw->ident_sta_fw.variant & GENMASK(15, 14);
> +	hw->ident_sta_fw.variant &= ~((u16)GENMASK(15, 14));

The cast is a no-op because of type promotion.  It gets cast to u16 then
immediately recast to int before the bitwise negate op.

regards,
dan carpenter

      reply	other threads:[~2016-11-15 12:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-10 18:16 [PATCH 0/4] staging: wlan-ng: make use of GENMASK macro Sergio Paracuellos
2016-11-10 18:16 ` [PATCH 1/4] staging: wlan-ng: use GENMASK macro in different defines of hfa384x.h Sergio Paracuellos
2016-11-15 12:21   ` Dan Carpenter
2016-11-10 18:16 ` [PATCH 2/4] staging: wlan-ng: use GENMASK macro in different defines of p80211hdr.h Sergio Paracuellos
2016-11-15 12:25   ` Dan Carpenter
2016-11-10 18:16 ` [PATCH 3/4] staging: wlan-ng: use GENMASK macro in define of p80211netdev.h Sergio Paracuellos
2016-11-10 18:16 ` [PATCH 4/4] staging: wlan-ng: use GENMASK macro in two bitwise operations in prism2sta.c Sergio Paracuellos
2016-11-15 12:34   ` Dan Carpenter [this message]

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=20161115123448.GQ28701@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sergio.paracuellos@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).