X-Git-Url: http://ftp.safe.ca/?a=blobdiff_plain;f=drivers%2Fnet%2F3c505.c;h=29b8d1d63bdeacdfb6cc7b432590216a448ab7e5;hb=c429137a67b82788d24682153bb9c96501a9ef34;hp=19c0b856c488097494f69c27ff14e2c3f615deeb;hpb=96e672c79fb114ec38a868dc864e743205c24332;p=safe%2Fjmp%2Flinux-2.6 diff --git a/drivers/net/3c505.c b/drivers/net/3c505.c index 19c0b85..29b8d1d 100644 --- a/drivers/net/3c505.c +++ b/drivers/net/3c505.c @@ -102,12 +102,12 @@ #include #include #include -#include #include #include #include #include #include +#include #include #include @@ -126,26 +126,25 @@ * *********************************************************/ -static const char filename[] = __FILE__; +#define filename __FILE__ -static const char timeout_msg[] = "*** timeout at %s:%s (line %d) ***\n"; +#define timeout_msg "*** timeout at %s:%s (line %d) ***\n" #define TIMEOUT_MSG(lineno) \ - printk(timeout_msg, filename,__FUNCTION__,(lineno)) + pr_notice(timeout_msg, filename, __func__, (lineno)) -static const char invalid_pcb_msg[] = -"*** invalid pcb length %d at %s:%s (line %d) ***\n"; +#define invalid_pcb_msg "*** invalid pcb length %d at %s:%s (line %d) ***\n" #define INVALID_PCB_MSG(len) \ - printk(invalid_pcb_msg, (len),filename,__FUNCTION__,__LINE__) + pr_notice(invalid_pcb_msg, (len), filename, __func__, __LINE__) -static char search_msg[] __initdata = KERN_INFO "%s: Looking for 3c505 adapter at address %#x..."; +#define search_msg "%s: Looking for 3c505 adapter at address %#x..." -static char stilllooking_msg[] __initdata = "still looking..."; +#define stilllooking_msg "still looking..." -static char found_msg[] __initdata = "found.\n"; +#define found_msg "found.\n" -static char notfound_msg[] __initdata = "not found (reason = %d)\n"; +#define notfound_msg "not found (reason = %d)\n" -static char couldnot_msg[] __initdata = KERN_INFO "%s: 3c505 not found\n"; +#define couldnot_msg "%s: 3c505 not found\n" /********************************************************* * @@ -169,21 +168,6 @@ static int elp_debug; /***************************************************************** * - * useful macros - * - *****************************************************************/ - -#ifndef TRUE -#define TRUE 1 -#endif - -#ifndef FALSE -#define FALSE 0 -#endif - - -/***************************************************************** - * * List of I/O-addresses we try to auto-sense * Last element MUST BE 0! *****************************************************************/ @@ -218,10 +202,10 @@ static inline int inb_command(unsigned int base_addr) static inline void outb_control(unsigned char val, struct net_device *dev) { outb(val, dev->base_addr + PORT_CONTROL); - ((elp_device *)(dev->priv))->hcr_val = val; + ((elp_device *)(netdev_priv(dev)))->hcr_val = val; } -#define HCR_VAL(x) (((elp_device *)((x)->priv))->hcr_val) +#define HCR_VAL(x) (((elp_device *)(netdev_priv(x)))->hcr_val) static inline void outb_command(unsigned char val, unsigned int base_addr) { @@ -262,7 +246,7 @@ static inline int get_status(unsigned int base_addr) static inline void set_hsf(struct net_device *dev, int hsf) { - elp_device *adapter = dev->priv; + elp_device *adapter = netdev_priv(dev); unsigned long flags; spin_lock_irqsave(&adapter->lock, flags); @@ -270,12 +254,12 @@ static inline void set_hsf(struct net_device *dev, int hsf) spin_unlock_irqrestore(&adapter->lock, flags); } -static int start_receive(struct net_device *, pcb_struct *); +static bool start_receive(struct net_device *, pcb_struct *); static inline void adapter_reset(struct net_device *dev) { unsigned long timeout; - elp_device *adapter = dev->priv; + elp_device *adapter = netdev_priv(dev); unsigned char orig_hcr = adapter->hcr_val; outb_control(0, dev); @@ -299,7 +283,7 @@ static inline void adapter_reset(struct net_device *dev) outb_control(orig_hcr, dev); if (!start_receive(dev, &adapter->tx_pcb)) - printk(KERN_ERR "%s: start receive command failed \n", dev->name); + pr_err("%s: start receive command failed\n", dev->name); } /* Check to make sure that a DMA transfer hasn't timed out. This should @@ -308,18 +292,20 @@ static inline void adapter_reset(struct net_device *dev) */ static inline void check_3c505_dma(struct net_device *dev) { - elp_device *adapter = dev->priv; + elp_device *adapter = netdev_priv(dev); if (adapter->dmaing && time_after(jiffies, adapter->current_dma.start_time + 10)) { unsigned long flags, f; - printk(KERN_ERR "%s: DMA %s timed out, %d bytes left\n", dev->name, adapter->current_dma.direction ? "download" : "upload", get_dma_residue(dev->dma)); + pr_err("%s: DMA %s timed out, %d bytes left\n", dev->name, + adapter->current_dma.direction ? "download" : "upload", + get_dma_residue(dev->dma)); 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); @@ -328,34 +314,34 @@ static inline void check_3c505_dma(struct net_device *dev) } /* Primitive functions used by send_pcb() */ -static inline unsigned int send_pcb_slow(unsigned int base_addr, unsigned char byte) +static inline bool send_pcb_slow(unsigned int base_addr, unsigned char byte) { unsigned long timeout; outb_command(byte, base_addr); for (timeout = jiffies + 5*HZ/100; time_before(jiffies, timeout);) { if (inb_status(base_addr) & HCRE) - return FALSE; + return false; } - printk(KERN_WARNING "3c505: send_pcb_slow timed out\n"); - return TRUE; + pr_warning("3c505: send_pcb_slow timed out\n"); + return true; } -static inline unsigned int send_pcb_fast(unsigned int base_addr, unsigned char byte) +static inline bool send_pcb_fast(unsigned int base_addr, unsigned char byte) { unsigned int timeout; outb_command(byte, base_addr); for (timeout = 0; timeout < 40000; timeout++) { if (inb_status(base_addr) & HCRE) - return FALSE; + return false; } - printk(KERN_WARNING "3c505: send_pcb_fast timed out\n"); - return TRUE; + pr_warning("3c505: send_pcb_fast timed out\n"); + return true; } /* Check to see if the receiver needs restarting, and kick it if so */ static inline void prime_rx(struct net_device *dev) { - elp_device *adapter = dev->priv; + elp_device *adapter = netdev_priv(dev); while (adapter->rx_active < ELP_RX_PCBS && netif_running(dev)) { if (!start_receive(dev, &adapter->itx_pcb)) break; @@ -386,24 +372,24 @@ static inline void prime_rx(struct net_device *dev) * timeout is reduced to 500us). */ -static int send_pcb(struct net_device *dev, pcb_struct * pcb) +static bool send_pcb(struct net_device *dev, pcb_struct * pcb) { int i; unsigned long timeout; - elp_device *adapter = dev->priv; + elp_device *adapter = netdev_priv(dev); unsigned long flags; check_3c505_dma(dev); if (adapter->dmaing && adapter->current_dma.direction == 0) - return FALSE; + return false; /* Avoid contention */ if (test_and_set_bit(1, &adapter->send_pcb_semaphore)) { if (elp_debug >= 3) { - printk(KERN_DEBUG "%s: send_pcb entered while threaded\n", dev->name); + pr_debug("%s: send_pcb entered while threaded\n", dev->name); } - return FALSE; + return false; } /* * load each byte into the command register and @@ -435,25 +421,26 @@ static int send_pcb(struct net_device *dev, pcb_struct * pcb) switch (GET_ASF(dev->base_addr)) { case ASF_PCB_ACK: adapter->send_pcb_semaphore = 0; - return TRUE; + return true; case ASF_PCB_NAK: #ifdef ELP_DEBUG - printk(KERN_DEBUG "%s: send_pcb got NAK\n", dev->name); + pr_debug("%s: send_pcb got NAK\n", dev->name); #endif goto abort; } } if (elp_debug >= 1) - printk(KERN_DEBUG "%s: timeout waiting for PCB acknowledge (status %02x)\n", dev->name, inb_status(dev->base_addr)); + pr_debug("%s: timeout waiting for PCB acknowledge (status %02x)\n", + dev->name, inb_status(dev->base_addr)); goto abort; sti_abort: spin_unlock_irqrestore(&adapter->lock, flags); abort: adapter->send_pcb_semaphore = 0; - return FALSE; + return false; } @@ -470,7 +457,7 @@ static int send_pcb(struct net_device *dev, pcb_struct * pcb) * *****************************************************************/ -static int receive_pcb(struct net_device *dev, pcb_struct * pcb) +static bool receive_pcb(struct net_device *dev, pcb_struct * pcb) { int i, j; int total_length; @@ -478,7 +465,7 @@ static int receive_pcb(struct net_device *dev, pcb_struct * pcb) unsigned long timeout; unsigned long flags; - elp_device *adapter = dev->priv; + elp_device *adapter = netdev_priv(dev); set_hsf(dev, 0); @@ -487,7 +474,7 @@ static int receive_pcb(struct net_device *dev, pcb_struct * pcb) while (((stat = get_status(dev->base_addr)) & ACRF) == 0 && time_before(jiffies, timeout)); if (time_after_eq(jiffies, timeout)) { TIMEOUT_MSG(__LINE__); - return FALSE; + return false; } pcb->command = inb_command(dev->base_addr); @@ -496,56 +483,62 @@ static int receive_pcb(struct net_device *dev, pcb_struct * pcb) while (((stat = get_status(dev->base_addr)) & ACRF) == 0 && time_before(jiffies, timeout)); if (time_after_eq(jiffies, timeout)) { TIMEOUT_MSG(__LINE__); - printk(KERN_INFO "%s: status %02x\n", dev->name, stat); - return FALSE; + pr_info("%s: status %02x\n", dev->name, stat); + return false; } pcb->length = inb_command(dev->base_addr); if (pcb->length > MAX_PCB_DATA) { INVALID_PCB_MSG(pcb->length); adapter_reset(dev); - return FALSE; + return false; } /* read the data */ spin_lock_irqsave(&adapter->lock, flags); - i = 0; - do { - j = 0; - while (((stat = get_status(dev->base_addr)) & ACRF) == 0 && j++ < 20000); - pcb->data.raw[i++] = inb_command(dev->base_addr); - if (i > MAX_PCB_DATA) - INVALID_PCB_MSG(i); - } while ((stat & ASF_PCB_MASK) != ASF_PCB_END && j < 20000); + for (i = 0; i < MAX_PCB_DATA; i++) { + for (j = 0; j < 20000; j++) { + stat = get_status(dev->base_addr); + if (stat & ACRF) + break; + } + pcb->data.raw[i] = inb_command(dev->base_addr); + if ((stat & ASF_PCB_MASK) == ASF_PCB_END || j >= 20000) + break; + } spin_unlock_irqrestore(&adapter->lock, flags); + if (i >= MAX_PCB_DATA) { + INVALID_PCB_MSG(i); + return false; + } if (j >= 20000) { TIMEOUT_MSG(__LINE__); - return FALSE; + return false; } - /* woops, the last "data" byte was really the length! */ - total_length = pcb->data.raw[--i]; + /* the last "data" byte was really the length! */ + total_length = pcb->data.raw[i]; /* safety check total length vs data length */ if (total_length != (pcb->length + 2)) { if (elp_debug >= 2) - printk(KERN_WARNING "%s: mangled PCB received\n", dev->name); + pr_warning("%s: mangled PCB received\n", dev->name); set_hsf(dev, HSF_PCB_NAK); - return FALSE; + return false; } if (pcb->command == CMD_RECEIVE_PACKET_COMPLETE) { if (test_and_set_bit(0, (void *) &adapter->busy)) { if (backlog_next(adapter->rx_backlog.in) == adapter->rx_backlog.out) { set_hsf(dev, HSF_PCB_NAK); - printk(KERN_WARNING "%s: PCB rejected, transfer in progress and backlog full\n", dev->name); + pr_warning("%s: PCB rejected, transfer in progress and backlog full\n", dev->name); pcb->command = 0; - return TRUE; + return true; } else { pcb->command = 0xff; } } } set_hsf(dev, HSF_PCB_ACK); - return TRUE; + return true; } /****************************************************** @@ -555,13 +548,13 @@ static int receive_pcb(struct net_device *dev, pcb_struct * pcb) * ******************************************************/ -static int start_receive(struct net_device *dev, pcb_struct * tx_pcb) +static bool start_receive(struct net_device *dev, pcb_struct * tx_pcb) { - int status; - elp_device *adapter = dev->priv; + bool status; + elp_device *adapter = netdev_priv(dev); if (elp_debug >= 3) - printk(KERN_DEBUG "%s: restarting receiver\n", dev->name); + pr_debug("%s: restarting receiver\n", dev->name); tx_pcb->command = CMD_RECEIVE_PACKET; tx_pcb->length = sizeof(struct Rcv_pkt); tx_pcb->data.rcv_pkt.buf_seg @@ -586,7 +579,7 @@ static int start_receive(struct net_device *dev, pcb_struct * tx_pcb) static void receive_packet(struct net_device *dev, int len) { int rlen; - elp_device *adapter = dev->priv; + elp_device *adapter = netdev_priv(dev); void *target; struct sk_buff *skb; unsigned long flags; @@ -595,7 +588,7 @@ static void receive_packet(struct net_device *dev, int len) skb = dev_alloc_skb(rlen + 2); if (!skb) { - printk(KERN_WARNING "%s: memory squeeze, dropping packet\n", dev->name); + pr_warning("%s: memory squeeze, dropping packet\n", dev->name); target = adapter->dma_buffer; adapter->current_dma.target = NULL; /* FIXME: stats */ @@ -613,9 +606,9 @@ static void receive_packet(struct net_device *dev, int len) /* if this happens, we die */ if (test_and_set_bit(0, (void *) &adapter->dmaing)) - printk(KERN_ERR "%s: rx blocked, DMA in progress, dir %d\n", dev->name, adapter->current_dma.direction); + pr_err("%s: rx blocked, DMA in progress, dir %d\n", + dev->name, adapter->current_dma.direction); - skb->dev = dev; adapter->current_dma.direction = 0; adapter->current_dma.length = rlen; adapter->current_dma.skb = skb; @@ -633,14 +626,14 @@ static void receive_packet(struct net_device *dev, int len) release_dma_lock(flags); if (elp_debug >= 3) { - printk(KERN_DEBUG "%s: rx DMA transfer started\n", dev->name); + pr_debug("%s: rx DMA transfer started\n", dev->name); } if (adapter->rx_active) adapter->rx_active--; if (!adapter->busy) - printk(KERN_WARNING "%s: receive_packet called, busy not set.\n", dev->name); + pr_warning("%s: receive_packet called, busy not set.\n", dev->name); } /****************************************************** @@ -649,18 +642,15 @@ 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; int icount = 0; - struct net_device *dev; - elp_device *adapter; + struct net_device *dev = dev_id; + elp_device *adapter = netdev_priv(dev); unsigned long timeout; - dev = dev_id; - adapter = (elp_device *) dev->priv; - spin_lock(&adapter->lock); do { @@ -668,12 +658,13 @@ static irqreturn_t elp_interrupt(int irq, void *dev_id, struct pt_regs *reg_ptr) * has a DMA transfer finished? */ if (inb_status(dev->base_addr) & DONE) { - if (!adapter->dmaing) { - printk(KERN_WARNING "%s: phantom DMA completed\n", dev->name); - } - if (elp_debug >= 3) { - printk(KERN_DEBUG "%s: %s DMA complete, status %02x\n", dev->name, adapter->current_dma.direction ? "tx" : "rx", inb_status(dev->base_addr)); - } + if (!adapter->dmaing) + pr_warning("%s: phantom DMA completed\n", dev->name); + + if (elp_debug >= 3) + pr_debug("%s: %s DMA complete, status %02x\n", dev->name, + adapter->current_dma.direction ? "tx" : "rx", + inb_status(dev->base_addr)); outb_control(adapter->hcr_val & ~(DMAE | TCEN | DIR), dev); if (adapter->current_dma.direction) { @@ -686,9 +677,8 @@ static irqreturn_t elp_interrupt(int irq, void *dev_id, struct pt_regs *reg_ptr) memcpy(adapter->current_dma.target, adapter->dma_buffer, adapter->current_dma.length); } skb->protocol = eth_type_trans(skb,dev); - adapter->stats.rx_bytes += skb->len; + dev->stats.rx_bytes += skb->len; netif_rx(skb); - dev->last_rx = jiffies; } } adapter->dmaing = 0; @@ -696,7 +686,7 @@ static irqreturn_t elp_interrupt(int irq, void *dev_id, struct pt_regs *reg_ptr) int t = adapter->rx_backlog.length[adapter->rx_backlog.out]; adapter->rx_backlog.out = backlog_next(adapter->rx_backlog.out); if (elp_debug >= 2) - printk(KERN_DEBUG "%s: receiving backlogged packet (%d)\n", dev->name, t); + pr_debug("%s: receiving backlogged packet (%d)\n", dev->name, t); receive_packet(dev, t); } else { adapter->busy = 0; @@ -712,7 +702,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; @@ -727,21 +717,23 @@ static irqreturn_t elp_interrupt(int irq, void *dev_id, struct pt_regs *reg_ptr) len = adapter->irx_pcb.data.rcv_resp.pkt_len; dlen = adapter->irx_pcb.data.rcv_resp.buf_len; if (adapter->irx_pcb.data.rcv_resp.timeout != 0) { - printk(KERN_ERR "%s: interrupt - packet not received correctly\n", dev->name); + pr_err("%s: interrupt - packet not received correctly\n", dev->name); } else { if (elp_debug >= 3) { - printk(KERN_DEBUG "%s: interrupt - packet received of length %i (%i)\n", dev->name, len, dlen); + pr_debug("%s: interrupt - packet received of length %i (%i)\n", + dev->name, len, dlen); } if (adapter->irx_pcb.command == 0xff) { if (elp_debug >= 2) - printk(KERN_DEBUG "%s: adding packet to backlog (len = %d)\n", dev->name, dlen); + pr_debug("%s: adding packet to backlog (len = %d)\n", + dev->name, dlen); adapter->rx_backlog.length[adapter->rx_backlog.in] = dlen; adapter->rx_backlog.in = backlog_next(adapter->rx_backlog.in); } else { receive_packet(dev, dlen); } if (elp_debug >= 3) - printk(KERN_DEBUG "%s: packet received\n", dev->name); + pr_debug("%s: packet received\n", dev->name); } break; @@ -751,7 +743,7 @@ static irqreturn_t elp_interrupt(int irq, void *dev_id, struct pt_regs *reg_ptr) case CMD_CONFIGURE_82586_RESPONSE: adapter->got[CMD_CONFIGURE_82586] = 1; if (elp_debug >= 3) - printk(KERN_DEBUG "%s: interrupt - configure response received\n", dev->name); + pr_debug("%s: interrupt - configure response received\n", dev->name); break; /* @@ -760,7 +752,7 @@ static irqreturn_t elp_interrupt(int irq, void *dev_id, struct pt_regs *reg_ptr) case CMD_CONFIGURE_ADAPTER_RESPONSE: adapter->got[CMD_CONFIGURE_ADAPTER_MEMORY] = 1; if (elp_debug >= 3) - printk(KERN_DEBUG "%s: Adapter memory configuration %s.\n", dev->name, + pr_debug("%s: Adapter memory configuration %s.\n", dev->name, adapter->irx_pcb.data.failed ? "failed" : "succeeded"); break; @@ -770,7 +762,7 @@ static irqreturn_t elp_interrupt(int irq, void *dev_id, struct pt_regs *reg_ptr) case CMD_LOAD_MULTICAST_RESPONSE: adapter->got[CMD_LOAD_MULTICAST_LIST] = 1; if (elp_debug >= 3) - printk(KERN_DEBUG "%s: Multicast address list loading %s.\n", dev->name, + pr_debug("%s: Multicast address list loading %s.\n", dev->name, adapter->irx_pcb.data.failed ? "failed" : "succeeded"); break; @@ -780,7 +772,7 @@ static irqreturn_t elp_interrupt(int irq, void *dev_id, struct pt_regs *reg_ptr) case CMD_SET_ADDRESS_RESPONSE: adapter->got[CMD_SET_STATION_ADDRESS] = 1; if (elp_debug >= 3) - printk(KERN_DEBUG "%s: Ethernet address setting %s.\n", dev->name, + pr_debug("%s: Ethernet address setting %s.\n", dev->name, adapter->irx_pcb.data.failed ? "failed" : "succeeded"); break; @@ -789,15 +781,15 @@ static irqreturn_t elp_interrupt(int irq, void *dev_id, struct pt_regs *reg_ptr) * received board statistics */ case CMD_NETWORK_STATISTICS_RESPONSE: - adapter->stats.rx_packets += adapter->irx_pcb.data.netstat.tot_recv; - adapter->stats.tx_packets += adapter->irx_pcb.data.netstat.tot_xmit; - adapter->stats.rx_crc_errors += adapter->irx_pcb.data.netstat.err_CRC; - adapter->stats.rx_frame_errors += adapter->irx_pcb.data.netstat.err_align; - adapter->stats.rx_fifo_errors += adapter->irx_pcb.data.netstat.err_ovrrun; - adapter->stats.rx_over_errors += adapter->irx_pcb.data.netstat.err_res; + dev->stats.rx_packets += adapter->irx_pcb.data.netstat.tot_recv; + dev->stats.tx_packets += adapter->irx_pcb.data.netstat.tot_xmit; + dev->stats.rx_crc_errors += adapter->irx_pcb.data.netstat.err_CRC; + dev->stats.rx_frame_errors += adapter->irx_pcb.data.netstat.err_align; + dev->stats.rx_fifo_errors += adapter->irx_pcb.data.netstat.err_ovrrun; + dev->stats.rx_over_errors += adapter->irx_pcb.data.netstat.err_res; adapter->got[CMD_NETWORK_STATISTICS] = 1; if (elp_debug >= 3) - printk(KERN_DEBUG "%s: interrupt - statistics response received\n", dev->name); + pr_debug("%s: interrupt - statistics response received\n", dev->name); break; /* @@ -805,17 +797,17 @@ static irqreturn_t elp_interrupt(int irq, void *dev_id, struct pt_regs *reg_ptr) */ case CMD_TRANSMIT_PACKET_COMPLETE: if (elp_debug >= 3) - printk(KERN_DEBUG "%s: interrupt - packet sent\n", dev->name); + pr_debug("%s: interrupt - packet sent\n", dev->name); if (!netif_running(dev)) break; switch (adapter->irx_pcb.data.xmit_resp.c_stat) { case 0xffff: - adapter->stats.tx_aborted_errors++; - printk(KERN_INFO "%s: transmit timed out, network cable problem?\n", dev->name); + dev->stats.tx_aborted_errors++; + pr_info("%s: transmit timed out, network cable problem?\n", dev->name); break; case 0xfffe: - adapter->stats.tx_fifo_errors++; - printk(KERN_INFO "%s: transmit timed out, FIFO underrun\n", dev->name); + dev->stats.tx_fifo_errors++; + pr_info("%s: transmit timed out, FIFO underrun\n", dev->name); break; } netif_wake_queue(dev); @@ -825,11 +817,12 @@ static irqreturn_t elp_interrupt(int irq, void *dev_id, struct pt_regs *reg_ptr) * some unknown PCB */ default: - printk(KERN_DEBUG "%s: unknown PCB received - %2.2x\n", dev->name, adapter->irx_pcb.command); + pr_debug("%s: unknown PCB received - %2.2x\n", + dev->name, adapter->irx_pcb.command); break; } } else { - printk(KERN_WARNING "%s: failed to read PCB on interrupt\n", dev->name); + pr_warning("%s: failed to read PCB on interrupt\n", dev->name); adapter_reset(dev); } } @@ -854,19 +847,17 @@ static irqreturn_t elp_interrupt(int irq, void *dev_id, struct pt_regs *reg_ptr) static int elp_open(struct net_device *dev) { - elp_device *adapter; + elp_device *adapter = netdev_priv(dev); int retval; - adapter = dev->priv; - if (elp_debug >= 3) - printk(KERN_DEBUG "%s: request to open device\n", dev->name); + pr_debug("%s: request to open device\n", dev->name); /* * make sure we actually found the device */ if (adapter == NULL) { - printk(KERN_ERR "%s: Opening a non-existent physical device\n", dev->name); + pr_err("%s: Opening a non-existent physical device\n", dev->name); return -EAGAIN; } /* @@ -889,24 +880,24 @@ 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); /* * install our interrupt service routine */ - if ((retval = request_irq(dev->irq, &elp_interrupt, 0, dev->name, dev))) { - printk(KERN_ERR "%s: could not allocate IRQ%d\n", dev->name, dev->irq); + if ((retval = request_irq(dev->irq, elp_interrupt, 0, dev->name, dev))) { + pr_err("%s: could not allocate IRQ%d\n", dev->name, dev->irq); return retval; } if ((retval = request_dma(dev->dma, dev->name))) { free_irq(dev->irq, dev); - printk(KERN_ERR "%s: could not allocate DMA%d channel\n", dev->name, dev->dma); + pr_err("%s: could not allocate DMA%d channel\n", dev->name, dev->dma); return retval; } adapter->dma_buffer = (void *) dma_mem_alloc(DMA_BUFFER_SIZE); if (!adapter->dma_buffer) { - printk(KERN_ERR "%s: could not allocate DMA buffer\n", dev->name); + pr_err("%s: could not allocate DMA buffer\n", dev->name); free_dma(dev->dma); free_irq(dev->irq, dev); return -ENOMEM; @@ -922,7 +913,7 @@ static int elp_open(struct net_device *dev) * configure adapter memory: we need 10 multicast addresses, default==0 */ if (elp_debug >= 3) - printk(KERN_DEBUG "%s: sending 3c505 memory configuration command\n", dev->name); + pr_debug("%s: sending 3c505 memory configuration command\n", dev->name); adapter->tx_pcb.command = CMD_CONFIGURE_ADAPTER_MEMORY; adapter->tx_pcb.data.memconf.cmd_q = 10; adapter->tx_pcb.data.memconf.rcv_q = 20; @@ -933,7 +924,7 @@ static int elp_open(struct net_device *dev) adapter->tx_pcb.length = sizeof(struct Memconf); adapter->got[CMD_CONFIGURE_ADAPTER_MEMORY] = 0; if (!send_pcb(dev, &adapter->tx_pcb)) - printk(KERN_ERR "%s: couldn't send memory configuration command\n", dev->name); + pr_err("%s: couldn't send memory configuration command\n", dev->name); else { unsigned long timeout = jiffies + TIMEOUT; while (adapter->got[CMD_CONFIGURE_ADAPTER_MEMORY] == 0 && time_before(jiffies, timeout)); @@ -946,13 +937,13 @@ static int elp_open(struct net_device *dev) * configure adapter to receive broadcast messages and wait for response */ if (elp_debug >= 3) - printk(KERN_DEBUG "%s: sending 82586 configure command\n", dev->name); + pr_debug("%s: sending 82586 configure command\n", dev->name); adapter->tx_pcb.command = CMD_CONFIGURE_82586; adapter->tx_pcb.data.configure = NO_LOOPBACK | RECV_BROAD; adapter->tx_pcb.length = 2; adapter->got[CMD_CONFIGURE_82586] = 0; if (!send_pcb(dev, &adapter->tx_pcb)) - printk(KERN_ERR "%s: couldn't send 82586 configure command\n", dev->name); + pr_err("%s: couldn't send 82586 configure command\n", dev->name); else { unsigned long timeout = jiffies + TIMEOUT; while (adapter->got[CMD_CONFIGURE_82586] == 0 && time_before(jiffies, timeout)); @@ -968,7 +959,7 @@ static int elp_open(struct net_device *dev) */ prime_rx(dev); if (elp_debug >= 3) - printk(KERN_DEBUG "%s: %d receive PCBs active\n", dev->name, adapter->rx_active); + pr_debug("%s: %d receive PCBs active\n", dev->name, adapter->rx_active); /* * device is now officially open! @@ -985,9 +976,9 @@ static int elp_open(struct net_device *dev) * ******************************************************/ -static int send_packet(struct net_device *dev, struct sk_buff *skb) +static netdev_tx_t send_packet(struct net_device *dev, struct sk_buff *skb) { - elp_device *adapter = dev->priv; + elp_device *adapter = netdev_priv(dev); unsigned long target; unsigned long flags; @@ -998,12 +989,12 @@ static int send_packet(struct net_device *dev, struct sk_buff *skb) if (test_and_set_bit(0, (void *) &adapter->busy)) { if (elp_debug >= 2) - printk(KERN_DEBUG "%s: transmit blocked\n", dev->name); - return FALSE; + pr_debug("%s: transmit blocked\n", dev->name); + return false; } - adapter->stats.tx_bytes += nlen; - + dev->stats.tx_bytes += nlen; + /* * send the adapter a transmit packet command. Ignore segment and offset * and make sure the length is even @@ -1016,17 +1007,17 @@ static int send_packet(struct net_device *dev, struct sk_buff *skb) if (!send_pcb(dev, &adapter->tx_pcb)) { adapter->busy = 0; - return FALSE; + return false; } /* if this happens, we die */ if (test_and_set_bit(0, (void *) &adapter->dmaing)) - printk(KERN_DEBUG "%s: tx: DMA %d in progress\n", dev->name, adapter->current_dma.direction); + pr_debug("%s: tx: DMA %d in progress\n", dev->name, adapter->current_dma.direction); adapter->current_dma.direction = 1; adapter->current_dma.start_time = jiffies; if ((unsigned long)(skb->data + nlen) >= MAX_DMA_ADDRESS || nlen != skb->len) { - memcpy(adapter->dma_buffer, skb->data, nlen); + skb_copy_from_linear_data(skb, adapter->dma_buffer, nlen); memset(adapter->dma_buffer+skb->len, 0, nlen-skb->len); target = isa_virt_to_bus(adapter->dma_buffer); } @@ -1044,28 +1035,28 @@ 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); + pr_debug("%s: DMA transfer started\n", dev->name); - return TRUE; + return true; } /* * The upper layer thinks we timed out */ - + static void elp_timeout(struct net_device *dev) { - elp_device *adapter = dev->priv; int stat; stat = inb_status(dev->base_addr); - printk(KERN_WARNING "%s: transmit timed out, lost %s?\n", dev->name, (stat & ACRF) ? "interrupt" : "command"); + pr_warning("%s: transmit timed out, lost %s?\n", dev->name, + (stat & ACRF) ? "interrupt" : "command"); if (elp_debug >= 1) - printk(KERN_DEBUG "%s: status %#02x\n", dev->name, stat); + pr_debug("%s: status %#02x\n", dev->name, stat); dev->trans_start = jiffies; - adapter->stats.tx_dropped++; + dev->stats.tx_dropped++; netif_wake_queue(dev); } @@ -1076,31 +1067,31 @@ static void elp_timeout(struct net_device *dev) * ******************************************************/ -static int elp_start_xmit(struct sk_buff *skb, struct net_device *dev) +static netdev_tx_t elp_start_xmit(struct sk_buff *skb, struct net_device *dev) { unsigned long flags; - elp_device *adapter = dev->priv; - + elp_device *adapter = netdev_priv(dev); + spin_lock_irqsave(&adapter->lock, flags); check_3c505_dma(dev); if (elp_debug >= 3) - printk(KERN_DEBUG "%s: request to send packet of length %d\n", dev->name, (int) skb->len); + pr_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 */ if (!send_packet(dev, skb)) { if (elp_debug >= 2) { - printk(KERN_DEBUG "%s: failed to transmit packet\n", dev->name); + pr_debug("%s: failed to transmit packet\n", dev->name); } spin_unlock_irqrestore(&adapter->lock, flags); - return 1; + return NETDEV_TX_BUSY; } if (elp_debug >= 3) - printk(KERN_DEBUG "%s: packet of length %d sent\n", dev->name, (int) skb->len); + pr_debug("%s: packet of length %d sent\n", dev->name, (int) skb->len); /* * start the transmit timeout @@ -1110,7 +1101,7 @@ static int elp_start_xmit(struct sk_buff *skb, struct net_device *dev) prime_rx(dev); spin_unlock_irqrestore(&adapter->lock, flags); netif_start_queue(dev); - return 0; + return NETDEV_TX_OK; } /****************************************************** @@ -1121,33 +1112,33 @@ static int elp_start_xmit(struct sk_buff *skb, struct net_device *dev) static struct net_device_stats *elp_get_stats(struct net_device *dev) { - elp_device *adapter = (elp_device *) dev->priv; + elp_device *adapter = netdev_priv(dev); if (elp_debug >= 3) - printk(KERN_DEBUG "%s: request for stats\n", dev->name); + pr_debug("%s: request for stats\n", dev->name); /* If the device is closed, just return the latest stats we have, - we cannot ask from the adapter without interrupts */ if (!netif_running(dev)) - return &adapter->stats; + return &dev->stats; /* send a get statistics command to the board */ adapter->tx_pcb.command = CMD_NETWORK_STATISTICS; adapter->tx_pcb.length = 0; adapter->got[CMD_NETWORK_STATISTICS] = 0; if (!send_pcb(dev, &adapter->tx_pcb)) - printk(KERN_ERR "%s: couldn't send get statistics command\n", dev->name); + pr_err("%s: couldn't send get statistics command\n", dev->name); else { unsigned long timeout = jiffies + TIMEOUT; while (adapter->got[CMD_NETWORK_STATISTICS] == 0 && time_before(jiffies, timeout)); if (time_after_eq(jiffies, timeout)) { TIMEOUT_MSG(__LINE__); - return &adapter->stats; + return &dev->stats; } } /* statistics are now up to date */ - return &adapter->stats; + return &dev->stats; } @@ -1169,7 +1160,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, @@ -1183,12 +1174,10 @@ static struct ethtool_ops netdev_ethtool_ops = { static int elp_close(struct net_device *dev) { - elp_device *adapter; - - adapter = dev->priv; + elp_device *adapter = netdev_priv(dev); if (elp_debug >= 3) - printk(KERN_DEBUG "%s: request to close device\n", dev->name); + pr_debug("%s: request to close device\n", dev->name); netif_stop_queue(dev); @@ -1226,28 +1215,27 @@ static int elp_close(struct net_device *dev) static void elp_set_mc_list(struct net_device *dev) { - elp_device *adapter = (elp_device *) dev->priv; - struct dev_mc_list *dmi = dev->mc_list; + elp_device *adapter = netdev_priv(dev); + struct dev_mc_list *dmi; int i; unsigned long flags; if (elp_debug >= 3) - printk(KERN_DEBUG "%s: request to set multicast list\n", dev->name); + pr_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 */ adapter->tx_pcb.command = CMD_LOAD_MULTICAST_LIST; - adapter->tx_pcb.length = 6 * dev->mc_count; - for (i = 0; i < dev->mc_count; i++) { - memcpy(adapter->tx_pcb.data.multicast[i], dmi->dmi_addr, 6); - dmi = dmi->next; - } + adapter->tx_pcb.length = 6 * netdev_mc_count(dev); + i = 0; + netdev_for_each_mc_addr(dmi, dev) + memcpy(adapter->tx_pcb.data.multicast[i++], dmi->dmi_addr, 6); adapter->got[CMD_LOAD_MULTICAST_LIST] = 0; if (!send_pcb(dev, &adapter->tx_pcb)) - printk(KERN_ERR "%s: couldn't send set_multicast command\n", dev->name); + pr_err("%s: couldn't send set_multicast command\n", dev->name); else { unsigned long timeout = jiffies + TIMEOUT; while (adapter->got[CMD_LOAD_MULTICAST_LIST] == 0 && time_before(jiffies, timeout)); @@ -1255,7 +1243,7 @@ static void elp_set_mc_list(struct net_device *dev) TIMEOUT_MSG(__LINE__); } } - if (dev->mc_count) + if (!netdev_mc_empty(dev)) adapter->tx_pcb.data.configure = NO_LOOPBACK | RECV_BROAD | RECV_MULTI; else /* num_addrs == 0 */ adapter->tx_pcb.data.configure = NO_LOOPBACK | RECV_BROAD; @@ -1266,14 +1254,14 @@ static void elp_set_mc_list(struct net_device *dev) * and wait for response */ if (elp_debug >= 3) - printk(KERN_DEBUG "%s: sending 82586 configure command\n", dev->name); + pr_debug("%s: sending 82586 configure command\n", dev->name); adapter->tx_pcb.command = CMD_CONFIGURE_82586; adapter->tx_pcb.length = 2; adapter->got[CMD_CONFIGURE_82586] = 0; if (!send_pcb(dev, &adapter->tx_pcb)) { spin_unlock_irqrestore(&adapter->lock, flags); - printk(KERN_ERR "%s: couldn't send 82586 configure command\n", dev->name); + pr_err("%s: couldn't send 82586 configure command\n", dev->name); } else { unsigned long timeout = jiffies + TIMEOUT; @@ -1302,17 +1290,17 @@ static int __init elp_sense(struct net_device *dev) orig_HSR = inb_status(addr); if (elp_debug > 0) - printk(search_msg, name, addr); + pr_debug(search_msg, name, addr); if (orig_HSR == 0xff) { if (elp_debug > 0) - printk(notfound_msg, 1); + pr_cont(notfound_msg, 1); goto out; } /* Wait for a while; the adapter may still be booting up */ if (elp_debug > 0) - printk(stilllooking_msg); + pr_cont(stilllooking_msg); if (orig_HSR & DIR) { /* If HCR.DIR is up, we pull it down. HSR.DIR should follow. */ @@ -1320,7 +1308,7 @@ static int __init elp_sense(struct net_device *dev) msleep(300); if (inb_status(addr) & DIR) { if (elp_debug > 0) - printk(notfound_msg, 2); + pr_cont(notfound_msg, 2); goto out; } } else { @@ -1329,7 +1317,7 @@ static int __init elp_sense(struct net_device *dev) msleep(300); if (!(inb_status(addr) & DIR)) { if (elp_debug > 0) - printk(notfound_msg, 3); + pr_cont(notfound_msg, 3); goto out; } } @@ -1337,7 +1325,7 @@ static int __init elp_sense(struct net_device *dev) * It certainly looks like a 3c505. */ if (elp_debug > 0) - printk(found_msg); + pr_cont(found_msg); return 0; out: @@ -1368,11 +1356,22 @@ static int __init elp_autodetect(struct net_device *dev) /* could not find an adapter */ if (elp_debug > 0) - printk(couldnot_msg, dev->name); + pr_debug(couldnot_msg, dev->name); return 0; /* Because of this, the layer above will return -ENODEV */ } +static const struct net_device_ops elp_netdev_ops = { + .ndo_open = elp_open, + .ndo_stop = elp_close, + .ndo_get_stats = elp_get_stats, + .ndo_start_xmit = elp_start_xmit, + .ndo_tx_timeout = elp_timeout, + .ndo_set_multicast_list = elp_set_mc_list, + .ndo_change_mtu = eth_change_mtu, + .ndo_set_mac_address = eth_mac_addr, + .ndo_validate_addr = eth_validate_addr, +}; /****************************************************** * @@ -1397,14 +1396,12 @@ static int __init elp_autodetect(struct net_device *dev) static int __init elplus_setup(struct net_device *dev) { - elp_device *adapter = dev->priv; + elp_device *adapter = netdev_priv(dev); int i, tries, tries1, okay; unsigned long timeout; unsigned long cookie = 0; int err = -ENODEV; - SET_MODULE_OWNER(dev); - /* * setup adapter structure */ @@ -1434,16 +1431,16 @@ static int __init elplus_setup(struct net_device *dev) /* Nope, it's ignoring the command register. This means that * either it's still booting up, or it's died. */ - printk(KERN_ERR "%s: command register wouldn't drain, ", dev->name); + pr_err("%s: command register wouldn't drain, ", dev->name); if ((inb_status(dev->base_addr) & 7) == 3) { /* If the adapter status is 3, it *could* still be booting. * Give it the benefit of the doubt for 10 seconds. */ - printk("assuming 3c505 still starting\n"); + pr_cont("assuming 3c505 still starting\n"); timeout = jiffies + 10*HZ; while (time_before(jiffies, timeout) && (inb_status(dev->base_addr) & 7)); if (inb_status(dev->base_addr) & 7) { - printk(KERN_ERR "%s: 3c505 failed to start\n", dev->name); + pr_err("%s: 3c505 failed to start\n", dev->name); } else { okay = 1; /* It started */ } @@ -1451,7 +1448,7 @@ static int __init elplus_setup(struct net_device *dev) /* Otherwise, it must just be in a strange * state. We probably need to kick it. */ - printk("3c505 is sulking\n"); + pr_cont("3c505 is sulking\n"); } } for (tries = 0; tries < 5 && okay; tries++) { @@ -1464,18 +1461,19 @@ static int __init elplus_setup(struct net_device *dev) adapter->tx_pcb.length = 0; cookie = probe_irq_on(); if (!send_pcb(dev, &adapter->tx_pcb)) { - printk(KERN_ERR "%s: could not send first PCB\n", dev->name); + pr_err("%s: could not send first PCB\n", dev->name); probe_irq_off(cookie); continue; } if (!receive_pcb(dev, &adapter->rx_pcb)) { - printk(KERN_ERR "%s: could not read first PCB\n", dev->name); + pr_err("%s: could not read first PCB\n", dev->name); probe_irq_off(cookie); continue; } if ((adapter->rx_pcb.command != CMD_ADDRESS_RESPONSE) || (adapter->rx_pcb.length != 6)) { - printk(KERN_ERR "%s: first PCB wrong (%d, %d)\n", dev->name, adapter->rx_pcb.command, adapter->rx_pcb.length); + pr_err("%s: first PCB wrong (%d, %d)\n", dev->name, + adapter->rx_pcb.command, adapter->rx_pcb.length); probe_irq_off(cookie); continue; } @@ -1484,32 +1482,32 @@ static int __init elplus_setup(struct net_device *dev) /* It's broken. Do a hard reset to re-initialise the board, * and try again. */ - printk(KERN_INFO "%s: resetting adapter\n", dev->name); + pr_info("%s: resetting adapter\n", dev->name); outb_control(adapter->hcr_val | FLSH | ATTN, dev); outb_control(adapter->hcr_val & ~(FLSH | ATTN), dev); } - printk(KERN_ERR "%s: failed to initialise 3c505\n", dev->name); + pr_err("%s: failed to initialise 3c505\n", dev->name); goto out; okay: if (dev->irq) { /* Is there a preset IRQ? */ int rpt = probe_irq_off(cookie); if (dev->irq != rpt) { - printk(KERN_WARNING "%s: warning, irq %d configured but %d detected\n", dev->name, dev->irq, rpt); + pr_warning("%s: warning, irq %d configured but %d detected\n", dev->name, dev->irq, rpt); } /* if dev->irq == probe_irq_off(cookie), all is well */ } else /* No preset IRQ; just use what we can detect */ dev->irq = probe_irq_off(cookie); switch (dev->irq) { /* Legal, sane? */ case 0: - printk(KERN_ERR "%s: IRQ probe failed: check 3c505 jumpers.\n", + pr_err("%s: IRQ probe failed: check 3c505 jumpers.\n", dev->name); goto out; case 1: case 6: case 8: case 13: - printk(KERN_ERR "%s: Impossible IRQ %d reported by probe_irq_off().\n", + pr_err("%s: Impossible IRQ %d reported by probe_irq_off().\n", dev->name, dev->irq); goto out; } @@ -1531,7 +1529,7 @@ static int __init elplus_setup(struct net_device *dev) dev->dma = dev->mem_start & 7; } else { - printk(KERN_WARNING "%s: warning, DMA channel not specified, using default\n", dev->name); + pr_warning("%s: warning, DMA channel not specified, using default\n", dev->name); dev->dma = ELP_DMA; } } @@ -1539,12 +1537,8 @@ static int __init elplus_setup(struct net_device *dev) /* * print remainder of startup message */ - printk(KERN_INFO "%s: 3c505 at %#lx, irq %d, dma %d, ", - dev->name, dev->base_addr, dev->irq, dev->dma); - printk("addr %02x:%02x:%02x:%02x:%02x:%02x, ", - dev->dev_addr[0], dev->dev_addr[1], dev->dev_addr[2], - dev->dev_addr[3], dev->dev_addr[4], dev->dev_addr[5]); - + pr_info("%s: 3c505 at %#lx, irq %d, dma %d, addr %pM, ", + dev->name, dev->base_addr, dev->irq, dev->dma, dev->dev_addr); /* * read more information from the adapter */ @@ -1555,9 +1549,10 @@ static int __init elplus_setup(struct net_device *dev) !receive_pcb(dev, &adapter->rx_pcb) || (adapter->rx_pcb.command != CMD_ADAPTER_INFO_RESPONSE) || (adapter->rx_pcb.length != 10)) { - printk("not responding to second PCB\n"); + pr_cont("not responding to second PCB\n"); } - printk("rev %d.%d, %dk\n", adapter->rx_pcb.data.info.major_vers, adapter->rx_pcb.data.info.minor_vers, adapter->rx_pcb.data.info.RAM_sz); + pr_cont("rev %d.%d, %dk\n", adapter->rx_pcb.data.info.major_vers, + adapter->rx_pcb.data.info.minor_vers, adapter->rx_pcb.data.info.RAM_sz); /* * reconfigure the adapter memory to better suit our purposes @@ -1574,22 +1569,16 @@ static int __init elplus_setup(struct net_device *dev) !receive_pcb(dev, &adapter->rx_pcb) || (adapter->rx_pcb.command != CMD_CONFIGURE_ADAPTER_RESPONSE) || (adapter->rx_pcb.length != 2)) { - printk(KERN_ERR "%s: could not configure adapter memory\n", dev->name); + pr_err("%s: could not configure adapter memory\n", dev->name); } if (adapter->rx_pcb.data.configure) { - printk(KERN_ERR "%s: adapter configuration failed\n", dev->name); + pr_err("%s: adapter configuration failed\n", dev->name); } - dev->open = elp_open; /* local */ - dev->stop = elp_close; /* local */ - dev->get_stats = elp_get_stats; /* local */ - dev->hard_start_xmit = elp_start_xmit; /* local */ - dev->tx_timeout = elp_timeout; /* local */ + dev->netdev_ops = &elp_netdev_ops; dev->watchdog_timeo = 10*HZ; - dev->set_multicast_list = elp_set_mc_list; /* local */ dev->ethtool_ops = &netdev_ethtool_ops; /* local */ - memset(&(adapter->stats), 0, sizeof(struct net_device_stats)); dev->mem_start = dev->mem_end = 0; err = register_netdev(dev); @@ -1648,17 +1637,17 @@ int __init init_module(void) dev->dma = dma[this_dev]; } else { dev->dma = ELP_DMA; - printk(KERN_WARNING "3c505.c: warning, using default DMA channel,\n"); + pr_warning("3c505.c: warning, using default DMA channel,\n"); } if (io[this_dev] == 0) { if (this_dev) { free_netdev(dev); break; } - printk(KERN_NOTICE "3c505.c: module autoprobe not recommended, give io=xx.\n"); + pr_notice("3c505.c: module autoprobe not recommended, give io=xx.\n"); } if (elplus_setup(dev) != 0) { - printk(KERN_WARNING "3c505.c: Failed to register card at 0x%x.\n", io[this_dev]); + pr_warning("3c505.c: Failed to register card at 0x%x.\n", io[this_dev]); free_netdev(dev); break; } @@ -1670,7 +1659,7 @@ int __init init_module(void) return 0; } -void cleanup_module(void) +void __exit cleanup_module(void) { int this_dev;