Commit 9a95371a authored by Luis R. Rodriguez's avatar Luis R. Rodriguez Committed by John W. Linville

mac80211: allow mac80211 drivers to get to struct ieee80211_hw from wiphy

If a driver is given a wiphy and it wants to get to its private
mac80211 driver area it can use wiphy_to_ieee80211_hw() to get first
to its ieee80211_hw and then access the private structure via hw->priv. The
wiphy_priv() is already being used internally by mac80211 and drivers
should not use this. This can be helpful in a drivers reg_notifier().
Signed-off-by: default avatarLuis R. Rodriguez <lrodriguez@atheros.com>
Acked-by: default avatarJohannes Berg <johannes@sipsolutions.net>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent f976376d
...@@ -989,6 +989,19 @@ struct ieee80211_hw { ...@@ -989,6 +989,19 @@ struct ieee80211_hw {
u8 max_rate_tries; u8 max_rate_tries;
}; };
/**
* wiphy_to_ieee80211_hw - return a mac80211 driver hw struct from a wiphy
*
* @wiphy: the &struct wiphy which we want to query
*
* mac80211 drivers can use this to get to their respective
* &struct ieee80211_hw. Drivers wishing to get to their own private
* structure can then access it via hw->priv. Note that mac802111 drivers should
* not use wiphy_priv() to try to get their private driver structure as this
* is already used internally by mac80211.
*/
struct ieee80211_hw *wiphy_to_ieee80211_hw(struct wiphy *wiphy);
/** /**
* SET_IEEE80211_DEV - set device for 802.11 hardware * SET_IEEE80211_DEV - set device for 802.11 hardware
* *
......
...@@ -41,6 +41,15 @@ const unsigned char rfc1042_header[] __aligned(2) = ...@@ -41,6 +41,15 @@ const unsigned char rfc1042_header[] __aligned(2) =
const unsigned char bridge_tunnel_header[] __aligned(2) = const unsigned char bridge_tunnel_header[] __aligned(2) =
{ 0xaa, 0xaa, 0x03, 0x00, 0x00, 0xf8 }; { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0xf8 };
struct ieee80211_hw *wiphy_to_ieee80211_hw(struct wiphy *wiphy)
{
struct ieee80211_local *local;
BUG_ON(!wiphy);
local = wiphy_priv(wiphy);
return &local->hw;
}
EXPORT_SYMBOL(wiphy_to_ieee80211_hw);
u8 *ieee80211_get_bssid(struct ieee80211_hdr *hdr, size_t len, u8 *ieee80211_get_bssid(struct ieee80211_hdr *hdr, size_t len,
enum nl80211_iftype type) enum nl80211_iftype type)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment