All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gertjan van Wingerde <gwingerde@gmail.com>
To: John W Linville <linville@tuxdriver.com>
Cc: <linux-wireless@vger.kernel.org>, <users@rt2x00.serialmonkey.com>,
	Ivo van Doorn <IvDoorn@gmail.com>,
	Helmut Schaa <helmut.schaa@googlemail.com>,
	Gertjan van Wingerde <gwingerde@gmail.com>
Subject: [PATCH 3/7] rt2x00: Convert big if-statements to switch-statements.
Date: Wed, 28 Dec 2011 01:53:20 +0100	[thread overview]
Message-ID: <1325033604-26469-4-git-send-email-gwingerde@gmail.com> (raw)
In-Reply-To: <1325033604-26469-3-git-send-email-gwingerde@gmail.com>

Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
---
 drivers/net/wireless/rt2x00/rt2800lib.c |   44 ++++++++++++++++++------------
 1 files changed, 26 insertions(+), 18 deletions(-)

diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index e5df380..5b0137c 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -1944,19 +1944,24 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,
 		info->default_power2 = TXPOWER_A_TO_DEV(info->default_power2);
 	}
 
-	if (rt2x00_rf(rt2x00dev, RF2020) ||
-	    rt2x00_rf(rt2x00dev, RF3020) ||
-	    rt2x00_rf(rt2x00dev, RF3021) ||
-	    rt2x00_rf(rt2x00dev, RF3022) ||
-	    rt2x00_rf(rt2x00dev, RF3320))
+	switch (rt2x00dev->chip.rf) {
+	case RF2020:
+	case RF3020:
+	case RF3021:
+	case RF3022:
+	case RF3320:
 		rt2800_config_channel_rf3xxx(rt2x00dev, conf, rf, info);
-	else if (rt2x00_rf(rt2x00dev, RF3052))
+		break;
+	case RF3052:
 		rt2800_config_channel_rf3052(rt2x00dev, conf, rf, info);
-	else if (rt2x00_rf(rt2x00dev, RF5370) ||
-		 rt2x00_rf(rt2x00dev, RF5390))
+		break;
+	case RF5370:
+	case RF5390:
 		rt2800_config_channel_rf53xx(rt2x00dev, conf, rf, info);
-	else
+		break;
+	default:
 		rt2800_config_channel_rf2xxx(rt2x00dev, conf, rf, info);
+	}
 
 	/*
 	 * Change BBP settings
@@ -3932,15 +3937,18 @@ int rt2800_init_eeprom(struct rt2x00_dev *rt2x00dev)
 	rt2x00_set_chip(rt2x00dev, rt2x00_get_field32(reg, MAC_CSR0_CHIPSET),
 			value, rt2x00_get_field32(reg, MAC_CSR0_REVISION));
 
-	if (!rt2x00_rt(rt2x00dev, RT2860) &&
-	    !rt2x00_rt(rt2x00dev, RT2872) &&
-	    !rt2x00_rt(rt2x00dev, RT2883) &&
-	    !rt2x00_rt(rt2x00dev, RT3070) &&
-	    !rt2x00_rt(rt2x00dev, RT3071) &&
-	    !rt2x00_rt(rt2x00dev, RT3090) &&
-	    !rt2x00_rt(rt2x00dev, RT3390) &&
-	    !rt2x00_rt(rt2x00dev, RT3572) &&
-	    !rt2x00_rt(rt2x00dev, RT5390)) {
+	switch (rt2x00dev->chip.rt) {
+	case RT2860:
+	case RT2872:
+	case RT2883:
+	case RT3070:
+	case RT3071:
+	case RT3090:
+	case RT3390:
+	case RT3572:
+	case RT5390:
+		break;
+	default:
 		ERROR(rt2x00dev, "Invalid RT chipset detected.\n");
 		return -ENODEV;
 	}
-- 
1.7.7.4


  reply	other threads:[~2011-12-28  0:59 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-28  0:53 [PATCH 0/7] Assorted fixes and clean-ups Gertjan van Wingerde
2011-12-28  0:53 ` [PATCH 1/7] rt2x00: Identify rt2800usb chipsets Gertjan van Wingerde
2011-12-28  0:53   ` [PATCH 2/7] rt2x00: Whitespace cleanup Gertjan van Wingerde
2011-12-28  0:53     ` Gertjan van Wingerde [this message]
2011-12-28  0:53       ` [PATCH 4/7] rt2800usb: Let rt2x00usb handle USB padding Gertjan van Wingerde
2011-12-28  0:53         ` [PATCH 5/7] rt2x00usb: Zero USB padding before sending URB Gertjan van Wingerde
2011-12-28  0:53           ` [PATCH 6/7] rt2x00: RT3593 is also applicable to USB Gertjan van Wingerde
2011-12-28  0:53             ` [PATCH 7/7] rt2x00: Change RF3853 to RF3053 Gertjan van Wingerde
2011-12-28 20:12               ` Ivo Van Doorn
2011-12-28 20:12             ` [PATCH 6/7] rt2x00: RT3593 is also applicable to USB Ivo Van Doorn
2011-12-28 22:40           ` [PATCH 5/7] rt2x00usb: Zero USB padding before sending URB Ivo Van Doorn
2011-12-28 20:12         ` [PATCH 4/7] rt2800usb: Let rt2x00usb handle USB padding Ivo Van Doorn
2011-12-28 20:43           ` Gertjan van Wingerde
2011-12-28 22:01             ` Andreas Hartmann
2011-12-28 22:40               ` Ivo Van Doorn
2011-12-28 22:40         ` Ivo Van Doorn
2011-12-28 20:11       ` [PATCH 3/7] rt2x00: Convert big if-statements to switch-statements Ivo Van Doorn
2011-12-28 20:10     ` [PATCH 2/7] rt2x00: Whitespace cleanup Ivo Van Doorn
2011-12-28 20:10   ` [PATCH 1/7] rt2x00: Identify rt2800usb chipsets Ivo Van Doorn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1325033604-26469-4-git-send-email-gwingerde@gmail.com \
    --to=gwingerde@gmail.com \
    --cc=IvDoorn@gmail.com \
    --cc=helmut.schaa@googlemail.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=users@rt2x00.serialmonkey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.