diff options
author | Amitoj Kaur Chawla <amitoj1606@gmail.com> | 2015-10-31 20:25:29 +0530 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-11-15 20:02:47 -0800 |
commit | d2071984b917784f74ab32c4f054e3503bc730e5 (patch) | |
tree | 53a9b838a31a16fb4ff17acdf320d0966360c710 /drivers/staging/rtl8192u | |
parent | c14291d2c3041237c2e26939d26fb67bb689bcc2 (diff) |
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>
Diffstat (limited to 'drivers/staging/rtl8192u')
-rw-r--r-- | drivers/staging/rtl8192u/r819xU_phy.c | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/drivers/staging/rtl8192u/r819xU_phy.c b/drivers/staging/rtl8192u/r819xU_phy.c index 70656441c145..f264d88364a1 100644 --- a/drivers/staging/rtl8192u/r819xU_phy.c +++ b/drivers/staging/rtl8192u/r819xU_phy.c @@ -38,21 +38,6 @@ static u32 RF_CHANNEL_TABLE_ZEBRA[] = { #define rtl819XAGCTAB_Array Rtl8192UsbAGCTAB_Array /****************************************************************************** - * function: This function reads BB parameters from header file we generate, - * and does register read/write - * input: u32 bitmask //taget bit pos in the addr to be modified - * output: none - * return: u32 return the shift bit position of the mask - ******************************************************************************/ -static u32 rtl8192_CalculateBitShift(u32 bitmask) -{ - u32 i; - - i = ffs(bitmask) - 1; - return i; -} - -/****************************************************************************** * function: This function checks different RF type to execute legal judgement. * If RF Path is illegal, we will return false. * input: net_device *dev @@ -94,7 +79,7 @@ void rtl8192_setBBreg(struct net_device *dev, u32 reg_addr, u32 bitmask, if (bitmask != bMaskDWord) { read_nic_dword(dev, reg_addr, ®); - bitshift = rtl8192_CalculateBitShift(bitmask); + bitshift = ffs(bitmask) - 1; reg &= ~bitmask; reg |= data << bitshift; write_nic_dword(dev, reg_addr, reg); @@ -117,7 +102,7 @@ u32 rtl8192_QueryBBReg(struct net_device *dev, u32 reg_addr, u32 bitmask) u32 reg, bitshift; read_nic_dword(dev, reg_addr, ®); - bitshift = rtl8192_CalculateBitShift(bitmask); + bitshift = ffs(bitmask) - 1; return (reg & bitmask) >> bitshift; } @@ -306,7 +291,7 @@ void rtl8192_phy_SetRFReg(struct net_device *dev, RF90_RADIO_PATH_E eRFPath, if (bitmask != bMask12Bits) { /* RF data is 12 bits only */ reg = phy_FwRFSerialRead(dev, eRFPath, reg_addr); - bitshift = rtl8192_CalculateBitShift(bitmask); + bitshift = ffs(bitmask) - 1; reg &= ~bitmask; reg |= data << bitshift; @@ -321,7 +306,7 @@ void rtl8192_phy_SetRFReg(struct net_device *dev, RF90_RADIO_PATH_E eRFPath, if (bitmask != bMask12Bits) { /* RF data is 12 bits only */ reg = rtl8192_phy_RFSerialRead(dev, eRFPath, reg_addr); - bitshift = rtl8192_CalculateBitShift(bitmask); + bitshift = ffs(bitmask) - 1; reg &= ~bitmask; reg |= data << bitshift; @@ -356,7 +341,7 @@ u32 rtl8192_phy_QueryRFReg(struct net_device *dev, RF90_RADIO_PATH_E eRFPath, } else { reg = rtl8192_phy_RFSerialRead(dev, eRFPath, reg_addr); } - bitshift = rtl8192_CalculateBitShift(bitmask); + bitshift = ffs(bitmask) - 1; reg = (reg & bitmask) >> bitshift; return reg; |