netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 2/2] rtlwifi: Fix reusable codes in core.c
@ 2016-02-03  2:16 Byeoungwook Kim
  2016-02-03 19:46 ` Larry Finger
  0 siblings, 1 reply; 2+ messages in thread
From: Byeoungwook Kim @ 2016-02-03  2:16 UTC (permalink / raw)
  To: Larry.Finger; +Cc: kvalo, chaoming_li, linux-wireless, netdev, linux-kernel

rtl_*_delay() functions were reused same codes about addr variable.
So i have converted to rtl_addr_delay() from code about addr variable.

Signed-off-by: Byeoungwook Kim <quddnr145@gmail.com>
Reviewed-by: Julian Calaby <julian.calaby@gmail.com>
---
V2 split in separate patchs.
 drivers/net/wireless/realtek/rtlwifi/core.c | 28 ++++------------------------
 1 file changed, 4 insertions(+), 24 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/core.c b/drivers/net/wireless/realtek/rtlwifi/core.c
index 05f432c..c1193d1 100644
--- a/drivers/net/wireless/realtek/rtlwifi/core.c
+++ b/drivers/net/wireless/realtek/rtlwifi/core.c
@@ -63,18 +63,8 @@ EXPORT_SYMBOL(rtl_addr_delay);
 void rtl_rfreg_delay(struct ieee80211_hw *hw, enum radio_path rfpath, u32 addr,
 		     u32 mask, u32 data)
 {
-	if (addr == 0xfe) {
-		mdelay(50);
-	} else if (addr == 0xfd) {
-		mdelay(5);
-	} else if (addr == 0xfc) {
-		mdelay(1);
-	} else if (addr == 0xfb) {
-		udelay(50);
-	} else if (addr == 0xfa) {
-		udelay(5);
-	} else if (addr == 0xf9) {
-		udelay(1);
+	if (addr >= 0xf9 && addr <= 0xfe) {
+		rtl_addr_delay(addr);
 	} else {
 		rtl_set_rfreg(hw, rfpath, addr, mask, data);
 		udelay(1);
@@ -84,18 +74,8 @@ EXPORT_SYMBOL(rtl_rfreg_delay);
 
 void rtl_bb_delay(struct ieee80211_hw *hw, u32 addr, u32 data)
 {
-	if (addr == 0xfe) {
-		mdelay(50);
-	} else if (addr == 0xfd) {
-		mdelay(5);
-	} else if (addr == 0xfc) {
-		mdelay(1);
-	} else if (addr == 0xfb) {
-		udelay(50);
-	} else if (addr == 0xfa) {
-		udelay(5);
-	} else if (addr == 0xf9) {
-		udelay(1);
+	if (addr >= 0xf9 && addr <= 0xfe) {
+		rtl_addr_delay(addr);
 	} else {
 		rtl_set_bbreg(hw, addr, MASKDWORD, data);
 		udelay(1);
-- 
2.5.0

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

* Re: [PATCH v2 2/2] rtlwifi: Fix reusable codes in core.c
  2016-02-03  2:16 [PATCH v2 2/2] rtlwifi: Fix reusable codes in core.c Byeoungwook Kim
@ 2016-02-03 19:46 ` Larry Finger
  0 siblings, 0 replies; 2+ messages in thread
From: Larry Finger @ 2016-02-03 19:46 UTC (permalink / raw)
  To: Byeoungwook Kim; +Cc: kvalo, chaoming_li, linux-wireless, netdev, linux-kernel

On 02/02/2016 08:16 PM, Byeoungwook Kim wrote:
> rtl_*_delay() functions were reused same codes about addr variable.
> So i have converted to rtl_addr_delay() from code about addr variable.
>
> Signed-off-by: Byeoungwook Kim <quddnr145@gmail.com>
> Reviewed-by: Julian Calaby <julian.calaby@gmail.com>
> ---
> V2 split in separate patchs.
>   drivers/net/wireless/realtek/rtlwifi/core.c | 28 ++++------------------------
>   1 file changed, 4 insertions(+), 24 deletions(-)
>
> diff --git a/drivers/net/wireless/realtek/rtlwifi/core.c b/drivers/net/wireless/realtek/rtlwifi/core.c
> index 05f432c..c1193d1 100644
> --- a/drivers/net/wireless/realtek/rtlwifi/core.c
> +++ b/drivers/net/wireless/realtek/rtlwifi/core.c
> @@ -63,18 +63,8 @@ EXPORT_SYMBOL(rtl_addr_delay);
>   void rtl_rfreg_delay(struct ieee80211_hw *hw, enum radio_path rfpath, u32 addr,
>   		     u32 mask, u32 data)
>   {
> -	if (addr == 0xfe) {
> -		mdelay(50);
> -	} else if (addr == 0xfd) {
> -		mdelay(5);
> -	} else if (addr == 0xfc) {
> -		mdelay(1);
> -	} else if (addr == 0xfb) {
> -		udelay(50);
> -	} else if (addr == 0xfa) {
> -		udelay(5);
> -	} else if (addr == 0xf9) {
> -		udelay(1);
> +	if (addr >= 0xf9 && addr <= 0xfe) {
> +		rtl_addr_delay(addr);
>   	} else {
>   		rtl_set_rfreg(hw, rfpath, addr, mask, data);
>   		udelay(1);
> @@ -84,18 +74,8 @@ EXPORT_SYMBOL(rtl_rfreg_delay);
>
>   void rtl_bb_delay(struct ieee80211_hw *hw, u32 addr, u32 data)
>   {
> -	if (addr == 0xfe) {
> -		mdelay(50);
> -	} else if (addr == 0xfd) {
> -		mdelay(5);
> -	} else if (addr == 0xfc) {
> -		mdelay(1);
> -	} else if (addr == 0xfb) {
> -		udelay(50);
> -	} else if (addr == 0xfa) {
> -		udelay(5);
> -	} else if (addr == 0xf9) {
> -		udelay(1);
> +	if (addr >= 0xf9 && addr <= 0xfe) {
> +		rtl_addr_delay(addr);
>   	} else {
>   		rtl_set_bbreg(hw, addr, MASKDWORD, data);
>   		udelay(1);
>

Unlike patch 1 of 2, this one makes changes that are good. Thus

Acked-by: Larry Finger <Larry.finger@lwfinger.net>

Thanks,

Larry

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

end of thread, other threads:[~2016-02-03 19:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-03  2:16 [PATCH v2 2/2] rtlwifi: Fix reusable codes in core.c Byeoungwook Kim
2016-02-03 19:46 ` Larry Finger

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