* [ath9k-devel] [PATCH] ath9k: remove repetitions of mask array size
@ 2016-04-16 14:54 Bob Copeland
2016-04-16 16:07 ` Oleksij Rempel
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Bob Copeland @ 2016-04-16 14:54 UTC (permalink / raw)
To: ath9k-devel
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>
---
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);
--
2.1.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [ath9k-devel] [PATCH] ath9k: remove repetitions of mask array size
2016-04-16 14:54 [ath9k-devel] [PATCH] ath9k: remove repetitions of mask array size Bob Copeland
@ 2016-04-16 16:07 ` Oleksij Rempel
2016-04-18 15:37 ` Kalle Valo
2016-04-22 18:21 ` Kalle Valo
2016-09-09 12:12 ` [ath9k-devel] " Kalle Valo
2 siblings, 1 reply; 5+ messages in thread
From: Oleksij Rempel @ 2016-04-16 16:07 UTC (permalink / raw)
To: ath9k-devel
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 213 bytes
Desc: OpenPGP digital signature
Url : http://lists.ath9k.org/pipermail/ath9k-devel/attachments/20160416/01a629b0/attachment.pgp
^ permalink raw reply [flat|nested] 5+ messages in thread
* [ath9k-devel] [PATCH] ath9k: remove repetitions of mask array size
2016-04-16 16:07 ` Oleksij Rempel
@ 2016-04-18 15:37 ` Kalle Valo
0 siblings, 0 replies; 5+ messages in thread
From: Kalle Valo @ 2016-04-18 15:37 UTC (permalink / raw)
To: ath9k-devel
Oleksij Rempel <linux@rempel-privat.de> writes:
> Kalle should be in CC.
Actually no need, CCing me is useless as I use patchwork. Most important
is that the patch is submitted to linux-wireless from where patchwork
picks it up.
--
Kalle Valo
^ permalink raw reply [flat|nested] 5+ messages in thread
* [ath9k-devel] [PATCH] ath9k: remove repetitions of mask array size
2016-04-16 14:54 [ath9k-devel] [PATCH] ath9k: remove repetitions of mask array size Bob Copeland
2016-04-16 16:07 ` Oleksij Rempel
@ 2016-04-22 18:21 ` Kalle Valo
2016-09-09 12:12 ` [ath9k-devel] " Kalle Valo
2 siblings, 0 replies; 5+ messages in thread
From: Kalle Valo @ 2016-04-22 18:21 UTC (permalink / raw)
To: ath9k-devel
Bob Copeland <me@bobcopeland.com> writes:
> 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>
As this depends on a patch in wireless-drivers (at least I assume so),
and I cannot apply a cleanup patch like this to that repository, I'm
planning to apply this only after 4.7-rc1 is released. I hope that's ok.
--
Kalle Valo
^ permalink raw reply [flat|nested] 5+ messages in thread
* [ath9k-devel] ath9k: remove repetitions of mask array size
2016-04-16 14:54 [ath9k-devel] [PATCH] ath9k: remove repetitions of mask array size Bob Copeland
2016-04-16 16:07 ` Oleksij Rempel
2016-04-22 18:21 ` Kalle Valo
@ 2016-09-09 12:12 ` Kalle Valo
2 siblings, 0 replies; 5+ messages in thread
From: Kalle Valo @ 2016-09-09 12:12 UTC (permalink / raw)
To: ath9k-devel
Bob Copeland <me@bobcopeland.com> wrote:
> 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>
Thanks, 1 patch applied to ath-next branch of ath.git:
b5182e157d3a ath9k: remove repetitions of mask array size
--
Sent by pwcli
https://patchwork.kernel.org/patch/8861641/
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-09-09 12:12 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-16 14:54 [ath9k-devel] [PATCH] ath9k: remove repetitions of mask array size Bob Copeland
2016-04-16 16:07 ` Oleksij Rempel
2016-04-18 15:37 ` Kalle Valo
2016-04-22 18:21 ` Kalle Valo
2016-09-09 12:12 ` [ath9k-devel] " Kalle Valo
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).