b43-dev.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [patch] b43: N-PHY: fix gain in b43_nphy_get_gain_ctl_workaround_ent()
@ 2013-01-13 20:03 Dan Carpenter
  2013-01-14 20:04 ` John W. Linville
  0 siblings, 1 reply; 7+ messages in thread
From: Dan Carpenter @ 2013-01-13 20:03 UTC (permalink / raw)
  To: Stefano Brivio; +Cc: John W. Linville, linux-wireless, b43-dev, kernel-janitors

There were no break statements in this switch statement so everything
used the default settings.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
Static checker stuff.  Untested.

diff --git a/drivers/net/wireless/b43/tables_nphy.c b/drivers/net/wireless/b43/tables_nphy.c
index 97d4e27..6a1c838 100644
--- a/drivers/net/wireless/b43/tables_nphy.c
+++ b/drivers/net/wireless/b43/tables_nphy.c
@@ -3259,20 +3259,28 @@ struct nphy_gain_ctl_workaround_entry *b43_nphy_get_gain_ctl_workaround_ent(
 		switch (tr_iso) {
 		case 0:
 			e->cliplo_gain = 0x0062;
+			break;
 		case 1:
 			e->cliplo_gain = 0x0064;
+			break;
 		case 2:
 			e->cliplo_gain = 0x006a;
+			break;
 		case 3:
 			e->cliplo_gain = 0x106a;
+			break;
 		case 4:
 			e->cliplo_gain = 0x106c;
+			break;
 		case 5:
 			e->cliplo_gain = 0x1074;
+			break;
 		case 6:
 			e->cliplo_gain = 0x107c;
+			break;
 		case 7:
 			e->cliplo_gain = 0x207c;
+			break;
 		default:
 			e->cliplo_gain = 0x106a;
 		}

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [patch] b43: N-PHY: fix gain in b43_nphy_get_gain_ctl_workaround_ent()
  2013-01-13 20:03 [patch] b43: N-PHY: fix gain in b43_nphy_get_gain_ctl_workaround_ent() Dan Carpenter
@ 2013-01-14 20:04 ` John W. Linville
  2013-01-17 19:03   ` walter harms
  0 siblings, 1 reply; 7+ messages in thread
From: John W. Linville @ 2013-01-14 20:04 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Stefano Brivio, linux-wireless, b43-dev, kernel-janitors

On Sun, Jan 13, 2013 at 11:03:09PM +0300, Dan Carpenter wrote:
> There were no break statements in this switch statement so everything
> used the default settings.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> Static checker stuff.  Untested.
> 
> diff --git a/drivers/net/wireless/b43/tables_nphy.c b/drivers/net/wireless/b43/tables_nphy.c
> index 97d4e27..6a1c838 100644
> --- a/drivers/net/wireless/b43/tables_nphy.c
> +++ b/drivers/net/wireless/b43/tables_nphy.c
> @@ -3259,20 +3259,28 @@ struct nphy_gain_ctl_workaround_entry *b43_nphy_get_gain_ctl_workaround_ent(
>  		switch (tr_iso) {
>  		case 0:
>  			e->cliplo_gain = 0x0062;
> +			break;
>  		case 1:
>  			e->cliplo_gain = 0x0064;
> +			break;
>  		case 2:
>  			e->cliplo_gain = 0x006a;
> +			break;
>  		case 3:
>  			e->cliplo_gain = 0x106a;
> +			break;
>  		case 4:
>  			e->cliplo_gain = 0x106c;
> +			break;
>  		case 5:
>  			e->cliplo_gain = 0x1074;
> +			break;
>  		case 6:
>  			e->cliplo_gain = 0x107c;
> +			break;
>  		case 7:
>  			e->cliplo_gain = 0x207c;
> +			break;
>  		default:
>  			e->cliplo_gain = 0x106a;
>  		}

Wow...nice find!

This seems like it could be significant.  Any comments from the
b43 folks?  Should this go to 3.8?

John
-- 
John W. Linville		Someday the world will need a hero, and you
linville at tuxdriver.com			might be all we have.  Be ready.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [patch] b43: N-PHY: fix gain in b43_nphy_get_gain_ctl_workaround_ent()
  2013-01-14 20:04 ` John W. Linville
