can: sja1000 platform data fixes
[safe/jmp/linux-2.6] / drivers / net / s2io.c
index 3138df5..668327c 100644 (file)
@@ -79,6 +79,7 @@
 #include <linux/tcp.h>
 #include <linux/uaccess.h>
 #include <linux/io.h>
+#include <linux/slab.h>
 #include <net/tcp.h>
 
 #include <asm/system.h>
@@ -523,7 +524,7 @@ module_param_array(rts_frm_len, uint, NULL, 0);
  * S2IO device table.
  * This table lists all the devices that this driver supports.
  */
-static struct pci_device_id s2io_tbl[] __devinitdata = {
+static DEFINE_PCI_DEVICE_TABLE(s2io_tbl) = {
        {PCI_VENDOR_ID_S2IO, PCI_DEVICE_ID_S2IO_WIN,
         PCI_ANY_ID, PCI_ANY_ID},
        {PCI_VENDOR_ID_S2IO, PCI_DEVICE_ID_S2IO_UNI,
@@ -923,8 +924,8 @@ static int init_shared_mem(struct s2io_nic *nic)
        tmp_v_addr = mac_control->stats_mem;
        mac_control->stats_info = (struct stat_block *)tmp_v_addr;
        memset(tmp_v_addr, 0, size);
-       DBG_PRINT(INIT_DBG, "%s: Ring Mem PHY: 0x%llx\n", dev->name,
-                 (unsigned long long)tmp_p_addr);
+       DBG_PRINT(INIT_DBG, "%s: Ring Mem PHY: 0x%llx\n",
+               dev_name(&nic->pdev->dev), (unsigned long long)tmp_p_addr);
        mac_control->stats_info->sw_stat.mem_allocated += mem_allocated;
        return SUCCESS;
 }
@@ -2399,7 +2400,7 @@ static struct sk_buff *s2io_txdl_getskb(struct fifo_info *fifo_data,
                return NULL;
        }
        pci_unmap_single(nic->pdev, (dma_addr_t)txds->Buffer_Pointer,
-                        skb->len - skb->data_len, PCI_DMA_TODEVICE);
+                        skb_headlen(skb), PCI_DMA_TODEVICE);
        frg_cnt = skb_shinfo(skb)->nr_frags;
        if (frg_cnt) {
                txds++;
@@ -2942,7 +2943,6 @@ static void s2io_netpoll(struct net_device *dev)
                }
        }
        enable_irq(dev->irq);
-       return;
 }
 #endif
 
@@ -3238,7 +3238,7 @@ static u64 s2io_mdio_read(u32 mmd_type, u64 addr, struct net_device *dev)
 
 /**
  *  s2io_chk_xpak_counter - Function to check the status of the xpak counters
- *  @counter      : couter value to be updated
+ *  @counter      : counter value to be updated
  *  @flag         : flag to indicate the status
  *  @type         : counter type
  *  Description:
@@ -3421,7 +3421,7 @@ static int wait_for_cmd_complete(void __iomem *addr, u64 busy_bit,
                                break;
                        }
                } else {
-                       if (!(val64 & busy_bit)) {
+                       if (val64 & busy_bit) {
                                ret = SUCCESS;
                                break;
                        }
@@ -3480,7 +3480,7 @@ static void s2io_reset(struct s2io_nic *sp)
        struct swStat *swstats;
 
        DBG_PRINT(INIT_DBG, "%s: Resetting XFrame card %s\n",
-                 __func__, sp->dev->name);
+                 __func__, pci_name(sp->pdev));
 
        /* Back up  the PCI-X CMD reg, dont want to lose MMRBC, OST settings */
        pci_read_config_word(sp->pdev, PCIX_COMMAND_REGISTER, &(pci_cmd));
@@ -3494,6 +3494,7 @@ static void s2io_reset(struct s2io_nic *sp)
 
                /* Restore the PCI state saved during initialization. */
                pci_restore_state(sp->pdev);
+               pci_save_state(sp->pdev);
                pci_read_config_word(sp->pdev, 0x2, &val16);
                if (check_pci_device_id(val16) != (u16)PCI_ANY_ID)
                        break;
@@ -4072,7 +4073,7 @@ static int s2io_close(struct net_device *dev)
  *  0 on success & 1 on failure.
  */
 
