aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEliad Peller <eliad@wizery.com>2011-10-05 05:55:56 -0400
committerLuciano Coelho <coelho@ti.com>2011-10-07 01:32:47 -0400
commite936bbe0dc235458408c060deaa43f5b8b0bd705 (patch)
tree33225c713c0fa45941a9384575f44ff4c36fdb2e
parent98b8625301e55bd3e4340f704edc378e4707e577 (diff)
wl12xx: move some logic into wl12xx_init_vif_data
Initialize the vif data according to the vif type Signed-off-by: Eliad Peller <eliad@wizery.com> Signed-off-by: Luciano Coelho <coelho@ti.com>
-rw-r--r--drivers/net/wireless/wl12xx/main.c66
1 files changed, 40 insertions, 26 deletions
diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c
index 63871b46c0c1..effba53eb3f4 100644
--- a/drivers/net/wireless/wl12xx/main.c
+++ b/drivers/net/wireless/wl12xx/main.c
@@ -1854,20 +1854,52 @@ static u8 wl12xx_get_role_type(struct wl1271 *wl, struct wl12xx_vif *wlvif)
1854 return WL12XX_INVALID_ROLE_TYPE; 1854 return WL12XX_INVALID_ROLE_TYPE;
1855} 1855}
1856 1856
1857static void wl12xx_init_vif_data(struct wl12xx_vif *wlvif) 1857static int wl12xx_init_vif_data(struct ieee80211_vif *vif)
1858{ 1858{
1859 wlvif->bss_type = MAX_BSS_TYPE; 1859 struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif);
1860
1861 /* make sure wlvif is zeroed */
1862 memset(wlvif, 0, sizeof(*wlvif));
1863
1864 switch (ieee80211_vif_type_p2p(vif)) {
1865 case NL80211_IFTYPE_P2P_CLIENT:
1866 wlvif->p2p = 1;
1867 /* fall-through */
1868 case NL80211_IFTYPE_STATION:
1869 wlvif->bss_type = BSS_TYPE_STA_BSS;
1870 break;
1871 case NL80211_IFTYPE_ADHOC:
1872 wlvif->bss_type = BSS_TYPE_IBSS;
1873 break;
1874 case NL80211_IFTYPE_P2P_GO:
1875 wlvif->p2p = 1;
1876 /* fall-through */
1877 case NL80211_IFTYPE_AP:
1878 wlvif->bss_type = BSS_TYPE_AP_BSS;
1879 break;
1880 default:
1881 wlvif->bss_type = MAX_BSS_TYPE;
1882 return -EOPNOTSUPP;
1883 }
1884
1860 wlvif->role_id = WL12XX_INVALID_ROLE_ID; 1885 wlvif->role_id = WL12XX_INVALID_ROLE_ID;
1861 wlvif->dev_role_id = WL12XX_INVALID_ROLE_ID; 1886 wlvif->dev_role_id = WL12XX_INVALID_ROLE_ID;
1862 1887
1863 /* TODO: init union by type */ 1888 if (wlvif->bss_type == BSS_TYPE_STA_BSS ||
1864 wlvif->sta.hlid = WL12XX_INVALID_LINK_ID; 1889 wlvif->bss_type == BSS_TYPE_IBSS) {
1865 wlvif->ap.bcast_hlid = WL12XX_INVALID_LINK_ID; 1890 /* init sta/ibss data */
1866 wlvif->ap.global_hlid = WL12XX_INVALID_LINK_ID; 1891 wlvif->sta.hlid = WL12XX_INVALID_LINK_ID;
1892
1893 } else {
1894 /* init ap data */
1895 wlvif->ap.bcast_hlid = WL12XX_INVALID_LINK_ID;
1896 wlvif->ap.global_hlid = WL12XX_INVALID_LINK_ID;
1897 }
1867 1898
1868 wlvif->basic_rate_set = CONF_TX_RATE_MASK_BASIC; 1899 wlvif->basic_rate_set = CONF_TX_RATE_MASK_BASIC;
1869 wlvif->basic_rate = CONF_TX_RATE_MASK_BASIC; 1900 wlvif->basic_rate = CONF_TX_RATE_MASK_BASIC;
1870 wlvif->rate_set = CONF_TX_RATE_MASK_BASIC; 1901 wlvif->rate_set = CONF_TX_RATE_MASK_BASIC;
1902 return 0;
1871} 1903}
1872 1904
1873static int wl1271_op_add_interface(struct ieee80211_hw *hw, 1905static int wl1271_op_add_interface(struct ieee80211_hw *hw,
@@ -1891,7 +1923,6 @@ static int wl1271_op_add_interface(struct ieee80211_hw *hw,
1891 ret = -EBUSY; 1923 ret = -EBUSY;
1892 goto out; 1924 goto out;
1893 } 1925 }
1894 wl12xx_init_vif_data(wlvif);
1895 1926
1896 /* 1927 /*
1897 * in some very corner case HW recovery scenarios its possible to 1928 * in some very corner case HW recovery scenarios its possible to
@@ -1903,26 +1934,9 @@ static int wl1271_op_add_interface(struct ieee80211_hw *hw,
1903 goto out; 1934 goto out;
1904 } 1935 }
1905 1936
1906 switch (ieee80211_vif_type_p2p(vif)) { 1937 ret = wl12xx_init_vif_data(vif);
1907 case NL80211_IFTYPE_P2P_CLIENT: 1938 if (ret < 0)
1908 wlvif->p2p = 1;
1909 /* fall-through */
1910 case NL80211_IFTYPE_STATION:
1911 wlvif->bss_type = BSS_TYPE_STA_BSS;
1912 break;
1913 case NL80211_IFTYPE_ADHOC:
1914 wlvif->bss_type = BSS_TYPE_IBSS;
1915 break;
1916 case NL80211_IFTYPE_P2P_GO:
1917 wlvif->p2p = 1;
1918 /* fall-through */
1919 case NL80211_IFTYPE_AP:
1920 wlvif->bss_type = BSS_TYPE_AP_BSS;
1921 break;
1922 default:
1923 ret = -EOPNOTSUPP;
1924 goto out; 1939 goto out;
1925 }
1926 1940
1927 role_type = wl12xx_get_role_type(wl, wlvif); 1941 role_type = wl12xx_get_role_type(wl, wlvif);
1928 if (role_type == WL12XX_INVALID_ROLE_TYPE) { 1942 if (role_type == WL12XX_INVALID_ROLE_TYPE) {