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 54cc0bba66b..fa8ce510478 100644 --- a/drivers/net/wireless/p54/eeprom.c +++ b/drivers/net/wireless/p54/eeprom.c @@ -24,6 +24,7 @@ #include <net/mac80211.h> #include <linux/crc-ccitt.h> +#include <linux/export.h> #include "p54.h" #include "eeprom.h" @@ -145,6 +146,7 @@ static int p54_fill_band_bitrates(struct ieee80211_hw *dev, static int p54_generate_band(struct ieee80211_hw *dev, struct p54_channel_list *list, + unsigned int *chan_num, enum ieee80211_band band) { struct p54_common *priv = dev->priv; @@ -190,7 +192,14 @@ static int p54_generate_band(struct ieee80211_hw *dev, tmp->channels[j].band = chan->band; tmp->channels[j].center_freq = chan->freq; + priv->survey[*chan_num].channel = &tmp->channels[j]; + priv->survey[*chan_num].filled = SURVEY_INFO_NOISE_DBM | + SURVEY_INFO_CHANNEL_TIME | + SURVEY_INFO_CHANNEL_TIME_BUSY | + SURVEY_INFO_CHANNEL_TIME_TX; + tmp->channels[j].hw_value = (*chan_num); j++; + (*chan_num)++; } if (j == 0) { @@ -263,7 +272,7 @@ static int p54_generate_channel_lists(struct ieee80211_hw *dev) { struct p54_common *priv = dev->priv; struct p54_channel_list *list; - unsigned int i, j, max_channel_num; + unsigned int i, j, k, max_channel_num; int ret = 0; u16 freq; @@ -283,6 +292,13 @@ static int p54_generate_channel_lists(struct ieee80211_hw *dev) ret = -ENOMEM; goto free; } + priv->chan_num = max_channel_num; + priv->survey = kzalloc(sizeof(struct survey_info) * max_channel_num, + GFP_KERNEL); + if (!priv->survey) { + ret = -ENOMEM; + goto free; + } list->max_entries = max_channel_num; list->channels = kzalloc(sizeof(struct p54_channel_entry) * @@ -321,8 +337,9 @@ static int p54_generate_channel_lists(struct ieee80211_hw *dev) sort(list->channels, list->entries, sizeof(struct p54_channel_entry), p54_compare_channels, NULL); + k = 0; for (i = 0, j = 0; i < IEEE80211_NUM_BANDS; i++) { - if (p54_generate_band(dev, list, i) == 0) + if (p54_generate_band(dev, list, &k, i) == 0) j++; } if (j == 0) { @@ -335,6 +352,10 @@ free: kfree(list->channels); kfree(list); } + if (ret) { + kfree(priv->survey); + priv->survey = NULL; + } return ret; } @@ -853,10 +874,12 @@ err: kfree(priv->output_limit); kfree(priv->curve_data); kfree(priv->rssi_db); + kfree(priv->survey); priv->iq_autocal = NULL; priv->output_limit = NULL; priv->curve_data = NULL; priv->rssi_db = NULL; + priv->survey = NULL; wiphy_err(dev->wiphy, "eeprom parse failed!\n"); return err; |