Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+27 -13
+1 -1
drivers/net/wireless/ipw2x00/Kconfig
··· 66 66 config IPW2200 67 67 tristate "Intel PRO/Wireless 2200BG and 2915ABG Network Connection" 68 68 depends on PCI && CFG80211 69 - select CFG80211_WEXT 69 + select CFG80211_WEXT_EXPORT 70 70 select WIRELESS_EXT 71 71 select WEXT_SPY 72 72 select WEXT_PRIV
+1 -1
drivers/net/wireless/orinoco/Kconfig
··· 2 2 tristate "Hermes chipset 802.11b support (Orinoco/Prism2/Symbol)" 3 3 depends on (PPC_PMAC || PCI || PCMCIA) 4 4 depends on CFG80211 5 - select CFG80211_WEXT 5 + select CFG80211_WEXT_EXPORT 6 6 select WIRELESS_EXT 7 7 select WEXT_SPY 8 8 select WEXT_PRIV
+8
net/wireless/Kconfig
··· 178 178 bool "cfg80211 wireless extensions compatibility" 179 179 depends on CFG80211 180 180 select WEXT_CORE 181 + default y if CFG80211_WEXT_EXPORT 181 182 help 182 183 Enable this option if you need old userspace for wireless 183 184 extensions with cfg80211-based drivers. 185 + 186 + config CFG80211_WEXT_EXPORT 187 + bool 188 + depends on CFG80211 189 + help 190 + Drivers should select this option if they require cfg80211's 191 + wext compatibility symbols to be exported. 184 192 185 193 config LIB80211 186 194 tristate
+2 -2
net/wireless/scan.c
··· 1237 1237 kfree(creq); 1238 1238 return err; 1239 1239 } 1240 - EXPORT_SYMBOL_GPL(cfg80211_wext_siwscan); 1240 + EXPORT_WEXT_HANDLER(cfg80211_wext_siwscan); 1241 1241 1242 1242 static void ieee80211_scan_add_ies(struct iw_request_info *info, 1243 1243 const struct cfg80211_bss_ies *ies, ··· 1545 1545 1546 1546 return res; 1547 1547 } 1548 - EXPORT_SYMBOL_GPL(cfg80211_wext_giwscan); 1548 + EXPORT_WEXT_HANDLER(cfg80211_wext_giwscan); 1549 1549 #endif
+9 -9
net/wireless/wext-compat.c
··· 63 63 64 64 return 0; 65 65 } 66 - EXPORT_SYMBOL_GPL(cfg80211_wext_giwname); 66 + EXPORT_WEXT_HANDLER(cfg80211_wext_giwname); 67 67 68 68 int cfg80211_wext_siwmode(struct net_device *dev, struct iw_request_info *info, 69 69 u32 *mode, char *extra) ··· 99 99 100 100 return cfg80211_change_iface(rdev, dev, type, NULL, &vifparams); 101 101 } 102 - EXPORT_SYMBOL_GPL(cfg80211_wext_siwmode); 102 + EXPORT_WEXT_HANDLER(cfg80211_wext_siwmode); 103 103 104 104 int cfg80211_wext_giwmode(struct net_device *dev, struct iw_request_info *info, 105 105 u32 *mode, char *extra) ··· 134 134 } 135 135 return 0; 136 136 } 137 - EXPORT_SYMBOL_GPL(cfg80211_wext_giwmode); 137 + EXPORT_WEXT_HANDLER(cfg80211_wext_giwmode); 138 138 139 139 140 140 int cfg80211_wext_giwrange(struct net_device *dev, ··· 248 248 249 249 return 0; 250 250 } 251 - EXPORT_SYMBOL_GPL(cfg80211_wext_giwrange); 251 + EXPORT_WEXT_HANDLER(cfg80211_wext_giwrange); 252 252 253 253 254 254 /** ··· 303 303 304 304 return err; 305 305 } 306 - EXPORT_SYMBOL_GPL(cfg80211_wext_siwrts); 306 + EXPORT_WEXT_HANDLER(cfg80211_wext_siwrts); 307 307 308 308 int cfg80211_wext_giwrts(struct net_device *dev, 309 309 struct iw_request_info *info, ··· 317 317 318 318 return 0; 319 319 } 320 - EXPORT_SYMBOL_GPL(cfg80211_wext_giwrts); 320 + EXPORT_WEXT_HANDLER(cfg80211_wext_giwrts); 321 321 322 322 int cfg80211_wext_siwfrag(struct net_device *dev, 323 323 struct iw_request_info *info, ··· 343 343 344 344 return err; 345 345 } 346 - EXPORT_SYMBOL_GPL(cfg80211_wext_siwfrag); 346 + EXPORT_WEXT_HANDLER(cfg80211_wext_siwfrag); 347 347 348 348 int cfg80211_wext_giwfrag(struct net_device *dev, 349 349 struct iw_request_info *info, ··· 357 357 358 358 return 0; 359 359 } 360 - EXPORT_SYMBOL_GPL(cfg80211_wext_giwfrag); 360 + EXPORT_WEXT_HANDLER(cfg80211_wext_giwfrag); 361 361 362 362 static int cfg80211_wext_siwretry(struct net_device *dev, 363 363 struct iw_request_info *info, ··· 427 427 428 428 return 0; 429 429 } 430 - EXPORT_SYMBOL_GPL(cfg80211_wext_giwretry); 430 + EXPORT_WEXT_HANDLER(cfg80211_wext_giwretry); 431 431 432 432 static int __cfg80211_set_encryption(struct cfg80211_registered_device *rdev, 433 433 struct net_device *dev, bool pairwise,
+6
net/wireless/wext-compat.h
··· 4 4 #include <net/iw_handler.h> 5 5 #include <linux/wireless.h> 6 6 7 + #ifdef CONFIG_CFG80211_WEXT_EXPORT 8 + #define EXPORT_WEXT_HANDLER(h) EXPORT_SYMBOL_GPL(h) 9 + #else 10 + #define EXPORT_WEXT_HANDLER(h) 11 + #endif /* CONFIG_CFG80211_WEXT_EXPORT */ 12 + 7 13 int cfg80211_ibss_wext_siwfreq(struct net_device *dev, 8 14 struct iw_request_info *info, 9 15 struct iw_freq *freq, char *extra);