Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp1640869ybh; Sun, 8 Mar 2020 09:14:11 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtAuo+d8Q7g5faOU1e2gcqH86HOvn20tElo4IBLzVHSIbwmxl1s1TrR8/Qvz8veVrZi02TO X-Received: by 2002:aca:dc56:: with SMTP id t83mr9300974oig.105.1583684051295; Sun, 08 Mar 2020 09:14:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583684051; cv=none; d=google.com; s=arc-20160816; b=AOtQBoNZmtr8fB5rnFSfOAvF10aUj2ui9nmK75CniBhwZ3qjkajp0G4eRQu3dfj31p GTV0QK5mG84/fxBktqbW5D2pk7T9TTokovmU33Tv5PY3WXd9xiRkjYl6nBf6kzQ/HXvx Qv+NEHN/YMTA7bbo3h5aME5YFLrfD7AkcvFkgQwWscifZeR6E+juK6RW73tzRph17gv1 MzoDTfCIpLOU2uHUZrOJxndFET9wvYFL8xgW/GDhzkWtF8luCu33dkq6346w6uNbN2Oz J4kwLCnY4thWtC1Qrt9V1Uop2cDmFdQldq7P3Pl4amUmWZZF0udCEbzWi99HJ4319mry tvzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:user-agent :in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:dkim-signature; bh=JagpHXtz31+J5GZLXTrVsh/VN0RFAL+TmJlYBh+m1PE=; b=zSeV486ahONu8H891ASvrk/wRw+U7yhyTCiuWzFqqUdLqalMYpXjwBffHbDtKCuW3u W8ynhzd2oosFFQh2SnOOxRBha4ivnFgB2o0yCCkknJBPnBwI4q6epnl1pSCpPsXBcmcj S74pS4hmrXqjo9gP7xYsXk581F/jPWJZIL4Ltw/dcLpnLeuCHYZdEdVHzOEWz5E0przZ 3XvikgjcNMLkunE2m+KWVixstXOXHQcnL1fJktOxzBxmYYYZSwWWbSOEKtNDFsV6y8G2 b0pnhpCMREgH4rtNggraWSOK6z374b35ubD2DmhRAIXV0bNKganPCEmrpUR7HbxbCyFR /57w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b=EeSGNtZC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g15si673983otr.90.2020.03.08.09.13.57; Sun, 08 Mar 2020 09:14:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmx.net header.s=badeba3b8450 header.b=EeSGNtZC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726297AbgCHQNh (ORCPT + 99 others); Sun, 8 Mar 2020 12:13:37 -0400 Received: from mout.gmx.net ([212.227.17.21]:36901 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726279AbgCHQNg (ORCPT ); Sun, 8 Mar 2020 12:13:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1583684011; bh=JA7KelqRX2ELKkZBiFXkGdbfW7TRtIGf4MCv3XKkKbE=; h=X-UI-Sender-Class:Date:From:To:Cc:Subject:References:In-Reply-To; b=EeSGNtZC0B3ykVAsfykY7ZIbZ5tOHlRL8BoP/0uolfcR0zWel+MO3tBDb/rKfdPvJ XxkiHRZR+/eWaLVJpb+gsIthhKjpR+2AS6/Wd9bpQVKQfLRc14WCj83PtwE2o2fNqc a6VKbtRIMMvKPTAghCAfB4WkE1u4NOs8TX00RPsc= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from ubuntu ([83.52.229.196]) by mail.gmx.com (mrgmx105 [212.227.17.174]) with ESMTPSA (Nemesis) id 1MKKUp-1iuokP40tT-00LnKg; Sun, 08 Mar 2020 17:13:31 +0100 Date: Sun, 8 Mar 2020 17:13:15 +0100 From: Oscar Carter To: Greg Kroah-Hartman Cc: Forest Bond , devel@driverdev.osuosl.org, Malcolm Priestley , linux-kernel@vger.kernel.org, Gabriela Bittencourt , Colin Ian King , Oscar Carter Subject: Re: [PATCH] staging: vt6656: Use BIT_ULL() macro instead of bit shift operation Message-ID: <20200308161047.GA3285@ubuntu> References: <20200307104929.7710-1-oscar.carter@gmx.com> <20200308065538.GF3983392@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200308065538.GF3983392@kroah.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Provags-ID: V03:K1:6xtxvJi0FfjwnfVyBu2Z2AJkOlgf8yEKyfAHWWDPyJI2yHaRHD8 XzrrZ4HsqEOJlW5S6p0yI+wdDyzQ5WsCxnOF7zzTWIi+4CLE6E4oOuQRHFJ5OTGA6yU1qKB O9fmRN3+Z0LT/UdjrdXAKv8D0GBK/s63IJpSIlD8GmsuM9uo9s//3e3IsunTlNCadhji55j q+dEqaWwfGRMTFQh5qZIw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:OzKg9uzPUdw=:dUn0lwO+yKYtK2S/EVDzha 7U0Mc3vIapzWR409zdisVcU22VcV3z2DZKRUml94MsucIG/OmPEGZLbY5CpmlM7aqWwXGdeKP SScU3F9k+a2sas2FP25eKvldW/h6/mZV7W6NzoY8poe3sqdzDwAHVfmEJSmGsSUV54RAUUzwv x0OkJdNU5z8499pH6CvbZJosSSNBs4+sR8GByOlNs3x7jmCnTZnsxvN22YQIhBfJfcMJRJWBS TjYl9Et6eq5aAPFrY2hNfEjHTZGwHHg3kMCfQ9D2c7XoBi3Nce/EZnddxFgpalt7wiSlQZFrX il3+35wFNZF5k8w1y1NF49DYLbmAFBoN3XR/gBnX4gkJsBn6XCj8x8NW2h4DpHqW2JzmE/Q58 UwCve5L2/YCUdu9XfslOeqo5Cz+UsXILZAGMRm+1dfAvI5q3gbgfseGCo5QUg5DrmuNL1dW8X ssuU2U70T898UC088eTZylcVxAzaMqds46Xa8BSOvTs1TmU0s7VUAsw8WVpjXsXGHqJJwGxe0 fsUMurrCQ114BsVoyceqYq2CXOfNHzf8kZwioXobjbf6e3JSPIOAOJ0tjVMAdOkNA/eFEzNLC 2HDoow5tGGnfK189qK9N+78tiKoWEEZ1c8H5Vs3MEsHftcgY27v+ohhPIgTYxv0lerSlT2DuP YU1zwyx0i/hC/xH03O8ej1KFhxA4h+e4mPIYeIiBh68NIUIXJucf083+Q3YytOXnIH0uV/ywf YAJAbVyGcdi2troOrDiyPzFECQ9ZiRw7g11XsLGLWU2XxrT1hOs9L6GO+Wm0R8HCxgJw32tS4 O9lLai89w7b5SNR8LCS87BGKVM8v/8U1Roc1v1G3oTUgVW4I+yMACFGTBpiDOOHRzaXRSF7jr 8tNOLuoMwnuT/CQG5Q4XG17jBI7hPjBC9ZvOalolJ9emAl06bnhF3ZXL4N1DO5RgAHJ2Kha+N O1gBwXsgotsCsHdJJ5rv6dlDbHKkGGEYtocHt63trSdn+5xVSZwOlvweVbD1J6kXxDDIT1jVq vyEgDo/1IYHRCZ1Xqiezs1j/gkbsPUs+y3DAwaB8qay2o2L9LNdjpFjuOKmoVD4Ni8chu2Ib2 hh2bjEtA2XImjhISNDTmGehfx084nhwC6CG2vNNq+x7mVh2Mr4GCs5vKS/GO0da7CzlcF1BRi 0qGvKKBSnmIYvWxRAdpQm+HXIKDJS5hZqoVbkX361hfFrJniBuYjYNBqeX8x92dVKDpt31EXI unANMlp44fA71xiSw Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Mar 08, 2020 at 07:55:38AM +0100, Greg Kroah-Hartman wrote: > On Sat, Mar 07, 2020 at 11:49:29AM +0100, Oscar Carter wrote: > > Replace the bit left shift operation with the BIT_ULL() macro and remo= ve > > the unnecessary "and" operation against the bit_nr variable. > > > > Signed-off-by: Oscar Carter > > --- > > drivers/staging/vt6656/main_usb.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt665= 6/main_usb.c > > index 5e48b3ddb94c..f7ca9e97594d 100644 > > --- a/drivers/staging/vt6656/main_usb.c > > +++ b/drivers/staging/vt6656/main_usb.c > > @@ -21,6 +21,7 @@ > > */ > > #undef __NO_VERSION__ > > > > +#include > > #include > > #include > > #include "device.h" > > @@ -802,8 +803,7 @@ static u64 vnt_prepare_multicast(struct ieee80211_= hw *hw, > > > > netdev_hw_addr_list_for_each(ha, mc_list) { > > bit_nr =3D ether_crc(ETH_ALEN, ha->addr) >> 26; > > - > > - mc_filter |=3D 1ULL << (bit_nr & 0x3f); > > + mc_filter |=3D BIT_ULL(bit_nr); > > Are you sure this does the same thing? You are not masking off bit_nr > anymore, why not? My reasons are exposed below: The ether_crc function returns an u32 type (unsigned of 32 bits). Then the= right shift operand discards the 26 lsb bits (the bits shifted off the right sid= e are discarded). The 6 msb bits of the u32 returned by the ether_crc function a= re positioned in bit 5 to bit 0 of the variable bit_nr. Due to the right shif= t happens over an unsigned type, the 26 new bits added on the left side will= be 0. In summary, after the right bit shift operation we obtain in the variable = bit_nr (unsigned of 32 bits) the value represented by the 6 msb bits of the value returned by the ether_crc function. So, only the 6 lsb bits of the variabl= e bit_nr are important. The 26 msb bits of this variable are 0. In this situation, the "and" operation with the mask 0x3f (mask of 6 lsb b= its) is unnecessary due to its purpose is to reset (set to 0 value) the 26 msb = bits that are yet 0. > > thanks, > > greg k-h thanks, Oscar