[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20200314161441.4870-1-oscar.carter@gmx.com>
Date: Sat, 14 Mar 2020 17:14:41 +0100
From: Oscar Carter <oscar.carter@....com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Forest Bond <forest@...ttletooquiet.net>
Cc: Quentin Deslandes <quentin.deslandes@...ev.co.uk>,
Malcolm Priestley <tvboxspy@...il.com>,
Colin Ian King <colin.king@...onical.com>,
Gabriela Bittencourt <gabrielabittencourt00@...il.com>,
Oscar Carter <oscar.carter@....com>,
devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org
Subject: [PATCH v2] staging: vt6656: Use BIT_ULL() macro instead of bit shift operation
Replace the bit left shift operation with the BIT_ULL() macro and remove
the unnecessary mask off operation against the bit_nr variable.
This mask is only there for legacy reasons. Originally it was 31 (0x1f)
and the bit_nr variable spread across an mc_filter array with two u32
elements. Now, this mask is not needed because its value is 0x3f and the
mc_filter variable is an u64 type.
In this situation, the 26 bit right shift operation against the value
returned by the ether_crc function set the bit_nr variable to the
following value:
bit 31 to bit 6 -> All 0 (due to the bit shift operation happens over an
unsigned type).
bit 5 to bit 0 -> The 6 msb bits of the value returned by the ether_crc
function.
The purpose of the 0x3f mask against the bit_nr variable is to reset
(set to 0) the 26 msb bits (bit 31 to bit 6), but these bits are yet 0.
So, the mask off operation is now unnecessary.
Signed-off-by: Oscar Carter <oscar.carter@....com>
---
Changelog v1 -> v2
- Add more information to clarify the patch.
- Add notes about the legacy provide by Malcolm Priestley.
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/vt6656/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 <linux/bits.h>
#include <linux/etherdevice.h>
#include <linux/file.h>
#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 = ether_crc(ETH_ALEN, ha->addr) >> 26;
-
- mc_filter |= 1ULL << (bit_nr & 0x3f);
+ mc_filter |= BIT_ULL(bit_nr);
}
priv->mc_list_count = mc_list->count;
--
2.20.1
Powered by blists - more mailing lists