X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fisdn%2Fi4l%2Fisdn_net.c;h=838b3734e2b6d82cf2bda00072399167077da68a;hb=refs%2Fheads%2Fvserver;hp=03f22b6b7697ec066f065354b6e8c6e3c8885320;hpb=5273a3df6485dc2ad6aa7ddd441b9a21970f003b;p=linux-2.6.git diff --git a/drivers/isdn/i4l/isdn_net.c b/drivers/isdn/i4l/isdn_net.c index 03f22b6b7..838b3734e 100644 --- a/drivers/isdn/i4l/isdn_net.c +++ b/drivers/isdn/i4l/isdn_net.c @@ -22,7 +22,6 @@ * http://i4l.zabbadoz.net/i4l/cisco-hdlc.txt */ -#include #include #include #include @@ -176,7 +175,7 @@ static __inline__ void isdn_net_zero_frame_cnt(isdn_net_local *lp) /* Prototypes */ -int isdn_net_force_dial_lp(isdn_net_local *); +static int isdn_net_force_dial_lp(isdn_net_local *); static int isdn_net_start_xmit(struct sk_buff *, struct net_device *); static void isdn_net_ciscohdlck_connected(isdn_net_local *lp); @@ -312,10 +311,10 @@ isdn_net_unbind_channel(isdn_net_local * lp) * Since this function is called every second, simply reset the * byte-counter of the interface after copying it to the cps-variable. */ -unsigned long last_jiffies = -HZ; +static unsigned long last_jiffies = -HZ; void -isdn_net_autohup() +isdn_net_autohup(void) { isdn_net_dev *p = dev->netdev; int anymore; @@ -396,8 +395,8 @@ isdn_net_stat_callback(int idx, isdn_ctrl *c) if (p) { isdn_net_local *lp = p->local; #ifdef CONFIG_ISDN_X25 - struct concap_proto *cprot = lp -> netdev -> cprot; - struct concap_proto_ops *pops = cprot ? cprot -> pops : 0; + struct concap_proto *cprot = lp->netdev->cprot; + struct concap_proto_ops *pops = cprot ? cprot->pops : NULL; #endif switch (cmd) { case ISDN_STAT_BSENT: @@ -617,7 +616,7 @@ isdn_net_dial(void) s = "dial suppressed: isdn system stopped"; else s = "dial suppressed: dialmode `off'"; - isdn_net_unreachable(&p->dev, 0, s); + isdn_net_unreachable(&p->dev, NULL, s); isdn_net_hangup(&p->dev); break; } @@ -645,7 +644,7 @@ isdn_net_dial(void) if (time_after(jiffies, lp->dialstarted + lp->dialtimeout)) { lp->dialwait_timer = jiffies + lp->dialwait; lp->dialstarted = 0; - isdn_net_unreachable(&p->dev, 0, "dial: timed out"); + isdn_net_unreachable(&p->dev, NULL, "dial: timed out"); isdn_net_hangup(&p->dev); break; } @@ -675,7 +674,7 @@ isdn_net_dial(void) if (lp->dialtimeout == 0) { lp->dialwait_timer = jiffies + lp->dialwait; lp->dialstarted = 0; - isdn_net_unreachable(&p->dev, 0, "dial: tried all numbers dialmax times"); + isdn_net_unreachable(&p->dev, NULL, "dial: tried all numbers dialmax times"); } isdn_net_hangup(&p->dev); break; @@ -827,8 +826,8 @@ isdn_net_hangup(struct net_device *d) isdn_net_local *lp = (isdn_net_local *) d->priv; isdn_ctrl cmd; #ifdef CONFIG_ISDN_X25 - struct concap_proto *cprot = lp -> netdev -> cprot; - struct concap_proto_ops *pops = cprot ? cprot -> pops : 0; + struct concap_proto *cprot = lp->netdev->cprot; + struct concap_proto_ops *pops = cprot ? cprot->pops : NULL; #endif if (lp->flags & ISDN_NET_CONNECTED) { @@ -985,9 +984,9 @@ void isdn_net_write_super(isdn_net_local *lp, struct sk_buff *skb) /* * called from tq_immediate */ -static void isdn_net_softint(void *private) +static void isdn_net_softint(struct work_struct *work) { - isdn_net_local *lp = private; + isdn_net_local *lp = container_of(work, isdn_net_local, tqueue); struct sk_buff *skb; spin_lock_bh(&lp->xmit_lock); @@ -1131,7 +1130,7 @@ isdn_net_adjust_hdr(struct sk_buff *skb, struct net_device *dev) } -void isdn_net_tx_timeout(struct net_device * ndev) +static void isdn_net_tx_timeout(struct net_device * ndev) { isdn_net_local *lp = (isdn_net_local *) ndev->priv; @@ -1369,7 +1368,7 @@ isdn_net_type_trans(struct sk_buff *skb, struct net_device *dev) skb->mac.raw = skb->data; skb_pull(skb, ETH_HLEN); - eth = skb->mac.ethernet; + eth = eth_hdr(skb); if (*eth->h_dest & 1) { if (memcmp(eth->h_dest, dev->broadcast, ETH_ALEN) == 0) @@ -1416,16 +1415,15 @@ isdn_net_ciscohdlck_alloc_skb(isdn_net_local *lp, int len) struct sk_buff *skb; skb = alloc_skb(hl + len, GFP_ATOMIC); - if (!skb) { + if (skb) + skb_reserve(skb, hl); + else printk("isdn out of mem at %s:%d!\n", __FILE__, __LINE__); - return 0; - } - skb_reserve(skb, hl); return skb; } /* cisco hdlck device private ioctls */ -int +static int isdn_ciscohdlck_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) { isdn_net_local *lp = (isdn_net_local *) dev->priv; @@ -1433,7 +1431,7 @@ isdn_ciscohdlck_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) unsigned long expires = 0; int tmp = 0; int period = lp->cisco_keepalive_period; - char debserint = lp->cisco_debserint; + s8 debserint = lp->cisco_debserint; int rc = 0; if (lp->p_encap != ISDN_NET_ENCAP_CISCOHDLCK) @@ -1443,15 +1441,14 @@ isdn_ciscohdlck_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) /* get/set keepalive period */ case SIOCGKEEPPERIOD: len = (unsigned long)sizeof(lp->cisco_keepalive_period); - if (copy_to_user((char *)ifr->ifr_ifru.ifru_data, - (int *)&lp->cisco_keepalive_period, len)) + if (copy_to_user(ifr->ifr_data, + &lp->cisco_keepalive_period, len)) rc = -EFAULT; break; case SIOCSKEEPPERIOD: tmp = lp->cisco_keepalive_period; len = (unsigned long)sizeof(lp->cisco_keepalive_period); - if (copy_from_user((int *)&period, - (char *)ifr->ifr_ifru.ifru_data, len)) + if (copy_from_user(&period, ifr->ifr_data, len)) rc = -EFAULT; if ((period > 0) && (period <= 32767)) lp->cisco_keepalive_period = period; @@ -1470,14 +1467,14 @@ isdn_ciscohdlck_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) /* get/set debugging */ case SIOCGDEBSERINT: len = (unsigned long)sizeof(lp->cisco_debserint); - if (copy_to_user((char *)ifr->ifr_ifru.ifru_data, - (char *)&lp->cisco_debserint, len)) + if (copy_to_user(ifr->ifr_data, + &lp->cisco_debserint, len)) rc = -EFAULT; break; case SIOCSDEBSERINT: len = (unsigned long)sizeof(lp->cisco_debserint); - if (copy_from_user((char *)&debserint, - (char *)ifr->ifr_ifru.ifru_data, len)) + if (copy_from_user(&debserint, + ifr->ifr_data, len)) rc = -EFAULT; if ((debserint >= 0) && (debserint <= 64)) lp->cisco_debserint = debserint; @@ -1617,8 +1614,8 @@ isdn_net_ciscohdlck_slarp_send_reply(isdn_net_local *lp) struct sk_buff *skb; unsigned char *p; struct in_device *in_dev = NULL; - u32 addr = 0; /* local ipv4 address */ - u32 mask = 0; /* local netmask */ + __be32 addr = 0; /* local ipv4 address */ + __be32 mask = 0; /* local netmask */ if ((in_dev = lp->netdev->dev.ip_ptr) != NULL) { /* take primary(first) address of interface */ @@ -2183,7 +2180,7 @@ isdn_net_find_icall(int di, int ch, int idx, setup_parm *setup) *my_eaz == 'b' || *my_eaz == 'B') my_eaz++; /* skip to allow a match */ else - my_eaz = 0; /* force non match */ + my_eaz = NULL; /* force non match */ } else { /* it's a DATA call, check if we allow it */ if (*my_eaz == 'b' || *my_eaz == 'B') my_eaz++; /* skip to allow a match */ @@ -2462,7 +2459,7 @@ isdn_net_findif(char *name) * This is called from the userlevel-routine below or * from isdn_net_start_xmit(). */ -int +static int isdn_net_force_dial_lp(isdn_net_local * lp) { if ((!(lp->flags & ISDN_NET_CONNECTED)) && !lp->dialstate) { @@ -2545,17 +2542,15 @@ isdn_net_new(char *name, struct net_device *master) printk(KERN_WARNING "isdn_net: interface %s already exists\n", name); return NULL; } - if (!(netdev = (isdn_net_dev *) kmalloc(sizeof(isdn_net_dev), GFP_KERNEL))) { + if (!(netdev = kzalloc(sizeof(isdn_net_dev), GFP_KERNEL))) { printk(KERN_WARNING "isdn_net: Could not allocate net-device\n"); return NULL; } - memset(netdev, 0, sizeof(isdn_net_dev)); - if (!(netdev->local = (isdn_net_local *) kmalloc(sizeof(isdn_net_local), GFP_KERNEL))) { + if (!(netdev->local = kzalloc(sizeof(isdn_net_local), GFP_KERNEL))) { printk(KERN_WARNING "isdn_net: Could not allocate device locals\n"); kfree(netdev); return NULL; } - memset(netdev->local, 0, sizeof(isdn_net_local)); if (name == NULL) strcpy(netdev->local->name, " "); else @@ -2599,7 +2594,7 @@ isdn_net_new(char *name, struct net_device *master) netdev->local->netdev = netdev; netdev->local->next = netdev->local; - INIT_WORK(&netdev->local->tqueue, (void *)(void *) isdn_net_softint, netdev->local); + INIT_WORK(&netdev->local->tqueue, isdn_net_softint); spin_lock_init(&netdev->local->xmit_lock); netdev->local->isdn_device = -1; @@ -2953,7 +2948,7 @@ isdn_net_addphone(isdn_net_ioctl_phone * phone) isdn_net_phone *n; if (p) { - if (!(n = (isdn_net_phone *) kmalloc(sizeof(isdn_net_phone), GFP_KERNEL))) + if (!(n = kmalloc(sizeof(isdn_net_phone), GFP_KERNEL))) return -ENOMEM; strcpy(n->num, phone->phone); n->next = p->local->phone[phone->outgoing & 1]; @@ -2968,7 +2963,7 @@ isdn_net_addphone(isdn_net_ioctl_phone * phone) * This might sleep and must be called with the isdn semaphore down. */ int -isdn_net_getphones(isdn_net_ioctl_phone * phone, char *phones) +isdn_net_getphones(isdn_net_ioctl_phone * phone, char __user *phones) { isdn_net_dev *p = isdn_net_findif(phone->name); int inout = phone->outgoing & 1; @@ -3001,7 +2996,7 @@ isdn_net_getphones(isdn_net_ioctl_phone * phone, char *phones) * to user space. */ int -isdn_net_getpeer(isdn_net_ioctl_phone *phone, isdn_net_ioctl_phone *peer) +isdn_net_getpeer(isdn_net_ioctl_phone *phone, isdn_net_ioctl_phone __user *peer) { isdn_net_dev *p = isdn_net_findif(phone->name); int ch, dv, idx;