X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fnet%2F3c505.c;h=702bfb2a5e99d047f82e6d2b80e46c48396108e2;hb=97bf2856c6014879bd04983a3e9dfcdac1e7fe85;hp=3aa8409fe5f9dc0c0373e0f10f49ea5ce439dea5;hpb=9bf4aaab3e101692164d49b7ca357651eb691cb6;p=linux-2.6.git diff --git a/drivers/net/3c505.c b/drivers/net/3c505.c index 3aa8409fe..702bfb2a5 100644 --- a/drivers/net/3c505.c +++ b/drivers/net/3c505.c @@ -32,7 +32,7 @@ * Linux 1.3.0 changes by * Alan Cox * More debugging, DMA support, currently maintained by - * Philip Blundell + * Philip Blundell * Multicard/soft configurable dma channel/rev 2 hardware support * by Christopher Collins * Ethtool support (jgarzik), 11/17/2001 @@ -107,9 +107,9 @@ #include #include #include +#include #include -#include #include #include @@ -228,16 +228,6 @@ static inline void outb_command(unsigned char val, unsigned int base_addr) outb(val, base_addr + PORT_COMMAND); } -static inline unsigned int inw_data(unsigned int base_addr) -{ - return inw(base_addr + PORT_DATA); -} - -static inline void outw_data(unsigned int val, unsigned int base_addr) -{ - outw(val, base_addr + PORT_DATA); -} - static inline unsigned int backlog_next(unsigned int n) { return (n + 1) % BACKLOG_SIZE; @@ -282,7 +272,7 @@ static inline void set_hsf(struct net_device *dev, int hsf) static int start_receive(struct net_device *, pcb_struct *); -inline static void adapter_reset(struct net_device *dev) +static inline void adapter_reset(struct net_device *dev) { unsigned long timeout; elp_device *adapter = dev->priv; @@ -325,11 +315,11 @@ static inline void check_3c505_dma(struct net_device *dev) spin_lock_irqsave(&adapter->lock, flags); adapter->dmaing = 0; adapter->busy = 0; - + f=claim_dma_lock(); disable_dma(dev->dma); release_dma_lock(f); - + if (adapter->rx_active) adapter->rx_active--; outb_control(adapter->hcr_val & ~(DMAE | TCEN | DIR), dev); @@ -659,7 +649,7 @@ static void receive_packet(struct net_device *dev, int len) * ******************************************************/ -static irqreturn_t elp_interrupt(int irq, void *dev_id, struct pt_regs *reg_ptr) +static irqreturn_t elp_interrupt(int irq, void *dev_id) { int len; int dlen; @@ -670,7 +660,7 @@ static irqreturn_t elp_interrupt(int irq, void *dev_id, struct pt_regs *reg_ptr) dev = dev_id; adapter = (elp_device *) dev->priv; - + spin_lock(&adapter->lock); do { @@ -722,7 +712,7 @@ static irqreturn_t elp_interrupt(int irq, void *dev_id, struct pt_regs *reg_ptr) timeout = jiffies + 3*HZ/100; while ((inb_status(dev->base_addr) & ACRF) != 0 && time_before(jiffies, timeout)) { if (receive_pcb(dev, &adapter->irx_pcb)) { - switch (adapter->irx_pcb.command) + switch (adapter->irx_pcb.command) { case 0: break; @@ -899,7 +889,7 @@ static int elp_open(struct net_device *dev) adapter->send_pcb_semaphore = 0; adapter->rx_backlog.in = 0; adapter->rx_backlog.out = 0; - + spin_lock_init(&adapter->lock); /* @@ -1013,7 +1003,7 @@ static int send_packet(struct net_device *dev, struct sk_buff *skb) } adapter->stats.tx_bytes += nlen; - + /* * send the adapter a transmit packet command. Ignore segment and offset * and make sure the length is even @@ -1054,7 +1044,7 @@ static int send_packet(struct net_device *dev, struct sk_buff *skb) outb_control(adapter->hcr_val | DMAE | TCEN, dev); enable_dma(dev->dma); release_dma_lock(flags); - + if (elp_debug >= 3) printk(KERN_DEBUG "%s: DMA transfer started\n", dev->name); @@ -1064,7 +1054,7 @@ static int send_packet(struct net_device *dev, struct sk_buff *skb) /* * The upper layer thinks we timed out */ - + static void elp_timeout(struct net_device *dev) { elp_device *adapter = dev->priv; @@ -1090,7 +1080,7 @@ static int elp_start_xmit(struct sk_buff *skb, struct net_device *dev) { unsigned long flags; elp_device *adapter = dev->priv; - + spin_lock_irqsave(&adapter->lock, flags); check_3c505_dma(dev); @@ -1098,7 +1088,7 @@ static int elp_start_xmit(struct sk_buff *skb, struct net_device *dev) printk(KERN_DEBUG "%s: request to send packet of length %d\n", dev->name, (int) skb->len); netif_stop_queue(dev); - + /* * send the packet at skb->data for skb->len */ @@ -1179,7 +1169,7 @@ static void netdev_set_msglevel(struct net_device *dev, u32 level) debug = level; } -static struct ethtool_ops netdev_ethtool_ops = { +static const struct ethtool_ops netdev_ethtool_ops = { .get_drvinfo = netdev_get_drvinfo, .get_msglevel = netdev_get_msglevel, .set_msglevel = netdev_set_msglevel, @@ -1245,7 +1235,7 @@ static void elp_set_mc_list(struct net_device *dev) printk(KERN_DEBUG "%s: request to set multicast list\n", dev->name); spin_lock_irqsave(&adapter->lock, flags); - + if (!(dev->flags & (IFF_PROMISC | IFF_ALLMULTI))) { /* send a "load multicast list" command to the board, max 10 addrs/cmd */ /* if num_addrs==0 the list will be cleared */ @@ -1327,8 +1317,7 @@ static int __init elp_sense(struct net_device *dev) if (orig_HSR & DIR) { /* If HCR.DIR is up, we pull it down. HSR.DIR should follow. */ outb(0, dev->base_addr + PORT_CONTROL); - set_current_state(TASK_UNINTERRUPTIBLE); - schedule_timeout(30*HZ/100); + msleep(300); if (inb_status(addr) & DIR) { if (elp_debug > 0) printk(notfound_msg, 2); @@ -1337,8 +1326,7 @@ static int __init elp_sense(struct net_device *dev) } else { /* If HCR.DIR is down, we pull it up. HSR.DIR should follow. */ outb(DIR, dev->base_addr + PORT_CONTROL); - set_current_state(TASK_UNINTERRUPTIBLE); - schedule_timeout(30*HZ/100); + msleep(300); if (!(inb_status(addr) & DIR)) { if (elp_debug > 0) printk(notfound_msg, 3); @@ -1638,14 +1626,14 @@ static struct net_device *dev_3c505[ELP_MAX_CARDS]; static int io[ELP_MAX_CARDS]; static int irq[ELP_MAX_CARDS]; static int dma[ELP_MAX_CARDS]; -MODULE_PARM(io, "1-" __MODULE_STRING(ELP_MAX_CARDS) "i"); -MODULE_PARM(irq, "1-" __MODULE_STRING(ELP_MAX_CARDS) "i"); -MODULE_PARM(dma, "1-" __MODULE_STRING(ELP_MAX_CARDS) "i"); +module_param_array(io, int, NULL, 0); +module_param_array(irq, int, NULL, 0); +module_param_array(dma, int, NULL, 0); MODULE_PARM_DESC(io, "EtherLink Plus I/O base address(es)"); MODULE_PARM_DESC(irq, "EtherLink Plus IRQ number(s) (assigned)"); MODULE_PARM_DESC(dma, "EtherLink Plus DMA channel(s)"); -int init_module(void) +int __init init_module(void) { int this_dev, found = 0; @@ -1682,7 +1670,7 @@ int init_module(void) return 0; } -void cleanup_module(void) +void __exit cleanup_module(void) { int this_dev;