]>
Commit | Line | Data |
---|---|---|
34ba3404 JB |
1 | --- linux-2.6.3/drivers/net/wan/tahoe9xx.c.orig Fri Feb 27 11:58:16 2004 |
2 | +++ linux-2.6.3/drivers/net/wan/tahoe9xx.c Fri Feb 27 13:27:08 2004 | |
3 | @@ -265,7 +265,7 @@ | |
4 | } ds21554_t; | |
5 | ||
6 | typedef struct port_s { | |
7 | - hdlc_device hdlc; /* HDLC device struct - must be first */ | |
8 | + struct net_device *dev; | |
9 | struct card_s *card; | |
10 | spinlock_t lock; /* TX lock */ | |
11 | te1_settings settings; | |
12 | @@ -361,21 +361,20 @@ | |
13 | ||
14 | static int t9xx_open(struct net_device *dev) | |
15 | { | |
16 | - hdlc_device *hdlc = dev_to_hdlc(dev); | |
17 | - port_t *port = hdlc_to_port(hdlc); | |
18 | + port_t *port = dev_to_port(dev); | |
19 | int result; | |
20 | ||
21 | if (!try_module_get(THIS_MODULE)) | |
22 | return -EFAULT; /* rmmod in progress */ | |
23 | ||
24 | - result = hdlc_open(hdlc); | |
25 | + result = hdlc_open(dev); | |
26 | ||
27 | if (result) { | |
28 | module_put(THIS_MODULE); | |
29 | return result; | |
30 | } | |
31 | ||
32 | - sca_open(hdlc); | |
33 | + sca_open(dev); | |
34 | t9xx_set_iface(port); | |
35 | sca_flush(port_to_card(port)); | |
36 | return 0; | |
37 | @@ -385,11 +384,9 @@ | |
38 | ||
39 | static int t9xx_close(struct net_device *dev) | |
40 | { | |
41 | - hdlc_device *hdlc = dev_to_hdlc(dev); | |
42 | - | |
43 | - sca_close(hdlc); | |
44 | + sca_close(dev); | |
45 | sca_flush(port_to_card(dev_to_port(dev))); | |
46 | - hdlc_close(hdlc); | |
47 | + hdlc_close(dev); | |
48 | module_put(THIS_MODULE); | |
49 | return 0; | |
50 | } | |
51 | @@ -400,12 +397,11 @@ | |
52 | { | |
53 | const size_t size = sizeof(te1_settings); | |
54 | te1_settings new_line, *line = ifr->ifr_settings.ifs_ifsu.te1; | |
55 | - hdlc_device *hdlc = dev_to_hdlc(dev); | |
56 | - port_t *port = hdlc_to_port(hdlc); | |
57 | + port_t *port = dev_to_port(dev); | |
58 | ||
59 | #ifdef CONFIG_HDLC_DEBUG_RINGS | |
60 | if (cmd == SIOCDEVPRIVATE) { | |
61 | - sca_dump_rings(hdlc); | |
62 | + sca_dump_rings(dev); | |
63 | return 0; | |
64 | } | |
65 | #endif | |
66 | @@ -463,8 +459,10 @@ | |
67 | else | |
68 | ports = 1; | |
69 | for(i = 0; i < ports; i++) | |
70 | - if (card->ports[i].card) | |
71 | - unregister_hdlc_device(&card->ports[i].hdlc); | |
72 | + if (card->ports[i].card) { | |
73 | + unregister_hdlc_device(card->ports[i].dev); | |
74 | + free_netdev(card->ports[i].dev); | |
75 | + } | |
76 | ||
77 | if (card->irq) | |
78 | free_irq(card->irq, card); | |
79 | @@ -722,6 +720,17 @@ | |
80 | p = &card->plxbase->intr_ctrl_stat; | |
81 | writew(readw(p) | 0x0040, p); | |
82 | ||
83 | + for(i = 0; i < card->no_ports; i++) { | |
84 | + card->ports[i].dev = alloc_hdlcdev(card); | |
85 | + if(!card->ports[i].dev) { | |
86 | + printk(KERN_ERR "tahoe9xx: unable to allocate memory\n"); | |
87 | + if(i > 0) | |
88 | + free_netdev(card->ports[0].dev); | |
89 | + kfree(card); | |
90 | + return -ENOBUFS; | |
91 | + } | |
92 | + } | |
93 | + | |
94 | /* Allocate IRQ */ | |
95 | if(request_irq(pdev->irq, sca_intr, SA_SHIRQ, devname, card)) { | |
96 | printk(KERN_WARNING "%s: could not allocate IRQ%d.\n", card->dev_name, | |
97 | @@ -735,7 +744,8 @@ | |
98 | ||
99 | for(i = 0; i < card->no_ports; i++) { | |
100 | port_t *port = &card->ports[i]; | |
101 | - struct net_device *dev = hdlc_to_dev(&port->hdlc); | |
102 | + struct net_device *dev = port->dev; | |
103 | + hdlc_device *hdlc = dev_to_hdlc(dev); | |
104 | port->phy_node = i; | |
105 | ||
106 | spin_lock_init(&port->lock); | |
107 | @@ -746,10 +756,10 @@ | |
108 | dev->do_ioctl = t9xx_ioctl; | |
109 | dev->open = t9xx_open; | |
110 | dev->stop = t9xx_close; | |
111 | - port->hdlc.attach = sca_attach; | |
112 | - port->hdlc.xmit = sca_xmit; | |
113 | + hdlc->attach = sca_attach; | |
114 | + hdlc->xmit = sca_xmit; | |
115 | port->settings.clock_type = CLOCK_EXT; | |
116 | - if(register_hdlc_device(&port->hdlc)) { | |
117 | + if(register_hdlc_device(dev)) { | |
118 | printk(KERN_ERR "%s: unable to register hdlc " | |
119 | "device\n", card->dev_name); | |
120 | t9xx_pci_remove_one(pdev); | |
121 | @@ -759,7 +769,7 @@ | |
122 | sca_init_sync_port(port); /* Set up SCA memory */ | |
123 | ||
124 | printk(KERN_INFO "%s: %s node %d\n", | |
125 | - hdlc_to_name(&port->hdlc), card->dev_name, port->phy_node); | |
126 | + dev->name, card->dev_name, port->phy_node); | |
127 | } | |
128 | ||
129 | sca_flush(card); |