cfg80211: combine IWAP handlers
authorJohannes Berg <johannes@sipsolutions.net>
Mon, 27 Jul 2009 10:01:51 +0000 (12:01 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 29 Jul 2009 19:46:16 +0000 (15:46 -0400)
Since we now have IWAP handlers for all modes, we can
combine them into one.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/iwmc3200wifi/wext.c
include/net/cfg80211.h
net/mac80211/wext.c
net/wireless/ibss.c
net/wireless/wext-compat.c
net/wireless/wext-compat.h
net/wireless/wext-sme.c

index 8058e9991c30d3d5e7138081caf0ad2a1fc61d0c..5319b16474e3be6c7391209009be2f7e688a8e05 100644 (file)
 #include "iwm.h"
 #include "commands.h"
 
-static int iwm_wext_siwap(struct net_device *dev, struct iw_request_info *info,
-                         struct sockaddr *ap_addr, char *extra)
-{
-       struct iwm_priv *iwm = ndev_to_iwm(dev);
-
-       switch (iwm->conf.mode) {
-       case UMAC_MODE_IBSS:
-               return cfg80211_ibss_wext_siwap(dev, info, ap_addr, extra);
-       case UMAC_MODE_BSS:
-               return cfg80211_mgd_wext_siwap(dev, info, ap_addr, extra);
-       default:
-               return -EOPNOTSUPP;
-       }
-}
-
-static int iwm_wext_giwap(struct net_device *dev, struct iw_request_info *info,
-                         struct sockaddr *ap_addr, char *extra)
-{
-       struct iwm_priv *iwm = ndev_to_iwm(dev);
-
-       switch (iwm->conf.mode) {
-       case UMAC_MODE_IBSS:
-               return cfg80211_ibss_wext_giwap(dev, info, ap_addr, extra);
-       case UMAC_MODE_BSS:
-               return cfg80211_mgd_wext_giwap(dev, info, ap_addr, extra);
-       default:
-               return -EOPNOTSUPP;
-       }
-}
-
 static int iwm_wext_siwessid(struct net_device *dev,
                             struct iw_request_info *info,
                             struct iw_point *data, char *ssid)
@@ -111,8 +81,8 @@ static const iw_handler iwm_handlers[] =
        (iw_handler) NULL,                              /* SIOCGIWSPY */
        (iw_handler) NULL,                              /* SIOCSIWTHRSPY */
        (iw_handler) NULL,                              /* SIOCGIWTHRSPY */
-       (iw_handler) iwm_wext_siwap,                    /* SIOCSIWAP */
-       (iw_handler) iwm_wext_giwap,                    /* SIOCGIWAP */
+       (iw_handler) cfg80211_wext_siwap,               /* SIOCSIWAP */
+       (iw_handler) cfg80211_wext_giwap,               /* SIOCGIWAP */
        (iw_handler) NULL,                              /* SIOCSIWMLME */
        (iw_handler) NULL,                              /* SIOCGIWAPLIST */
        (iw_handler) cfg80211_wext_siwscan,             /* SIOCSIWSCAN */
index 5d249c4bf225c8e3923229a766ec4fcfb7d849ef..3348c16e1f357daefdd27c1cf21958b7ee330a33 100644 (file)
@@ -1601,12 +1601,6 @@ int cfg80211_ibss_wext_siwessid(struct net_device *dev,
 int cfg80211_ibss_wext_giwessid(struct net_device *dev,
                                struct iw_request_info *info,
                                struct iw_point *data, char *ssid);
-int cfg80211_ibss_wext_siwap(struct net_device *dev,
-                            struct iw_request_info *info,
-                            struct sockaddr *ap_addr, char *extra);
-int cfg80211_ibss_wext_giwap(struct net_device *dev,
-                            struct iw_request_info *info,
-                            struct sockaddr *ap_addr, char *extra);
 
 int cfg80211_mgd_wext_siwessid(struct net_device *dev,
                               struct iw_request_info *info,
@@ -1614,12 +1608,6 @@ int cfg80211_mgd_wext_siwessid(struct net_device *dev,
 int cfg80211_mgd_wext_giwessid(struct net_device *dev,
                               struct iw_request_info *info,
                               struct iw_point *data, char *ssid);
-int cfg80211_mgd_wext_siwap(struct net_device *dev,
-                           struct iw_request_info *info,
-                           struct sockaddr *ap_addr, char *extra);
-int cfg80211_mgd_wext_giwap(struct net_device *dev,
-                           struct iw_request_info *info,
-                           struct sockaddr *ap_addr, char *extra);
 int cfg80211_wext_siwgenie(struct net_device *dev,
                           struct iw_request_info *info,
                           struct iw_point *data, char *extra);
@@ -1686,12 +1674,12 @@ int cfg80211_wext_giwpower(struct net_device *dev,
                           struct iw_request_info *info,
                           struct iw_param *wrq, char *extra);
 
-int cfg80211_wds_wext_siwap(struct net_device *dev,
-                           struct iw_request_info *info,
-                           struct sockaddr *addr, char *extra);
-int cfg80211_wds_wext_giwap(struct net_device *dev,
-                           struct iw_request_info *info,
-                           struct sockaddr *addr, char *extra);
+int cfg80211_wext_siwap(struct net_device *dev,
+                       struct iw_request_info *info,
+                       struct sockaddr *ap_addr, char *extra);
+int cfg80211_wext_giwap(struct net_device *dev,
+                       struct iw_request_info *info,
+                       struct sockaddr *ap_addr, char *extra);
 
 /*
  * callbacks for asynchronous cfg80211 methods, notification
index 7cd9aa79ef528746af720ad6e439e7cffdd550aa..72866c8b8c3d0eb08444e6f6986f8493f3adb850 100644 (file)
@@ -59,43 +59,6 @@ static int ieee80211_ioctl_giwessid(struct net_device *dev,
 }
 
 
-static int ieee80211_ioctl_siwap(struct net_device *dev,
-                                struct iw_request_info *info,
-                                struct sockaddr *ap_addr, char *extra)
-{
-       struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
-
-       if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
-               return cfg80211_ibss_wext_siwap(dev, info, ap_addr, extra);
-
-       if (sdata->vif.type == NL80211_IFTYPE_STATION)
-               return cfg80211_mgd_wext_siwap(dev, info, ap_addr, extra);
-
-       if (sdata->vif.type == NL80211_IFTYPE_WDS)
-               return cfg80211_wds_wext_siwap(dev, info, ap_addr, extra);
-       return -EOPNOTSUPP;
-}
-
-
-static int ieee80211_ioctl_giwap(struct net_device *dev,
-                                struct iw_request_info *info,
-                                struct sockaddr *ap_addr, char *extra)
-{
-       struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
-
-       if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
-               return cfg80211_ibss_wext_giwap(dev, info, ap_addr, extra);
-
-       if (sdata->vif.type == NL80211_IFTYPE_STATION)
-               return cfg80211_mgd_wext_giwap(dev, info, ap_addr, extra);
-
-       if (sdata->vif.type == NL80211_IFTYPE_WDS)
-               return cfg80211_wds_wext_giwap(dev, info, ap_addr, extra);
-
-       return -EOPNOTSUPP;
-}
-
-
 /* Structures to export the Wireless Handlers */
 
 static const iw_handler ieee80211_handler[] =
@@ -120,8 +83,8 @@ static const iw_handler ieee80211_handler[] =
        (iw_handler) NULL,                              /* SIOCGIWSPY */
        (iw_handler) NULL,                              /* SIOCSIWTHRSPY */
        (iw_handler) NULL,                              /* SIOCGIWTHRSPY */
-       (iw_handler) ieee80211_ioctl_siwap,             /* SIOCSIWAP */
-       (iw_handler) ieee80211_ioctl_giwap,             /* SIOCGIWAP */
+       (iw_handler) cfg80211_wext_siwap,               /* SIOCSIWAP */
+       (iw_handler) cfg80211_wext_giwap,               /* SIOCGIWAP */
        (iw_handler) cfg80211_wext_siwmlme,             /* SIOCSIWMLME */
        (iw_handler) NULL,                              /* SIOCGIWAPLIST */
        (iw_handler) cfg80211_wext_siwscan,             /* SIOCSIWSCAN */
index de9ac49cd907c985862676e032becdc10a790e0b..f955225ed91159628bf395367420a6b7ea21ed9b 100644 (file)
@@ -466,8 +466,6 @@ int cfg80211_ibss_wext_siwap(struct net_device *dev,
 
        return err;
 }
-/* temporary symbol - mark GPL - in the future the handler won't be */
-EXPORT_SYMBOL_GPL(cfg80211_ibss_wext_siwap);
 
 int cfg80211_ibss_wext_giwap(struct net_device *dev,
                             struct iw_request_info *info,
@@ -493,6 +491,4 @@ int cfg80211_ibss_wext_giwap(struct net_device *dev,
 
        return 0;
 }
-/* temporary symbol - mark GPL - in the future the handler won't be */
-EXPORT_SYMBOL_GPL(cfg80211_ibss_wext_giwap);
 #endif
index fc2e7768967d70eab8ad375caae689c8e199c928..c27774bd010765060c4a78bfd171c94273a5e6c0 100644 (file)
@@ -1149,9 +1149,9 @@ int cfg80211_wext_giwpower(struct net_device *dev,
 }
 EXPORT_SYMBOL_GPL(cfg80211_wext_giwpower);
 
-int cfg80211_wds_wext_siwap(struct net_device *dev,
-                           struct iw_request_info *info,
-                           struct sockaddr *addr, char *extra)
+static int cfg80211_wds_wext_siwap(struct net_device *dev,
+                                  struct iw_request_info *info,
+                                  struct sockaddr *addr, char *extra)
 {
        struct wireless_dev *wdev = dev->ieee80211_ptr;
        struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy);
@@ -1177,11 +1177,10 @@ int cfg80211_wds_wext_siwap(struct net_device *dev,
 
        return 0;
 }
-EXPORT_SYMBOL_GPL(cfg80211_wds_wext_siwap);
 
-int cfg80211_wds_wext_giwap(struct net_device *dev,
-                           struct iw_request_info *info,
-                           struct sockaddr *addr, char *extra)
+static int cfg80211_wds_wext_giwap(struct net_device *dev,
+                                  struct iw_request_info *info,
+                                  struct sockaddr *addr, char *extra)
 {
        struct wireless_dev *wdev = dev->ieee80211_ptr;
 
@@ -1193,7 +1192,6 @@ int cfg80211_wds_wext_giwap(struct net_device *dev,
 
        return 0;
 }
-EXPORT_SYMBOL_GPL(cfg80211_wds_wext_giwap);
 
 int cfg80211_wext_siwrate(struct net_device *dev,
                          struct iw_request_info *info,
@@ -1327,3 +1325,41 @@ struct iw_statistics *cfg80211_wireless_stats(struct net_device *dev)
        return &wstats;
 }
 EXPORT_SYMBOL_GPL(cfg80211_wireless_stats);
+
+int cfg80211_wext_siwap(struct net_device *dev,
+                       struct iw_request_info *info,
+                       struct sockaddr *ap_addr, char *extra)
+{
+       struct wireless_dev *wdev = dev->ieee80211_ptr;
+
+       switch (wdev->iftype) {
+       case NL80211_IFTYPE_ADHOC:
+               return cfg80211_ibss_wext_siwap(dev, info, ap_addr, extra);
+       case NL80211_IFTYPE_STATION:
+               return cfg80211_mgd_wext_siwap(dev, info, ap_addr, extra);
+       case NL80211_IFTYPE_WDS:
+               return cfg80211_wds_wext_siwap(dev, info, ap_addr, extra);
+       default:
+               return -EOPNOTSUPP;
+       }
+}
+EXPORT_SYMBOL_GPL(cfg80211_wext_siwap);
+
+int cfg80211_wext_giwap(struct net_device *dev,
+                       struct iw_request_info *info,
+                       struct sockaddr *ap_addr, char *extra)
+{
+       struct wireless_dev *wdev = dev->ieee80211_ptr;
+
+       switch (wdev->iftype) {
+       case NL80211_IFTYPE_ADHOC:
+               return cfg80211_ibss_wext_giwap(dev, info, ap_addr, extra);
+       case NL80211_IFTYPE_STATION:
+               return cfg80211_mgd_wext_giwap(dev, info, ap_addr, extra);
+       case NL80211_IFTYPE_WDS:
+               return cfg80211_wds_wext_giwap(dev, info, ap_addr, extra);
+       default:
+               return -EOPNOTSUPP;
+       }
+}
+EXPORT_SYMBOL_GPL(cfg80211_wext_giwap);
index 23a6b5a83f2ddbc914e411629401afb7b27893fc..51028ebf19ae1a8f133b567be42337f172113789 100644 (file)
@@ -7,6 +7,12 @@ int cfg80211_ibss_wext_siwfreq(struct net_device *dev,
 int cfg80211_ibss_wext_giwfreq(struct net_device *dev,
                               struct iw_request_info *info,
                               struct iw_freq *freq, char *extra);
+int cfg80211_ibss_wext_siwap(struct net_device *dev,
+                            struct iw_request_info *info,
+                            struct sockaddr *ap_addr, char *extra);
+int cfg80211_ibss_wext_giwap(struct net_device *dev,
+                            struct iw_request_info *info,
+                            struct sockaddr *ap_addr, char *extra);
 
 int cfg80211_mgd_wext_siwfreq(struct net_device *dev,
                              struct iw_request_info *info,
@@ -14,6 +20,12 @@ int cfg80211_mgd_wext_siwfreq(struct net_device *dev,
 int cfg80211_mgd_wext_giwfreq(struct net_device *dev,
                              struct iw_request_info *info,
                              struct iw_freq *freq, char *extra);
+int cfg80211_mgd_wext_siwap(struct net_device *dev,
+                           struct iw_request_info *info,
+                           struct sockaddr *ap_addr, char *extra);
+int cfg80211_mgd_wext_giwap(struct net_device *dev,
+                           struct iw_request_info *info,
+                           struct sockaddr *ap_addr, char *extra);
 
 struct ieee80211_channel *cfg80211_wext_freq(struct wiphy *wiphy,
                                             struct iw_freq *freq);
index 509279a1cfb2ccb68cbc8cb8910f0d5a792ca017..1aa31cc5511320f5958305ea8f4400f89d038153 100644 (file)
@@ -273,8 +273,6 @@ int cfg80211_mgd_wext_siwap(struct net_device *dev,
        cfg80211_unlock_rdev(wiphy_to_dev(wdev->wiphy));
        return err;
 }
-/* temporary symbol - mark GPL - in the future the handler won't be */
-EXPORT_SYMBOL_GPL(cfg80211_mgd_wext_siwap);
 
 int cfg80211_mgd_wext_giwap(struct net_device *dev,
                            struct iw_request_info *info,
@@ -299,8 +297,6 @@ int cfg80211_mgd_wext_giwap(struct net_device *dev,
 
        return 0;
 }
-/* temporary symbol - mark GPL - in the future the handler won't be */
-EXPORT_SYMBOL_GPL(cfg80211_mgd_wext_giwap);
 
 int cfg80211_wext_siwgenie(struct net_device *dev,
                           struct iw_request_info *info,