Commit d8dd3645 authored by Oscar Carter's avatar Oscar Carter Committed by Greg Kroah-Hartman

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: default avatarOscar Carter <oscar.carter@gmx.com>
Link: https://lore.kernel.org/r/20200314161441.4870-1-oscar.carter@gmx.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c15e7f07
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
*/ */
#undef __NO_VERSION__ #undef __NO_VERSION__
#include <linux/bits.h>
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
#include <linux/file.h> #include <linux/file.h>
#include "device.h" #include "device.h"
...@@ -793,8 +794,7 @@ static u64 vnt_prepare_multicast(struct ieee80211_hw *hw, ...@@ -793,8 +794,7 @@ static u64 vnt_prepare_multicast(struct ieee80211_hw *hw,
netdev_hw_addr_list_for_each(ha, mc_list) { netdev_hw_addr_list_for_each(ha, mc_list) {
bit_nr = ether_crc(ETH_ALEN, ha->addr) >> 26; bit_nr = ether_crc(ETH_ALEN, ha->addr) >> 26;
mc_filter |= BIT_ULL(bit_nr);
mc_filter |= 1ULL << (bit_nr & 0x3f);
} }
priv->mc_list_count = mc_list->count; priv->mc_list_count = mc_list->count;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment