netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] rtlwifi: Fix improve function 'rtl_addr_delay()' in core.c
@ 2016-02-03  1:59 Byeoungwook Kim
  2016-02-03  2:07 ` Julian Calaby
  2016-02-03 14:41 ` David Laight
  0 siblings, 2 replies; 8+ messages in thread
From: Byeoungwook Kim @ 2016-02-03  1:59 UTC (permalink / raw)
  To: Larry.Finger; +Cc: kvalo, chaoming_li, linux-wireless, netdev, linux-kernel

Conditional codes in rtl_addr_delay() were improved in readability and
performance by using switch codes.

Signed-off-by: Byeoungwook Kim <quddnr145@gmail.com>
Reported-by: Julian Calaby <julian.calaby@gmail.com>
---
 drivers/net/wireless/realtek/rtlwifi/core.c | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/core.c b/drivers/net/wireless/realtek/rtlwifi/core.c
index 4ae421e..05f432c 100644
--- a/drivers/net/wireless/realtek/rtlwifi/core.c
+++ b/drivers/net/wireless/realtek/rtlwifi/core.c
@@ -37,18 +37,26 @@
 
 void rtl_addr_delay(u32 addr)
 {
-	if (addr == 0xfe)
+	switch (addr) {
+	case 0xfe:
 		mdelay(50);
-	else if (addr == 0xfd)
+		break;
+	case 0xfd:
 		mdelay(5);
-	else if (addr == 0xfc)
+		break;
+	case 0xfc:
 		mdelay(1);
-	else if (addr == 0xfb)
+		break;
+	case 0xfb:
 		udelay(50);
-	else if (addr == 0xfa)
+		break;
+	case 0xfa:
 		udelay(5);
-	else if (addr == 0xf9)
+		break;
+	case 0xf9:
 		udelay(1);
+		break;
+	};
 }
 EXPORT_SYMBOL(rtl_addr_delay);
 
-- 
2.5.0

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

end of thread, other threads:[~2016-02-04 16:02 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-03  1:59 [PATCH 1/2] rtlwifi: Fix improve function 'rtl_addr_delay()' in core.c Byeoungwook Kim
2016-02-03  2:07 ` Julian Calaby
2016-02-03 14:41 ` David Laight
2016-02-03 17:49   ` ByeoungWook Kim
2016-02-03 19:44     ` Larry Finger
2016-02-04  9:48       ` David Laight
2016-02-04 15:43         ` Larry Finger
2016-02-04 16:02           ` David Laight

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