diff options
author | Andreas Herrmann <andreas.herrmann3@amd.com> | 2010-08-30 19:04:01 +0000 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-11-15 13:27:04 -0500 |
commit | 7919a57bc608140aa8614c19eac40c6916fb61d2 (patch) | |
tree | 0813ff8983a937eae8636808167bc59aa0e80c34 /drivers/net/wireless/ath/ath5k/phy.c | |
parent | e4b3fdb80021bc0a3239bfc2a873a6d7c6ac52a1 (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/ath/ath5k/phy.c')
-rw-r--r-- | drivers/net/wireless/ath/ath5k/phy.c | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/drivers/net/wireless/ath/ath5k/phy.c b/drivers/net/wireless/ath/ath5k/phy.c index 219367884e64..6b43f535ff53 100644 --- a/drivers/net/wireless/ath/ath5k/phy.c +++ b/drivers/net/wireless/ath/ath5k/phy.c @@ -1102,18 +1102,12 @@ int ath5k_hw_channel(struct ath5k_hw *ah, struct ieee80211_channel *channel) PHY calibration \*****************/ -static int sign_extend(int val, const int nbits) -{ - int order = BIT(nbits-1); - return (val ^ order) - order; -} - static s32 ath5k_hw_read_measured_noise_floor(struct ath5k_hw *ah) { s32 val; val = ath5k_hw_reg_read(ah, AR5K_PHY_NF); - return sign_extend(AR5K_REG_MS(val, AR5K_PHY_NF_MINCCA_PWR), 9); + return sign_extend32(AR5K_REG_MS(val, AR5K_PHY_NF_MINCCA_PWR), 8); } void ath5k_hw_init_nfcal_hist(struct ath5k_hw *ah) |