All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2 v2] Refactor code to increase readability
@ 2015-02-24  7:24 Vatika Harlalka
  2015-02-24  7:25 ` [PATCH 1/2 v2] Introduce new macro Vatika Harlalka
  2015-02-24  7:26 ` [PATCH 2/2 v2] Staging: rtl8188eu: Refactor code to increase readability Vatika Harlalka
  0 siblings, 2 replies; 7+ messages in thread
From: Vatika Harlalka @ 2015-02-24  7:24 UTC (permalink / raw)
  To: outreachy-kernel

The function get_right_chnl_for_iqk only requires Wifi channels
from the 5GHz spectrum. Therefore, the 14 2GHz channels 
can be removed.

Vatika Harlalka (2):
  Staging: rtl8188eu: Introduce new macro
  Staging: rtl8188eu: Refactor code to increase readability

 drivers/staging/rtl8188eu/hal/phy.c     | 11 +++++------
 drivers/staging/rtl8188eu/include/phy.h |  1 +
 2 files changed, 6 insertions(+), 6 deletions(-)

-- 
1.9.1



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

* [PATCH 1/2 v2] Introduce new macro
  2015-02-24  7:24 [PATCH 0/2 v2] Refactor code to increase readability Vatika Harlalka
@ 2015-02-24  7:25 ` Vatika Harlalka
  2015-02-24  7:40   ` [Outreachy kernel] " Greg KH
  2015-02-24  7:26 ` [PATCH 2/2 v2] Staging: rtl8188eu: Refactor code to increase readability Vatika Harlalka
  1 sibling, 1 reply; 7+ messages in thread
From: Vatika Harlalka @ 2015-02-24  7:25 UTC (permalink / raw)
  To: outreachy-kernel

New macro is introduced for the number of channels in the
5GHz spectrum.

Signed-off-by: Vatika Harlalka <vatikaharlalka@gmail.com>
---
 drivers/staging/rtl8188eu/include/phy.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/rtl8188eu/include/phy.h b/drivers/staging/rtl8188eu/include/phy.h
index 9a9ab82..1312189 100644
--- a/drivers/staging/rtl8188eu/include/phy.h
+++ b/drivers/staging/rtl8188eu/include/phy.h
@@ -4,6 +4,7 @@
 #define index_mapping_NUM_88E	    15
 #define AVG_THERMAL_NUM_88E	    4
 #define ODM_TARGET_CHNL_NUM_2G_5G   59
+#define ODM_TARGET_CHNL_NUM_5G	    45
 
 bool rtl88eu_phy_mac_config(struct adapter *adapt);
 bool rtl88eu_phy_rf_config(struct adapter *adapt);
-- 
1.9.1



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

* [PATCH 2/2 v2] Staging: rtl8188eu: Refactor code to increase readability
  2015-02-24  7:24 [PATCH 0/2 v2] Refactor code to increase readability Vatika Harlalka
  2015-02-24  7:25 ` [PATCH 1/2 v2] Introduce new macro Vatika Harlalka
@ 2015-02-24  7:26 ` Vatika Harlalka
  1 sibling, 0 replies; 7+ messages in thread
From: Vatika Harlalka @ 2015-02-24  7:26 UTC (permalink / raw)
  To: outreachy-kernel

Reduce the array size and modify the loop
counter so as to start from 0.
Also, the assignment of variable place is redundant as it is
initialized again in the loop.


Signed-off-by: Vatika Harlalka <vatikaharlalka@gmail.com>
---
 drivers/staging/rtl8188eu/hal/phy.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8188eu/hal/phy.c b/drivers/staging/rtl8188eu/hal/phy.c
index a1a9ebf..a91bc6d 100644
--- a/drivers/staging/rtl8188eu/hal/phy.c
+++ b/drivers/staging/rtl8188eu/hal/phy.c
@@ -386,19 +386,18 @@ void phy_sw_chnl(struct adapter *adapt, u8 channel)
 
 static u8 get_right_chnl_for_iqk(u8 chnl)
 {
-	u8 channel_all[ODM_TARGET_CHNL_NUM_2G_5G] = {
-		1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+	u8 place;
+	u8 channel_5g[ODM_TARGET_CHNL_NUM_5G] = {
 		36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64,
 		100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122,
 		124, 126, 128, 130, 132, 134, 136, 138, 140, 149, 151, 153,
 		155, 157, 159, 161, 163, 165
 	};
-	u8 place = chnl;
 
 	if (chnl > 14) {
-		for (place = 14; place < sizeof(channel_all); place++) {
-			if (channel_all[place] == chnl)
-				return place-13;
+		for (place = 0; place < sizeof(channel_5g); place++) {
+			if (channel_5g[place] == chnl)
+				return ++place;
 		}
 	}
 	return 0;
-- 
1.9.1



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

* Re: [Outreachy kernel] [PATCH 1/2 v2] Introduce new macro
  2015-02-24  7:25 ` [PATCH 1/2 v2] Introduce new macro Vatika Harlalka
