Skip to contentSkip to conversation

Staging: rtl8188eu: Replace if-else block with switch-case

PATCH In review Vatika Harlalka 2 participants 2 messages Feb 26, 2015 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: rtl8188eu: Replace if-else block with switch-case

Replace if-else block with switch-case to make it more compact and increase readability.

---
 drivers/staging/rtl8188eu/hal/bb_cfg.c | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)
drivers/staging/rtl8188eu/hal/bb_cfg.c +16 -8
index 1e963bf..baebe35 100644
@@ -552,21 +552,29 @@ static void store_pwrindex_offset(struct adapter *Adapter, u32 regaddr, u32 bitm
 	}
 }
 
-static void rtl_addr_delay(struct adapter *adapt, u32 addr, u32 bit_mask, u32 data)
+static void rtl_addr_delay(struct adapter *adapt,
+			u32 addr, u32 bit_mask, u32 data)
 {
-	if (addr == 0xfe) {
+	switch (addr) {
+	case 0xfe:
 		msleep(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);
-	} else{
+		break;
+	default:
 		store_pwrindex_offset(adapt, addr, bit_mask, data);
 	}
 }
Signature · 1 line
1.9.1