aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/at76c50x-usb.c
diff options
context:
space:
mode:
authorJason Andryuk <jandryuk@gmail.com>2009-02-18 15:40:57 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-02-27 14:52:44 -0500
commit19e8bc7fa7df2f208554d1d06b9af129cd7f452a (patch)
treeb92c8119e7a26be4713382c06ff745711ba1fdbe /drivers/net/wireless/at76c50x-usb.c
parent1264b951463a00efebe1bb596499aaad620ec8af (diff)
at76c50x-usb: update to latest mac80211 hw scan api
With the latest mac80211 stack, the driver needs to be updated for cfg80211 scanning. I based the changes off of modifications for at76_usb found here: http://johannes.sipsolutions.net/patches/old/all/2008-09-19-13:35/020-cfg80211-scan.patch The trick was that max_signal also needs to be set to avoid a divide by zero Oops. I just guessed and used the value 100 for now. kvalo: handpicked the change from two different patches Signed-off-by: Jason Andryuk <jandryuk@gmail.com> Signed-off-by: Kalle Valo <kalle.valo@iki.fi> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/at76c50x-usb.c')
-rw-r--r--drivers/net/wireless/at76c50x-usb.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/drivers/net/wireless/at76c50x-usb.c b/drivers/net/wireless/at76c50x-usb.c
index e8868aef02b9..df3efc568580 100644
--- a/drivers/net/wireless/at76c50x-usb.c
+++ b/drivers/net/wireless/at76c50x-usb.c
@@ -1861,7 +1861,7 @@ static void at76_dwork_hw_scan(struct work_struct *work)
1861 goto exit; 1861 goto exit;
1862 } 1862 }
1863 1863
1864 ieee80211_scan_completed(priv->hw); 1864 ieee80211_scan_completed(priv->hw, false);
1865 1865
1866 if (is_valid_ether_addr(priv->bssid)) 1866 if (is_valid_ether_addr(priv->bssid))
1867 at76_join(priv); 1867 at76_join(priv);
@@ -1872,14 +1872,15 @@ exit:
1872 mutex_unlock(&priv->mtx); 1872 mutex_unlock(&priv->mtx);
1873} 1873}
1874 1874
1875static int at76_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len) 1875static int at76_hw_scan(struct ieee80211_hw *hw,
1876 struct cfg80211_scan_request *req)
1876{ 1877{
1877 struct at76_priv *priv = hw->priv; 1878 struct at76_priv *priv = hw->priv;
1878 struct at76_req_scan scan; 1879 struct at76_req_scan scan;
1879 int ret; 1880 u8 *ssid = NULL;
1881 int ret, len = 0;
1880 1882
1881 at76_dbg(DBG_MAC80211, "%s():", __func__); 1883 at76_dbg(DBG_MAC80211, "%s():", __func__);
1882 at76_dbg_dump(DBG_MAC80211, ssid, len, "ssid %zd bytes:", len);
1883 1884
1884 mutex_lock(&priv->mtx); 1885 mutex_lock(&priv->mtx);
1885 1886
@@ -1887,11 +1888,20 @@ static int at76_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len)
1887 1888
1888 memset(&scan, 0, sizeof(struct at76_req_scan)); 1889 memset(&scan, 0, sizeof(struct at76_req_scan));
1889 memset(scan.bssid, 0xFF, ETH_ALEN); 1890 memset(scan.bssid, 0xFF, ETH_ALEN);
1890 scan.scan_type = SCAN_TYPE_ACTIVE; 1891
1891 if (priv->essid_size > 0) { 1892 if (req->n_ssids) {
1893 scan.scan_type = SCAN_TYPE_ACTIVE;
1894 ssid = req->ssids[0].ssid;
1895 len = req->ssids[0].ssid_len;
1896 } else {
1897 scan.scan_type = SCAN_TYPE_PASSIVE;
1898 }
1899
1900 if (len) {
1892 memcpy(scan.essid, ssid, len); 1901 memcpy(scan.essid, ssid, len);
1893 scan.essid_size = len; 1902 scan.essid_size = len;
1894 } 1903 }
1904
1895 scan.min_channel_time = cpu_to_le16(priv->scan_min_time); 1905 scan.min_channel_time = cpu_to_le16(priv->scan_min_time);
1896 scan.max_channel_time = cpu_to_le16(priv->scan_max_time); 1906 scan.max_channel_time = cpu_to_le16(priv->scan_max_time);
1897 scan.probe_delay = cpu_to_le16(priv->scan_min_time * 1000); 1907 scan.probe_delay = cpu_to_le16(priv->scan_min_time * 1000);
@@ -2217,10 +2227,12 @@ static int at76_init_new_device(struct at76_priv *priv,
2217 priv->scan_mode = SCAN_TYPE_ACTIVE; 2227 priv->scan_mode = SCAN_TYPE_ACTIVE;
2218 2228
2219 /* mac80211 initialisation */ 2229 /* mac80211 initialisation */
2230 priv->hw->wiphy->max_scan_ssids = 1;
2220 priv->hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION); 2231 priv->hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION);
2221 priv->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &at76_supported_band; 2232 priv->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &at76_supported_band;
2222 priv->hw->flags = IEEE80211_HW_RX_INCLUDES_FCS | 2233 priv->hw->flags = IEEE80211_HW_RX_INCLUDES_FCS |
2223 IEEE80211_HW_SIGNAL_UNSPEC; 2234 IEEE80211_HW_SIGNAL_UNSPEC;
2235 priv->hw->max_signal = 100;
2224 2236
2225 SET_IEEE80211_DEV(priv->hw, &interface->dev); 2237 SET_IEEE80211_DEV(priv->hw, &interface->dev);
2226 SET_IEEE80211_PERM_ADDR(priv->hw, priv->mac_addr); 2238 SET_IEEE80211_PERM_ADDR(priv->hw, priv->mac_addr);