From 4ecdc381d768eb978b782ccb66c959db7231f2d8 Mon Sep 17 00:00:00 2001 From: Tapasweni Pathak Date: Wed, 8 Oct 2014 10:15:42 +0530 Subject: [PATCH] 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: Tapasweni Pathak Reviewed-by: Josh Triplett Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723au/core/rtw_efuse.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/staging/rtl8723au/core/rtw_efuse.c b/drivers/staging/rtl8723au/core/rtw_efuse.c index 9f6ce7d071cd..799b9cf63263 100644 --- a/drivers/staging/rtl8723au/core/rtw_efuse.c +++ b/drivers/staging/rtl8723au/core/rtw_efuse.c @@ -117,12 +117,7 @@ Efuse_GetCurrentSize23a(struct rtw_adapter *pAdapter, u8 efuseType) u8 Efuse_CalculateWordCnts23a(u8 word_en) { - u8 word_cnts = 0; - 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; + return hweight8((~word_en) & 0xf); } /* */ -- 2.30.2