From 72f1f75257de812137ee5110822370fadc4927f6 Mon Sep 17 00:00:00 2001 From: Mateusz Kulikowski Date: Tue, 28 Jul 2015 23:31:43 +0200 Subject: [PATCH] staging: rtl8192e: Simplify rtl92e_set_bandwidth Move phy version check outside of the loop. Signed-off-by: Mateusz Kulikowski Signed-off-by: Greg Kroah-Hartman --- .../rtl8192e/rtl8192e/r8190P_rtl8256.c | 53 +++++++------------ 1 file changed, 18 insertions(+), 35 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c b/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c index e5f4c2df69fd..85f9341ac281 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c @@ -28,49 +28,32 @@ void rtl92e_set_bandwidth(struct net_device *dev, u8 eRFPath; struct r8192_priv *priv = rtllib_priv(dev); + if (priv->card_8192_version != VERSION_8190_BD && + priv->card_8192_version != VERSION_8190_BE) { + netdev_warn(dev, "%s(): Unknown HW version.\n", __func__); + return; + } + for (eRFPath = 0; eRFPath < priv->NumTotalRFPath; eRFPath++) { if (!rtl92e_is_legal_rf_path(dev, eRFPath)) continue; switch (Bandwidth) { case HT_CHANNEL_WIDTH_20: - if (priv->card_8192_version == VERSION_8190_BD || - priv->card_8192_version == VERSION_8190_BE) { - rtl92e_set_rf_reg(dev, - (enum rf90_radio_path)eRFPath, - 0x0b, bMask12Bits, 0x100); - rtl92e_set_rf_reg(dev, - (enum rf90_radio_path)eRFPath, - 0x2c, bMask12Bits, 0x3d7); - rtl92e_set_rf_reg(dev, - (enum rf90_radio_path)eRFPath, - 0x0e, bMask12Bits, 0x021); - - } else { - netdev_warn(dev, "%s(): Unknown HW version.\n", - __func__); - } - + rtl92e_set_rf_reg(dev, (enum rf90_radio_path)eRFPath, + 0x0b, bMask12Bits, 0x100); + rtl92e_set_rf_reg(dev, (enum rf90_radio_path)eRFPath, + 0x2c, bMask12Bits, 0x3d7); + rtl92e_set_rf_reg(dev, (enum rf90_radio_path)eRFPath, + 0x0e, bMask12Bits, 0x021); break; case HT_CHANNEL_WIDTH_20_40: - if (priv->card_8192_version == VERSION_8190_BD || - priv->card_8192_version == VERSION_8190_BE) { - rtl92e_set_rf_reg(dev, - (enum rf90_radio_path)eRFPath, - 0x0b, bMask12Bits, 0x300); - rtl92e_set_rf_reg(dev, - (enum rf90_radio_path)eRFPath, - 0x2c, bMask12Bits, 0x3ff); - rtl92e_set_rf_reg(dev, - (enum rf90_radio_path)eRFPath, - 0x0e, bMask12Bits, 0x0e1); - - } else { - netdev_warn(dev, "%s(): Unknown HW version.\n", - __func__); - } - - + rtl92e_set_rf_reg(dev, (enum rf90_radio_path)eRFPath, + 0x0b, bMask12Bits, 0x300); + rtl92e_set_rf_reg(dev, (enum rf90_radio_path)eRFPath, + 0x2c, bMask12Bits, 0x3ff); + rtl92e_set_rf_reg(dev, (enum rf90_radio_path)eRFPath, + 0x0e, bMask12Bits, 0x0e1); break; default: netdev_err(dev, "%s(): Unknown bandwidth: %#X\n", -- 2.30.2