From d8dd36459dd512c38673946cf895901d575e9d67 Mon Sep 17 00:00:00 2001 From: Oscar Carter Date: Sat, 14 Mar 2020 17:14:41 +0100 Subject: [PATCH] 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 Link: https://lore.kernel.org/r/20200314161441.4870-1-oscar.carter@gmx.com Signed-off-by: Greg Kroah-Hartman --- 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 56f8178..46012aa 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" @@ -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; -- 2.7.4