Skip to content

Commit

Permalink
cfg80211-wext: export symbols only when needed
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
jmberg-intel committed Feb 28, 2015
1 parent 7d9bb2f commit 2afe38d
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 13 deletions.
2 changes: 1 addition & 1 deletion drivers/net/wireless/ipw2x00/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ config IPW2100_DEBUG
config IPW2200
tristate "Intel PRO/Wireless 2200BG and 2915ABG Network Connection"
depends on PCI && CFG80211
select CFG80211_WEXT
select CFG80211_WEXT_EXPORT
select WIRELESS_EXT
select WEXT_SPY
select WEXT_PRIV
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/wireless/orinoco/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ config HERMES
tristate "Hermes chipset 802.11b support (Orinoco/Prism2/Symbol)"
depends on (PPC_PMAC || PCI || PCMCIA)
depends on CFG80211
select CFG80211_WEXT
select CFG80211_WEXT_EXPORT
select WIRELESS_EXT
select WEXT_SPY
select WEXT_PRIV
Expand Down
8 changes: 8 additions & 0 deletions net/wireless/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,18 @@ config CFG80211_WEXT
bool "cfg80211 wireless extensions compatibility"
depends on CFG80211
select WEXT_CORE
default y if CFG80211_WEXT_EXPORT
help
Enable this option if you need old userspace for wireless
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
tristate
default n
Expand Down
4 changes: 2 additions & 2 deletions net/wireless/scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -1237,7 +1237,7 @@ int cfg80211_wext_siwscan(struct net_device *dev,
kfree(creq);
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,
const struct cfg80211_bss_ies *ies,
Expand Down Expand Up @@ -1545,5 +1545,5 @@ int cfg80211_wext_giwscan(struct net_device *dev,

return res;
}
EXPORT_SYMBOL_GPL(cfg80211_wext_giwscan);
EXPORT_WEXT_HANDLER(cfg80211_wext_giwscan);
#endif
18 changes: 9 additions & 9 deletions net/wireless/wext-compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ int cfg80211_wext_giwname(struct net_device *dev,

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,
u32 *mode, char *extra)
Expand Down Expand Up @@ -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);
}
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,
u32 *mode, char *extra)
Expand Down Expand Up @@ -134,7 +134,7 @@ int cfg80211_wext_giwmode(struct net_device *dev, struct iw_request_info *info,
}
return 0;
}
EXPORT_SYMBOL_GPL(cfg80211_wext_giwmode);
EXPORT_WEXT_HANDLER(cfg80211_wext_giwmode);


int cfg80211_wext_giwrange(struct net_device *dev,
Expand Down Expand Up @@ -248,7 +248,7 @@ int cfg80211_wext_giwrange(struct net_device *dev,

return 0;
}
EXPORT_SYMBOL_GPL(cfg80211_wext_giwrange);
EXPORT_WEXT_HANDLER(cfg80211_wext_giwrange);


/**
Expand Down Expand Up @@ -303,7 +303,7 @@ int cfg80211_wext_siwrts(struct net_device *dev,

return err;
}
EXPORT_SYMBOL_GPL(cfg80211_wext_siwrts);
EXPORT_WEXT_HANDLER(cfg80211_wext_siwrts);

int cfg80211_wext_giwrts(struct net_device *dev,
struct iw_request_info *info,
Expand All @@ -317,7 +317,7 @@ int cfg80211_wext_giwrts(struct net_device *dev,

return 0;
}
EXPORT_SYMBOL_GPL(cfg80211_wext_giwrts);
EXPORT_WEXT_HANDLER(cfg80211_wext_giwrts);

int cfg80211_wext_siwfrag(struct net_device *dev,
struct iw_request_info *info,
Expand All @@ -343,7 +343,7 @@ int cfg80211_wext_siwfrag(struct net_device *dev,

return err;
}
EXPORT_SYMBOL_GPL(cfg80211_wext_siwfrag);
EXPORT_WEXT_HANDLER(cfg80211_wext_siwfrag);

int cfg80211_wext_giwfrag(struct net_device *dev,
struct iw_request_info *info,
Expand All @@ -357,7 +357,7 @@ int cfg80211_wext_giwfrag(struct net_device *dev,

return 0;
}
EXPORT_SYMBOL_GPL(cfg80211_wext_giwfrag);
EXPORT_WEXT_HANDLER(cfg80211_wext_giwfrag);

static int cfg80211_wext_siwretry(struct net_device *dev,
struct iw_request_info *info,
Expand Down Expand Up @@ -427,7 +427,7 @@ int cfg80211_wext_giwretry(struct net_device *dev,

return 0;
}
EXPORT_SYMBOL_GPL(cfg80211_wext_giwretry);
EXPORT_WEXT_HANDLER(cfg80211_wext_giwretry);

static int __cfg80211_set_encryption(struct cfg80211_registered_device *rdev,
struct net_device *dev, bool pairwise,
Expand Down
6 changes: 6 additions & 0 deletions net/wireless/wext-compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
#include <net/iw_handler.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,
struct iw_request_info *info,
struct iw_freq *freq, char *extra);
Expand Down

0 comments on commit 2afe38d

Please sign in to comment.