diff options
author | Krzysztof Hałasa <khc@pm.waw.pl> | 2008-07-10 01:13:49 +0400 |
---|---|---|
committer | Krzysztof Hałasa <khc@pm.waw.pl> | 2008-11-22 04:49:48 +0300 |
commit | 61e0a6a268947f7385282c6841f3e3d64b4c5cb9 (patch) | |
tree | 86a9ee7c3eb2028fe1589df5a94091b153fb273a /drivers/net/wan/pci200syn.c | |
parent | 967834361a4beb3bbd3069189c192dc6fdeef8a9 (diff) | |
download | linux-61e0a6a268947f7385282c6841f3e3d64b4c5cb9.tar.xz |
WAN: Simplify HD64572 drivers.
Signed-off-by: Krzysztof Hałasa <khc@pm.waw.pl>
Diffstat (limited to 'drivers/net/wan/pci200syn.c')
-rw-r--r-- | drivers/net/wan/pci200syn.c | 55 |
1 files changed, 21 insertions, 34 deletions
diff --git a/drivers/net/wan/pci200syn.c b/drivers/net/wan/pci200syn.c index a16311a79e9a..1104d3a692f7 100644 --- a/drivers/net/wan/pci200syn.c +++ b/drivers/net/wan/pci200syn.c @@ -1,7 +1,7 @@ /* * Goramo PCI200SYN synchronous serial card driver for Linux * - * Copyright (C) 2002-2003 Krzysztof Halasa <khc@pm.waw.pl> + * Copyright (C) 2002-2008 Krzysztof Halasa <khc@pm.waw.pl> * * This program is free software; you can redistribute it and/or modify it * under the terms of version 2 of the GNU General Public License @@ -63,7 +63,7 @@ typedef struct { typedef struct port_s { struct napi_struct napi; - struct net_device *dev; + struct net_device *netdev; struct card_s *card; spinlock_t lock; /* TX lock */ sync_serial_settings settings; @@ -74,7 +74,7 @@ typedef struct port_s { u16 txin; /* tx ring buffer 'in' and 'last' pointers */ u16 txlast; u8 rxs, txs, tmc; /* SCA registers */ - u8 phy_node; /* physical port # - 0 or 1 */ + u8 chan; /* physical port # - 0 or 1 */ }port_t; @@ -92,17 +92,6 @@ typedef struct card_s { }card_t; -#define sca_in(reg, card) readb(card->scabase + (reg)) -#define sca_out(value, reg, card) writeb(value, card->scabase + (reg)) -#define sca_inw(reg, card) readw(card->scabase + (reg)) -#define sca_outw(value, reg, card) writew(value, card->scabase + (reg)) -#define sca_inl(reg, card) readl(card->scabase + (reg)) -#define sca_outl(value, reg, card) writel(value, card->scabase + (reg)) - -#define port_to_card(port) (port->card) -#define log_node(port) (port->phy_node) -#define phy_node(port) (port->phy_node) -#define winbase(card) (card->rambase) #define get_port(card, port) (&card->ports[port]) #define sca_flush(card) (sca_in(IER0, card)); @@ -132,8 +121,8 @@ static void pci200_set_iface(port_t *port) u8 rxs = port->rxs & CLK_BRG_MASK; u8 txs = port->txs & CLK_BRG_MASK; - sca_out(EXS_TES1, (phy_node(port) ? MSCI1_OFFSET : MSCI0_OFFSET) + EXS, - port_to_card(port)); + sca_out(EXS_TES1, (port->chan ? MSCI1_OFFSET : MSCI0_OFFSET) + EXS, + port->card); switch(port->settings.clock_type) { case CLOCK_INT: rxs |= CLK_BRG; /* BRG output */ @@ -175,7 +164,7 @@ static int pci200_open(struct net_device *dev) sca_open(dev); pci200_set_iface(port); - sca_flush(port_to_card(port)); + sca_flush(port->card); return 0; } @@ -184,7 +173,7 @@ static int pci200_open(struct net_device *dev) static int pci200_close(struct net_device *dev) { sca_close(dev); - sca_flush(port_to_card(dev_to_port(dev))); + sca_flush(dev_to_port(dev)->card); hdlc_close(dev); return 0; } @@ -237,7 +226,7 @@ static int pci200_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) memcpy(&port->settings, &new_line, size); /* Update settings */ pci200_set_iface(port); - sca_flush(port_to_card(port)); + sca_flush(port->card); return 0; default: @@ -253,10 +242,8 @@ static void pci200_pci_remove_one(struct pci_dev *pdev) card_t *card = pci_get_drvdata(pdev); for (i = 0; i < 2; i++) - if (card->ports[i].card) { - struct net_device *dev = port_to_dev(&card->ports[i]); - unregister_hdlc_device(dev); - } + if (card->ports[i].card) + unregister_hdlc_device(card->ports[i].netdev); if (card->irq) free_irq(card->irq, card); @@ -271,10 +258,10 @@ static void pci200_pci_remove_one(struct pci_dev *pdev) pci_release_regions(pdev); pci_disable_device(pdev); pci_set_drvdata(pdev, NULL); - if (card->ports[0].dev) - free_netdev(card->ports[0].dev); - if (card->ports[1].dev) - free_netdev(card->ports[1].dev); + if (card->ports[0].netdev) + free_netdev(card->ports[0].netdev); + if (card->ports[1].netdev) + free_netdev(card->ports[1].netdev); kfree(card); } @@ -309,9 +296,9 @@ static int __devinit pci200_pci_init_one(struct pci_dev *pdev, return -ENOBUFS; } pci_set_drvdata(pdev, card); - card->ports[0].dev = alloc_hdlcdev(&card->ports[0]); - card->ports[1].dev = alloc_hdlcdev(&card->ports[1]); - if (!card->ports[0].dev || !card->ports[1].dev) { + card->ports[0].netdev = alloc_hdlcdev(&card->ports[0]); + card->ports[1].netdev = alloc_hdlcdev(&card->ports[1]); + if (!card->ports[0].netdev || !card->ports[1].netdev) { printk(KERN_ERR "pci200syn: unable to allocate memory\n"); pci200_pci_remove_one(pdev); return -ENOMEM; @@ -399,9 +386,9 @@ static int __devinit pci200_pci_init_one(struct pci_dev *pdev, for (i = 0; i < 2; i++) { port_t *port = &card->ports[i]; - struct net_device *dev = port_to_dev(port); + struct net_device *dev = port->netdev; hdlc_device *hdlc = dev_to_hdlc(dev); - port->phy_node = i; + port->chan = i; spin_lock_init(&port->lock); dev->irq = card->irq; @@ -424,8 +411,8 @@ static int __devinit pci200_pci_init_one(struct pci_dev *pdev, return -ENOBUFS; } - printk(KERN_INFO "%s: PCI200SYN node %d\n", - dev->name, port->phy_node); + printk(KERN_INFO "%s: PCI200SYN channel %d\n", + dev->name, port->chan); } sca_flush(card); |