Commit 4ecdc381 authored by Tapasweni Pathak's avatar Tapasweni Pathak Committed by Greg Kroah-Hartman

staging: rtl8723au: core: Replace open coded version with existing hweight function

This patch replaces the open coded version with Linux's existing hweight
functions.
The original version checked each of the low four bits, accumulating and
returning the result. Instead, use a mask to select those four bits, and
pass the result to hweight8.
It also makes the code in this function simpler.
Signed-off-by: default avatarTapasweni Pathak <tapaswenipathak@gmail.com>
Reviewed-by: default avatarJosh Triplett <josh@joshtriplett.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 2430454e
...@@ -117,12 +117,7 @@ Efuse_GetCurrentSize23a(struct rtw_adapter *pAdapter, u8 efuseType) ...@@ -117,12 +117,7 @@ Efuse_GetCurrentSize23a(struct rtw_adapter *pAdapter, u8 efuseType)
u8 u8
Efuse_CalculateWordCnts23a(u8 word_en) Efuse_CalculateWordCnts23a(u8 word_en)
{ {
u8 word_cnts = 0; return hweight8((~word_en) & 0xf);
if (!(word_en & BIT(0))) word_cnts++; /* 0 : write enable */
if (!(word_en & BIT(1))) word_cnts++;
if (!(word_en & BIT(2))) word_cnts++;
if (!(word_en & BIT(3))) word_cnts++;
return word_cnts;
} }
/* */ /* */
......
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