Search Linux Wireless

Re: [PATCH v3 5/7] cfg80211/mac80211: refactor cfg80211_chandef_dfs_required()

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

 



On Fri, 2014-02-21 at 09:40 +0100, Johannes Berg wrote:
> On Thu, 2014-02-20 at 16:36 +0200, Luciano Coelho wrote:
> 
> > +	radar_required = !!(err);
> 
> That's going a bit overboard - you really need only ... = err; for bool
> variables :) 

There's nothing not right with using double-negation!! :P

I like to make it explicit that we're converting an integer to a boolean
and it happens in other parts of the code too.

Anyway, I have removed the double-negations for the next version.


> >  	int width;
> > -	int r;
> > +	int ret;
> >  
> >  	if (WARN_ON(!cfg80211_chandef_valid(chandef)))
> >  		return -EINVAL;
> >  
> > -	width = cfg80211_chandef_get_width(chandef);
> > -	if (width < 0)
> > -		return -EINVAL;
> > +	switch (iftype) {
> > +	case NL80211_IFTYPE_UNSPECIFIED:
> > +	case NL80211_IFTYPE_ADHOC:
> > +	case NL80211_IFTYPE_AP:
> > +	case NL80211_IFTYPE_P2P_GO:
> > +	case NL80211_IFTYPE_MESH_POINT:
> > +		width = cfg80211_chandef_get_width(chandef);
> > +		if (width < 0)
> > +			return -EINVAL;
> >  
> > -	r = cfg80211_get_chans_dfs_required(wiphy, chandef->center_freq1,
> > -					    width);
> > -	if (r)
> > -		return r;
> > +		ret = cfg80211_get_chans_dfs_required(wiphy,
> > +						      chandef->center_freq1,
> > +						      width);
> > +		if (ret < 0)
> > +			return ret;
> > +		else if (ret > 0)
> > +			return BIT(chandef->width);
> 
> What's with the width vs. chandef->width?

width is an integer; chandef->width is the enumeration.  This is how the
existing functions work.  Do you want me to change something?

--
Luca.

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




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

  Powered by Linux