b43: pull out helpers for writing noise table
authorHarvey Harrison <harvey.harrison@gmail.com>
Sat, 8 Mar 2008 10:40:38 +0000 (02:40 -0800)
committerJohn W. Linville <linville@tuxdriver.com>
Thu, 13 Mar 2008 20:02:33 +0000 (16:02 -0400)
Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/b43/wa.c

index e632125cb772db3ebb69baeb153a569bf33f6628..daa94211f8388c7d1e1945317daaff3d44904623 100644 (file)
@@ -204,42 +204,43 @@ static void b43_wa_rt(struct b43_wldev *dev) /* Rotor table */
                b43_ofdmtab_write32(dev, B43_OFDMTAB_ROTOR, i, b43_tab_rotor[i]);
 }
 
+static void b43_write_null_nst(struct b43_wldev *dev)
+{
+       int i;
+
+       for (i = 0; i < B43_TAB_NOISESCALE_SIZE; i++)
+               b43_ofdmtab_write16(dev, B43_OFDMTAB_NOISESCALE, i, 0);
+}
+
+static void b43_write_nst(struct b43_wldev *dev, const u16 *nst)
+{
+       int i;
+
+       for (i = 0; i < B43_TAB_NOISESCALE_SIZE; i++)
+               b43_ofdmtab_write16(dev, B43_OFDMTAB_NOISESCALE, i, nst[i]);
+}
+
 static void b43_wa_nst(struct b43_wldev *dev) /* Noise scale table */
 {
        struct b43_phy *phy = &dev->phy;
-       int i;
 
        if (phy->type == B43_PHYTYPE_A) {
                if (phy->rev <= 1)
-                       for (i = 0; i < B43_TAB_NOISESCALE_SIZE; i++)
-                               b43_ofdmtab_write16(dev, B43_OFDMTAB_NOISESCALE,
-                                                       i, 0);
+                       b43_write_null_nst(dev);
                else if (phy->rev == 2)
-                       for (i = 0; i < B43_TAB_NOISESCALE_SIZE; i++)
-                               b43_ofdmtab_write16(dev, B43_OFDMTAB_NOISESCALE,
-                                                       i, b43_tab_noisescalea2[i]);
+                       b43_write_nst(dev, b43_tab_noisescalea2);
                else if (phy->rev == 3)
-                       for (i = 0; i < B43_TAB_NOISESCALE_SIZE; i++)
-                               b43_ofdmtab_write16(dev, B43_OFDMTAB_NOISESCALE,
-                                                       i, b43_tab_noisescalea3[i]);
+                       b43_write_nst(dev, b43_tab_noisescalea3);
                else
-                       for (i = 0; i < B43_TAB_NOISESCALE_SIZE; i++)
-                               b43_ofdmtab_write16(dev, B43_OFDMTAB_NOISESCALE,
-                                                       i, b43_tab_noisescaleg3[i]);
+                       b43_write_nst(dev, b43_tab_noisescaleg3);
        } else {
                if (phy->rev >= 6) {
                        if (b43_phy_read(dev, B43_PHY_ENCORE) & B43_PHY_ENCORE_EN)
-                               for (i = 0; i < B43_TAB_NOISESCALE_SIZE; i++)
-                                       b43_ofdmtab_write16(dev, B43_OFDMTAB_NOISESCALE,
-                                               i, b43_tab_noisescaleg3[i]);
+                               b43_write_nst(dev, b43_tab_noisescaleg3);
                        else
-                               for (i = 0; i < B43_TAB_NOISESCALE_SIZE; i++)
-                                       b43_ofdmtab_write16(dev, B43_OFDMTAB_NOISESCALE,
-                                               i, b43_tab_noisescaleg2[i]);
+                               b43_write_nst(dev, b43_tab_noisescaleg2);
                } else {
-                       for (i = 0; i < B43_TAB_NOISESCALE_SIZE; i++)
-                               b43_ofdmtab_write16(dev, B43_OFDMTAB_NOISESCALE,
-                                                       i, b43_tab_noisescaleg1[i]);
+                       b43_write_nst(dev, b43_tab_noisescaleg1);
                }
        }
 }