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