summaryrefslogtreecommitdiff
path: root/drivers/staging/vt6656/main_usb.c
diff options
context:
space:
mode:
authorOscar Carter <oscar.carter@gmx.com>2020-03-14 17:14:41 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-03-17 12:28:03 +0100
commitd8dd36459dd512c38673946cf895901d575e9d67 (patch)
tree66f0ff4d6da283ef9afb563dcf3ad262920a7e8d /drivers/staging/vt6656/main_usb.c
parentc15e7f072288bc6d19bbab065a8b60ca096529bf (diff)
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@gmx.com> Link: https://lore.kernel.org/r/20200314161441.4870-1-oscar.carter@gmx.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/vt6656/main_usb.c')
-rw-r--r--drivers/staging/vt6656/main_usb.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c
index 56f81785a118..46012aaff21d 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"
@@ -793,8 +794,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;