* [PATCH 1/1 linux-next] ath5k: use swap() in ath5k_hw_get_median_noise_floor()
@ 2015-06-10 16:33 Fabian Frederick
2015-06-10 19:52 ` Joe Perches
0 siblings, 1 reply; 5+ messages in thread
From: Fabian Frederick @ 2015-06-10 16:33 UTC (permalink / raw)
To: linux-kernel
Cc: Julia Lawall, Fabian Frederick, Jiri Slaby, Nick Kossifidis,
Luis R. Rodriguez, Kalle Valo, linux-wireless, netdev
Use kernel.h macro definition.
Thanks to Julia Lawall for Coccinelle scripting support.
Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
drivers/net/wireless/ath/ath5k/phy.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/net/wireless/ath/ath5k/phy.c b/drivers/net/wireless/ath/ath5k/phy.c
index 0fce1c7..ef108a3 100644
--- a/drivers/net/wireless/ath/ath5k/phy.c
+++ b/drivers/net/wireless/ath/ath5k/phy.c
@@ -1566,17 +1566,13 @@ static s16
ath5k_hw_get_median_noise_floor(struct ath5k_hw *ah)
{
s16 sort[ATH5K_NF_CAL_HIST_MAX];
- s16 tmp;
int i, j;
memcpy(sort, ah->ah_nfcal_hist.nfval, sizeof(sort));
for (i = 0; i < ATH5K_NF_CAL_HIST_MAX - 1; i++) {
for (j = 1; j < ATH5K_NF_CAL_HIST_MAX - i; j++) {
- if (sort[j] > sort[j - 1]) {
- tmp = sort[j];
- sort[j] = sort[j - 1];
- sort[j - 1] = tmp;
- }
+ if (sort[j] > sort[j - 1])
+ swap(sort[j], sort[j]);
}
}
for (i = 0; i < ATH5K_NF_CAL_HIST_MAX; i++) {
--
2.4.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1 linux-next] ath5k: use swap() in ath5k_hw_get_median_noise_floor()
2015-06-10 16:33 [PATCH 1/1 linux-next] ath5k: use swap() in ath5k_hw_get_median_noise_floor() Fabian Frederick
@ 2015-06-10 19:52 ` Joe Perches
[not found] ` <1433965966.32331.25.camel-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Joe Perches @ 2015-06-10 19:52 UTC (permalink / raw)
To: Fabian Frederick
Cc: linux-kernel, Julia Lawall, Jiri Slaby, Nick Kossifidis,
Luis R. Rodriguez, Kalle Valo, linux-wireless, netdev
On Wed, 2015-06-10 at 18:33 +0200, Fabian Frederick wrote:
> Use kernel.h macro definition.
>
> Thanks to Julia Lawall for Coccinelle scripting support.
[]
> diff --git a/drivers/net/wireless/ath/ath5k/phy.c b/drivers/net/wireless/ath/ath5k/phy.c
[]
> @@ -1566,17 +1566,13 @@ static s16
> ath5k_hw_get_median_noise_floor(struct ath5k_hw *ah)
> {
> s16 sort[ATH5K_NF_CAL_HIST_MAX];
> - s16 tmp;
> int i, j;
>
> memcpy(sort, ah->ah_nfcal_hist.nfval, sizeof(sort));
> for (i = 0; i < ATH5K_NF_CAL_HIST_MAX - 1; i++) {
> for (j = 1; j < ATH5K_NF_CAL_HIST_MAX - i; j++) {
> - if (sort[j] > sort[j - 1]) {
> - tmp = sort[j];
> - sort[j] = sort[j - 1];
> - sort[j - 1] = tmp;
> - }
> + if (sort[j] > sort[j - 1])
> + swap(sort[j], sort[j]);
swap(a, a) doesn't look useful.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1 linux-next] ath5k: use swap() in ath5k_hw_get_median_noise_floor()
[not found] ` <1433965966.32331.25.camel-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org>
@ 2015-06-10 19:59 ` Fabian Frederick
2015-06-10 20:29 ` Julia Lawall
0 siblings, 1 reply; 5+ messages in thread
From: Fabian Frederick @ 2015-06-10 19:59 UTC (permalink / raw)
To: Joe Perches
Cc: Luis R. Rodriguez, Nick Kossifidis,
linux-wireless-u79uwXL29TY76Z2rM5mHXA, Jiri Slaby,
netdev-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA, Julia Lawall, Kalle Valo
> On 10 June 2015 at 21:52 Joe Perches <joe-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org> wrote:
>
>
> On Wed, 2015-06-10 at 18:33 +0200, Fabian Frederick wrote:
> > Use kernel.h macro definition.
> >
> > Thanks to Julia Lawall for Coccinelle scripting support.
> []
> > diff --git a/drivers/net/wireless/ath/ath5k/phy.c
> > b/drivers/net/wireless/ath/ath5k/phy.c
> []
> > @@ -1566,17 +1566,13 @@ static s16
> > ath5k_hw_get_median_noise_floor(struct ath5k_hw *ah)
> > {
> > s16 sort[ATH5K_NF_CAL_HIST_MAX];
> > - s16 tmp;
> > int i, j;
> >
> > memcpy(sort, ah->ah_nfcal_hist.nfval, sizeof(sort));
> > for (i = 0; i < ATH5K_NF_CAL_HIST_MAX - 1; i++) {
> > for (j = 1; j < ATH5K_NF_CAL_HIST_MAX - i; j++) {
> > - if (sort[j] > sort[j - 1]) {
> > - tmp = sort[j];
> > - sort[j] = sort[j - 1];
> > - sort[j - 1] = tmp;
> > - }
> > + if (sort[j] > sort[j - 1])
> > + swap(sort[j], sort[j]);
>
> swap(a, a) doesn't look useful.
Thanks a lot Joe, I'll fix this one :)
Regards,
Fabian
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1 linux-next] ath5k: use swap() in ath5k_hw_get_median_noise_floor()
2015-06-10 19:59 ` Fabian Frederick
@ 2015-06-10 20:29 ` Julia Lawall
[not found] ` <alpine.DEB.2.02.1506102228560.1986-bi+AKbBUZKagILUCTcTcHdKyNwTtLsGr@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Julia Lawall @ 2015-06-10 20:29 UTC (permalink / raw)
To: Fabian Frederick
Cc: Joe Perches, Luis R. Rodriguez, Nick Kossifidis, linux-wireless,
Jiri Slaby, netdev, linux-kernel, Kalle Valo
[-- Attachment #1: Type: TEXT/PLAIN, Size: 1419 bytes --]
On Wed, 10 Jun 2015, Fabian Frederick wrote:
>
>
> > On 10 June 2015 at 21:52 Joe Perches <joe@perches.com> wrote:
> >
> >
> > On Wed, 2015-06-10 at 18:33 +0200, Fabian Frederick wrote:
> > > Use kernel.h macro definition.
> > >
> > > Thanks to Julia Lawall for Coccinelle scripting support.
> > []
> > > diff --git a/drivers/net/wireless/ath/ath5k/phy.c
> > > b/drivers/net/wireless/ath/ath5k/phy.c
> > []
> > > @@ -1566,17 +1566,13 @@ static s16
> > > ath5k_hw_get_median_noise_floor(struct ath5k_hw *ah)
> > > {
> > > s16 sort[ATH5K_NF_CAL_HIST_MAX];
> > > - s16 tmp;
> > > int i, j;
> > >
> > > memcpy(sort, ah->ah_nfcal_hist.nfval, sizeof(sort));
> > > for (i = 0; i < ATH5K_NF_CAL_HIST_MAX - 1; i++) {
> > > for (j = 1; j < ATH5K_NF_CAL_HIST_MAX - i; j++) {
> > > - if (sort[j] > sort[j - 1]) {
> > > - tmp = sort[j];
> > > - sort[j] = sort[j - 1];
> > > - sort[j - 1] = tmp;
> > > - }
> > > + if (sort[j] > sort[j - 1])
> > > + swap(sort[j], sort[j]);
> >
> > swap(a, a) doesn't look useful.
> Thanks a lot Joe, I'll fix this one :)
How did it come out like that?
julia
>
> Regards,
> Fabian
> >
> >
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1 linux-next] ath5k: use swap() in ath5k_hw_get_median_noise_floor()
[not found] ` <alpine.DEB.2.02.1506102228560.1986-bi+AKbBUZKagILUCTcTcHdKyNwTtLsGr@public.gmane.org>
@ 2015-06-11 5:06 ` Fabian Frederick
0 siblings, 0 replies; 5+ messages in thread
From: Fabian Frederick @ 2015-06-11 5:06 UTC (permalink / raw)
To: Julia Lawall
Cc: Luis R. Rodriguez, Nick Kossifidis,
linux-wireless-u79uwXL29TY76Z2rM5mHXA, Joe Perches, Jiri Slaby,
netdev-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA, Kalle Valo
> On 10 June 2015 at 22:29 Julia Lawall <julia.lawall-L2FTfq7BK8M@public.gmane.org> wrote:
>
>
>
>
> On Wed, 10 Jun 2015, Fabian Frederick wrote:
>
> >
> >
> > > On 10 June 2015 at 21:52 Joe Perches <joe-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org> wrote:
> > >
> > >
> > > On Wed, 2015-06-10 at 18:33 +0200, Fabian Frederick wrote:
> > > > Use kernel.h macro definition.
> > > >
> > > > Thanks to Julia Lawall for Coccinelle scripting support.
> > > []
> > > > diff --git a/drivers/net/wireless/ath/ath5k/phy.c
> > > > b/drivers/net/wireless/ath/ath5k/phy.c
> > > []
> > > > @@ -1566,17 +1566,13 @@ static s16
> > > > ath5k_hw_get_median_noise_floor(struct ath5k_hw *ah)
> > > > {
> > > > s16 sort[ATH5K_NF_CAL_HIST_MAX];
> > > > - s16 tmp;
> > > > int i, j;
> > > >
> > > > memcpy(sort, ah->ah_nfcal_hist.nfval, sizeof(sort));
> > > > for (i = 0; i < ATH5K_NF_CAL_HIST_MAX - 1; i++) {
> > > > for (j = 1; j < ATH5K_NF_CAL_HIST_MAX - i; j++) {
> > > > - if (sort[j] > sort[j - 1]) {
> > > > - tmp = sort[j];
> > > > - sort[j] = sort[j - 1];
> > > > - sort[j - 1] = tmp;
> > > > - }
> > > > + if (sort[j] > sort[j - 1])
> > > > + swap(sort[j], sort[j]);
> > >
> > > swap(a, a) doesn't look useful.
> > Thanks a lot Joe, I'll fix this one :)
>
> How did it come out like that?
>
> julia
I used script for detection only and made updates manually.
I guess I was distracted by [j - 1] on line above.
It was based on linux-next; if maintainers prefer another branch, I'll
send the right version on top of it.
Regards,
Fabian
>
> >
> > Regards,
> > Fabian
> > >
> > >
> >
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-06-11 5:06 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-10 16:33 [PATCH 1/1 linux-next] ath5k: use swap() in ath5k_hw_get_median_noise_floor() Fabian Frederick
2015-06-10 19:52 ` Joe Perches
[not found] ` <1433965966.32331.25.camel-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org>
2015-06-10 19:59 ` Fabian Frederick
2015-06-10 20:29 ` Julia Lawall
[not found] ` <alpine.DEB.2.02.1506102228560.1986-bi+AKbBUZKagILUCTcTcHdKyNwTtLsGr@public.gmane.org>
2015-06-11 5:06 ` Fabian Frederick
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).