wifi: brcm80211: change current_bss to value
PATCH v2 1/1 wifi: brcm80211: change current_bss to value
Change to a single allocation and remove some boilerplate.
Signed-off-by Rosen Penev <[email protected]>
---
v2: change to value
.../broadcom/brcm80211/brcmsmac/main.c | 40 +++---------------- .../broadcom/brcm80211/brcmsmac/main.h | 2 +- 2 files changed, 7 insertions(+), 35 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.c +6 -34
@@ -418,21 +418,12 @@ static int brcms_chspec_bw(u16 chanspec)return BRCMS_10_MHZ ; } -static void brcms_c_bsscfg_mfree (struct brcms_bss_cfg *cfg) -{ -if (cfg ==NULL ) -return ; - -kfree (cfg->current_bss); -kfree (cfg); -} -static void brcms_c_detach_mfree (struct brcms_c_info *wlc) {if (wlc ==NULL )return ; -brcms_c_bsscfg_mfree (wlc->bsscfg); +kfree (wlc->bsscfg);kfree (wlc->pub);kfree (wlc->modulecb);kfree (wlc->default_bss);
@@ -453,25 +444,6 @@ static void brcms_c_detach_mfree(struct brcms_c_info *wlc)kfree (wlc); } -static struct brcms_bss_cfg *brcms_c_bsscfg_malloc (uint unit) -{ -struct brcms_bss_cfg *cfg; - - cfg =kzalloc_obj (*cfg,GFP_ATOMIC ); -if (cfg ==NULL ) - goto fail; - - cfg->current_bss =kzalloc_obj (*cfg->current_bss,GFP_ATOMIC ); -if (cfg->current_bss ==NULL ) - goto fail; - -return cfg; - - fail: -brcms_c_bsscfg_mfree (cfg); -return NULL ; -} -static struct brcms_c_info *brcms_c_attach_malloc (uint unit,uint *err,uint devid) {
@@ -527,7 +499,7 @@ brcms_c_attach_malloc(uint unit, uint *err, uint devid) goto fail; } - wlc->bsscfg =brcms_c_bsscfg_malloc (unit); + wlc->bsscfg =kzalloc_obj (*wlc->bsscfg,GFP_ATOMIC );if (wlc->bsscfg ==NULL ) { *err =1011 ; goto fail;
@@ -3813,7 +3785,7 @@ static void brcms_c_set_home_chanspec(struct brcms_c_info *wlc, u16 chanspec) wlc->home_chanspec = chanspec;if (wlc->pub->associated) - wlc->bsscfg->current_bss->chanspec = chanspec; + wlc->bsscfg->current_bss.chanspec = chanspec; } }
@@ -5423,7 +5395,7 @@ void brcms_c_get_current_rateset(struct brcms_c_info *wlc,struct brcms_c_rateset *rs;if (wlc->pub->associated) - rs = &wlc->bsscfg->current_bss->rateset; + rs = &wlc->bsscfg->current_bss.rateset;else rs = &wlc->default_bss->rateset;
@@ -5450,7 +5422,7 @@ int brcms_c_set_rateset(struct brcms_c_info *wlc, struct brcm_rateset *rs)if (wlc->pub->_n_enab &SUPPORT_11N ) {struct brcms_bss_info *mcsset_bss;if (wlc->pub->associated) - mcsset_bss = wlc->bsscfg->current_bss; + mcsset_bss = &wlc->bsscfg->current_bss;else mcsset_bss = wlc->default_bss; memcpy(internal_rs.mcs, &mcsset_bss->rateset.mcs[0],
@@ -7809,7 +7781,7 @@ void brcms_c_init(struct brcms_c_info *wlc, bool mute_tx)u32 bi;/* get beacon period and convert to uS */ - bi = wlc->bsscfg->current_bss->beacon_period <<10 ; + bi = wlc->bsscfg->current_bss.beacon_period <<10 ;/* * update since init path would reset * to default value
drivers/net/wireless/broadcom/brcm80211/brcmsmac/main.h +1 -1
@@ -614,7 +614,7 @@ struct brcms_bss_cfg {u8 SSID_len;u8 SSID [IEEE80211_MAX_SSID_LEN ];u8 BSSID [ETH_ALEN ]; -struct brcms_bss_info *current_bss; +struct brcms_bss_info current_bss; };int brcms_c_txfifo (struct brcms_c_info *wlc,uint fifo,struct sk_buff *p);
--
2.54.0
Op 8 juni 2026 07:29:12 schreef Rosen Penev <[email protected]>:
Quoted 1 line
Change to a single allocation and remove some boilerplate.
I thought current_bss used to be NULL when not associated, but seems my memory needs to catch up to today's reality....
Acked-by Arend van Spriel <[email protected]>
Quoted 6 lines
Signed-off-by Rosen Penev <[email protected]>---
v2: change to value.../broadcom/brcm80211/brcmsmac/main.c| 40 +++----------------.../broadcom/brcm80211/brcmsmac/main.h| 2 +-2 files changed, 7 insertions(+), 35 deletions(-)