Commit 070c8cb2 authored by Alexander Viro's avatar Alexander Viro Committed by Stephen Hemminger

[wan hdlc] switch register_hdlc_device() to take net_device arg

register_hdlc_device()/unregister_hdlc_device() switched to net_device.
Now all remaining callers of hdlc_to_dev() are isolated and we can
start killing them.
parent e7c0af6d
......@@ -363,7 +363,7 @@ static int __init c101_run(unsigned long irq, unsigned long winbase)
hdlc->xmit = sca_xmit;
card->settings.clock_type = CLOCK_EXT;
result = register_hdlc_device(hdlc);
result = register_hdlc_device(dev);
if (result) {
printk(KERN_WARNING "c101: unable to register hdlc device\n");
c101_destroy_card(card);
......@@ -424,7 +424,7 @@ static void __exit c101_cleanup(void)
while (card) {
card_t *ptr = card;
card = card->next_card;
unregister_hdlc_device(dev_to_hdlc(port_to_dev(ptr)));
unregister_hdlc_device(port_to_dev(ptr));
c101_destroy_card(ptr);
}
}
......
......@@ -694,7 +694,7 @@ static void dscc4_free1(struct pci_dev *pdev)
root = ppriv->root;
for (i = 0; i < dev_per_card; i++)
unregister_hdlc_device(&root[i].hdlc);
unregister_hdlc_device(dscc4_to_dev(&root[i]));
pci_set_drvdata(pdev, NULL);
......@@ -910,7 +910,7 @@ static int dscc4_found1(struct pci_dev *pdev, unsigned long ioaddr)
hdlc->xmit = dscc4_start_xmit;
hdlc->attach = dscc4_hdlc_attach;
ret = register_hdlc_device(hdlc);
ret = register_hdlc_device(d);
if (ret < 0) {
printk(KERN_ERR "%s: unable to register\n", DRV_NAME);
goto err_unregister;
......@@ -922,7 +922,7 @@ static int dscc4_found1(struct pci_dev *pdev, unsigned long ioaddr)
ret = dscc4_init_ring(d);
if (ret < 0) {
unregister_hdlc_device(hdlc);
unregister_hdlc_device(d);
goto err_unregister;
}
}
......@@ -937,7 +937,7 @@ static int dscc4_found1(struct pci_dev *pdev, unsigned long ioaddr)
err_unregister:
while (--i >= 0) {
dscc4_release_ring(root + i);
unregister_hdlc_device(&root[i].hdlc);
unregister_hdlc_device(dscc4_to_dev(&root[i]));
}
kfree(ppriv);
err_free_dev:
......
......@@ -1491,7 +1491,7 @@ fst_init_card ( struct fst_card_info *card )
hdlc->attach = fst_attach;
hdlc->xmit = fst_start_xmit;
if (( err = register_hdlc_device(dev_to_hdlc(dev))) < 0 )
if (( err = register_hdlc_device(dev)) < 0 )
{
printk_err ("Cannot register HDLC device for port %d"
" (errno %d)\n", i, -err );
......@@ -1657,7 +1657,7 @@ fst_remove_one ( struct pci_dev *pdev )
for ( i = 0 ; i < card->nports ; i++ )
{
struct net_device *dev = port_to_dev(&card->ports[i]);
unregister_hdlc_device(dev_to_hdlc(dev));
unregister_hdlc_device(dev);
}
fst_disable_intr ( card );
......
......@@ -228,10 +228,10 @@ int hdlc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
int register_hdlc_device(hdlc_device *hdlc)
int register_hdlc_device(struct net_device *dev)
{
int result;
struct net_device *dev = hdlc_to_dev(hdlc);
hdlc_device *hdlc = dev_to_hdlc(dev);
dev->get_stats = hdlc_get_stats;
dev->change_mtu = hdlc_change_mtu;
......@@ -261,11 +261,11 @@ int register_hdlc_device(hdlc_device *hdlc)
void unregister_hdlc_device(hdlc_device *hdlc)
void unregister_hdlc_device(struct net_device *dev)
{
rtnl_lock();
hdlc_proto_detach(hdlc);
unregister_netdevice(hdlc_to_dev(hdlc));
hdlc_proto_detach(dev_to_hdlc(dev));
unregister_netdevice(dev);
rtnl_unlock();
}
......
......@@ -311,7 +311,7 @@ static void n2_destroy_card(card_t *card)
for (cnt = 0; cnt < 2; cnt++)
if (card->ports[cnt].card) {
struct net_device *dev = port_to_dev(&card->ports[cnt]);
unregister_hdlc_device(dev_to_hdlc(dev));
unregister_hdlc_device(dev);
}
if (card->irq)
......@@ -459,7 +459,7 @@ static int __init n2_run(unsigned long io, unsigned long irq,
hdlc->xmit = sca_xmit;
port->settings.clock_type = CLOCK_EXT;
if (register_hdlc_device(hdlc)) {
if (register_hdlc_device(dev)) {
printk(KERN_WARNING "n2: unable to register hdlc "
"device\n");
n2_destroy_card(card);
......
......@@ -3379,7 +3379,7 @@ static void cpc_init_card(pc300_t * card)
dev->change_mtu = cpc_change_mtu;
dev->do_ioctl = cpc_ioctl;
if (register_hdlc_device(hdlc) == 0) {
if (register_hdlc_device(dev) == 0) {
dev->priv = d; /* We need 'priv', hdlc doesn't */
printk("%s: Cyclades-PC300/", dev->name);
switch (card->hw.type) {
......@@ -3639,7 +3639,7 @@ static void __devexit cpc_remove_one(struct pci_dev *pdev)
cpc_readw(card->hw.plxbase + card->hw.intctl_reg) & ~(0x0040));
for (i = 0; i < card->hw.nchan; i++) {
unregister_hdlc_device(dev_to_hdlc(card->chan[i].d.dev));
unregister_hdlc_device(card->chan[i].d.dev);
}
iounmap((void *) card->hw.plxbase);
iounmap((void *) card->hw.scabase);
......
......@@ -534,7 +534,7 @@ static void wanxl_pci_remove_one(struct pci_dev *pdev)
for (i = 0; i < 4; i++)
if (card->ports[i]) {
struct net_device *dev = port_to_dev(card->ports[i]);
unregister_hdlc_device(dev_to_hdlc(dev));
unregister_hdlc_device(dev);
}
wanxl_reset(card);
......@@ -715,7 +715,7 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev,
dev->stop = wanxl_close;
hdlc->attach = wanxl_attach;
hdlc->xmit = wanxl_xmit;
if (register_hdlc_device(dev_to_hdlc(dev))) {
if (register_hdlc_device(dev)) {
printk(KERN_ERR "wanXL %s: unable to register hdlc"
" device\n", card_name(pdev));
wanxl_pci_remove_one(pdev);
......
......@@ -185,8 +185,8 @@ int hdlc_x25_ioctl(struct net_device *dev, struct ifreq *ifr);
int hdlc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
/* Must be used by hardware driver on module startup/exit */
int register_hdlc_device(hdlc_device *hdlc);
void unregister_hdlc_device(hdlc_device *hdlc);
int register_hdlc_device(struct net_device *dev);
void unregister_hdlc_device(struct net_device *dev);
static __inline__ struct net_device* hdlc_to_dev(hdlc_device *hdlc)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment