diff options
author | Lars Ericsson <Lars_Ericsson@telia.com> | 2009-07-18 14:21:52 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-07-27 15:24:08 -0400 |
commit | eb87eaac52e916e28bcf3bd5974f3b581f6c0ae9 (patch) | |
tree | 3da38b5c765f3fda6833f9611da0648ca854685e /drivers | |
parent | a272a720660059c30fa038113b77fa2a096437d9 (diff) |
rt2x00: Don't alter rt2x00dev->default_ant
rt2x00dev->default_ant should be initialized once by the driver,
and should not be changed afterwards. Because rt2x00lib_config_antenna()
was using a reference to the struct antenna_setup it actually had the oppurtunity
to change the default antenna setting and it actually did that during the validation.
Instead of passing a pointer to antenna_setup the entire structure should be copied.
Signed-off-by: Lars Ericsson <Lars_Ericsson@telia.com>
Signed-off-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/rt2x00config.c | 12 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00lib.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00link.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00mac.c | 2 |
4 files changed, 10 insertions, 10 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00config.c b/drivers/net/wireless/rt2x00/rt2x00config.c index c6e0bcf78e9e..3845316ccd39 100644 --- a/drivers/net/wireless/rt2x00/rt2x00config.c +++ b/drivers/net/wireless/rt2x00/rt2x00config.c | |||
@@ -124,7 +124,7 @@ enum antenna rt2x00lib_config_antenna_check(enum antenna current_ant, | |||
124 | } | 124 | } |
125 | 125 | ||
126 | void rt2x00lib_config_antenna(struct rt2x00_dev *rt2x00dev, | 126 | void rt2x00lib_config_antenna(struct rt2x00_dev *rt2x00dev, |
127 | struct antenna_setup *ant) | 127 | struct antenna_setup ant) |
128 | { | 128 | { |
129 | struct antenna_setup *def = &rt2x00dev->default_ant; | 129 | struct antenna_setup *def = &rt2x00dev->default_ant; |
130 | struct antenna_setup *active = &rt2x00dev->link.ant.active; | 130 | struct antenna_setup *active = &rt2x00dev->link.ant.active; |
@@ -138,10 +138,10 @@ void rt2x00lib_config_antenna(struct rt2x00_dev *rt2x00dev, | |||
138 | * might have caused that we restore back to the already | 138 | * might have caused that we restore back to the already |
139 | * active setting. If that has happened we can quit. | 139 | * active setting. If that has happened we can quit. |
140 | */ | 140 | */ |
141 | ant->rx = rt2x00lib_config_antenna_check(ant->rx, def->rx); | 141 | ant.rx = rt2x00lib_config_antenna_check(ant.rx, def->rx); |
142 | ant->tx = rt2x00lib_config_antenna_check(ant->tx, def->tx); | 142 | ant.tx = rt2x00lib_config_antenna_check(ant.tx, def->tx); |
143 | 143 | ||
144 | if (ant->rx == active->rx && ant->tx == active->tx) | 144 | if (ant.rx == active->rx && ant.tx == active->tx) |
145 | return; | 145 | return; |
146 | 146 | ||
147 | /* | 147 | /* |
@@ -156,11 +156,11 @@ void rt2x00lib_config_antenna(struct rt2x00_dev *rt2x00dev, | |||
156 | * The latter is required since we need to recalibrate the | 156 | * The latter is required since we need to recalibrate the |
157 | * noise-sensitivity ratio for the new setup. | 157 | * noise-sensitivity ratio for the new setup. |
158 | */ | 158 | */ |
159 | rt2x00dev->ops->lib->config_ant(rt2x00dev, ant); | 159 | rt2x00dev->ops->lib->config_ant(rt2x00dev, &ant); |
160 | 160 | ||
161 | rt2x00link_reset_tuner(rt2x00dev, true); | 161 | rt2x00link_reset_tuner(rt2x00dev, true); |
162 | 162 | ||
163 | memcpy(active, ant, sizeof(*ant)); | 163 | memcpy(active, &ant, sizeof(ant)); |
164 | 164 | ||
165 | if (test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) | 165 | if (test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) |
166 | rt2x00lib_toggle_rx(rt2x00dev, STATE_RADIO_RX_ON_LINK); | 166 | rt2x00lib_toggle_rx(rt2x00dev, STATE_RADIO_RX_ON_LINK); |
diff --git a/drivers/net/wireless/rt2x00/rt2x00lib.h b/drivers/net/wireless/rt2x00/rt2x00lib.h index 512fa2bc3a10..eeb2881e818e 100644 --- a/drivers/net/wireless/rt2x00/rt2x00lib.h +++ b/drivers/net/wireless/rt2x00/rt2x00lib.h | |||
@@ -88,7 +88,7 @@ void rt2x00lib_config_erp(struct rt2x00_dev *rt2x00dev, | |||
88 | struct rt2x00_intf *intf, | 88 | struct rt2x00_intf *intf, |
89 | struct ieee80211_bss_conf *conf); | 89 | struct ieee80211_bss_conf *conf); |
90 | void rt2x00lib_config_antenna(struct rt2x00_dev *rt2x00dev, | 90 | void rt2x00lib_config_antenna(struct rt2x00_dev *rt2x00dev, |
91 | struct antenna_setup *ant); | 91 | struct antenna_setup ant); |
92 | void rt2x00lib_config(struct rt2x00_dev *rt2x00dev, | 92 | void rt2x00lib_config(struct rt2x00_dev *rt2x00dev, |
93 | struct ieee80211_conf *conf, | 93 | struct ieee80211_conf *conf, |
94 | const unsigned int changed_flags); | 94 | const unsigned int changed_flags); |
diff --git a/drivers/net/wireless/rt2x00/rt2x00link.c b/drivers/net/wireless/rt2x00/rt2x00link.c index 32570758e67c..79915687e744 100644 --- a/drivers/net/wireless/rt2x00/rt2x00link.c +++ b/drivers/net/wireless/rt2x00/rt2x00link.c | |||
@@ -173,7 +173,7 @@ static void rt2x00lib_antenna_diversity_sample(struct rt2x00_dev *rt2x00dev) | |||
173 | if (ant->flags & ANTENNA_TX_DIVERSITY) | 173 | if (ant->flags & ANTENNA_TX_DIVERSITY) |
174 | new_ant.tx = (sample_a > sample_b) ? ANTENNA_A : ANTENNA_B; | 174 | new_ant.tx = (sample_a > sample_b) ? ANTENNA_A : ANTENNA_B; |
175 | 175 | ||
176 | rt2x00lib_config_antenna(rt2x00dev, &new_ant); | 176 | rt2x00lib_config_antenna(rt2x00dev, new_ant); |
177 | } | 177 | } |
178 | 178 | ||
179 | static void rt2x00lib_antenna_diversity_eval(struct rt2x00_dev *rt2x00dev) | 179 | static void rt2x00lib_antenna_diversity_eval(struct rt2x00_dev *rt2x00dev) |
@@ -213,7 +213,7 @@ static void rt2x00lib_antenna_diversity_eval(struct rt2x00_dev *rt2x00dev) | |||
213 | if (ant->flags & ANTENNA_TX_DIVERSITY) | 213 | if (ant->flags & ANTENNA_TX_DIVERSITY) |
214 | new_ant.tx = (new_ant.tx == ANTENNA_A) ? ANTENNA_B : ANTENNA_A; | 214 | new_ant.tx = (new_ant.tx == ANTENNA_A) ? ANTENNA_B : ANTENNA_A; |
215 | 215 | ||
216 | rt2x00lib_config_antenna(rt2x00dev, &new_ant); | 216 | rt2x00lib_config_antenna(rt2x00dev, new_ant); |
217 | } | 217 | } |
218 | 218 | ||
219 | static void rt2x00lib_antenna_diversity(struct rt2x00_dev *rt2x00dev) | 219 | static void rt2x00lib_antenna_diversity(struct rt2x00_dev *rt2x00dev) |
diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c index 9d31c23b92fa..7de1a2cdcf8c 100644 --- a/drivers/net/wireless/rt2x00/rt2x00mac.c +++ b/drivers/net/wireless/rt2x00/rt2x00mac.c | |||
@@ -378,7 +378,7 @@ int rt2x00mac_config(struct ieee80211_hw *hw, u32 changed) | |||
378 | */ | 378 | */ |
379 | if (changed & IEEE80211_CONF_CHANGE_RADIO_ENABLED) | 379 | if (changed & IEEE80211_CONF_CHANGE_RADIO_ENABLED) |
380 | rt2x00lib_config_antenna(rt2x00dev, | 380 | rt2x00lib_config_antenna(rt2x00dev, |
381 | &rt2x00dev->default_ant); | 381 | rt2x00dev->default_ant); |
382 | 382 | ||
383 | /* Turn RX back on */ | 383 | /* Turn RX back on */ |
384 | rt2x00lib_toggle_rx(rt2x00dev, STATE_RADIO_RX_ON); | 384 | rt2x00lib_toggle_rx(rt2x00dev, STATE_RADIO_RX_ON); |