aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/i4l/isdn_net.c
diff options
context:
space:
mode:
authorKarsten Keil <kkeil@suse.de>2007-10-15 05:11:44 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-15 15:26:37 -0400
commitfaca94ffaed31528e2e859ee3c26d7d4dba6702f (patch)
tree16737e9d22b99c8116873586fec8c2813950acb1 /drivers/isdn/i4l/isdn_net.c
parentf885c5b08e76f920a4ed4dc63b8b19514272de7b (diff)
[ISDN]: Remove local copy of device name to make sure renames work.
Signed-off-by: Karsten Keil <kkeil@suse.de> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/isdn/i4l/isdn_net.c')
-rw-r--r--drivers/isdn/i4l/isdn_net.c144
1 files changed, 79 insertions, 65 deletions
diff --git a/drivers/isdn/i4l/isdn_net.c b/drivers/isdn/i4l/isdn_net.c
index 7c9cb7e19f2e..71ec2a8aab2a 100644
--- a/drivers/isdn/i4l/isdn_net.c
+++ b/drivers/isdn/i4l/isdn_net.c
@@ -328,7 +328,7 @@ isdn_net_autohup(void)
328 l->cps = (l->transcount * HZ) / (jiffies - last_jiffies); 328 l->cps = (l->transcount * HZ) / (jiffies - last_jiffies);
329 l->transcount = 0; 329 l->transcount = 0;
330 if (dev->net_verbose > 3) 330 if (dev->net_verbose > 3)
331 printk(KERN_DEBUG "%s: %d bogocps\n", l->name, l->cps); 331 printk(KERN_DEBUG "%s: %d bogocps\n", p->dev->name, l->cps);
332 if ((l->flags & ISDN_NET_CONNECTED) && (!l->dialstate)) { 332 if ((l->flags & ISDN_NET_CONNECTED) && (!l->dialstate)) {
333 anymore = 1; 333 anymore = 1;
334 l->huptimer++; 334 l->huptimer++;
@@ -350,12 +350,12 @@ isdn_net_autohup(void)
350 if (l->hupflags & ISDN_CHARGEHUP) { 350 if (l->hupflags & ISDN_CHARGEHUP) {
351 if (l->hupflags & ISDN_WAITCHARGE) { 351 if (l->hupflags & ISDN_WAITCHARGE) {
352 printk(KERN_DEBUG "isdn_net: Hupflags of %s are %X\n", 352 printk(KERN_DEBUG "isdn_net: Hupflags of %s are %X\n",
353 l->name, l->hupflags); 353 p->dev->name, l->hupflags);
354 isdn_net_hangup(p->dev); 354 isdn_net_hangup(p->dev);
355 } else if (time_after(jiffies, l->chargetime + l->chargeint)) { 355 } else if (time_after(jiffies, l->chargetime + l->chargeint)) {
356 printk(KERN_DEBUG 356 printk(KERN_DEBUG
357 "isdn_net: %s: chtime = %lu, chint = %d\n", 357 "isdn_net: %s: chtime = %lu, chint = %d\n",
358 l->name, l->chargetime, l->chargeint); 358 p->dev->name, l->chargetime, l->chargeint);
359 isdn_net_hangup(p->dev); 359 isdn_net_hangup(p->dev);
360 } 360 }
361 } else 361 } else
@@ -442,8 +442,8 @@ isdn_net_stat_callback(int idx, isdn_ctrl *c)
442#endif 442#endif
443 isdn_net_lp_disconnected(lp); 443 isdn_net_lp_disconnected(lp);
444 isdn_all_eaz(lp->isdn_device, lp->isdn_channel); 444 isdn_all_eaz(lp->isdn_device, lp->isdn_channel);
445 printk(KERN_INFO "%s: remote hangup\n", lp->name); 445 printk(KERN_INFO "%s: remote hangup\n", p->dev->name);
446 printk(KERN_INFO "%s: Chargesum is %d\n", lp->name, 446 printk(KERN_INFO "%s: Chargesum is %d\n", p->dev->name,
447 lp->charge); 447 lp->charge);
448 isdn_net_unbind_channel(lp); 448 isdn_net_unbind_channel(lp);
449 return 1; 449 return 1;
@@ -487,7 +487,7 @@ isdn_net_stat_callback(int idx, isdn_ctrl *c)
487 isdn_net_add_to_bundle(nd, lp); 487 isdn_net_add_to_bundle(nd, lp);
488 } 488 }
489 } 489 }
490 printk(KERN_INFO "isdn_net: %s connected\n", lp->name); 490 printk(KERN_INFO "isdn_net: %s connected\n", p->dev->name);
491 /* If first Chargeinfo comes before B-Channel connect, 491 /* If first Chargeinfo comes before B-Channel connect,
492 * we correct the timestamp here. 492 * we correct the timestamp here.
493 */ 493 */
@@ -534,7 +534,7 @@ isdn_net_stat_callback(int idx, isdn_ctrl *c)
534 lp->hupflags |= ISDN_HAVECHARGE; 534 lp->hupflags |= ISDN_HAVECHARGE;
535 lp->chargetime = jiffies; 535 lp->chargetime = jiffies;
536 printk(KERN_DEBUG "isdn_net: Got CINF chargetime of %s now %lu\n", 536 printk(KERN_DEBUG "isdn_net: Got CINF chargetime of %s now %lu\n",
537 lp->name, lp->chargetime); 537 p->dev->name, lp->chargetime);
538 return 1; 538 return 1;
539 } 539 }
540 } 540 }
@@ -565,7 +565,7 @@ isdn_net_dial(void)
565 565
566#ifdef ISDN_DEBUG_NET_DIAL 566#ifdef ISDN_DEBUG_NET_DIAL
567 if (lp->dialstate) 567 if (lp->dialstate)
568 printk(KERN_DEBUG "%s: dialstate=%d\n", lp->name, lp->dialstate); 568 printk(KERN_DEBUG "%s: dialstate=%d\n", p->dev->name, lp->dialstate);
569#endif 569#endif
570 switch (lp->dialstate) { 570 switch (lp->dialstate) {
571 case 0: 571 case 0:
@@ -578,7 +578,7 @@ isdn_net_dial(void)
578 lp->dial = lp->phone[1]; 578 lp->dial = lp->phone[1];
579 if (!lp->dial) { 579 if (!lp->dial) {
580 printk(KERN_WARNING "%s: phone number deleted?\n", 580 printk(KERN_WARNING "%s: phone number deleted?\n",
581 lp->name); 581 p->dev->name);
582 isdn_net_hangup(p->dev); 582 isdn_net_hangup(p->dev);
583 break; 583 break;
584 } 584 }
@@ -632,13 +632,13 @@ isdn_net_dial(void)
632 cmd.arg = lp->isdn_channel; 632 cmd.arg = lp->isdn_channel;
633 if (!lp->dial) { 633 if (!lp->dial) {
634 printk(KERN_WARNING "%s: phone number deleted?\n", 634 printk(KERN_WARNING "%s: phone number deleted?\n",
635 lp->name); 635 p->dev->name);
636 isdn_net_hangup(p->dev); 636 isdn_net_hangup(p->dev);
637 break; 637 break;
638 } 638 }
639 if (!strncmp(lp->dial->num, "LEASED", strlen("LEASED"))) { 639 if (!strncmp(lp->dial->num, "LEASED", strlen("LEASED"))) {
640 lp->dialstate = 4; 640 lp->dialstate = 4;
641 printk(KERN_INFO "%s: Open leased line ...\n", lp->name); 641 printk(KERN_INFO "%s: Open leased line ...\n", p->dev->name);
642 } else { 642 } else {
643 if(lp->dialtimeout > 0) 643 if(lp->dialtimeout > 0)
644 if (time_after(jiffies, lp->dialstarted + lp->dialtimeout)) { 644 if (time_after(jiffies, lp->dialstarted + lp->dialtimeout)) {
@@ -688,7 +688,7 @@ isdn_net_dial(void)
688 dev->usage[i] |= ISDN_USAGE_OUTGOING; 688 dev->usage[i] |= ISDN_USAGE_OUTGOING;
689 isdn_info_update(); 689 isdn_info_update();
690 } 690 }
691 printk(KERN_INFO "%s: dialing %d %s... %s\n", lp->name, 691 printk(KERN_INFO "%s: dialing %d %s... %s\n", p->dev->name,
692 lp->dialretry, cmd.parm.setup.phone, 692 lp->dialretry, cmd.parm.setup.phone,
693 (cmd.parm.setup.si1 == 1) ? "DOV" : ""); 693 (cmd.parm.setup.si1 == 1) ? "DOV" : "");
694 lp->dtimer = 0; 694 lp->dtimer = 0;
@@ -797,7 +797,7 @@ isdn_net_dial(void)
797 */ 797 */
798 if (lp->dtimer++ > lp->cbdelay) 798 if (lp->dtimer++ > lp->cbdelay)
799 { 799 {
800 printk(KERN_INFO "%s: hangup waiting for callback ...\n", lp->name); 800 printk(KERN_INFO "%s: hangup waiting for callback ...\n", p->dev->name);
801 lp->dtimer = 0; 801 lp->dtimer = 0;
802 lp->dialstate = 4; 802 lp->dialstate = 4;
803 cmd.driver = lp->isdn_device; 803 cmd.driver = lp->isdn_device;
@@ -810,7 +810,7 @@ isdn_net_dial(void)
810 break; 810 break;
811 default: 811 default:
812 printk(KERN_WARNING "isdn_net: Illegal dialstate %d for device %s\n", 812 printk(KERN_WARNING "isdn_net: Illegal dialstate %d for device %s\n",
813 lp->dialstate, lp->name); 813 lp->dialstate, p->dev->name);
814 } 814 }
815 p = (isdn_net_dev *) p->next; 815 p = (isdn_net_dev *) p->next;
816 } 816 }
@@ -836,11 +836,11 @@ isdn_net_hangup(struct net_device *d)
836 if (slp->flags & ISDN_NET_CONNECTED) { 836 if (slp->flags & ISDN_NET_CONNECTED) {
837 printk(KERN_INFO 837 printk(KERN_INFO
838 "isdn_net: hang up slave %s before %s\n", 838 "isdn_net: hang up slave %s before %s\n",
839 slp->name, lp->name); 839 lp->slave->name, d->name);
840 isdn_net_hangup(lp->slave); 840 isdn_net_hangup(lp->slave);
841 } 841 }
842 } 842 }
843 printk(KERN_INFO "isdn_net: local hangup %s\n", lp->name); 843 printk(KERN_INFO "isdn_net: local hangup %s\n", d->name);
844#ifdef CONFIG_ISDN_PPP 844#ifdef CONFIG_ISDN_PPP
845 if (lp->p_encap == ISDN_NET_ENCAP_SYNCPPP) 845 if (lp->p_encap == ISDN_NET_ENCAP_SYNCPPP)
846 isdn_ppp_free(lp); 846 isdn_ppp_free(lp);
@@ -858,7 +858,7 @@ isdn_net_hangup(struct net_device *d)
858 cmd.command = ISDN_CMD_HANGUP; 858 cmd.command = ISDN_CMD_HANGUP;
859 cmd.arg = lp->isdn_channel; 859 cmd.arg = lp->isdn_channel;
860 isdn_command(&cmd); 860 isdn_command(&cmd);
861 printk(KERN_INFO "%s: Chargesum is %d\n", lp->name, lp->charge); 861 printk(KERN_INFO "%s: Chargesum is %d\n", d->name, lp->charge);
862 isdn_all_eaz(lp->isdn_device, lp->isdn_channel); 862 isdn_all_eaz(lp->isdn_device, lp->isdn_channel);
863 } 863 }
864 isdn_net_unbind_channel(lp); 864 isdn_net_unbind_channel(lp);
@@ -885,7 +885,7 @@ isdn_net_log_skb(struct sk_buff * skb, isdn_net_local * lp)
885 /* fall back to old isdn_net_log_packet method() */ 885 /* fall back to old isdn_net_log_packet method() */
886 char * buf = skb->data; 886 char * buf = skb->data;
887 887
888 printk(KERN_DEBUG "isdn_net: protocol %04x is buggy, dev %s\n", skb->protocol, lp->name); 888 printk(KERN_DEBUG "isdn_net: protocol %04x is buggy, dev %s\n", skb->protocol, lp->netdev->dev->name);
889 p = buf; 889 p = buf;
890 proto = ETH_P_IP; 890 proto = ETH_P_IP;
891 switch (lp->p_encap) { 891 switch (lp->p_encap) {
@@ -1023,7 +1023,7 @@ void isdn_net_writebuf_skb(isdn_net_local *lp, struct sk_buff *skb)
1023 ret = isdn_writebuf_skb_stub(lp->isdn_device, lp->isdn_channel, 1, skb); 1023 ret = isdn_writebuf_skb_stub(lp->isdn_device, lp->isdn_channel, 1, skb);
1024 if (ret != len) { 1024 if (ret != len) {
1025 /* we should never get here */ 1025 /* we should never get here */
1026 printk(KERN_WARNING "%s: HL driver queue full\n", lp->name); 1026 printk(KERN_WARNING "%s: HL driver queue full\n", lp->netdev->dev->name);
1027 goto error; 1027 goto error;
1028 } 1028 }
1029 1029
@@ -1461,7 +1461,7 @@ isdn_ciscohdlck_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
1461 mod_timer(&lp->cisco_timer, expires); 1461 mod_timer(&lp->cisco_timer, expires);
1462 printk(KERN_INFO "%s: Keepalive period set " 1462 printk(KERN_INFO "%s: Keepalive period set "
1463 "to %d seconds.\n", 1463 "to %d seconds.\n",
1464 lp->name, lp->cisco_keepalive_period); 1464 dev->name, lp->cisco_keepalive_period);
1465 } 1465 }
1466 break; 1466 break;
1467 1467
@@ -1512,7 +1512,7 @@ isdn_net_ciscohdlck_slarp_send_keepalive(unsigned long data)
1512 lp->cisco_line_state = 0; 1512 lp->cisco_line_state = 0;
1513 printk (KERN_WARNING 1513 printk (KERN_WARNING
1514 "UPDOWN: Line protocol on Interface %s," 1514 "UPDOWN: Line protocol on Interface %s,"
1515 " changed state to down\n", lp->name); 1515 " changed state to down\n", lp->netdev->dev->name);
1516 /* should stop routing higher-level data accross */ 1516 /* should stop routing higher-level data accross */
1517 } else if ((!lp->cisco_line_state) && 1517 } else if ((!lp->cisco_line_state) &&
1518 (myseq_diff >= 0) && (myseq_diff <= 2)) { 1518 (myseq_diff >= 0) && (myseq_diff <= 2)) {
@@ -1520,14 +1520,14 @@ isdn_net_ciscohdlck_slarp_send_keepalive(unsigned long data)
1520 lp->cisco_line_state = 1; 1520 lp->cisco_line_state = 1;
1521 printk (KERN_WARNING 1521 printk (KERN_WARNING
1522 "UPDOWN: Line protocol on Interface %s," 1522 "UPDOWN: Line protocol on Interface %s,"
1523 " changed state to up\n", lp->name); 1523 " changed state to up\n", lp->netdev->dev->name);
1524 /* restart routing higher-level data accross */ 1524 /* restart routing higher-level data accross */
1525 } 1525 }
1526 1526
1527 if (lp->cisco_debserint) 1527 if (lp->cisco_debserint)
1528 printk (KERN_DEBUG "%s: HDLC " 1528 printk (KERN_DEBUG "%s: HDLC "
1529 "myseq %lu, mineseen %lu%c, yourseen %lu, %s\n", 1529 "myseq %lu, mineseen %lu%c, yourseen %lu, %s\n",
1530 lp->name, last_cisco_myseq, lp->cisco_mineseen, 1530 lp->netdev->dev->name, last_cisco_myseq, lp->cisco_mineseen,
1531 ((last_cisco_myseq == lp->cisco_mineseen) ? '*' : 040), 1531 ((last_cisco_myseq == lp->cisco_mineseen) ? '*' : 040),
1532 lp->cisco_yourseq, 1532 lp->cisco_yourseq,
1533 ((lp->cisco_line_state) ? "line up" : "line down")); 1533 ((lp->cisco_line_state) ? "line up" : "line down"));
@@ -1682,7 +1682,7 @@ isdn_net_ciscohdlck_slarp_in(isdn_net_local *lp, struct sk_buff *skb)
1682 "remote ip: %d.%d.%d.%d, " 1682 "remote ip: %d.%d.%d.%d, "
1683 "local ip: %d.%d.%d.%d " 1683 "local ip: %d.%d.%d.%d "
1684 "mask: %d.%d.%d.%d\n", 1684 "mask: %d.%d.%d.%d\n",
1685 lp->name, 1685 lp->netdev->dev->name,
1686 HIPQUAD(addr), 1686 HIPQUAD(addr),
1687 HIPQUAD(local), 1687 HIPQUAD(local),
1688 HIPQUAD(mask)); 1688 HIPQUAD(mask));
@@ -1690,7 +1690,7 @@ isdn_net_ciscohdlck_slarp_in(isdn_net_local *lp, struct sk_buff *skb)
1690 slarp_reply_out: 1690 slarp_reply_out:
1691 printk(KERN_INFO "%s: got invalid slarp " 1691 printk(KERN_INFO "%s: got invalid slarp "
1692 "reply (%d.%d.%d.%d/%d.%d.%d.%d) " 1692 "reply (%d.%d.%d.%d/%d.%d.%d.%d) "
1693 "- ignored\n", lp->name, 1693 "- ignored\n", lp->netdev->dev->name,
1694 HIPQUAD(addr), HIPQUAD(mask)); 1694 HIPQUAD(addr), HIPQUAD(mask));
1695 break; 1695 break;
1696 case CISCO_SLARP_KEEPALIVE: 1696 case CISCO_SLARP_KEEPALIVE:
@@ -1701,7 +1701,8 @@ isdn_net_ciscohdlck_slarp_in(isdn_net_local *lp, struct sk_buff *skb)
1701 lp->cisco_last_slarp_in) { 1701 lp->cisco_last_slarp_in) {
1702 printk(KERN_DEBUG "%s: Keepalive period mismatch - " 1702 printk(KERN_DEBUG "%s: Keepalive period mismatch - "
1703 "is %d but should be %d.\n", 1703 "is %d but should be %d.\n",
1704 lp->name, period, lp->cisco_keepalive_period); 1704 lp->netdev->dev->name, period,
1705 lp->cisco_keepalive_period);
1705 } 1706 }
1706 lp->cisco_last_slarp_in = jiffies; 1707 lp->cisco_last_slarp_in = jiffies;
1707 p += get_u32(p, &my_seq); 1708 p += get_u32(p, &my_seq);
@@ -1732,12 +1733,12 @@ isdn_net_ciscohdlck_receive(isdn_net_local *lp, struct sk_buff *skb)
1732 1733
1733 if (addr != CISCO_ADDR_UNICAST && addr != CISCO_ADDR_BROADCAST) { 1734 if (addr != CISCO_ADDR_UNICAST && addr != CISCO_ADDR_BROADCAST) {
1734 printk(KERN_WARNING "%s: Unknown Cisco addr 0x%02x\n", 1735 printk(KERN_WARNING "%s: Unknown Cisco addr 0x%02x\n",
1735 lp->name, addr); 1736 lp->netdev->dev->name, addr);
1736 goto out_free; 1737 goto out_free;
1737 } 1738 }
1738 if (ctrl != CISCO_CTRL) { 1739 if (ctrl != CISCO_CTRL) {
1739 printk(KERN_WARNING "%s: Unknown Cisco ctrl 0x%02x\n", 1740 printk(KERN_WARNING "%s: Unknown Cisco ctrl 0x%02x\n",
1740 lp->name, ctrl); 1741 lp->netdev->dev->name, ctrl);
1741 goto out_free; 1742 goto out_free;
1742 } 1743 }
1743 1744
@@ -1748,7 +1749,8 @@ isdn_net_ciscohdlck_receive(isdn_net_local *lp, struct sk_buff *skb)
1748 case CISCO_TYPE_CDP: 1749 case CISCO_TYPE_CDP:
1749 if (lp->cisco_debserint) 1750 if (lp->cisco_debserint)
1750 printk(KERN_DEBUG "%s: Received CDP packet. use " 1751 printk(KERN_DEBUG "%s: Received CDP packet. use "
1751 "\"no cdp enable\" on cisco.\n", lp->name); 1752 "\"no cdp enable\" on cisco.\n",
1753 lp->netdev->dev->name);
1752 goto out_free; 1754 goto out_free;
1753 default: 1755 default:
1754 /* no special cisco protocol */ 1756 /* no special cisco protocol */
@@ -1843,7 +1845,7 @@ isdn_net_receive(struct net_device *ndev, struct sk_buff *skb)
1843 }; 1845 };
1844#endif /* CONFIG_ISDN_X25 */ 1846#endif /* CONFIG_ISDN_X25 */
1845 printk(KERN_WARNING "%s: unknown encapsulation, dropping\n", 1847 printk(KERN_WARNING "%s: unknown encapsulation, dropping\n",
1846 lp->name); 1848 lp->netdev->dev->name);
1847 kfree_skb(skb); 1849 kfree_skb(skb);
1848 return; 1850 return;
1849 } 1851 }
@@ -2174,7 +2176,7 @@ isdn_net_find_icall(int di, int ch, int idx, setup_parm *setup)
2174 wret = matchret; 2176 wret = matchret;
2175#ifdef ISDN_DEBUG_NET_ICALL 2177#ifdef ISDN_DEBUG_NET_ICALL
2176 printk(KERN_DEBUG "n_fi: if='%s', l.msn=%s, l.flags=%d, l.dstate=%d\n", 2178 printk(KERN_DEBUG "n_fi: if='%s', l.msn=%s, l.flags=%d, l.dstate=%d\n",
2177 lp->name, lp->msn, lp->flags, lp->dialstate); 2179 p->dev->name, lp->msn, lp->flags, lp->dialstate);
2178#endif 2180#endif
2179 if ((!matchret) && /* EAZ is matching */ 2181 if ((!matchret) && /* EAZ is matching */
2180 (((!(lp->flags & ISDN_NET_CONNECTED)) && /* but not connected */ 2182 (((!(lp->flags & ISDN_NET_CONNECTED)) && /* but not connected */
@@ -2277,7 +2279,7 @@ isdn_net_find_icall(int di, int ch, int idx, setup_parm *setup)
2277 * */ 2279 * */
2278 if (ISDN_NET_DIALMODE(*lp) == ISDN_NET_DM_OFF) { 2280 if (ISDN_NET_DIALMODE(*lp) == ISDN_NET_DM_OFF) {
2279 printk(KERN_INFO "incoming call, interface %s `stopped' -> rejected\n", 2281 printk(KERN_INFO "incoming call, interface %s `stopped' -> rejected\n",
2280 lp->name); 2282 p->dev->name);
2281 return 3; 2283 return 3;
2282 } 2284 }
2283 /* 2285 /*
@@ -2286,7 +2288,7 @@ isdn_net_find_icall(int di, int ch, int idx, setup_parm *setup)
2286 */ 2288 */
2287 if (!isdn_net_device_started(p)) { 2289 if (!isdn_net_device_started(p)) {
2288 printk(KERN_INFO "%s: incoming call, interface down -> rejected\n", 2290 printk(KERN_INFO "%s: incoming call, interface down -> rejected\n",
2289 lp->name); 2291 p->dev->name);
2290 return 3; 2292 return 3;
2291 } 2293 }
2292 /* Interface is up, now see if it's a slave. If so, see if 2294 /* Interface is up, now see if it's a slave. If so, see if
@@ -2294,8 +2296,8 @@ isdn_net_find_icall(int di, int ch, int idx, setup_parm *setup)
2294 */ 2296 */
2295 if (lp->master) { 2297 if (lp->master) {
2296 isdn_net_local *mlp = (isdn_net_local *) lp->master->priv; 2298 isdn_net_local *mlp = (isdn_net_local *) lp->master->priv;
2297 printk(KERN_DEBUG "ICALLslv: %s\n", lp->name); 2299 printk(KERN_DEBUG "ICALLslv: %s\n", p->dev->name);
2298 printk(KERN_DEBUG "master=%s\n", mlp->name); 2300 printk(KERN_DEBUG "master=%s\n", lp->master->name);
2299 if (mlp->flags & ISDN_NET_CONNECTED) { 2301 if (mlp->flags & ISDN_NET_CONNECTED) {
2300 printk(KERN_DEBUG "master online\n"); 2302 printk(KERN_DEBUG "master online\n");
2301 /* Master is online, find parent-slave (master if first slave) */ 2303 /* Master is online, find parent-slave (master if first slave) */
@@ -2322,11 +2324,11 @@ isdn_net_find_icall(int di, int ch, int idx, setup_parm *setup)
2322 * */ 2324 * */
2323 if (ISDN_NET_DIALMODE(*lp) == ISDN_NET_DM_OFF) { 2325 if (ISDN_NET_DIALMODE(*lp) == ISDN_NET_DM_OFF) {
2324 printk(KERN_INFO "incoming call for callback, interface %s `off' -> rejected\n", 2326 printk(KERN_INFO "incoming call for callback, interface %s `off' -> rejected\n",
2325 lp->name); 2327 p->dev->name);
2326 return 3; 2328 return 3;
2327 } 2329 }
2328 printk(KERN_DEBUG "%s: call from %s -> %s, start callback\n", 2330 printk(KERN_DEBUG "%s: call from %s -> %s, start callback\n",
2329 lp->name, nr, eaz); 2331 p->dev->name, nr, eaz);
2330 if (lp->phone[1]) { 2332 if (lp->phone[1]) {
2331 /* Grab a free ISDN-Channel */ 2333 /* Grab a free ISDN-Channel */
2332 spin_lock_irqsave(&dev->lock, flags); 2334 spin_lock_irqsave(&dev->lock, flags);
@@ -2340,7 +2342,8 @@ isdn_net_find_icall(int di, int ch, int idx, setup_parm *setup)
2340 lp->msn) 2342 lp->msn)
2341 ) < 0) { 2343 ) < 0) {
2342 2344
2343 printk(KERN_WARNING "isdn_net_find_icall: No channel for %s\n", lp->name); 2345 printk(KERN_WARNING "isdn_net_find_icall: No channel for %s\n",
2346 p->dev->name);
2344 spin_unlock_irqrestore(&dev->lock, flags); 2347 spin_unlock_irqrestore(&dev->lock, flags);
2345 return 0; 2348 return 0;
2346 } 2349 }
@@ -2361,11 +2364,12 @@ isdn_net_find_icall(int di, int ch, int idx, setup_parm *setup)
2361 /* Initiate dialing by returning 2 or 4 */ 2364 /* Initiate dialing by returning 2 or 4 */
2362 return (lp->flags & ISDN_NET_CBHUP) ? 2 : 4; 2365 return (lp->flags & ISDN_NET_CBHUP) ? 2 : 4;
2363 } else 2366 } else
2364 printk(KERN_WARNING "isdn_net: %s: No phone number\n", lp->name); 2367 printk(KERN_WARNING "isdn_net: %s: No phone number\n",
2368 p->dev->name);
2365 return 0; 2369 return 0;
2366 } else { 2370 } else {
2367 printk(KERN_DEBUG "%s: call from %s -> %s accepted\n", lp->name, nr, 2371 printk(KERN_DEBUG "%s: call from %s -> %s accepted\n",
2368 eaz); 2372 p->dev->name, nr, eaz);
2369 /* if this interface is dialing, it does it probably on a different 2373 /* if this interface is dialing, it does it probably on a different
2370 device, so free this device */ 2374 device, so free this device */
2371 if ((lp->dialstate == 4) || (lp->dialstate == 12)) { 2375 if ((lp->dialstate == 4) || (lp->dialstate == 12)) {
@@ -2424,7 +2428,7 @@ isdn_net_findif(char *name)
2424 isdn_net_dev *p = dev->netdev; 2428 isdn_net_dev *p = dev->netdev;
2425 2429
2426 while (p) { 2430 while (p) {
2427 if (!strcmp(p->local->name, name)) 2431 if (!strcmp(p->dev->name, name))
2428 return p; 2432 return p;
2429 p = (isdn_net_dev *) p->next; 2433 p = (isdn_net_dev *) p->next;
2430 } 2434 }
@@ -2453,7 +2457,8 @@ isdn_net_force_dial_lp(isdn_net_local * lp)
2453 lp->pre_device, 2457 lp->pre_device,
2454 lp->pre_channel, 2458 lp->pre_channel,
2455 lp->msn)) < 0) { 2459 lp->msn)) < 0) {
2456 printk(KERN_WARNING "isdn_net_force_dial: No channel for %s\n", lp->name); 2460 printk(KERN_WARNING "isdn_net_force_dial: No channel for %s\n",
2461 lp->netdev->dev->name);
2457 spin_unlock_irqrestore(&dev->lock, flags); 2462 spin_unlock_irqrestore(&dev->lock, flags);
2458 return -EAGAIN; 2463 return -EAGAIN;
2459 } 2464 }
@@ -2556,7 +2561,7 @@ isdn_net_new(char *name, struct net_device *master)
2556 return NULL; 2561 return NULL;
2557 } 2562 }
2558 if (name == NULL) 2563 if (name == NULL)
2559 name = " "; 2564 return NULL;
2560 if (!(netdev = kzalloc(sizeof(isdn_net_dev), GFP_KERNEL))) { 2565 if (!(netdev = kzalloc(sizeof(isdn_net_dev), GFP_KERNEL))) {
2561 printk(KERN_WARNING "isdn_net: Could not allocate net-device\n"); 2566 printk(KERN_WARNING "isdn_net: Could not allocate net-device\n");
2562 return NULL; 2567 return NULL;
@@ -2568,7 +2573,6 @@ isdn_net_new(char *name, struct net_device *master)
2568 return NULL; 2573 return NULL;
2569 } 2574 }
2570 netdev->local = netdev->dev->priv; 2575 netdev->local = netdev->dev->priv;
2571 strcpy(netdev->local->name, netdev->dev->name);
2572 netdev->dev->init = isdn_net_init; 2576 netdev->dev->init = isdn_net_init;
2573 if (master) { 2577 if (master) {
2574 /* Device shall be a slave */ 2578 /* Device shall be a slave */
@@ -2673,7 +2677,7 @@ isdn_net_setcfg(isdn_net_ioctl_cfg * cfg)
2673#endif 2677#endif
2674 if (isdn_net_device_started(p)) { 2678 if (isdn_net_device_started(p)) {
2675 printk(KERN_WARNING "%s: cannot change encap when if is up\n", 2679 printk(KERN_WARNING "%s: cannot change encap when if is up\n",
2676 lp->name); 2680 p->dev->name);
2677 return -EBUSY; 2681 return -EBUSY;
2678 } 2682 }
2679#ifdef CONFIG_ISDN_X25 2683#ifdef CONFIG_ISDN_X25
@@ -2698,7 +2702,7 @@ isdn_net_setcfg(isdn_net_ioctl_cfg * cfg)
2698 case ISDN_NET_ENCAP_SYNCPPP: 2702 case ISDN_NET_ENCAP_SYNCPPP:
2699#ifndef CONFIG_ISDN_PPP 2703#ifndef CONFIG_ISDN_PPP
2700 printk(KERN_WARNING "%s: SyncPPP support not configured\n", 2704 printk(KERN_WARNING "%s: SyncPPP support not configured\n",
2701 lp->name); 2705 p->dev->name);
2702 return -EINVAL; 2706 return -EINVAL;
2703#else 2707#else
2704 p->dev->type = ARPHRD_PPP; /* change ARP type */ 2708 p->dev->type = ARPHRD_PPP; /* change ARP type */
@@ -2725,7 +2729,7 @@ isdn_net_setcfg(isdn_net_ioctl_cfg * cfg)
2725 break; 2729 break;
2726 printk(KERN_WARNING 2730 printk(KERN_WARNING
2727 "%s: encapsulation protocol %d not supported\n", 2731 "%s: encapsulation protocol %d not supported\n",
2728 p->local->name, cfg->p_encap); 2732 p->dev->name, cfg->p_encap);
2729 return -EINVAL; 2733 return -EINVAL;
2730 } 2734 }
2731 if (strlen(cfg->drvid)) { 2735 if (strlen(cfg->drvid)) {
@@ -2902,13 +2906,18 @@ isdn_net_getcfg(isdn_net_ioctl_cfg * cfg)
2902 cfg->pppbind = lp->pppbind; 2906 cfg->pppbind = lp->pppbind;
2903 cfg->dialtimeout = lp->dialtimeout >= 0 ? lp->dialtimeout / HZ : -1; 2907 cfg->dialtimeout = lp->dialtimeout >= 0 ? lp->dialtimeout / HZ : -1;
2904 cfg->dialwait = lp->dialwait / HZ; 2908 cfg->dialwait = lp->dialwait / HZ;
2905 if (lp->slave) 2909 if (lp->slave) {
2906 strcpy(cfg->slave, ((isdn_net_local *) lp->slave->priv)->name); 2910 if (strlen(lp->slave->name) > 8)
2907 else 2911 strcpy(cfg->slave, "too-long");
2912 else
2913 strcpy(cfg->slave, lp->slave->name);
2914 } else
2908 cfg->slave[0] = '\0'; 2915 cfg->slave[0] = '\0';
2909 if (lp->master) 2916 if (lp->master) {
2910 strcpy(cfg->master, ((isdn_net_local *) lp->master->priv)->name); 2917 if (strlen(lp->master->name) > 8)
2911 else 2918 strcpy(cfg->master, "too-long");
2919 strcpy(cfg->master, lp->master->name);
2920 } else
2912 cfg->master[0] = '\0'; 2921 cfg->master[0] = '\0';
2913 return 0; 2922 return 0;
2914 } 2923 }
@@ -2978,7 +2987,8 @@ isdn_net_getpeer(isdn_net_ioctl_phone *phone, isdn_net_ioctl_phone __user *peer)
2978 isdn_net_dev *p = isdn_net_findif(phone->name); 2987 isdn_net_dev *p = isdn_net_findif(phone->name);
2979 int ch, dv, idx; 2988 int ch, dv, idx;
2980 2989
2981 if (!p) return -ENODEV; 2990 if (!p)
2991 return -ENODEV;
2982 /* 2992 /*
2983 * Theoretical race: while this executes, the remote number might 2993 * Theoretical race: while this executes, the remote number might
2984 * become invalid (hang up) or change (new connection), resulting 2994 * become invalid (hang up) or change (new connection), resulting
@@ -2987,14 +2997,18 @@ isdn_net_getpeer(isdn_net_ioctl_phone *phone, isdn_net_ioctl_phone __user *peer)
2987 */ 2997 */
2988 ch = p->local->isdn_channel; 2998 ch = p->local->isdn_channel;
2989 dv = p->local->isdn_device; 2999 dv = p->local->isdn_device;
2990 if(ch<0 && dv<0) return -ENOTCONN; 3000 if(ch < 0 && dv < 0)
3001 return -ENOTCONN;
2991 idx = isdn_dc2minor(dv, ch); 3002 idx = isdn_dc2minor(dv, ch);
2992 if (idx<0) return -ENODEV; 3003 if (idx <0 )
3004 return -ENODEV;
2993 /* for pre-bound channels, we need this extra check */ 3005 /* for pre-bound channels, we need this extra check */
2994 if ( strncmp(dev->num[idx],"???",3) == 0 ) return -ENOTCONN; 3006 if (strncmp(dev->num[idx], "???", 3) == 0)
2995 strncpy(phone->phone,dev->num[idx],ISDN_MSNLEN); 3007 return -ENOTCONN;
2996 phone->outgoing=USG_OUTGOING(dev->usage[idx]); 3008 strncpy(phone->phone, dev->num[idx], ISDN_MSNLEN);
2997 if ( copy_to_user(peer,phone,sizeof(*peer)) ) return -EFAULT; 3009 phone->outgoing = USG_OUTGOING(dev->usage[idx]);
3010 if (copy_to_user(peer, phone, sizeof(*peer)))
3011 return -EFAULT;
2998 return 0; 3012 return 0;
2999} 3013}
3000/* 3014/*
@@ -3113,18 +3127,18 @@ isdn_net_realrm(isdn_net_dev * p, isdn_net_dev * q)
3113 dev->netdev = p->next; 3127 dev->netdev = p->next;
3114 if (p->local->slave) { 3128 if (p->local->slave) {
3115 /* If this interface has a slave, remove it also */ 3129 /* If this interface has a slave, remove it also */
3116 char *slavename = ((isdn_net_local *) (p->local->slave->priv))->name; 3130 char *slavename = p->local->slave->name;
3117 isdn_net_dev *n = dev->netdev; 3131 isdn_net_dev *n = dev->netdev;
3118 q = NULL; 3132 q = NULL;
3119 while (n) { 3133 while (n) {
3120 if (!strcmp(n->local->name, slavename)) { 3134 if (!strcmp(n->dev->name, slavename)) {
3121 spin_unlock_irqrestore(&dev->lock, flags); 3135 spin_unlock_irqrestore(&dev->lock, flags);
3122 isdn_net_realrm(n, q); 3136 isdn_net_realrm(n, q);
3123 spin_lock_irqsave(&dev->lock, flags); 3137 spin_lock_irqsave(&dev->lock, flags);
3124 break; 3138 break;
3125 } 3139 }
3126 q = n; 3140 q = n;
3127 n = (isdn_net_dev *) n->next; 3141 n = (isdn_net_dev *)n->next;
3128 } 3142 }
3129 } 3143 }
3130 spin_unlock_irqrestore(&dev->lock, flags); 3144 spin_unlock_irqrestore(&dev->lock, flags);
@@ -3152,7 +3166,7 @@ isdn_net_rm(char *name)
3152 p = dev->netdev; 3166 p = dev->netdev;
3153 q = NULL; 3167 q = NULL;
3154 while (p) { 3168 while (p) {
3155 if (!strcmp(p->local->name, name)) { 3169 if (!strcmp(p->dev->name, name)) {
3156 spin_unlock_irqrestore(&dev->lock, flags); 3170 spin_unlock_irqrestore(&dev->lock, flags);
3157 return (isdn_net_realrm(p, q)); 3171 return (isdn_net_realrm(p, q));
3158 } 3172 }