]> bbs.cooldavid.org Git - jme.git/blobdiff - jme.c
Fix pci_dma_mapping_error prototype for older kernel
[jme.git] / jme.c
diff --git a/jme.c b/jme.c
index ed558dc55e9759725409a291704c0c40fa022388..153dd0e63fd238ce335360523aba7487fdc1d34e 100644 (file)
--- a/jme.c
+++ b/jme.c
@@ -782,7 +782,12 @@ jme_make_new_rx_buf(struct jme_adapter *jme, int i)
        mapping = pci_map_page(jme->pdev, virt_to_page(skb->data),
                               offset_in_page(skb->data), skb_tailroom(skb),
                               PCI_DMA_FROMDEVICE);
-       if (unlikely(pci_dma_mapping_error(jme->pdev, mapping))) {
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,26)
+       if (unlikely(pci_dma_mapping_error(jme->pdev, mapping)))
+#else
+       if (unlikely(pci_dma_mapping_error(mapping)))
+#endif
+       {
                dev_kfree_skb(skb);
                return -ENOMEM;
        }
@@ -1991,10 +1996,10 @@ jme_map_tx_skb(struct jme_adapter *jme, struct sk_buff *skb, int idx)
        struct jme_ring *txring = &(jme->txring[0]);
        struct txdesc *txdesc = txring->desc, *ctxdesc;
        struct jme_buffer_info *txbi = txring->bufinf, *ctxbi;
-       u8 hidma = jme->dev->features & NETIF_F_HIGHDMA;
+       u8 hidma = !!(jme->dev->features & NETIF_F_HIGHDMA);
        int i, nr_frags = skb_shinfo(skb)->nr_frags;
        int mask = jme->tx_ring_mask;
-       struct skb_frag_struct *frag;
+       const struct skb_frag_struct *frag;
        u32 len;
 
        for (i = 0 ; i < nr_frags ; ++i) {
@@ -2008,7 +2013,7 @@ jme_map_tx_skb(struct jme_adapter *jme, struct sk_buff *skb, int idx)
 #else
                jme_fill_tx_map(jme->pdev, ctxdesc, ctxbi,
                                skb_frag_page(frag),
-                               frag->page_offset, frag->size, hidma);
+                               frag->page_offset, skb_frag_size(frag), hidma);
 #endif
        }
 
@@ -2463,9 +2468,9 @@ jme_get_drvinfo(struct net_device *netdev,
 {
        struct jme_adapter *jme = netdev_priv(netdev);
 
-       strcpy(info->driver, DRV_NAME);
-       strcpy(info->version, DRV_VERSION);
-       strcpy(info->bus_info, pci_name(jme->pdev));
+       strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
+       strlcpy(info->version, DRV_VERSION, sizeof(info->version));
+       strlcpy(info->bus_info, pci_name(jme->pdev), sizeof(info->bus_info));
 }
 
 static int
@@ -2862,8 +2867,13 @@ jme_set_tso(struct net_device *netdev, u32 on)
        return 0;
 }
 #else
+#ifndef __NEW_FIX_FEATURES_TYPE__
 static u32
 jme_fix_features(struct net_device *netdev, u32 features)
+#else
+static netdev_features_t
+jme_fix_features(struct net_device *netdev, netdev_features_t features)
+#endif
 {
        if (netdev->mtu > 1900)
                features &= ~(NETIF_F_ALL_TSO | NETIF_F_ALL_CSUM);
@@ -2871,7 +2881,11 @@ jme_fix_features(struct net_device *netdev, u32 features)
 }
 
 static int
+#ifndef __NEW_FIX_FEATURES_TYPE__
 jme_set_features(struct net_device *netdev, u32 features)
+#else
+jme_set_features(struct net_device *netdev, netdev_features_t features)
+#endif
 {
        struct jme_adapter *jme = netdev_priv(netdev);