[drivers rtl8180] Updated rtl8180 driver for API changes
authorJoshua Oreman <oremanj@xenon.get-linux.org>
Sun, 7 Jun 2009 04:57:05 +0000 (21:57 -0700)
committerJoshua Oreman <oremanj@xenon.get-linux.org>
Sun, 7 Jun 2009 04:57:05 +0000 (21:57 -0700)
Updated the rtl8180 driver to pass signal strength to net80211_rx()
instead of storing it in the net80211_device, and to use dev->state
instead of dev->assoc in configuring the RX filter. Also added a
forgotten initialization step (setting MAC address if the user changed
it).

src/drivers/net/rtl818x/rtl8180.c

index 152429d..e08ba88 100644 (file)
@@ -85,9 +85,8 @@ static void rtl8180_handle_rx(struct net80211_device *dev)
                        }
 
                        iob_put(iob, flags & 0xFFF);
-                       dev->signal = (flags2 >> 8) & 0x7f;
 
-                       net80211_rx(dev, iob);
+                       net80211_rx(dev, iob, (flags2 >> 8) & 0x7f);
 
                        iob = new_iob;
                        priv->rx_buf[priv->rx_idx] = iob;
@@ -392,6 +391,18 @@ static void rtl8180_irq(struct net80211_device *dev, int enable)
        rtl818x_iowrite16(priv, &priv->map->INT_MASK, enable? 0xFFFF : 0);
 }
 
+/* Sets the MAC address of the card. */
+static void rtl8180_set_hwaddr(struct net80211_device *dev, u8 *hwaddr)
+{
+       struct rtl8180_priv *priv = dev->priv;
+       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG);
+       rtl818x_iowrite32(priv, (u32 *)&priv->map->MAC[0],
+                         le32_to_cpu(*(u32 *)hwaddr));
+       rtl818x_iowrite16(priv, (u16 *)&priv->map->MAC[4],
+                         le16_to_cpu(*(u16 *)(hwaddr + 4)));
+       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL);
+}
+
 static int rtl8180_start(struct net80211_device *dev)
 {
        struct rtl8180_priv *priv = dev->priv;
@@ -410,6 +421,8 @@ static int rtl8180_start(struct net80211_device *dev)
        if (ret)
                goto err_free_rings;
 
+       rtl8180_set_hwaddr(dev, dev->netdev->ll_addr);
+
        rtl818x_iowrite32(priv, &priv->map->RDSAR, priv->rx_ring_dma);
        rtl818x_iowrite32(priv, &priv->map->TNPDA, priv->tx_ring_dma);
 
@@ -506,20 +519,6 @@ static void rtl8180_stop(struct net80211_device *dev)
        rtl8180_free_tx_ring(dev);
 }
 
-/* Sets the MAC address of the card. */
-#if 0                          /* currently unused */
-static void rtl8180_set_hwaddr(struct net80211_device *dev, u8 *hwaddr)
-{
-       struct rtl8180_priv *priv = dev->priv;
-       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG);
-       rtl818x_iowrite32(priv, (u32 *)&priv->map->MAC[0],
-                         le32_to_cpu(*(u32 *)hwaddr));
-       rtl818x_iowrite16(priv, (u16 *)&priv->map->MAC[4],
-                         le16_to_cpu(*(u16 *)(hwaddr + 4)));
-       rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL);
-}
-#endif
-
 static int rtl8180_config(struct net80211_device *dev, int changed)
 {
        struct rtl8180_priv *priv = dev->priv;
@@ -532,7 +531,8 @@ static int rtl8180_config(struct net80211_device *dev, int changed)
                for (i = 0; i < ETH_ALEN; i++)
                        rtl818x_iowrite8(priv, &priv->map->BSSID[i], dev->bssid[i]);
                rtl818x_iowrite8(priv, &priv->map->MSR,
-                                dev->assoc? RTL818X_MSR_INFRA : RTL818X_MSR_NO_LINK);
+                                dev->state & NET80211_ASSOCIATED?
+                                       RTL818X_MSR_INFRA : RTL818X_MSR_NO_LINK);
        }
 
        if (changed & NET80211_CFG_ERP_PARAMS)