Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933678AbcKOMfM (ORCPT ); Tue, 15 Nov 2016 07:35:12 -0500 Received: from aserp1040.oracle.com ([141.146.126.69]:38879 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750890AbcKOMfK (ORCPT ); Tue, 15 Nov 2016 07:35:10 -0500 Date: Tue, 15 Nov 2016 15:34:49 +0300 From: Dan Carpenter To: Sergio Paracuellos 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 Message-ID: <20161115123448.GQ28701@mwanda> References: <1478801802-7731-1-git-send-email-sergio.paracuellos@gmail.com> <1478801802-7731-5-git-send-email-sergio.paracuellos@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1478801802-7731-5-git-send-email-sergio.paracuellos@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Source-IP: userv0021.oracle.com [156.151.31.71] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1293 Lines: 31 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 > --- > 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