2012-07-09 12:42:23

by Stanislaw Gruszka

[permalink] [raw]
Subject: [PATCH 1/2] rt2x00pci: small 3290 changes cleanup

Fix indention and remove unnecessary brackets and compares.

Signed-off-by: Stanislaw Gruszka <[email protected]>
---
drivers/net/wireless/rt2x00/rt2800pci.c | 11 +++++------
1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c
index dd43612..bf0e71e 100644
--- a/drivers/net/wireless/rt2x00/rt2800pci.c
+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
@@ -986,7 +986,7 @@ static int rt2800_enable_wlan_rt3290(struct rt2x00_dev *rt2x00dev)
int i, count;

rt2800_register_read(rt2x00dev, WLAN_FUN_CTRL, &reg);
- if ((rt2x00_get_field32(reg, WLAN_EN) == 1))
+ if (rt2x00_get_field32(reg, WLAN_EN))
return 0;

rt2x00_set_field32(&reg, WLAN_GPIO_OUT_OE_BIT_ALL, 0xff);
@@ -1004,9 +1004,9 @@ static int rt2800_enable_wlan_rt3290(struct rt2x00_dev *rt2x00dev)
*/
for (i = 0; i < REGISTER_BUSY_COUNT; i++) {
rt2800_register_read(rt2x00dev, CMB_CTRL, &reg);
- if ((rt2x00_get_field32(reg, PLL_LD) == 1) &&
- (rt2x00_get_field32(reg, XTAL_RDY) == 1))
- break;
+ if (rt2x00_get_field32(reg, PLL_LD) &&
+ rt2x00_get_field32(reg, XTAL_RDY))
+ break;
udelay(REGISTER_BUSY_DELAY);
}

@@ -1022,9 +1022,8 @@ static int rt2800_enable_wlan_rt3290(struct rt2x00_dev *rt2x00dev)
rt2800_register_write(rt2x00dev, 0x58, 0x618);
udelay(REGISTER_BUSY_DELAY);
count++;
- } else {
+ } else
count = 0;
- }

rt2800_register_read(rt2x00dev, WLAN_FUN_CTRL, &reg);
rt2x00_set_field32(&reg, PCIE_APP0_CLK_REQ, 0);
--
1.7.1



2012-07-11 19:33:37

by John W. Linville

[permalink] [raw]
Subject: Re: [PATCH 1/2] rt2x00pci: small 3290 changes cleanup

On Tue, Jul 10, 2012 at 12:59:12PM +0300, Veli-Pekka Peltola wrote:
> On 07/09/2012 03:41 PM, Stanislaw Gruszka wrote:
> >Fix indention and remove unnecessary brackets and compares.
>
> Hi,
>
> Otherwise looks ok but I have a one comment, see below.
>
> >Signed-off-by: Stanislaw Gruszka <[email protected]>
> >---
> > drivers/net/wireless/rt2x00/rt2800pci.c | 11 +++++------
> > 1 files changed, 5 insertions(+), 6 deletions(-)
> >
> >diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c
> >index dd43612..bf0e71e 100644
> >--- a/drivers/net/wireless/rt2x00/rt2800pci.c
> >+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
>
> <snip>
>
> >@@ -1022,9 +1022,8 @@ static int rt2800_enable_wlan_rt3290(struct rt2x00_dev *rt2x00dev)
> > rt2800_register_write(rt2x00dev, 0x58, 0x618);
> > udelay(REGISTER_BUSY_DELAY);
> > count++;
> >- } else {
> >+ } else
> > count = 0;
> >- }
>
> I have understood that Linux CodingStyle requires braces on all
> else/if branches if any of those have more than one statement. So I
> would not remove braces here.

I'll just drop that hunk...

--
John W. Linville Someday the world will need a hero, and you
[email protected] might be all we have. Be ready.

2012-07-10 06:34:52

by Helmut Schaa

[permalink] [raw]
Subject: Re: [PATCH 2/2] rt2800lib: merge same defines

2012/7/9 Stanislaw Gruszka <[email protected]>:
> Merge 3290 and 5390 POWER_BOUND and FREQ_OFFSET_BOUND defines.
>
> Signed-off-by: Stanislaw Gruszka <[email protected]>

Yep, makes sense.

Acked-by: Helmut Schaa <[email protected]>

