staging: rtl8192e: Simplify rtl92e_set_bandwidth
authorMateusz Kulikowski <mateusz.kulikowski@gmail.com>
Tue, 28 Jul 2015 21:31:43 +0000 (23:31 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 31 Jul 2015 23:21:37 +0000 (16:21 -0700)
Move phy version check outside of the loop.

Signed-off-by: Mateusz Kulikowski <mateusz.kulikowski@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c

index e5f4c2df69fdd51b9bbbce85f215df50c130f290..85f9341ac2813b82a7ac639387e33ea8d2f0d53e 100644 (file)
@@ -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",