@ 2013-01-17 19:03   ` walter harms
  2013-01-18 13:36     ` [patch v2] " Dan Carpenter
  0 siblings, 1 reply; 7+ messages in thread
From: walter harms @ 2013-01-17 19:03 UTC (permalink / raw)
  To: John W. Linville
  Cc: Dan Carpenter, Stefano Brivio, linux-wireless, b43-dev,
	kernel-janitors



Am 14.01.2013 21:04, schrieb John W. Linville:
> On Sun, Jan 13, 2013 at 11:03:09PM +0300, Dan Carpenter wrote:
>> There were no break statements in this switch statement so everything
>> used the default settings.

great :)

>>
>> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>> ---
>> Static checker stuff.  Untested.
>>
>> diff --git a/drivers/net/wireless/b43/tables_nphy.c b/drivers/net/wireless/b43/tables_nphy.c
>> index 97d4e27..6a1c838 100644
>> --- a/drivers/net/wireless/b43/tables_nphy.c
>> +++ b/drivers/net/wireless/b43/tables_nphy.c
>> @@ -3259,20 +3259,28 @@ struct nphy_gain_ctl_workaround_entry *b43_nphy_get_gain_ctl_workaround_ent(
>>  		switch (tr_iso) {
>>  		case 0:
>>  			e->cliplo_gain = 0x0062;
>> +			break;
>>  		case 1:
>>  			e->cliplo_gain = 0x0064;
>> +			break;
>>  		case 2:
>>  			e->cliplo_gain = 0x006a;
>> +			break;
>>  		case 3:
>>  			e->cliplo_gain = 0x106a;
>> +			break;
>>  		case 4:
>>  			e->cliplo_gain = 0x106c;
>> +			break;
>>  		case 5:
>>  			e->cliplo_gain = 0x1074;
>> +			break;
>>  		case 6:
>>  			e->cliplo_gain = 0x107c;
>> +			break;
>>  		case 7:
>>  			e->cliplo_gain = 0x207c;
>> +			break;
>>  		default:
>>  			e->cliplo_gain = 0x106a;
>>  		}
> 
> Wow...nice find!
> 
> This seems like it could be significant.  Any comments from the
> b43 folks?  Should this go to 3.8?
> 

perhaps an array would be more simple here ?


if (tr_iso > 7 )
 e->cliplo_gain = 0x106a;
{
 int data[]={0x0062,0x0064,0x006a,0x106a,0x106c,0x1074,0x107c,0x207c};
  e->cliplo_gain = data[tr_iso];

}

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [patch v2] b43: N-PHY: fix gain in b43_nphy_get_gain_ctl_workaround_ent()
  2013-01-17 19:03   ` walter harms
@ 2013-01-18 13:36     ` Dan Carpenter
  2013-01-18 13:53       ` David Laight
  0 siblings, 1 reply; 7+ messages in thread
From: Dan Carpenter @ 2013-01-18 13:36 UTC (permalink / raw)
  To: Stefano Brivio
  Cc: John W. Linville, linux-wireless, b43-dev, netdev, linux-kernel,
	kernel-janitors

There were no break statements in this switch statement so everything
used the default settings.  Per Walter Harms's suggestion, I've replaced
the switch statement and done a little cleanup.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
v2: Additional cleanups.

diff --git a/drivers/net/wireless/b43/tables_nphy.c b/drivers/net/wireless/b43/tables_nphy.c
index 97d4e27..99567db 100644
--- a/drivers/net/wireless/b43/tables_nphy.c
+++ b/drivers/net/wireless/b43/tables_nphy.c
@@ -3226,8 +3226,6 @@ struct nphy_gain_ctl_workaround_entry *b43_nphy_get_gain_ctl_workaround_ent(
 {
 	struct nphy_gain_ctl_workaround_entry *e;
 	u8 phy_idx;
-	u8 tr_iso = ghz5 ? dev->dev->bus_sprom->fem.ghz5.tr_iso :
-			   dev->dev->bus_sprom->fem.ghz2.tr_iso;
 
 	if (!ghz5 && dev->phy.rev >= 6 && dev->phy.radio_rev == 11)
 		return &nphy_gain_ctl_wa_phy6_radio11_ghz2;
@@ -3249,6 +3247,10 @@ struct nphy_gain_ctl_workaround_entry *b43_nphy_get_gain_ctl_workaround_ent(
 		    !b43_channel_type_is_40mhz(dev->phy.channel_type))
 			e->cliplo_gain = 0x2d;
 	} else if (!ghz5 && dev->phy.rev >= 5) {
+		int gain_data[] = {0x0062, 0x0064, 0x006a, 0x106a, 0x106c,
+				   0x1074, 0x107c, 0x207c};
+		u8 tr_iso = dev->dev->bus_sprom->fem.ghz2.tr_iso;
+
 		if (ext_lna) {
 			e->rfseq_init[0] &= ~0x4000;
 			e->rfseq_init[1] &= ~0x4000;
@@ -3256,26 +3258,10 @@ struct nphy_gain_ctl_workaround_entry *b43_nphy_get_gain_ctl_workaround_ent(
 			e->rfseq_init[3] &= ~0x4000;
 			e->init_gain &= ~0x4000;
 		}
-		switch (tr_iso) {
-		case 0:
-			e->cliplo_gain = 0x0062;
-		case 1:
-			e->cliplo_gain = 0x0064;
-		case 2:
-			e->cliplo_gain = 0x006a;
-		case 3:
-			e->cliplo_gain = 0x106a;
-		case 4:
-			e->cliplo_gain = 0x106c;
-		case 5:
-			e->cliplo_gain = 0x1074;
-		case 6:
-			e->cliplo_gain = 0x107c;
-		case 7:
-			e->cliplo_gain = 0x207c;
-		default:
-			e->cliplo_gain = 0x106a;
-		}
+		if (tr_iso > 7)
+			tr_iso = 3;
+		e->cliplo_gain = gain_data[tr_iso];
+
 	} else if (ghz5 && dev->phy.rev == 4 && ext_lna) {
 		e->rfseq_init[0] &= ~0x4000;
 		e->rfseq_init[1] &= ~0x4000;

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [patch v2] b43: N-PHY: fix gain in b43_nphy_get_gain_ctl_workaround_ent()
  2013-01-18 13:36     ` [patch v2] " Dan Carpenter
@ 2013-01-18 13:53       ` David Laight
  2013-01-20 16:31         ` [patch v3] " Dan Carpenter
  0 siblings, 1 reply; 7+ messages in thread
From: David Laight @ 2013-01-18 13:53 UTC (permalink / raw)
  To: Dan Carpenter, Stefano Brivio
  Cc: John W. Linville, linux-wireless, b43-dev, netdev, linux-kernel,
	kernel-janitors

> +		int gain_data[] = {0x0062, 0x0064, 0x006a, 0x106a, 0x106c,
> +				   0x1074, 0x107c, 0x207c};

static const int ...

	David

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [patch v3] b43: N-PHY: fix gain in b43_nphy_get_gain_ctl_workaround_ent()
  2013-01-18 13:53       ` David Laight
@ 2013-01-20 16:31         ` Dan Carpenter
  2013-01-20 21:01           ` Rafał Miłecki
  0 siblings, 1 reply; 7+ messages in thread
From: Dan Carpenter @ 2013-01-20 16:31 UTC (permalink / raw)
  To: Stefano Brivio
  Cc: John W. Linville, linux-wireless, b43-dev, netdev, linux-kernel,
	David Laight, kernel-janitors

There were no break statements in this switch statement so everything
used the default settings.  Per Walter Harms's suggestion, I've replaced
the switch statement and done a little cleanup.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
v2: Make additional style fixes as well while we're messing with the
    function.
v3: Make the array static const int.

diff --git a/drivers/net/wireless/b43/tables_nphy.c b/drivers/net/wireless/b43/tables_nphy.c
index 97d4e27..aaca60c 100644
--- a/drivers/net/wireless/b43/tables_nphy.c
+++ b/drivers/net/wireless/b43/tables_nphy.c
@@ -3226,8 +3226,6 @@ struct nphy_gain_ctl_workaround_entry *b43_nphy_get_gain_ctl_workaround_ent(
 {
 	struct nphy_gain_ctl_workaround_entry *e;
 	u8 phy_idx;
-	u8 tr_iso = ghz5 ? dev->dev->bus_sprom->fem.ghz5.tr_iso :
-			   dev->dev->bus_sprom->fem.ghz2.tr_iso;
 
 	if (!ghz5 && dev->phy.rev >= 6 && dev->phy.radio_rev == 11)
 		return &nphy_gain_ctl_wa_phy6_radio11_ghz2;
@@ -3249,6 +3247,10 @@ struct nphy_gain_ctl_workaround_entry *b43_nphy_get_gain_ctl_workaround_ent(
 		    !b43_channel_type_is_40mhz(dev->phy.channel_type))
 			e->cliplo_gain = 0x2d;
 	} else if (!ghz5 && dev->phy.rev >= 5) {
+		static const int gain_data[] = {0x0062, 0x0064, 0x006a, 0x106a,
+						0x106c, 0x1074, 0x107c, 0x207c};
+		u8 tr_iso = dev->dev->bus_sprom->fem.ghz2.tr_iso;
+
 		if (ext_lna) {
 			e->rfseq_init[0] &= ~0x4000;
 			e->rfseq_init[1] &= ~0x4000;
@@ -3256,26 +3258,10 @@ struct nphy_gain_ctl_workaround_entry *b43_nphy_get_gain_ctl_workaround_ent(
 			e->rfseq_init[3] &= ~0x4000;
 			e->init_gain &= ~0x4000;
 		}
-		switch (tr_iso) {
-		case 0:
-			e->cliplo_gain = 0x0062;
-		case 1:
-			e->cliplo_gain = 0x0064;
-		case 2:
-			e->cliplo_gain = 0x006a;
-		case 3:
-			e->cliplo_gain = 0x106a;
-		case 4:
-			e->cliplo_gain = 0x106c;
-		case 5:
-			e->cliplo_gain = 0x1074;
-		case 6:
-			e->cliplo_gain = 0x107c;
-		case 7:
-			e->cliplo_gain = 0x207c;
-		default:
-			e->cliplo_gain = 0x106a;
-		}
+		if (tr_iso > 7)
+			tr_iso = 3;
+		e->cliplo_gain = gain_data[tr_iso];
+
 	} else if (ghz5 && dev->phy.rev == 4 && ext_lna) {
 		e->rfseq_init[0] &= ~0x4000;
 		e->rfseq_init[1] &= ~0x4000;

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [patch v3] b43: N-PHY: fix gain in b43_nphy_get_gain_ctl_workaround_ent()
  2013-01-20 16:31         ` [patch v3] " Dan Carpenter
@ 2013-01-20 21:01           ` Rafał Miłecki
  0 siblings, 0 replies; 7+ messages in thread
From: Rafał Miłecki @ 2013-01-20 21:01 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Stefano Brivio, John W. Linville, linux-wireless, b43-dev, netdev,
	linux-kernel, David Laight, kernel-janitors

2013/1/20 Dan Carpenter <dan.carpenter@oracle.com>:
> There were no break statements in this switch statement so everything
> used the default settings.  Per Walter Harms's suggestion, I've replaced
> the switch statement and done a little cleanup.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> v2: Make additional style fixes as well while we're messing with the
>     function.
> v3: Make the array static const int.

Looks fine, thanks Dan

-- 
Rafa?

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-01-20 21:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-13 20:03 [patch] b43: N-PHY: fix gain in b43_nphy_get_gain_ctl_workaround_ent() Dan Carpenter
2013-01-14 20:04 ` John W. Linville
2013-01-17 19:03   ` walter harms
2013-01-18 13:36     ` [patch v2] " Dan Carpenter
2013-01-18 13:53       ` David Laight
2013-01-20 16:31         ` [patch v3] " Dan Carpenter
2013-01-20 21:01           ` Rafał Miłecki

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).