> ---
> drivers/net/wireless/rt2x00/rt2800lib.c | 29 ++++++++++++-----------------
> 1 files changed, 12 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
> index 068276e..e76f03c 100644
> --- a/drivers/net/wireless/rt2x00/rt2800lib.c
> +++ b/drivers/net/wireless/rt2x00/rt2800lib.c
> @@ -1940,10 +1940,8 @@ static void rt2800_config_channel_rf3052(struct rt2x00_dev *rt2x00dev,
> rt2800_rfcsr_write(rt2x00dev, 7, rfcsr);
> }
>
> -#define RT3290_POWER_BOUND 0x27
> -#define RT3290_FREQ_OFFSET_BOUND 0x5f
> -#define RT5390_POWER_BOUND 0x27
> -#define RT5390_FREQ_OFFSET_BOUND 0x5f
> +#define POWER_BOUND 0x27
> +#define FREQ_OFFSET_BOUND 0x5f
>
> static void rt2800_config_channel_rf3290(struct rt2x00_dev *rt2x00dev,
> struct ieee80211_conf *conf,
> @@ -1959,16 +1957,15 @@ static void rt2800_config_channel_rf3290(struct rt2x00_dev *rt2x00dev,
> rt2800_rfcsr_write(rt2x00dev, 11, rfcsr);
>
> rt2800_rfcsr_read(rt2x00dev, 49, &rfcsr);
> - if (info->default_power1 > RT3290_POWER_BOUND)
> - rt2x00_set_field8(&rfcsr, RFCSR49_TX, RT3290_POWER_BOUND);
> + if (info->default_power1 > POWER_BOUND)
> + rt2x00_set_field8(&rfcsr, RFCSR49_TX, POWER_BOUND);
> else
> rt2x00_set_field8(&rfcsr, RFCSR49_TX, info->default_power1);
> rt2800_rfcsr_write(rt2x00dev, 49, rfcsr);
>
> rt2800_rfcsr_read(rt2x00dev, 17, &rfcsr);
> - if (rt2x00dev->freq_offset > RT3290_FREQ_OFFSET_BOUND)
> - rt2x00_set_field8(&rfcsr, RFCSR17_CODE,
> - RT3290_FREQ_OFFSET_BOUND);
> + if (rt2x00dev->freq_offset > FREQ_OFFSET_BOUND)
> + rt2x00_set_field8(&rfcsr, RFCSR17_CODE, FREQ_OFFSET_BOUND);
> else
> rt2x00_set_field8(&rfcsr, RFCSR17_CODE, rt2x00dev->freq_offset);
> rt2800_rfcsr_write(rt2x00dev, 17, rfcsr);
> @@ -2002,17 +1999,16 @@ static void rt2800_config_channel_rf53xx(struct rt2x00_dev *rt2x00dev,
> rt2800_rfcsr_write(rt2x00dev, 11, rfcsr);
>
> rt2800_rfcsr_read(rt2x00dev, 49, &rfcsr);
> - if (info->default_power1 > RT5390_POWER_BOUND)
> - rt2x00_set_field8(&rfcsr, RFCSR49_TX, RT5390_POWER_BOUND);
> + if (info->default_power1 > POWER_BOUND)
> + rt2x00_set_field8(&rfcsr, RFCSR49_TX, POWER_BOUND);
> else
> rt2x00_set_field8(&rfcsr, RFCSR49_TX, info->default_power1);
> rt2800_rfcsr_write(rt2x00dev, 49, rfcsr);
>
> if (rt2x00_rt(rt2x00dev, RT5392)) {
> rt2800_rfcsr_read(rt2x00dev, 50, &rfcsr);
> - if (info->default_power1 > RT5390_POWER_BOUND)
> - rt2x00_set_field8(&rfcsr, RFCSR50_TX,
> - RT5390_POWER_BOUND);
> + if (info->default_power1 > POWER_BOUND)
> + rt2x00_set_field8(&rfcsr, RFCSR50_TX, POWER_BOUND);
> else
> rt2x00_set_field8(&rfcsr, RFCSR50_TX,
> info->default_power2);
> @@ -2031,9 +2027,8 @@ static void rt2800_config_channel_rf53xx(struct rt2x00_dev *rt2x00dev,
> rt2800_rfcsr_write(rt2x00dev, 1, rfcsr);
>
> rt2800_rfcsr_read(rt2x00dev, 17, &rfcsr);
> - if (rt2x00dev->freq_offset > RT5390_FREQ_OFFSET_BOUND)
> - rt2x00_set_field8(&rfcsr, RFCSR17_CODE,
> - RT5390_FREQ_OFFSET_BOUND);
> + if (rt2x00dev->freq_offset > FREQ_OFFSET_BOUND)
> + rt2x00_set_field8(&rfcsr, RFCSR17_CODE, FREQ_OFFSET_BOUND);
> else
> rt2x00_set_field8(&rfcsr, RFCSR17_CODE, rt2x00dev->freq_offset);
> rt2800_rfcsr_write(rt2x00dev, 17, rfcsr);
> --
> 1.7.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html

2012-07-10 06:33:56

by Helmut Schaa

[permalink] [raw]
Subject: Re: [PATCH 1/2] rt2x00pci: small 3290 changes cleanup

On Mon, Jul 9, 2012 at 2:41 PM, Stanislaw Gruszka <[email protected]> wrote:
> Fix indention and remove unnecessary brackets and compares.
>
> Signed-off-by: Stanislaw Gruszka <[email protected]>

Thanks for cleaning this up Stanislaw!

Acked-by: Helmut Schaa <[email protected]>

> ---
> drivers/net/wireless/rt2x00/rt2800pci.c | 11 +++++------
> 1 files changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c
> index dd43612..bf0e71e 100644
> --- a/drivers/net/wireless/rt2x00/rt2800pci.c
> +++ b/drivers/net/wireless/rt2x00/rt2800pci.c
> @@ -986,7 +986,7 @@ static int rt2800_enable_wlan_rt3290(struct rt2x00_dev *rt2x00dev)
> int i, count;
>
> rt2800_register_read(rt2x00dev, WLAN_FUN_CTRL, &reg);
> - if ((rt2x00_get_field32(reg, WLAN_EN) == 1))
> + if (rt2x00_get_field32(reg, WLAN_EN))
> return 0;
>
> rt2x00_set_field32(&reg, WLAN_GPIO_OUT_OE_BIT_ALL, 0xff);
> @@ -1004,9 +1004,9 @@ static int rt2800_enable_wlan_rt3290(struct rt2x00_dev *rt2x00dev)
> */
> for (i = 0; i < REGISTER_BUSY_COUNT; i++) {
> rt2800_register_read(rt2x00dev, CMB_CTRL, &reg);
> - if ((rt2x00_get_field32(reg, PLL_LD) == 1) &&
> - (rt2x00_get_field32(reg, XTAL_RDY) == 1))
> - break;
> + if (rt2x00_get_field32(reg, PLL_LD) &&
> + rt2x00_get_field32(reg, XTAL_RDY))
> + break;
> udelay(REGISTER_BUSY_DELAY);
> }
>
> @@ -1022,9 +1022,8 @@ static int rt2800_enable_wlan_rt3290(struct rt2x00_dev *rt2x00dev)
> rt2800_register_write(rt2x00dev, 0x58, 0x618);
> udelay(REGISTER_BUSY_DELAY);
> count++;
> - } else {
> + } else
> count = 0;
> - }
>
> rt2800_register_read(rt2x00dev, WLAN_FUN_CTRL, &reg);
> rt2x00_set_field32(&reg, PCIE_APP0_CLK_REQ, 0);
> --
> 1.7.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html

2012-07-09 12:42:12

by Stanislaw Gruszka

[permalink] [raw]
Subject: [PATCH 2/2] rt2800lib: merge same defines

Merge 3290 and 5390 POWER_BOUND and FREQ_OFFSET_BOUND defines.

Signed-off-by: Stanislaw Gruszka <[email protected]>
---
drivers/net/wireless/rt2x00/rt2800lib.c | 29 ++++++++++++-----------------
1 files changed, 12 insertions(+), 17 deletions(-)

diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index 068276e..e76f03c 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -1940,10 +1940,8 @@ static void rt2800_config_channel_rf3052(struct rt2x00_dev *rt2x00dev,
rt2800_rfcsr_write(rt2x00dev, 7, rfcsr);
}

-#define RT3290_POWER_BOUND 0x27
-#define RT3290_FREQ_OFFSET_BOUND 0x5f
-#define RT5390_POWER_BOUND 0x27
-#define RT5390_FREQ_OFFSET_BOUND 0x5f
+#define POWER_BOUND 0x27
+#define FREQ_OFFSET_BOUND 0x5f

static void rt2800_config_channel_rf3290(struct rt2x00_dev *rt2x00dev,
struct ieee80211_conf *conf,
@@ -1959,16 +1957,15 @@ static void rt2800_config_channel_rf3290(struct rt2x00_dev *rt2x00dev,
rt2800_rfcsr_write(rt2x00dev, 11, rfcsr);

rt2800_rfcsr_read(rt2x00dev, 49, &rfcsr);
- if (info->default_power1 > RT3290_POWER_BOUND)
- rt2x00_set_field8(&rfcsr, RFCSR49_TX, RT3290_POWER_BOUND);
+ if (info->default_power1 > POWER_BOUND)
+ rt2x00_set_field8(&rfcsr, RFCSR49_TX, POWER_BOUND);
else
rt2x00_set_field8(&rfcsr, RFCSR49_TX, info->default_power1);
rt2800_rfcsr_write(rt2x00dev, 49, rfcsr);

rt2800_rfcsr_read(rt2x00dev, 17, &rfcsr);
- if (rt2x00dev->freq_offset > RT3290_FREQ_OFFSET_BOUND)
- rt2x00_set_field8(&rfcsr, RFCSR17_CODE,
- RT3290_FREQ_OFFSET_BOUND);
+ if (rt2x00dev->freq_offset > FREQ_OFFSET_BOUND)
+ rt2x00_set_field8(&rfcsr, RFCSR17_CODE, FREQ_OFFSET_BOUND);
else
rt2x00_set_field8(&rfcsr, RFCSR17_CODE, rt2x00dev->freq_offset);
rt2800_rfcsr_write(rt2x00dev, 17, rfcsr);
@@ -2002,17 +1999,16 @@ static void rt2800_config_channel_rf53xx(struct rt2x00_dev *rt2x00dev,
rt2800_rfcsr_write(rt2x00dev, 11, rfcsr);

rt2800_rfcsr_read(rt2x00dev, 49, &rfcsr);
- if (info->default_power1 > RT5390_POWER_BOUND)
- rt2x00_set_field8(&rfcsr, RFCSR49_TX, RT5390_POWER_BOUND);
+ if (info->default_power1 > POWER_BOUND)
+ rt2x00_set_field8(&rfcsr, RFCSR49_TX, POWER_BOUND);
else
rt2x00_set_field8(&rfcsr, RFCSR49_TX, info->default_power1);
rt2800_rfcsr_write(rt2x00dev, 49, rfcsr);

if (rt2x00_rt(rt2x00dev, RT5392)) {
rt2800_rfcsr_read(rt2x00dev, 50, &rfcsr);
- if (info->default_power1 > RT5390_POWER_BOUND)
- rt2x00_set_field8(&rfcsr, RFCSR50_TX,
- RT5390_POWER_BOUND);
+ if (info->default_power1 > POWER_BOUND)
+ rt2x00_set_field8(&rfcsr, RFCSR50_TX, POWER_BOUND);
else
rt2x00_set_field8(&rfcsr, RFCSR50_TX,
info->default_power2);
@@ -2031,9 +2027,8 @@ static void rt2800_config_channel_rf53xx(struct rt2x00_dev *rt2x00dev,
rt2800_rfcsr_write(rt2x00dev, 1, rfcsr);

rt2800_rfcsr_read(rt2x00dev, 17, &rfcsr);
- if (rt2x00dev->freq_offset > RT5390_FREQ_OFFSET_BOUND)
- rt2x00_set_field8(&rfcsr, RFCSR17_CODE,
- RT5390_FREQ_OFFSET_BOUND);
+ if (rt2x00dev->freq_offset > FREQ_OFFSET_BOUND)
+ rt2x00_set_field8(&rfcsr, RFCSR17_CODE, FREQ_OFFSET_BOUND);
else
rt2x00_set_field8(&rfcsr, RFCSR17_CODE, rt2x00dev->freq_offset);
rt2800_rfcsr_write(rt2x00dev, 17, rfcsr);
--
1.7.1


2012-07-10 10:09:47

by Veli-Pekka Peltola

[permalink] [raw]
Subject: Re: [PATCH 1/2] rt2x00pci: small 3290 changes cleanup

On 07/09/2012 03:41 PM, Stanislaw Gruszka wrote:
> Fix indention and remove unnecessary brackets and compares.

Hi,

Otherwise looks ok but I have a one comment, see below.

> Signed-off-by: Stanislaw Gruszka <[email protected]>
> ---
> drivers/net/wireless/rt2x00/rt2800pci.c | 11 +++++------
> 1 files changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c
> index dd43612..bf0e71e 100644
> --- a/drivers/net/wireless/rt2x00/rt2800pci.c
> +++ b/drivers/net/wireless/rt2x00/rt2800pci.c

<snip>

> @@ -1022,9 +1022,8 @@ static int rt2800_enable_wlan_rt3290(struct rt2x00_dev *rt2x00dev)
> rt2800_register_write(rt2x00dev, 0x58, 0x618);
> udelay(REGISTER_BUSY_DELAY);
> count++;
> - } else {
> + } else
> count = 0;
> - }

I have understood that Linux CodingStyle requires braces on all else/if
branches if any of those have more than one statement. So I would not
remove braces here.

--
Veli-Pekka Peltola