aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-4965.c
diff options
context:
space:
mode:
authorAndreas Herrmann <andreas.herrmann3@amd.com>2010-08-30 15:04:01 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-11-15 13:27:04 -0500
commit7919a57bc608140aa8614c19eac40c6916fb61d2 (patch)
tree0813ff8983a937eae8636808167bc59aa0e80c34 /drivers/net/wireless/iwlwifi/iwl-4965.c
parente4b3fdb80021bc0a3239bfc2a873a6d7c6ac52a1 (diff)
bitops: Provide generic sign_extend32 function
This patch moves code out from wireless drivers where two different functions are defined in three code locations for the same purpose and provides a common function to sign extend a 32-bit value. Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-4965.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965.c20
1 files changed, 2 insertions, 18 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index cd14843878ae..4748d067eb1d 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -1687,22 +1687,6 @@ static void iwl4965_txq_update_byte_cnt_tbl(struct iwl_priv *priv,
1687} 1687}
1688 1688
1689/** 1689/**
1690 * sign_extend - Sign extend a value using specified bit as sign-bit
1691 *
1692 * Example: sign_extend(9, 3) would return -7 as bit3 of 1001b is 1
1693 * and bit0..2 is 001b which when sign extended to 1111111111111001b is -7.
1694 *
1695 * @param oper value to sign extend
1696 * @param index 0 based bit index (0<=index<32) to sign bit
1697 */
1698static s32 sign_extend(u32 oper, int index)
1699{
1700 u8 shift = 31 - index;
1701
1702 return (s32)(oper << shift) >> shift;
1703}
1704
1705/**
1706 * iwl4965_hw_get_temperature - return the calibrated temperature (in Kelvin) 1690 * iwl4965_hw_get_temperature - return the calibrated temperature (in Kelvin)
1707 * @statistics: Provides the temperature reading from the uCode 1691 * @statistics: Provides the temperature reading from the uCode
1708 * 1692 *
@@ -1739,9 +1723,9 @@ static int iwl4965_hw_get_temperature(struct iwl_priv *priv)
1739 * "initialize" ALIVE response. 1723 * "initialize" ALIVE response.
1740 */ 1724 */
1741 if (!test_bit(STATUS_TEMPERATURE, &priv->status)) 1725 if (!test_bit(STATUS_TEMPERATURE, &priv->status))
1742 vt = sign_extend(R4, 23); 1726 vt = sign_extend32(R4, 23);
1743 else 1727 else
1744 vt = sign_extend(le32_to_cpu(priv->_agn.statistics. 1728 vt = sign_extend32(le32_to_cpu(priv->_agn.statistics.
1745 general.common.temperature), 23); 1729 general.common.temperature), 23);
1746 1730
1747 IWL_DEBUG_TEMP(priv, "Calib values R[1-3]: %d %d %d R4: %d\n", R1, R2, R3, vt); 1731 IWL_DEBUG_TEMP(priv, "Calib values R[1-3]: %d %d %d R4: %d\n", R1, R2, R3, vt);