Browse Source

cfg80211-wext: export symbols only when needed

When a fully converted cfg80211 driver needs cfg80211-wext for
userspace API purposes, the symbols need not be exported. When
other drivers (orinoco/hermes or ipw2200) are enabled, they do
need the symbols exported as they use them directly.

Make those drivers select a new CFG80211_WEXT_EXPORT Kconfig
symbol (instead of just CFG80211_WEXT) and export the functions
only if requested - this saves about 1/2k due to the size of
EXPORT_SYMBOL() itself.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Johannes Berg 10 years ago
parent
commit
2afe38d15c

+ 1 - 1
drivers/net/wireless/ipw2x00/Kconfig

@@ -66,7 +66,7 @@ config IPW2100_DEBUG
 config IPW2200
 config IPW2200
 	tristate "Intel PRO/Wireless 2200BG and 2915ABG Network Connection"
 	tristate "Intel PRO/Wireless 2200BG and 2915ABG Network Connection"
 	depends on PCI && CFG80211
 	depends on PCI && CFG80211
-	select CFG80211_WEXT
+	select CFG80211_WEXT_EXPORT
 	select WIRELESS_EXT
 	select WIRELESS_EXT
 	select WEXT_SPY
 	select WEXT_SPY
 	select WEXT_PRIV
 	select WEXT_PRIV

+ 1 - 1
drivers/net/wireless/orinoco/Kconfig

@@ -2,7 +2,7 @@ config HERMES
 	tristate "Hermes chipset 802.11b support (Orinoco/Prism2/Symbol)"
 	tristate "Hermes chipset 802.11b support (Orinoco/Prism2/Symbol)"
 	depends on (PPC_PMAC || PCI || PCMCIA)
 	depends on (PPC_PMAC || PCI || PCMCIA)
 	depends on CFG80211
 	depends on CFG80211
-	select CFG80211_WEXT
+	select CFG80211_WEXT_EXPORT
 	select WIRELESS_EXT
 	select WIRELESS_EXT
 	select WEXT_SPY
 	select WEXT_SPY
 	select WEXT_PRIV
 	select WEXT_PRIV

+ 8 - 0
net/wireless/Kconfig

@@ -178,10 +178,18 @@ config CFG80211_WEXT
 	bool "cfg80211 wireless extensions compatibility"
 	bool "cfg80211 wireless extensions compatibility"
 	depends on CFG80211
 	depends on CFG80211
 	select WEXT_CORE
 	select WEXT_CORE
+	default y if CFG80211_WEXT_EXPORT
 	help
 	help
 	  Enable this option if you need old userspace for wireless
 	  Enable this option if you need old userspace for wireless
 	  extensions with cfg80211-based drivers.
 	  extensions with cfg80211-based drivers.
 
 
+config CFG80211_WEXT_EXPORT
+	bool
+	depends on CFG80211
+	help
+	  Drivers should select this option if they require cfg80211's
+	  wext compatibility symbols to be exported.
+
 config LIB80211
 config LIB80211
 	tristate
 	tristate
 	default n
 	default n

+ 2 - 2
net/wireless/scan.c

@@ -1237,7 +1237,7 @@ int cfg80211_wext_siwscan(struct net_device *dev,
 	kfree(creq);
 	kfree(creq);
 	return err;
 	return err;
 }
 }
-EXPORT_SYMBOL_GPL(cfg80211_wext_siwscan);
+EXPORT_WEXT_HANDLER(cfg80211_wext_siwscan);
 
 
 static void ieee80211_scan_add_ies(struct iw_request_info *info,
 static void ieee80211_scan_add_ies(struct iw_request_info *info,
 				   const struct cfg80211_bss_ies *ies,
 				   const struct cfg80211_bss_ies *ies,
@@ -1545,5 +1545,5 @@ int cfg80211_wext_giwscan(struct net_device *dev,
 
 
 	return res;
 	return res;
 }
 }
-EXPORT_SYMBOL_GPL(cfg80211_wext_giwscan);
+EXPORT_WEXT_HANDLER(cfg80211_wext_giwscan);
 #endif
 #endif

+ 9 - 9
net/wireless/wext-compat.c

@@ -63,7 +63,7 @@ int cfg80211_wext_giwname(struct net_device *dev,
 
 
 	return 0;
 	return 0;
 }
 }
-EXPORT_SYMBOL_GPL(cfg80211_wext_giwname);
+EXPORT_WEXT_HANDLER(cfg80211_wext_giwname);
 
 
 int cfg80211_wext_siwmode(struct net_device *dev, struct iw_request_info *info,
 int cfg80211_wext_siwmode(struct net_device *dev, struct iw_request_info *info,
 			  u32 *mode, char *extra)
 			  u32 *mode, char *extra)
@@ -99,7 +99,7 @@ int cfg80211_wext_siwmode(struct net_device *dev, struct iw_request_info *info,
 
 
 	return cfg80211_change_iface(rdev, dev, type, NULL, &vifparams);
 	return cfg80211_change_iface(rdev, dev, type, NULL, &vifparams);
 }
 }
