diff options
Diffstat (limited to 'drivers/net/wireless/p54/eeprom.c')
| -rw-r--r-- | drivers/net/wireless/p54/eeprom.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/drivers/net/wireless/p54/eeprom.c b/drivers/net/wireless/p54/eeprom.c index 54cc0bba66b9..fa8ce5104781 100644 --- a/drivers/net/wireless/p54/eeprom.c +++ b/drivers/net/wireless/p54/eeprom.c | |||
| @@ -24,6 +24,7 @@ | |||
| 24 | 24 | ||
| 25 | #include <net/mac80211.h> | 25 | #include <net/mac80211.h> |
| 26 | #include <linux/crc-ccitt.h> | 26 | #include <linux/crc-ccitt.h> |
| 27 | #include <linux/export.h> | ||
| 27 | 28 | ||
| 28 | #include "p54.h" | 29 | #include "p54.h" |
| 29 | #include "eeprom.h" | 30 | #include "eeprom.h" |
| @@ -145,6 +146,7 @@ static int p54_fill_band_bitrates(struct ieee80211_hw *dev, | |||
| 145 | 146 | ||
| 146 | static int p54_generate_band(struct ieee80211_hw *dev, | 147 | static int p54_generate_band(struct ieee80211_hw *dev, |
| 147 | struct p54_channel_list *list, | 148 | struct p54_channel_list *list, |
| 149 | unsigned int *chan_num, | ||
| 148 | enum ieee80211_band band) | 150 | enum ieee80211_band band) |
| 149 | { | 151 | { |
| 150 | struct p54_common *priv = dev->priv; | 152 | struct p54_common *priv = dev->priv; |
| @@ -190,7 +192,14 @@ static int p54_generate_band(struct ieee80211_hw *dev, | |||
| 190 | 192 | ||
| 191 | tmp->channels[j].band = chan->band; | 193 | tmp->channels[j].band = chan->band; |
| 192 | tmp->channels[j].center_freq = chan->freq; | 194 | tmp->channels[j].center_freq = chan->freq; |
| 195 | priv->survey[*chan_num].channel = &tmp->channels[j]; | ||
| 196 | priv->survey[*chan_num].filled = SURVEY_INFO_NOISE_DBM | | ||
| 197 | SURVEY_INFO_CHANNEL_TIME | | ||
| 198 | SURVEY_INFO_CHANNEL_TIME_BUSY | | ||
| 199 | SURVEY_INFO_CHANNEL_TIME_TX; | ||
| 200 | tmp->channels[j].hw_value = (*chan_num); | ||
| 193 | j++; | 201 | j++; |
| 202 | (*chan_num)++; | ||
| 194 | } | 203 | } |
| 195 | 204 | ||
| 196 | if (j == 0) { | 205 | if (j == 0) { |
| @@ -263,7 +272,7 @@ static int p54_generate_channel_lists(struct ieee80211_hw *dev) | |||
| 263 | { | 272 | { |
| 264 | struct p54_common *priv = dev->priv; | 273 | struct p54_common *priv = dev->priv; |
| 265 | struct p54_channel_list *list; | 274 | struct p54_channel_list *list; |
| 266 | unsigned int i, j, max_channel_num; | 275 | unsigned int i, j, k, max_channel_num; |
| 267 | int ret = 0; | 276 | int ret = 0; |
| 268 | u16 freq; | 277 | u16 freq; |
| 269 | 278 | ||
| @@ -283,6 +292,13 @@ static int p54_generate_channel_lists(struct ieee80211_hw *dev) | |||
| 283 | ret = -ENOMEM; | 292 | ret = -ENOMEM; |
| 284 | goto free; | 293 | goto free; |
| 285 | } | 294 | } |
| 295 | priv->chan_num = max_channel_num; | ||
| 296 | priv->survey = kzalloc(sizeof(struct survey_info) * max_channel_num, | ||
| 297 | GFP_KERNEL); | ||
| 298 | if (!priv->survey) { | ||
| 299 | ret = -ENOMEM; | ||
| 300 | goto free; | ||
| 301 | } | ||
| 286 | 302 | ||
| 287 | list->max_entries = max_channel_num; | 303 | list->max_entries = max_channel_num; |
| 288 | list->channels = kzalloc(sizeof(struct p54_channel_entry) * | 304 | list->channels = kzalloc(sizeof(struct p54_channel_entry) * |
| @@ -321,8 +337,9 @@ static int p54_generate_channel_lists(struct ieee80211_hw *dev) | |||
| 321 | sort(list->channels, list->entries, sizeof(struct p54_channel_entry), | 337 | sort(list->channels, list->entries, sizeof(struct p54_channel_entry), |
| 322 | p54_compare_channels, NULL); | 338 | p54_compare_channels, NULL); |
| 323 | 339 | ||
| 340 | k = 0; | ||
| 324 | for (i = 0, j = 0; i < IEEE80211_NUM_BANDS; i++) { | 341 | for (i = 0, j = 0; i < IEEE80211_NUM_BANDS; i++) { |
| 325 | if (p54_generate_band(dev, list, i) == 0) | 342 | if (p54_generate_band(dev, list, &k, i) == 0) |
| 326 | j++; | 343 | j++; |
| 327 | } | 344 | } |
| 328 | if (j == 0) { | 345 | if (j == 0) { |
| @@ -335,6 +352,10 @@ free: | |||
| 335 | kfree(list->channels); | 352 | kfree(list->channels); |
| 336 | kfree(list); | 353 | kfree(list); |
| 337 | } | 354 | } |
| 355 | if (ret) { | ||
| 356 | kfree(priv->survey); | ||
| 357 | priv->survey = NULL; | ||
| 358 | } | ||
| 338 | 359 | ||
| 339 | return ret; | 360 | return ret; |
| 340 | } | 361 | } |
| @@ -853,10 +874,12 @@ err: | |||
| 853 | kfree(priv->output_limit); | 874 | kfree(priv->output_limit); |
| 854 | kfree(priv->curve_data); | 875 | kfree(priv->curve_data); |
| 855 | kfree(priv->rssi_db); | 876 | kfree(priv->rssi_db); |
| 877 | kfree(priv->survey); | ||
| 856 | priv->iq_autocal = NULL; | 878 | priv->iq_autocal = NULL; |
| 857 | priv->output_limit = NULL; | 879 | priv->output_limit = NULL; |
| 858 | priv->curve_data = NULL; | 880 | priv->curve_data = NULL; |
| 859 | priv->rssi_db = NULL; | 881 | priv->rssi_db = NULL; |
| 882 | priv->survey = NULL; | ||
| 860 | 883 | ||
| 861 | wiphy_err(dev->wiphy, "eeprom parse failed!\n"); | 884 | wiphy_err(dev->wiphy, "eeprom parse failed!\n"); |
| 862 | return err; | 885 | return err; |
