Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging: rtl8192u: Remove unnecessary function

This patch solves two problems.
The function rtl8192_CalculateBitShift() had an unnecessary variable i
that could be removed by using a single line of code.

After this change, rtl8192_CalculateBitShift() becomes a wrapper
function, so the rtl8192_CalculateBitShift() function has been removed
completely to replace it with a single line of code.

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Amitoj Kaur Chawla and committed by
Greg Kroah-Hartman
d2071984 c14291d2

+5 -20
+5 -20
drivers/staging/rtl8192u/r819xU_phy.c
··· 38 38 #define rtl819XAGCTAB_Array Rtl8192UsbAGCTAB_Array 39 39 40 40 /****************************************************************************** 41 - * function: This function reads BB parameters from header file we generate, 42 - * and does register read/write 43 - * input: u32 bitmask //taget bit pos in the addr to be modified 44 - * output: none 45 - * return: u32 return the shift bit position of the mask 46 - ******************************************************************************/ 47 - static u32 rtl8192_CalculateBitShift(u32 bitmask) 48 - { 49 - u32 i; 50 - 51 - i = ffs(bitmask) - 1; 52 - return i; 53 - } 54 - 55 - /****************************************************************************** 56 41 * function: This function checks different RF type to execute legal judgement. 57 42 * If RF Path is illegal, we will return false. 58 43 * input: net_device *dev ··· 79 94 80 95 if (bitmask != bMaskDWord) { 81 96 read_nic_dword(dev, reg_addr, &reg); 82 - bitshift = rtl8192_CalculateBitShift(bitmask); 97 + bitshift = ffs(bitmask) - 1; 83 98 reg &= ~bitmask; 84 99 reg |= data << bitshift; 85 100 write_nic_dword(dev, reg_addr, reg); ··· 102 117 u32 reg, bitshift; 103 118 104 119 read_nic_dword(dev, reg_addr, &reg); 105 - bitshift = rtl8192_CalculateBitShift(bitmask); 120 + bitshift = ffs(bitmask) - 1; 106 121 107 122 return (reg & bitmask) >> bitshift; 108 123 } ··· 291 306 if (bitmask != bMask12Bits) { 292 307 /* RF data is 12 bits only */ 293 308 reg = phy_FwRFSerialRead(dev, eRFPath, reg_addr); 294 - bitshift = rtl8192_CalculateBitShift(bitmask); 309 + bitshift = ffs(bitmask) - 1; 295 310 reg &= ~bitmask; 296 311 reg |= data << bitshift; 297 312 ··· 306 321 if (bitmask != bMask12Bits) { 307 322 /* RF data is 12 bits only */ 308 323 reg = rtl8192_phy_RFSerialRead(dev, eRFPath, reg_addr); 309 - bitshift = rtl8192_CalculateBitShift(bitmask); 324 + bitshift = ffs(bitmask) - 1; 310 325 reg &= ~bitmask; 311 326 reg |= data << bitshift; 312 327 ··· 341 356 } else { 342 357 reg = rtl8192_phy_RFSerialRead(dev, eRFPath, reg_addr); 343 358 } 344 - bitshift = rtl8192_CalculateBitShift(bitmask); 359 + bitshift = ffs(bitmask) - 1; 345 360 reg = (reg & bitmask) >> bitshift; 346 361 return reg; 347 362