diff options
author | Gertjan van Wingerde <gwingerde@gmail.com> | 2012-09-16 16:29:49 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-09-24 14:59:12 -0400 |
commit | 8c6728b08ee589ae3c7a75f0d1aa5d73a9c042f1 (patch) | |
tree | fe65942fa3b4bc83dd40646a18b1f22cb9402d50 /drivers | |
parent | 06236e53ce83d9f770a25a5305b8651544ff8b67 (diff) |
rt2x00: Code clean up in rt2800lib.
Make the code in rt2800_get_default_vgc more understandable and
readable, especially for the 5GHz band values.
Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800lib.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c index 9e09367c9739..cec4a992374e 100644 --- a/drivers/net/wireless/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/rt2x00/rt2800lib.c | |||
@@ -2896,6 +2896,8 @@ EXPORT_SYMBOL_GPL(rt2800_link_stats); | |||
2896 | 2896 | ||
2897 | static u8 rt2800_get_default_vgc(struct rt2x00_dev *rt2x00dev) | 2897 | static u8 rt2800_get_default_vgc(struct rt2x00_dev *rt2x00dev) |
2898 | { | 2898 | { |
2899 | u8 vgc; | ||
2900 | |||
2899 | if (rt2x00dev->curr_band == IEEE80211_BAND_2GHZ) { | 2901 | if (rt2x00dev->curr_band == IEEE80211_BAND_2GHZ) { |
2900 | if (rt2x00_rt(rt2x00dev, RT3070) || | 2902 | if (rt2x00_rt(rt2x00dev, RT3070) || |
2901 | rt2x00_rt(rt2x00dev, RT3071) || | 2903 | rt2x00_rt(rt2x00dev, RT3071) || |
@@ -2904,15 +2906,17 @@ static u8 rt2800_get_default_vgc(struct rt2x00_dev *rt2x00dev) | |||
2904 | rt2x00_rt(rt2x00dev, RT3390) || | 2906 | rt2x00_rt(rt2x00dev, RT3390) || |
2905 | rt2x00_rt(rt2x00dev, RT5390) || | 2907 | rt2x00_rt(rt2x00dev, RT5390) || |
2906 | rt2x00_rt(rt2x00dev, RT5392)) | 2908 | rt2x00_rt(rt2x00dev, RT5392)) |
2907 | return 0x1c + (2 * rt2x00dev->lna_gain); | 2909 | vgc = 0x1c + (2 * rt2x00dev->lna_gain); |
2910 | else | ||
2911 | vgc = 0x2e + rt2x00dev->lna_gain; | ||
2912 | } else { /* 5GHZ band */ | ||
2913 | if (!test_bit(CONFIG_CHANNEL_HT40, &rt2x00dev->flags)) | ||
2914 | vgc = 0x32 + (rt2x00dev->lna_gain * 5) / 3; | ||
2908 | else | 2915 | else |
2909 | return 0x2e + rt2x00dev->lna_gain; | 2916 | vgc = 0x3a + (rt2x00dev->lna_gain * 5) / 3; |
2910 | } | 2917 | } |
2911 | 2918 | ||
2912 | if (!test_bit(CONFIG_CHANNEL_HT40, &rt2x00dev->flags)) | 2919 | return vgc; |
2913 | return 0x32 + (rt2x00dev->lna_gain * 5) / 3; | ||
2914 | else | ||
2915 | return 0x3a + (rt2x00dev->lna_gain * 5) / 3; | ||
2916 | } | 2920 | } |
2917 | 2921 | ||
2918 | static inline void rt2800_set_vgc(struct rt2x00_dev *rt2x00dev, | 2922 | static inline void rt2800_set_vgc(struct rt2x00_dev *rt2x00dev, |