Search Linux Wireless

Re: [PATCH wireless-next 2/2] wifi: mac80211: reduce the scope of rts_threshold

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2025-09-03 at 07:30 -0700, Jeff Johnson wrote:
> On 9/3/2025 1:39 AM, Miri Korenblit wrote:
> > This is only needed within the 'if' scope, not in the function scope.
> > 
> > Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@xxxxxxxxx>
> > ---
> >  net/mac80211/util.c | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> > 
> > diff --git a/net/mac80211/util.c b/net/mac80211/util.c
> > index 32f1bc5908c5..b56941a70754 100644
> > --- a/net/mac80211/util.c
> > +++ b/net/mac80211/util.c
> > @@ -1756,7 +1756,6 @@ int ieee80211_reconfig(struct ieee80211_local *local)
> >  	bool sched_scan_stopped = false;
> >  	bool suspended = local->suspended;
> >  	bool in_reconfig = false;
> > -	u32 rts_threshold;
> >  
> >  	lockdep_assert_wiphy(local->hw.wiphy);
> >  
> > @@ -1832,7 +1831,9 @@ int ieee80211_reconfig(struct ieee80211_local *local)
> >  	/* setup RTS threshold */
> >  	if (hw->wiphy->n_radio > 0) {
> >  		for (i = 0; i < hw->wiphy->n_radio; i++) {
> > -			rts_threshold = hw->wiphy->radio_cfg[i].rts_threshold;
> > +			u32 rts_threshold =
> > +				hw->wiphy->radio_cfg[i].rts_threshold;
> > +
> >  			drv_set_rts_threshold(local, i, rts_threshold);
> >  		}
> >  	} else {
> 
> Johannes, is this your preference for wireless?

I'm actually not sure where this came from, and I don't know why Miri
made this change now. I don't really have a strong preference either
way.

> Kalle had a preference for defining all local variables at the beginning of
> functions,

That almost sounds like it was a misunderstanding, since the kernel
coding style says it should be at the beginning of the _scope_? I don't
know where that came from either, unless Kalle had some personal
preference, but I can't remember him ever stating that (to me.)

>  so that is a position I've been continuing even though my
> preference is to limit the scope.

I'd tend to agree that limiting the scope can make things nicer. So
let's just drop Kalle's invention I guess? :)

johannes





[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux