include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit...
[linux-2.6.git] / drivers / isdn / i4l / isdn_net.c
index 7c5f970..8c85d1e 100644 (file)
@@ -23,6 +23,7 @@
  */
 
 #include <linux/isdn.h>
+#include <linux/slab.h>
 #include <net/arp.h>
 #include <net/dst.h>
 #include <net/pkt_sched.h>
@@ -176,7 +177,8 @@ static __inline__ void isdn_net_zero_frame_cnt(isdn_net_local *lp)
 /* Prototypes */
 
 static int isdn_net_force_dial_lp(isdn_net_local *);
-static int isdn_net_start_xmit(struct sk_buff *, struct net_device *);
+static netdev_tx_t isdn_net_start_xmit(struct sk_buff *,
+                                            struct net_device *);
 
 static void isdn_net_ciscohdlck_connected(isdn_net_local *lp);
 static void isdn_net_ciscohdlck_disconnected(isdn_net_local *lp);
@@ -292,7 +294,9 @@ isdn_net_unbind_channel(isdn_net_local * lp)
        lp->dialstate = 0;
        dev->rx_netdev[isdn_dc2minor(lp->isdn_device, lp->isdn_channel)] = NULL;
        dev->st_netdev[isdn_dc2minor(lp->isdn_device, lp->isdn_channel)] = NULL;
-       isdn_free_channel(lp->isdn_device, lp->isdn_channel, ISDN_USAGE_NET);
+       if (lp->isdn_device != -1 && lp->isdn_channel != -1)
+               isdn_free_channel(lp->isdn_device, lp->isdn_channel,
+                                 ISDN_USAGE_NET);
        lp->flags &= ~ISDN_NET_CONNECTED;
        lp->isdn_device = -1;
        lp->isdn_channel = -1;
@@ -1049,12 +1053,12 @@ isdn_net_xmit(struct net_device *ndev, struct sk_buff *skb)
        isdn_net_dev *nd;
        isdn_net_local *slp;
        isdn_net_local *lp = (isdn_net_local *) netdev_priv(ndev);
-       int retv = 0;
+       int retv = NETDEV_TX_OK;
 
        if (((isdn_net_local *) netdev_priv(ndev))->master) {
                printk("isdn BUG at %s:%d!\n", __FILE__, __LINE__);
                dev_kfree_skb(skb);
-               return 0;
+               return NETDEV_TX_OK;
        }
 
        /* For the other encaps the header has already been built */
@@ -1067,7 +1071,7 @@ isdn_net_xmit(struct net_device *ndev, struct sk_buff *skb)
        lp = isdn_net_get_locked_lp(nd);
        if (!lp) {
                printk(KERN_WARNING "%s: all channels busy - requeuing!\n", ndev->name);
-               return 1;
+               return NETDEV_TX_BUSY;
        }
        /* we have our lp locked from now on */
 
@@ -1158,7 +1162,7 @@ static void isdn_net_tx_timeout(struct net_device * ndev)
  * If this interface isn't connected to a ISDN-Channel, find a free channel,
  * and start dialing.
  */
-static int
+static netdev_tx_t
 isdn_net_start_xmit(struct sk_buff *skb, struct net_device *ndev)
 {
        isdn_net_local *lp = (isdn_net_local *) netdev_priv(ndev);
@@ -1200,7 +1204,7 @@ isdn_net_start_xmit(struct sk_buff *skb, struct net_device *ndev)
                        if (!(ISDN_NET_DIALMODE(*lp) == ISDN_NET_DM_AUTO)) {
                                isdn_net_unreachable(ndev, skb, "dial rejected: interface not in dialmode `auto'");
                                dev_kfree_skb(skb);
-                               return 0;
+                               return NETDEV_TX_OK;
                        }
                        if (lp->phone[1]) {
                                ulong flags;
@@ -1213,7 +1217,7 @@ isdn_net_start_xmit(struct sk_buff *skb, struct net_device *ndev)
                                        if(time_before(jiffies, lp->dialwait_timer)) {
                                                isdn_net_unreachable(ndev, skb, "dial rejected: retry-time not reached");
                                                dev_kfree_skb(skb);
-                                               return 0;
+                                               return NETDEV_TX_OK;
                                        } else
                                                lp->dialwait_timer = 0;
                                }
@@ -1241,7 +1245,7 @@ isdn_net_start_xmit(struct sk_buff *skb, struct net_device *ndev)
                                        isdn_net_unreachable(ndev, skb,
                                                           "No channel");
                                        dev_kfree_skb(skb);
-                                       return 0;
+                                       return NETDEV_TX_OK;
                                }
                                /* Log packet, which triggered dialing */
                                if (dev->net_verbose)
