Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
[pandora-kernel.git] / drivers / net / enc28j60.c
index e1b441e..535e140 100644 (file)
@@ -477,12 +477,10 @@ static int enc28j60_set_hw_macaddr(struct net_device *ndev)
 
        mutex_lock(&priv->lock);
        if (!priv->hw_enable) {
-               if (netif_msg_drv(priv)) {
-                       DECLARE_MAC_BUF(mac);
+               if (netif_msg_drv(priv))
                        printk(KERN_INFO DRV_NAME
-                               ": %s: Setting MAC address to %s\n",
-                               ndev->name, print_mac(mac, ndev->dev_addr));
-               }
+                               ": %s: Setting MAC address to %pM\n",
+                               ndev->name, ndev->dev_addr);
                /* NOTE: MAC address in ENC28J60 is byte-backward */
                nolock_regb_write(priv, MAADR5, ndev->dev_addr[0]);
                nolock_regb_write(priv, MAADR4, ndev->dev_addr[1]);
@@ -568,6 +566,17 @@ static u16 erxrdpt_workaround(u16 next_packet_ptr, u16 start, u16 end)
        return erxrdpt;
 }
 
+/*
+ * Calculate wrap around when reading beyond the end of the RX buffer
+ */
+static u16 rx_packet_start(u16 ptr)
+{
+       if (ptr + RSV_SIZE > RXEND_INIT)
+               return (ptr + RSV_SIZE) - (RXEND_INIT - RXSTART_INIT + 1);
+       else
+               return ptr + RSV_SIZE;
+}
+
 static void nolock_rxfifo_init(struct enc28j60_net *priv, u16 start, u16 end)
 {
        u16 erxrdpt;
@@ -938,16 +947,16 @@ static void enc28j60_hw_rx(struct net_device *ndev)
                        skb->dev = ndev;
                        skb_reserve(skb, NET_IP_ALIGN);
                        /* copy the packet from the receive buffer */
-                       enc28j60_mem_read(priv, priv->next_pk_ptr + sizeof(rsv),
-                                       len, skb_put(skb, len));
+                       enc28j60_mem_read(priv,
+                               rx_packet_start(priv->next_pk_ptr),
+                               len, skb_put(skb, len));
                        if (netif_msg_pktdata(priv))
                                dump_packet(__func__, skb->len, skb->data);
                        skb->protocol = eth_type_trans(skb, ndev);
                        /* update statistics */
                        ndev->stats.rx_packets++;
                        ndev->stats.rx_bytes += len;
-                       ndev->last_rx = jiffies;
-                       netif_rx(skb);
+                       netif_rx_ni(skb);
                }
        }
        /*
@@ -1328,11 +1337,9 @@ static int enc28j60_net_open(struct net_device *dev)
                printk(KERN_DEBUG DRV_NAME ": %s() enter\n", __func__);
 
        if (!is_valid_ether_addr(dev->dev_addr)) {
-               if (netif_msg_ifup(priv)) {
-                       DECLARE_MAC_BUF(mac);
-                       dev_err(&dev->dev, "invalid MAC address %s\n",
-                               print_mac(mac, dev->dev_addr));
-               }
+               if (netif_msg_ifup(priv))
+                       dev_err(&dev->dev, "invalid MAC address %pM\n",
+                               dev->dev_addr);
                return -EADDRNOTAVAIL;
        }
        /* Reset the hardware here (and take it out of low power mode) */
@@ -1453,7 +1460,7 @@ enc28j60_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
        strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
        strlcpy(info->version, DRV_VERSION, sizeof(info->version));
        strlcpy(info->bus_info,
-               dev->dev.parent->bus_id, sizeof(info->bus_info));
+               dev_name(dev->dev.parent), sizeof(info->bus_info));
 }
 
 static int