From 65c3f000133ae375f34772d5e59f8aee28fbac9a Mon Sep 17 00:00:00 2001 From: Chris Park Date: Thu, 4 Feb 2016 18:15:54 +0900 Subject: staging: wilc1000: Optimize code of wilc_get_chipid function This patch optimize code of wilc_get_chipid function. u8 type changed to boolean type and removed unnecessary if statement. Signed-off-by: Chris Park Signed-off-by: Leo Kim Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wilc1000/wilc_wlan.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'drivers/staging/wilc1000/wilc_wlan.c') diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index dc26322..46087e2 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -1441,36 +1441,31 @@ static u32 init_chip(struct net_device *dev) return ret; } -u32 wilc_get_chipid(struct wilc *wilc, u8 update) +u32 wilc_get_chipid(struct wilc *wilc, bool update) { static u32 chipid; u32 tempchipid = 0; - u32 rfrevid; + u32 rfrevid = 0; - if (chipid == 0 || update != 0) { + if (chipid == 0 || update) { wilc->hif_func->hif_read_reg(wilc, 0x1000, &tempchipid); wilc->hif_func->hif_read_reg(wilc, 0x13f4, &rfrevid); if (!ISWILC1000(tempchipid)) { chipid = 0; - goto _fail_; + return chipid; } if (tempchipid == 0x1002a0) { - if (rfrevid == 0x1) { - } else { + if (rfrevid != 0x1) tempchipid = 0x1002a1; - } } else if (tempchipid == 0x1002b0) { - if (rfrevid == 3) { - } else if (rfrevid == 4) { + if (rfrevid == 0x4) tempchipid = 0x1002b1; - } else { + else if (rfrevid != 0x3) tempchipid = 0x1002b2; - } } chipid = tempchipid; } -_fail_: return chipid; } -- cgit v1.1