-EXPORT_SYMBOL_GPL(cfg80211_wext_siwmode);
+EXPORT_WEXT_HANDLER(cfg80211_wext_siwmode);
 
 
 int cfg80211_wext_giwmode(struct net_device *dev, struct iw_request_info *info,
 int cfg80211_wext_giwmode(struct net_device *dev, struct iw_request_info *info,
 			  u32 *mode, char *extra)
 			  u32 *mode, char *extra)
@@ -134,7 +134,7 @@ int cfg80211_wext_giwmode(struct net_device *dev, struct iw_request_info *info,
 	}
 	}
 	return 0;
 	return 0;
 }
 }
-EXPORT_SYMBOL_GPL(cfg80211_wext_giwmode);
+EXPORT_WEXT_HANDLER(cfg80211_wext_giwmode);
 
 
 
 
 int cfg80211_wext_giwrange(struct net_device *dev,
 int cfg80211_wext_giwrange(struct net_device *dev,
@@ -248,7 +248,7 @@ int cfg80211_wext_giwrange(struct net_device *dev,
 
 
 	return 0;
 	return 0;
 }
 }
-EXPORT_SYMBOL_GPL(cfg80211_wext_giwrange);
+EXPORT_WEXT_HANDLER(cfg80211_wext_giwrange);
 
 
 
 
 /**
 /**
@@ -303,7 +303,7 @@ int cfg80211_wext_siwrts(struct net_device *dev,
 
 
 	return err;
 	return err;
 }
 }
-EXPORT_SYMBOL_GPL(cfg80211_wext_siwrts);
+EXPORT_WEXT_HANDLER(cfg80211_wext_siwrts);
 
 
 int cfg80211_wext_giwrts(struct net_device *dev,
 int cfg80211_wext_giwrts(struct net_device *dev,
 			 struct iw_request_info *info,
 			 struct iw_request_info *info,
@@ -317,7 +317,7 @@ int cfg80211_wext_giwrts(struct net_device *dev,
 
 
 	return 0;
 	return 0;
 }
 }
-EXPORT_SYMBOL_GPL(cfg80211_wext_giwrts);
+EXPORT_WEXT_HANDLER(cfg80211_wext_giwrts);
 
 
 int cfg80211_wext_siwfrag(struct net_device *dev,
 int cfg80211_wext_siwfrag(struct net_device *dev,
 			  struct iw_request_info *info,
 			  struct iw_request_info *info,
@@ -343,7 +343,7 @@ int cfg80211_wext_siwfrag(struct net_device *dev,
 
 
 	return err;
 	return err;
 }
 }
-EXPORT_SYMBOL_GPL(cfg80211_wext_siwfrag);
+EXPORT_WEXT_HANDLER(cfg80211_wext_siwfrag);
 
 
 int cfg80211_wext_giwfrag(struct net_device *dev,
 int cfg80211_wext_giwfrag(struct net_device *dev,
 			  struct iw_request_info *info,
 			  struct iw_request_info *info,
@@ -357,7 +357,7 @@ int cfg80211_wext_giwfrag(struct net_device *dev,
 
 
 	return 0;
 	return 0;
 }
 }
-EXPORT_SYMBOL_GPL(cfg80211_wext_giwfrag);
+EXPORT_WEXT_HANDLER(cfg80211_wext_giwfrag);
 
 
 static int cfg80211_wext_siwretry(struct net_device *dev,
 static int cfg80211_wext_siwretry(struct net_device *dev,
 				  struct iw_request_info *info,
 				  struct iw_request_info *info,
@@ -427,7 +427,7 @@ int cfg80211_wext_giwretry(struct net_device *dev,
 
 
 	return 0;
 	return 0;
 }
 }
-EXPORT_SYMBOL_GPL(cfg80211_wext_giwretry);
+EXPORT_WEXT_HANDLER(cfg80211_wext_giwretry);
 
 
 static int __cfg80211_set_encryption(struct cfg80211_registered_device *rdev,
 static int __cfg80211_set_encryption(struct cfg80211_registered_device *rdev,
 				     struct net_device *dev, bool pairwise,
 				     struct net_device *dev, bool pairwise,

+ 6 - 0
net/wireless/wext-compat.h

@@ -4,6 +4,12 @@
 #include <net/iw_handler.h>
 #include <net/iw_handler.h>
 #include <linux/wireless.h>
 #include <linux/wireless.h>
 
 
+#ifdef CONFIG_CFG80211_WEXT_EXPORT
+#define EXPORT_WEXT_HANDLER(h) EXPORT_SYMBOL_GPL(h)
+#else
+#define EXPORT_WEXT_HANDLER(h)
+#endif /* CONFIG_CFG80211_WEXT_EXPORT */
+
 int cfg80211_ibss_wext_siwfreq(struct net_device *dev,
 int cfg80211_ibss_wext_siwfreq(struct net_device *dev,
 			       struct iw_request_info *info,
 			       struct iw_request_info *info,
 			       struct iw_freq *freq, char *extra);
 			       struct iw_freq *freq, char *extra);