]> bbs.cooldavid.org Git - jme.git/blobdiff - jme.c
net: drivers: use bool type instead of double negation
[jme.git] / jme.c
diff --git a/jme.c b/jme.c
index 7dae9b86c92964ce46ccb28aafc440be877b57e9..40cab5b0c0e2eb09367d6a03cd0b41bd9a9755b8 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;
        }
@@ -1957,7 +1962,7 @@ jme_fill_tx_map(struct pci_dev *pdev,
                struct page *page,
                u32 page_offset,
                u32 len,
-               u8 hidma)
+               bool hidma)
 {
        dma_addr_t dmaaddr;
 
@@ -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;
+       bool 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) {
@@ -2002,8 +2007,14 @@ jme_map_tx_skb(struct jme_adapter *jme, struct sk_buff *skb, int idx)
                ctxdesc = txdesc + ((idx + i + 2) & (mask));
                ctxbi = txbi + ((idx + i + 2) & (mask));
 
+#ifndef __USE_SKB_FRAG_API__
                jme_fill_tx_map(jme->pdev, ctxdesc, ctxbi, frag->page,
                                 frag->page_offset, frag->size, hidma);
+#else
+               jme_fill_tx_map(jme->pdev, ctxdesc, ctxbi,
+                               skb_frag_page(frag),
+                               frag->page_offset, skb_frag_size(frag), hidma);
+#endif
        }
 
        len = skb_is_nonlinear(skb) ? skb_headlen(skb) : skb->len;
@@ -2457,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
@@ -2856,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);
@@ -2865,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);
 
@@ -3112,7 +3132,11 @@ static const struct net_device_ops jme_netdev_ops = {
        .ndo_do_ioctl           = jme_ioctl,
        .ndo_start_xmit         = jme_start_xmit,
        .ndo_set_mac_address    = jme_set_macaddr,
+#ifndef __USE_NDO_SET_RX_MODE__
        .ndo_set_multicast_list = jme_set_multi,
+#else
+       .ndo_set_rx_mode        = jme_set_multi,
+#endif
        .ndo_change_mtu         = jme_change_mtu,
        .ndo_tx_timeout         = jme_tx_timeout,
 #ifndef __UNIFY_VLAN_RX_PATH__