@@ -1256,7 +1260,7 @@ isdn_net_start_xmit(struct sk_buff *skb, struct net_device *ndev)
                                                dev_kfree_skb(skb);
                                                isdn_net_unbind_channel(lp);
                                                spin_unlock_irqrestore(&dev->lock, flags);
-                                               return 0;       /* STN (skb to nirvana) ;) */
+                                               return NETDEV_TX_OK;    /* STN (skb to nirvana) ;) */
                                        }
 #ifdef CONFIG_IPPP_FILTER
                                        if (isdn_ppp_autodial_filter(skb, lp)) {
@@ -1265,25 +1269,25 @@ isdn_net_start_xmit(struct sk_buff *skb, struct net_device *ndev)
                                                spin_unlock_irqrestore(&dev->lock, flags);
                                                isdn_net_unreachable(ndev, skb, "dial rejected: packet filtered");
                                                dev_kfree_skb(skb);
-                                               return 0;
+                                               return NETDEV_TX_OK;
                                        }
 #endif
                                        spin_unlock_irqrestore(&dev->lock, flags);
                                        isdn_net_dial();        /* Initiate dialing */
                                        netif_stop_queue(ndev);
-                                       return 1;       /* let upper layer requeue skb packet */
+                                       return NETDEV_TX_BUSY;  /* let upper layer requeue skb packet */
                                }
 #endif
                                /* Initiate dialing */
                                spin_unlock_irqrestore(&dev->lock, flags);
                                isdn_net_dial();
                                isdn_net_device_stop_queue(lp);
-                               return 1;
+                               return NETDEV_TX_BUSY;
                        } else {
                                isdn_net_unreachable(ndev, skb,
                                                     "No phone number");
                                dev_kfree_skb(skb);
-                               return 0;
+                               return NETDEV_TX_OK;
                        }
                } else {
                        /* Device is connected to an ISDN channel */ 
@@ -1298,7 +1302,7 @@ isdn_net_start_xmit(struct sk_buff *skb, struct net_device *ndev)
                                netif_stop_queue(ndev);
                }
        }
-       return 1;
+       return NETDEV_TX_BUSY;
 }
 
 /*
@@ -1560,7 +1564,7 @@ isdn_net_ciscohdlck_slarp_send_keepalive(unsigned long data)
        *(__be32 *)(p +  4) = cpu_to_be32(CISCO_SLARP_KEEPALIVE);
        *(__be32 *)(p +  8) = cpu_to_be32(lp->cisco_myseq);
        *(__be32 *)(p + 12) = cpu_to_be32(lp->cisco_yourseq);
-       *(__be16 *)(p + 16) = cpu_to_be16(0xffff); // reliablity, always 0xffff
+       *(__be16 *)(p + 16) = cpu_to_be16(0xffff); // reliability, always 0xffff
        p += 18;
 
        isdn_net_write_super(lp, skb);
@@ -2513,7 +2517,6 @@ static const struct net_device_ops isdn_netdev_ops = {
        .ndo_stop             = isdn_net_close,
        .ndo_do_ioctl         = isdn_net_ioctl,
 
-       .ndo_validate_addr    = NULL,
        .ndo_start_xmit       = isdn_net_start_xmit,
        .ndo_get_stats        = isdn_net_get_stats,
        .ndo_tx_timeout       = isdn_net_tx_timeout,
@@ -2528,12 +2531,8 @@ static void _isdn_setup(struct net_device *dev)
 
        ether_setup(dev);
 
-       dev->flags = IFF_NOARP | IFF_POINTOPOINT;
        /* Setup the generic properties */
-       dev->mtu = 1500;
        dev->flags = IFF_NOARP|IFF_POINTOPOINT;
-       dev->type = ARPHRD_ETHER;
-       dev->addr_len = ETH_ALEN;
        dev->header_ops = NULL;
        dev->netdev_ops = &isdn_netdev_ops;