@ 2015-02-24  7:40   ` Greg KH
  2015-02-24  7:57     ` Vatika Harlalka
  0 siblings, 1 reply; 7+ messages in thread
From: Greg KH @ 2015-02-24  7:40 UTC (permalink / raw)
  To: Vatika Harlalka; +Cc: outreachy-kernel

On Tue, Feb 24, 2015 at 12:55:05PM +0530, Vatika Harlalka wrote:
> New macro is introduced for the number of channels in the
> 5GHz spectrum.
> 
> Signed-off-by: Vatika Harlalka <vatikaharlalka@gmail.com>
> ---
>  drivers/staging/rtl8188eu/include/phy.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/staging/rtl8188eu/include/phy.h b/drivers/staging/rtl8188eu/include/phy.h
> index 9a9ab82..1312189 100644
> --- a/drivers/staging/rtl8188eu/include/phy.h
> +++ b/drivers/staging/rtl8188eu/include/phy.h
> @@ -4,6 +4,7 @@
>  #define index_mapping_NUM_88E	    15
>  #define AVG_THERMAL_NUM_88E	    4
>  #define ODM_TARGET_CHNL_NUM_2G_5G   59
> +#define ODM_TARGET_CHNL_NUM_5G	    45

Why do you need this?  You aren't using it in this patch :(


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

* Re: [Outreachy kernel] [PATCH 1/2 v2] Introduce new macro
  2015-02-24  7:40   ` [Outreachy kernel] " Greg KH
@ 2015-02-24  7:57     ` Vatika Harlalka
  2015-02-24 14:18       ` Greg KH
  0 siblings, 1 reply; 7+ messages in thread
From: Vatika Harlalka @ 2015-02-24  7:57 UTC (permalink / raw)
  To: Greg KH; +Cc: outreachy-kernel

[-- Attachment #1: Type: text/plain, Size: 331 bytes --]

Hi, thanks for your response!

I'm using this macro in  /rtl8188eu/hal/phy.c ( in patch 2/2 ).
> u8 channel_5g[ODM_TARGET_CHNL_NUM_5G]
However, based on your response, I will make this array static const int,
so I won't explicitly declare the size.
Should I resend a patch for this with just that fix?

Thanks a lot for your help!

[-- Attachment #2: Type: text/html, Size: 457 bytes --]

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

* Re: [Outreachy kernel] [PATCH 1/2 v2] Introduce new macro
  2015-02-24  7:57     ` Vatika Harlalka
@ 2015-02-24 14:18       ` Greg KH
  2015-02-26 12:26         ` Vatika Harlalka
  0 siblings, 1 reply; 7+ messages in thread
From: Greg KH @ 2015-02-24 14:18 UTC (permalink / raw)
  To: Vatika Harlalka; +Cc: outreachy-kernel

On Tue, Feb 24, 2015 at 01:27:46PM +0530, Vatika Harlalka wrote:
> Hi, thanks for your response!
> 
> I'm using this macro in� /rtl8188eu/hal/phy.c ( in patch 2/2 ).
> > u8 channel_5g[ODM_TARGET_CHNL_NUM_5G]
> However, based on your response, I will make this array static const int,
> so I won't explicitly declare the size.
> Should I resend a patch for this with just that fix?

Why 'int'?

And watch out for your email client settings, you are sending html email
which the linux-kernel mailing lists will reject.

thanks,

greg k-h


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

* Re: [Outreachy kernel] [PATCH 1/2 v2] Introduce new macro
  2015-02-24 14:18       ` Greg KH
@ 2015-02-26 12:26         ` Vatika Harlalka
  0 siblings, 0 replies; 7+ messages in thread
From: Vatika Harlalka @ 2015-02-26 12:26 UTC (permalink / raw)
  To: Greg KH; +Cc: outreachy-kernel

[-- Attachment #1: Type: text/plain, Size: 136 bytes --]

Oh sorry, if the array is declared as static const u8, the additional macro
will not be required as we do not need the size in advance.

[-- Attachment #2: Type: text/html, Size: 172 bytes --]

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

end of thread, other threads:[~2015-02-26 12:26 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-24  7:24 [PATCH 0/2 v2] Refactor code to increase readability Vatika Harlalka
2015-02-24  7:25 ` [PATCH 1/2 v2] Introduce new macro Vatika Harlalka
2015-02-24  7:40   ` [Outreachy kernel] " Greg KH
2015-02-24  7:57     ` Vatika Harlalka
2015-02-24 14:18       ` Greg KH
2015-02-26 12:26         ` Vatika Harlalka
2015-02-24  7:26 ` [PATCH 2/2 v2] Staging: rtl8188eu: Refactor code to increase readability Vatika Harlalka

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.