linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oleksij Rempel <linux@rempel-privat.de>
To: Bob Copeland <me@bobcopeland.com>, linux-wireless@vger.kernel.org
Cc: ath9k-devel@lists.ath9k.org, Kalle Valo <kvalo@codeaurora.org>
Subject: Re: [PATCH] ath9k: remove repetitions of mask array size
Date: Sat, 16 Apr 2016 18:07:28 +0200	[thread overview]
Message-ID: <57126340.1090204@rempel-privat.de> (raw)
In-Reply-To: <1460818477-22785-1-git-send-email-me@bobcopeland.com>


[-- Attachment #1.1: Type: text/plain, Size: 1875 bytes --]

Thank you!

Kalle should be in CC.

Am 16.04.2016 um 16:54 schrieb Bob Copeland:
> The constant "123", which is the number of elements in
> mask_m / mask_p, is repeated several times in this function.
> 
> Replace memsets with array initialization, and replace a loop
> conditional with ARRAY_SIZE() so that we don't repeat ourselves.
> 
> Signed-off-by: Bob Copeland <me@bobcopeland.com>

Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>

> ---
>  drivers/net/wireless/ath/ath9k/ar5008_phy.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/wireless/ath/ath9k/ar5008_phy.c b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
> index 1b271b9..8eea8d2 100644
> --- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
> +++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
> @@ -260,8 +260,8 @@ void ar5008_hw_cmn_spur_mitigate(struct ath_hw *ah,
>  	int cur_bin;
>  	int upper, lower, cur_vit_mask;
>  	int i;
> -	int8_t mask_m[123];
> -	int8_t mask_p[123];
> +	int8_t mask_m[123] = {0};
> +	int8_t mask_p[123] = {0};
>  	int8_t mask_amt;
>  	int tmp_mask;
>  	static const int pilot_mask_reg[4] = {
> @@ -274,9 +274,6 @@ void ar5008_hw_cmn_spur_mitigate(struct ath_hw *ah,
>  	};
>  	static const int inc[4] = { 0, 100, 0, 0 };
>  
> -	memset(&mask_m, 0, sizeof(int8_t) * 123);
> -	memset(&mask_p, 0, sizeof(int8_t) * 123);
> -
>  	cur_bin = -6000;
>  	upper = bin + 100;
>  	lower = bin - 100;
> @@ -302,7 +299,7 @@ void ar5008_hw_cmn_spur_mitigate(struct ath_hw *ah,
>  	upper = bin + 120;
>  	lower = bin - 120;
>  
> -	for (i = 0; i < 123; i++) {
> +	for (i = 0; i < ARRAY_SIZE(mask_m); i++) {
>  		if ((cur_vit_mask > lower) && (cur_vit_mask < upper)) {
>  			/* workaround for gcc bug #37014 */
>  			volatile int tmp_v = abs(cur_vit_mask - bin);
> 


-- 
Regards,
Oleksij


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 213 bytes --]

  reply	other threads:[~2016-04-16 16:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-16 14:54 [PATCH] ath9k: remove repetitions of mask array size Bob Copeland
2016-04-16 16:07 ` Oleksij Rempel [this message]
2016-04-18 15:37   ` Kalle Valo
2016-04-22 18:21 ` Kalle Valo
2016-09-09 12:12 ` Kalle Valo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=57126340.1090204@rempel-privat.de \
    --to=linux@rempel-privat.de \
    --cc=ath9k-devel@lists.ath9k.org \
    --cc=kvalo@codeaurora.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=me@bobcopeland.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).