drivers/net/vmxnet3: Use kzalloc
[safe/jmp/linux-2.6] / drivers / net / vmxnet3 / vmxnet3_drv.c
index 1ceb9d0..989b742 100644 (file)
@@ -35,7 +35,7 @@ char vmxnet3_driver_name[] = "vmxnet3";
  * PCI Device ID Table
  * Last entry must be all 0s
  */
-static const struct pci_device_id vmxnet3_pciid_table[] = {
+static DEFINE_PCI_DEVICE_TABLE(vmxnet3_pciid_table) = {
        {PCI_VDEVICE(VMWARE, PCI_DEVICE_ID_VMWARE_VMXNET3)},
        {0}
 };
@@ -992,7 +992,6 @@ vmxnet3_tq_xmit(struct sk_buff *skb, struct vmxnet3_tx_queue *tq,
                VMXNET3_WRITE_BAR0_REG(adapter, VMXNET3_REG_TXPROD,
                                       tq->tx_ring.next2fill);
        }
-       netdev->trans_start = jiffies;
 
        return NETDEV_TX_OK;
 
@@ -1174,7 +1173,6 @@ vmxnet3_rq_rx_complete(struct vmxnet3_rx_queue *rq,
                                netif_receive_skb(skb);
                        }
 
-                       adapter->netdev->last_rx = jiffies;
                        ctx->skb = NULL;
                }
 
@@ -1371,13 +1369,12 @@ vmxnet3_rq_create(struct vmxnet3_rx_queue *rq, struct vmxnet3_adapter *adapter)
 
        sz = sizeof(struct vmxnet3_rx_buf_info) * (rq->rx_ring[0].size +
                                                   rq->rx_ring[1].size);
-       bi = kmalloc(sz, GFP_KERNEL);
+       bi = kzalloc(sz, GFP_KERNEL);
        if (!bi) {
                printk(KERN_ERR "%s: failed to allocate rx bufinfo\n",
                       adapter->netdev->name);
                goto err;
        }
-       memset(bi, 0, sz);
        rq->buf_info[0] = bi;
        rq->buf_info[1] = bi + rq->rx_ring[0].size;
 
@@ -1668,22 +1665,19 @@ static u8 *
 vmxnet3_copy_mc(struct net_device *netdev)
 {
        u8 *buf = NULL;
-       u32 sz = netdev->mc_count * ETH_ALEN;
+       u32 sz = netdev_mc_count(netdev) * ETH_ALEN;
 
        /* struct Vmxnet3_RxFilterConf.mfTableLen is u16. */
        if (sz <= 0xffff) {
                /* We may be called with BH disabled */
                buf = kmalloc(sz, GFP_ATOMIC);
                if (buf) {
-                       int i;
-                       struct dev_mc_list *mc = netdev->mc_list;
+                       struct netdev_hw_addr *ha;
+                       int i = 0;
 
-                       for (i = 0; i < netdev->mc_count; i++) {
-                               BUG_ON(!mc);
-                               memcpy(buf + i * ETH_ALEN, mc->dmi_addr,
+                       netdev_for_each_mc_addr(ha, netdev)
+                               memcpy(buf + i++ * ETH_ALEN, ha->addr,
                                       ETH_ALEN);
-                               mc = mc->next;
-                       }
                }
        }
        return buf;
@@ -1708,12 +1702,12 @@ vmxnet3_set_mc(struct net_device *netdev)
        if (netdev->flags & IFF_ALLMULTI)
                new_mode |= VMXNET3_RXM_ALL_MULTI;
        else
-               if (netdev->mc_count > 0) {
+               if (!netdev_mc_empty(netdev)) {
                        new_table = vmxnet3_copy_mc(netdev);
                        if (new_table) {
                                new_mode |= VMXNET3_RXM_MCAST;
                                rxConf->mfTableLen = cpu_to_le16(
-                                               netdev->mc_count * ETH_ALEN);
+                                       netdev_mc_count(netdev) * ETH_ALEN);
                                rxConf->mfTablePA = cpu_to_le64(virt_to_phys(
                                                    new_table));
                        } else {
@@ -2689,7 +2683,7 @@ vmxnet3_resume(struct device *device)
        return 0;
 }
 
-static struct dev_pm_ops vmxnet3_pm_ops = {
+static const struct dev_pm_ops vmxnet3_pm_ops = {
        .suspend = vmxnet3_suspend,
        .resume = vmxnet3_resume,
 };