lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 26 Oct 2014 17:40:55 -0700
From:	Joe Perches <joe@...ches.com>
To:	Paul McQuade <paulmcquad@...il.com>
Cc:	linux-kernel@...r.kernel.org, devel@...verdev.osuosl.org,
	linux-wireless@...r.kernel.org, gregkh@...uxfoundation.org,
	Jes.Sorensen@...hat.com, Larry.Finger@...inger.net
Subject: Re: [PATCH] staging: rtl8723au: create macro get_max_rate

On Mon, 2014-10-27 at 00:05 +0000, Paul McQuade wrote:
> create marco for max_rate values

macro

> diff --git a/drivers/staging/rtl8723au/core/rtw_ieee80211.c b/drivers/staging/rtl8723au/core/rtw_ieee80211.c
[]
> @@ -13,6 +13,8 @@
>   *
>   ******************************************************************************/
>  #define _IEEE80211_C
> +#define get_max_rate(r1, r2, r3, r4)					\
> +	(bw_40MHz ? (short_GI_40 ? r1 : r2) : (short_GI_20 ? r3 : r4))

This macro should really be defined next to the uses as
it's dependent on naming within the rtw_mcs_rate23a function.

> @@ -794,64 +796,56 @@ u16 rtw_mcs_rate23a(u8 rf_type, u8 bw_40MHz, u8 short_GI_20, u8 short_GI_40,
>  
>  	if (rf_type == RF_1T1R) {
>  		if (mcs->rx_mask[0] & BIT(7))
> -			max_rate = (bw_40MHz) ? ((short_GI_40)?1500:1350):
> -				((short_GI_20)?722:650);
> +			max_rate = get_max_rate(1500, 1350, 722, 650);
[...]
>  	} else {
>  		if (mcs->rx_mask[1]) {
>  			if (mcs->rx_mask[1] & BIT(7))
> -				max_rate = (bw_40MHz) ? ((short_GI_40)?3000:2700):((short_GI_20)?1444:1300);
> +				max_rate = get_max_rate(3000, 2700, 1444, 1300);
[...]
>  		} else {
>  			if (mcs->rx_mask[0] & BIT(7))
> -				max_rate = (bw_40MHz) ? ((short_GI_40)?1500:1350):((short_GI_20)?722:650);
> +				max_rate = get_max_rate(1500, 1350, 722, 650);
[...]
>  		}
>  	}
>  	return max_rate;

This can be written with fewer indents as

	if (rf_type == RF_1T1R( {
		[...]
	else if (mcs->rx_mask[1]) {
		[...]
	} else {
		[...]
	}

	return max_rate;
}


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