@@ -753,7 +753,7 @@ s32 brcmf_notify_escan_complete(struct brcmf_cfg80211_info *cfg,
753
753
static int brcmf_cfg80211_del_ap_iface (struct wiphy * wiphy ,
754
754
struct wireless_dev * wdev )
755
755
{
756
- struct brcmf_cfg80211_info * cfg = wiphy_priv (wiphy );
756
+ struct brcmf_cfg80211_info * cfg = wiphy_to_cfg (wiphy );
757
757
struct net_device * ndev = wdev -> netdev ;
758
758
struct brcmf_if * ifp = netdev_priv (ndev );
759
759
int ret ;
@@ -786,7 +786,7 @@ static int brcmf_cfg80211_del_ap_iface(struct wiphy *wiphy,
786
786
static
787
787
int brcmf_cfg80211_del_iface (struct wiphy * wiphy , struct wireless_dev * wdev )
788
788
{
789
- struct brcmf_cfg80211_info * cfg = wiphy_priv (wiphy );
789
+ struct brcmf_cfg80211_info * cfg = wiphy_to_cfg (wiphy );
790
790
struct net_device * ndev = wdev -> netdev ;
791
791
792
792
if (ndev && ndev == cfg_to_ndev (cfg ))
@@ -831,7 +831,7 @@ brcmf_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev,
831
831
enum nl80211_iftype type ,
832
832
struct vif_params * params )
833
833
{
834
- struct brcmf_cfg80211_info * cfg = wiphy_priv (wiphy );
834
+ struct brcmf_cfg80211_info * cfg = wiphy_to_cfg (wiphy );
835
835
struct brcmf_if * ifp = netdev_priv (ndev );
836
836
struct brcmf_cfg80211_vif * vif = ifp -> vif ;
837
837
s32 infra = 0 ;
@@ -2127,17 +2127,15 @@ static s32
2127
2127
brcmf_cfg80211_get_tx_power (struct wiphy * wiphy , struct wireless_dev * wdev ,
2128
2128
s32 * dbm )
2129
2129
{
2130
- struct brcmf_cfg80211_info * cfg = wiphy_to_cfg (wiphy );
2131
- struct net_device * ndev = cfg_to_ndev (cfg );
2132
- struct brcmf_if * ifp = netdev_priv (ndev );
2130
+ struct brcmf_cfg80211_vif * vif = wdev_to_vif (wdev );
2133
2131
s32 qdbm = 0 ;
2134
2132
s32 err ;
2135
2133
2136
2134
brcmf_dbg (TRACE , "Enter\n" );
2137
- if (!check_vif_up (ifp -> vif ))
2135
+ if (!check_vif_up (vif ))
2138
2136
return - EIO ;
2139
2137
2140
- err = brcmf_fil_iovar_int_get (ifp , "qtxpower" , & qdbm );
2138
+ err = brcmf_fil_iovar_int_get (vif -> ifp , "qtxpower" , & qdbm );
2141
2139
if (err ) {
2142
2140
brcmf_err ("error (%d)\n" , err );
2143
2141
goto done ;
@@ -3358,7 +3356,7 @@ brcmf_cfg80211_sched_scan_start(struct wiphy *wiphy,
3358
3356
struct cfg80211_sched_scan_request * req )
3359
3357
{
3360
3358
struct brcmf_if * ifp = netdev_priv (ndev );
3361
- struct brcmf_cfg80211_info * cfg = wiphy_priv (wiphy );
3359
+ struct brcmf_cfg80211_info * cfg = wiphy_to_cfg (wiphy );
3362
3360
3363
3361
brcmf_dbg (SCAN , "Enter: n_match_sets=%d n_ssids=%d\n" ,
3364
3362
req -> n_match_sets , req -> n_ssids );
@@ -5190,6 +5188,12 @@ static struct cfg80211_ops brcmf_cfg80211_ops = {
5190
5188
.del_pmk = brcmf_cfg80211_del_pmk ,
5191
5189
};
5192
5190
5191
+ struct cfg80211_ops * brcmf_cfg80211_get_ops (void )
5192
+ {
5193
+ return kmemdup (& brcmf_cfg80211_ops , sizeof (brcmf_cfg80211_ops ),
5194
+ GFP_KERNEL );
5195
+ }
5196
+
5193
5197
struct brcmf_cfg80211_vif * brcmf_alloc_vif (struct brcmf_cfg80211_info * cfg ,
5194
5198
enum nl80211_iftype type )
5195
5199
{
@@ -5897,7 +5901,7 @@ static void brcmf_update_bw40_channel_flag(struct ieee80211_channel *channel,
5897
5901
static int brcmf_construct_chaninfo (struct brcmf_cfg80211_info * cfg ,
5898
5902
u32 bw_cap [])
5899
5903
{
5900
- struct brcmf_if * ifp = netdev_priv ( cfg_to_ndev ( cfg ) );
5904
+ struct brcmf_if * ifp = brcmf_get_ifp ( cfg -> pub , 0 );
5901
5905
struct ieee80211_supported_band * band ;
5902
5906
struct ieee80211_channel * channel ;
5903
5907
struct wiphy * wiphy ;
@@ -6012,7 +6016,7 @@ static int brcmf_construct_chaninfo(struct brcmf_cfg80211_info *cfg,
6012
6016
6013
6017
static int brcmf_enable_bw40_2g (struct brcmf_cfg80211_info * cfg )
6014
6018
{
6015
- struct brcmf_if * ifp = netdev_priv ( cfg_to_ndev ( cfg ) );
6019
+ struct brcmf_if * ifp = brcmf_get_ifp ( cfg -> pub , 0 );
6016
6020
struct ieee80211_supported_band * band ;
6017
6021
struct brcmf_fil_bwcap_le band_bwcap ;
6018
6022
struct brcmf_chanspec_list * list ;
@@ -6197,10 +6201,10 @@ static void brcmf_update_vht_cap(struct ieee80211_supported_band *band,
6197
6201
}
6198
6202
}
6199
6203
6200
- static int brcmf_setup_wiphybands (struct wiphy * wiphy )
6204
+ static int brcmf_setup_wiphybands (struct brcmf_cfg80211_info * cfg )
6201
6205
{
6202
- struct brcmf_cfg80211_info * cfg = wiphy_priv ( wiphy );
6203
- struct brcmf_if * ifp = netdev_priv ( cfg_to_ndev ( cfg )) ;
6206
+ struct brcmf_if * ifp = brcmf_get_ifp ( cfg -> pub , 0 );
6207
+ struct wiphy * wiphy ;
6204
6208
u32 nmode = 0 ;
6205
6209
u32 vhtmode = 0 ;
6206
6210
u32 bw_cap [2 ] = { WLC_BW_20MHZ_BIT , WLC_BW_20MHZ_BIT };
@@ -6794,8 +6798,8 @@ static s32 brcmf_translate_country_code(struct brcmf_pub *drvr, char alpha2[2],
6794
6798
static void brcmf_cfg80211_reg_notifier (struct wiphy * wiphy ,
6795
6799
struct regulatory_request * req )
6796
6800
{
6797
- struct brcmf_cfg80211_info * cfg = wiphy_priv (wiphy );
6798
- struct brcmf_if * ifp = netdev_priv ( cfg_to_ndev ( cfg ) );
6801
+ struct brcmf_cfg80211_info * cfg = wiphy_to_cfg (wiphy );
6802
+ struct brcmf_if * ifp = brcmf_get_ifp ( cfg -> pub , 0 );
6799
6803
struct brcmf_fil_country_le ccreq ;
6800
6804
s32 err ;
6801
6805
int i ;
@@ -6830,7 +6834,7 @@ static void brcmf_cfg80211_reg_notifier(struct wiphy *wiphy,
6830
6834
brcmf_err ("Firmware rejected country setting\n" );
6831
6835
return ;
6832
6836
}
6833
- brcmf_setup_wiphybands (wiphy );
6837
+ brcmf_setup_wiphybands (cfg );
6834
6838
}
6835
6839
6836
6840
static void brcmf_free_wiphy (struct wiphy * wiphy )
@@ -6857,17 +6861,15 @@ static void brcmf_free_wiphy(struct wiphy *wiphy)
6857
6861
if (wiphy -> wowlan != & brcmf_wowlan_support )
6858
6862
kfree (wiphy -> wowlan );
6859
6863
#endif
6860
- wiphy_free (wiphy );
6861
6864
}
6862
6865
6863
6866
struct brcmf_cfg80211_info * brcmf_cfg80211_attach (struct brcmf_pub * drvr ,
6864
- struct device * busdev ,
6867
+ struct cfg80211_ops * ops ,
6865
6868
bool p2pdev_forced )
6866
6869
{
6870
+ struct wiphy * wiphy = drvr -> wiphy ;
6867
6871
struct net_device * ndev = brcmf_get_ifp (drvr , 0 )-> ndev ;
6868
6872
struct brcmf_cfg80211_info * cfg ;
6869
- struct wiphy * wiphy ;
6870
- struct cfg80211_ops * ops ;
6871
6873
struct brcmf_cfg80211_vif * vif ;
6872
6874
struct brcmf_if * ifp ;
6873
6875
s32 err = 0 ;
@@ -6879,26 +6881,13 @@ struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr,
6879
6881
return NULL ;
6880
6882
}
6881
6883
6882
- ops = kmemdup (& brcmf_cfg80211_ops , sizeof (* ops ), GFP_KERNEL );
6883
- if (!ops )
6884
- return NULL ;
6885
-
6886
- ifp = netdev_priv (ndev );
6887
- #ifdef CONFIG_PM
6888
- if (brcmf_feat_is_enabled (ifp , BRCMF_FEAT_WOWL_GTK ))
6889
- ops -> set_rekey_data = brcmf_cfg80211_set_rekey_data ;
6890
- #endif
6891
- wiphy = wiphy_new (ops , sizeof (struct brcmf_cfg80211_info ));
6892
- if (!wiphy ) {
6884
+ cfg = kzalloc (sizeof (* cfg ), GFP_KERNEL );
6885
+ if (!cfg ) {
6893
6886
brcmf_err ("Could not allocate wiphy device\n" );
6894
- goto ops_out ;
6887
+ return NULL ;
6895
6888
}
6896
- memcpy (wiphy -> perm_addr , drvr -> mac , ETH_ALEN );
6897
- set_wiphy_dev (wiphy , busdev );
6898
6889
6899
- cfg = wiphy_priv (wiphy );
6900
6890
cfg -> wiphy = wiphy ;
6901
- cfg -> ops = ops ;
6902
6891
cfg -> pub = drvr ;
6903
6892
init_vif_event (& cfg -> vif_event );
6904
6893
INIT_LIST_HEAD (& cfg -> vif_list );
@@ -6907,6 +6896,7 @@ struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr,
6907
6896
if (IS_ERR (vif ))
6908
6897
goto wiphy_out ;
6909
6898
6899
+ ifp = netdev_priv (ndev );
6910
6900
vif -> ifp = ifp ;
6911
6901
vif -> wdev .netdev = ndev ;
6912
6902
ndev -> ieee80211_ptr = & vif -> wdev ;
@@ -6933,6 +6923,11 @@ struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr,
6933
6923
if (err < 0 )
6934
6924
goto priv_out ;
6935
6925
6926
+ /* regulatory notifer below needs access to cfg so
6927
+ * assign it now.
6928
+ */
6929
+ drvr -> config = cfg ;
6930
+
6936
6931
brcmf_dbg (INFO , "Registering custom regulatory\n" );
6937
6932
wiphy -> reg_notifier = brcmf_cfg80211_reg_notifier ;
6938
6933
wiphy -> regulatory_flags |= REGULATORY_CUSTOM_REG ;
@@ -6946,13 +6941,17 @@ struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr,
6946
6941
cap = & wiphy -> bands [NL80211_BAND_2GHZ ]-> ht_cap .cap ;
6947
6942
* cap |= IEEE80211_HT_CAP_SUP_WIDTH_20_40 ;
6948
6943
}
6944
+ #ifdef CONFIG_PM
6945
+ if (brcmf_feat_is_enabled (ifp , BRCMF_FEAT_WOWL_GTK ))
6946
+ ops -> set_rekey_data = brcmf_cfg80211_set_rekey_data ;
6947
+ #endif
6949
6948
err = wiphy_register (wiphy );
6950
6949
if (err < 0 ) {
6951
6950
brcmf_err ("Could not register wiphy device (%d)\n" , err );
6952
6951
goto priv_out ;
6953
6952
}
6954
6953
6955
- err = brcmf_setup_wiphybands (wiphy );
6954
+ err = brcmf_setup_wiphybands (cfg );
6956
6955
if (err ) {
6957
6956
brcmf_err ("Setting wiphy bands failed (%d)\n" , err );
6958
6957
goto wiphy_unreg_out ;
@@ -6969,12 +6968,7 @@ struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr,
6969
6968
else
6970
6969
* cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40 ;
6971
6970
}
6972
- /* p2p might require that "if-events" get processed by fweh. So
6973
- * activate the already registered event handlers now and activate
6974
- * the rest when initialization has completed. drvr->config needs to
6975
- * be assigned before activating events.
6976
- */
6977
- drvr -> config = cfg ;
6971
+
6978
6972
err = brcmf_fweh_activate_events (ifp );
6979
6973
if (err ) {
6980
6974
brcmf_err ("FWEH activation failed (%d)\n" , err );
@@ -7042,8 +7036,7 @@ struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr,
7042
7036
ifp -> vif = NULL ;
7043
7037
wiphy_out :
7044
7038
brcmf_free_wiphy (wiphy );
7045
- ops_out :
7046
- kfree (ops );
7039
+ kfree (cfg );
7047
7040
return NULL ;
7048
7041
}
7049
7042
@@ -7058,4 +7051,5 @@ void brcmf_cfg80211_detach(struct brcmf_cfg80211_info *cfg)
7058
7051
kfree (cfg -> ops );
7059
7052
wl_deinit_priv (cfg );
7060
7053
brcmf_free_wiphy (cfg -> wiphy );
7054
+ kfree (cfg );
7061
7055
}
0 commit comments