-static int s2io_xmit(struct sk_buff *skb, struct net_device *dev)
+static netdev_tx_t s2io_xmit(struct sk_buff *skb, struct net_device *dev)
 {
        struct s2io_nic *sp = netdev_priv(dev);
        u16 frg_cnt, frg_len, i, queue, queue_len, put_off, get_off;
@@ -4200,7 +4201,7 @@ static int s2io_xmit(struct sk_buff *skb, struct net_device *dev)
                txdp->Control_2 |= TXD_VLAN_TAG(vlan_tag);
        }
 
-       frg_len = skb->len - skb->data_len;
+       frg_len = skb_headlen(skb);
        if (offload_type == SKB_GSO_UDP) {
                int ufo_size;
 
@@ -4754,7 +4755,6 @@ reset:
        s2io_stop_all_tx_queue(sp);
        schedule_work(&sp->rst_timer_task);
        sw_stat->soft_reset_cnt++;
-       return;
 }
 
 /**
@@ -4963,7 +4963,7 @@ static struct net_device_stats *s2io_get_stats(struct net_device *dev)
 static void s2io_set_multicast(struct net_device *dev)
 {
        int i, j, prev_cnt;
-       struct dev_mc_list *mclist;
+       struct netdev_hw_addr *ha;
        struct s2io_nic *sp = netdev_priv(dev);
        struct XENA_dev_config __iomem *bar0 = sp->bar0;
        u64 val64 = 0, multi_mac = 0x010203040506ULL, mask =
@@ -5054,8 +5054,8 @@ static void s2io_set_multicast(struct net_device *dev)
        }
 
        /*  Update individual M_CAST address list */
-       if ((!sp->m_cast_flg) && dev->mc_count) {
-               if (dev->mc_count >
+       if ((!sp->m_cast_flg) && netdev_mc_count(dev)) {
+               if (netdev_mc_count(dev) >
                    (config->max_mc_addr - config->max_mac_addr)) {
                        DBG_PRINT(ERR_DBG,
                                  "%s: No more Rx filters can be added - "
@@ -5065,7 +5065,7 @@ static void s2io_set_multicast(struct net_device *dev)
                }
 
                prev_cnt = sp->mc_addr_count;
-               sp->mc_addr_count = dev->mc_count;
+               sp->mc_addr_count = netdev_mc_count(dev);
 
                /* Clear out the previous list of Mc in the H/W. */
                for (i = 0; i < prev_cnt; i++) {
@@ -5091,13 +5091,13 @@ static void s2io_set_multicast(struct net_device *dev)
                }
 
                /* Create the new Rx filter list and update the same in H/W. */
-               for (i = 0, mclist = dev->mc_list; i < dev->mc_count;
-                    i++, mclist = mclist->next) {
-                       memcpy(sp->usr_addrs[i].addr, mclist->dmi_addr,
+               i = 0;
+               netdev_for_each_mc_addr(ha, dev) {
+                       memcpy(sp->usr_addrs[i].addr, ha->addr,
                               ETH_ALEN);
                        mac_addr = 0;
                        for (j = 0; j < ETH_ALEN; j++) {
-                               mac_addr |= mclist->dmi_addr[j];
+                               mac_addr |= ha->addr[j];
                                mac_addr <<= 8;
                        }
                        mac_addr >>= 8;
@@ -5120,6 +5120,7 @@ static void s2io_set_multicast(struct net_device *dev)
                                          dev->name);
                                return;
                        }
+                       i++;
                }
        }
 }
@@ -5817,10 +5818,8 @@ static void s2io_vpd_read(struct s2io_nic *nic)
                }
        }
 
-       if ((!fail) && (vpd_data[1] < VPD_STRING_LEN)) {
-               memset(nic->product_name, 0, vpd_data[1]);
+       if ((!fail) && (vpd_data[1] < VPD_STRING_LEN))
                memcpy(nic->product_name, &vpd_data[3], vpd_data[1]);
-       }
        kfree(vpd_data);
        swstats->mem_freed += 256;
 }
@@ -8644,7 +8643,6 @@ static void lro_append_pkt(struct s2io_nic *sp, struct lro *lro,
        first->truesize += skb->truesize;
        lro->last_frag = skb;
        swstats->clubbed_frms_cnt++;
-       return;
 }
 
 /**