Commit 139d2ebb authored by Jeff Garzik's avatar Jeff Garzik

net driver cleanup, volume 5

Affected drivers: 3c505 (notably), depca, ni5010, ni52, ni65,
dmfe, winbond-840.

3c505 included quite a few s/int timeout/unsigned long timeout/
changes as well, for proper jiffies comparison typing.

98% contributed by Andrew Morton.
parent d59a6c2f
......@@ -259,7 +259,7 @@ static inline unsigned int backlog_next(unsigned int n)
static inline int get_status(unsigned int base_addr)
{
int timeout = jiffies + 10*HZ/100;
unsigned long timeout = jiffies + 10*HZ/100;
register int stat1;
do {
stat1 = inb_status(base_addr);
......@@ -283,7 +283,7 @@ static int start_receive(struct net_device *, pcb_struct *);
inline static void adapter_reset(struct net_device *dev)
{
int timeout;
unsigned long timeout;
elp_device *adapter = dev->priv;
unsigned char orig_hcr = adapter->hcr_val;
......@@ -343,7 +343,7 @@ 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)
{
unsigned int timeout;
unsigned long timeout;
outb_command(byte, base_addr);
for (timeout = jiffies + 5*HZ/100; time_before(jiffies, timeout);) {
if (inb_status(base_addr) & HCRE)
......@@ -402,7 +402,7 @@ static inline void prime_rx(struct net_device *dev)
static int send_pcb(struct net_device *dev, pcb_struct * pcb)
{
int i;
int timeout;
unsigned long timeout;
elp_device *adapter = dev->priv;
unsigned long flags;
......@@ -488,7 +488,7 @@ static int receive_pcb(struct net_device *dev, pcb_struct * pcb)
int i, j;
int total_length;
int stat;
int timeout;
unsigned long timeout;
unsigned long flags;
elp_device *adapter = dev->priv;
......@@ -662,14 +662,14 @@ static void receive_packet(struct net_device *dev, int len)
*
******************************************************/
static void elp_interrupt(int irq, void *dev_id, struct pt_regs *reg_ptr)
static irqreturn_t elp_interrupt(int irq, void *dev_id, struct pt_regs *reg_ptr)
{
int len;
int dlen;
int icount = 0;
struct net_device *dev;
elp_device *adapter;
int timeout;
unsigned long timeout;
dev = dev_id;
adapter = (elp_device *) dev->priv;
......@@ -855,6 +855,7 @@ static void elp_interrupt(int irq, void *dev_id, struct pt_regs *reg_ptr)
* indicate no longer in interrupt routine
*/
spin_unlock(&adapter->lock);
return IRQ_HANDLED;
}
......@@ -947,7 +948,7 @@ static int elp_open(struct net_device *dev)
if (!send_pcb(dev, &adapter->tx_pcb))
printk("%s: couldn't send memory configuration command\n", dev->name);
else {
int timeout = jiffies + TIMEOUT;
unsigned long timeout = jiffies + TIMEOUT;
while (adapter->got[CMD_CONFIGURE_ADAPTER_MEMORY] == 0 && time_before(jiffies, timeout));
if (time_after_eq(jiffies, timeout))
TIMEOUT_MSG(__LINE__);
......@@ -966,7 +967,7 @@ static int elp_open(struct net_device *dev)
if (!send_pcb(dev, &adapter->tx_pcb))
printk("%s: couldn't send 82586 configure command\n", dev->name);
else {
int timeout = jiffies + TIMEOUT;
unsigned long timeout = jiffies + TIMEOUT;
while (adapter->got[CMD_CONFIGURE_82586] == 0 && time_before(jiffies, timeout));
if (time_after_eq(jiffies, timeout))
TIMEOUT_MSG(__LINE__);
......@@ -1150,7 +1151,7 @@ static struct net_device_stats *elp_get_stats(struct net_device *dev)
if (!send_pcb(dev, &adapter->tx_pcb))
printk("%s: couldn't send get statistics command\n", dev->name);
else {
int timeout = jiffies + TIMEOUT;
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__);
......@@ -1317,7 +1318,7 @@ static void elp_set_mc_list(struct net_device *dev)
if (!send_pcb(dev, &adapter->tx_pcb))
printk("%s: couldn't send set_multicast command\n", dev->name);
else {
int timeout = jiffies + TIMEOUT;
unsigned long timeout = jiffies + TIMEOUT;
while (adapter->got[CMD_LOAD_MULTICAST_LIST] == 0 && time_before(jiffies, timeout));
if (time_after_eq(jiffies, timeout)) {
TIMEOUT_MSG(__LINE__);
......@@ -1344,7 +1345,7 @@ static void elp_set_mc_list(struct net_device *dev)
printk("%s: couldn't send 82586 configure command\n", dev->name);
}
else {
int timeout = jiffies + TIMEOUT;
unsigned long timeout = jiffies + TIMEOUT;
spin_unlock_irqrestore(&adapter->lock, flags);
while (adapter->got[CMD_CONFIGURE_82586] == 0 && time_before(jiffies, timeout));
if (time_after_eq(jiffies, timeout))
......@@ -1396,10 +1397,8 @@ static inline void elp_init(struct net_device *dev)
static int __init elp_sense(struct net_device *dev)
{
int timeout;
int addr = dev->base_addr;
const char *name = dev->name;
unsigned long flags;
byte orig_HSR;
if (!request_region(addr, ELP_IO_EXTENT, "3c505"))
......@@ -1506,7 +1505,8 @@ static int __init elp_autodetect(struct net_device *dev)
int __init elplus_probe(struct net_device *dev)
{
elp_device *adapter;
int i, tries, tries1, timeout, okay;
int i, tries, tries1, okay;
unsigned long timeout;
unsigned long cookie = 0;
SET_MODULE_OWNER(dev);
......
......@@ -279,7 +279,7 @@ typedef struct {
unsigned int length;
struct sk_buff *skb;
void *target;
long int start_time;
unsigned long start_time;
} current_dma;
/* flags */
......
......@@ -430,7 +430,7 @@ struct depca_private {
*/
static int depca_open(struct net_device *dev);
static int depca_start_xmit(struct sk_buff *skb, struct net_device *dev);
static void depca_interrupt(int irq, void *dev_id, struct pt_regs *regs);
static irqreturn_t depca_interrupt(int irq, void *dev_id, struct pt_regs *regs);
static int depca_close(struct net_device *dev);
static int depca_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
static void depca_tx_timeout(struct net_device *dev);
......@@ -894,7 +894,7 @@ static int depca_start_xmit(struct sk_buff *skb, struct net_device *dev)
/*
** The DEPCA interrupt handler.
*/
static void depca_interrupt(int irq, void *dev_id, struct pt_regs *regs)
static irqreturn_t depca_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{
struct net_device *dev = dev_id;
struct depca_private *lp;
......@@ -903,7 +903,7 @@ static void depca_interrupt(int irq, void *dev_id, struct pt_regs *regs)
if (dev == NULL) {
printk("depca_interrupt(): irq %d for unknown device.\n", irq);
return;
return IRQ_NONE;
}
lp = (struct depca_private *) dev->priv;
......@@ -938,6 +938,7 @@ static void depca_interrupt(int irq, void *dev_id, struct pt_regs *regs)
outb(nicsr, DEPCA_NICSR);
spin_unlock(&lp->lock);
return IRQ_HANDLED;
}
/* Called with lp->lock held */
......
......@@ -104,7 +104,7 @@ extern int ni5010_probe(struct net_device *dev);
static int ni5010_probe1(struct net_device *dev, int ioaddr);
static int ni5010_open(struct net_device *dev);
static int ni5010_send_packet(struct sk_buff *skb, struct net_device *dev);
static void ni5010_interrupt(int irq, void *dev_id, struct pt_regs *regs);
static irqreturn_t ni5010_interrupt(int irq, void *dev_id, struct pt_regs *regs);
static void ni5010_rx(struct net_device *dev);
static void ni5010_timeout(struct net_device *dev);
static int ni5010_close(struct net_device *dev);
......@@ -451,7 +451,7 @@ static int ni5010_send_packet(struct sk_buff *skb, struct net_device *dev)
* The typical workload of the driver:
* Handle the network interface interrupts.
*/
static void ni5010_interrupt(int irq, void *dev_id, struct pt_regs *regs)
static irqreturn_t ni5010_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{
struct net_device *dev = dev_id;
struct ni5010_local *lp;
......@@ -479,7 +479,7 @@ static void ni5010_interrupt(int irq, void *dev_id, struct pt_regs *regs)
if (!xmit_was_error)
reset_receiver(dev);
return;
return IRQ_HANDLED;
}
......
......@@ -193,7 +193,7 @@ sizeof(nop_cmd) = 8;
#define NI52_ADDR2 0x01
static int ni52_probe1(struct net_device *dev,int ioaddr);
static void ni52_interrupt(int irq,void *dev_id,struct pt_regs *reg_ptr);
static irqreturn_t ni52_interrupt(int irq,void *dev_id,struct pt_regs *reg_ptr);
static int ni52_open(struct net_device *dev);
static int ni52_close(struct net_device *dev);
static int ni52_send_packet(struct sk_buff *,struct net_device *);
......@@ -821,7 +821,7 @@ static void *alloc_rfa(struct net_device *dev,void *ptr)
* Interrupt Handler ...
*/
static void ni52_interrupt(int irq,void *dev_id,struct pt_regs *reg_ptr)
static irqreturn_t ni52_interrupt(int irq,void *dev_id,struct pt_regs *reg_ptr)
{
struct net_device *dev = dev_id;
unsigned short stat;
......@@ -830,7 +830,7 @@ static void ni52_interrupt(int irq,void *dev_id,struct pt_regs *reg_ptr)
if (!dev) {
printk ("ni5210-interrupt: irq %d for unknown device.\n",irq);
return;
return IRQ_NONE;
}
p = (struct priv *) dev->priv;
......@@ -889,6 +889,7 @@ static void ni52_interrupt(int irq,void *dev_id,struct pt_regs *reg_ptr)
if(debuglevel > 1)
printk("i");
return IRQ_HANDLED;
}
/*******************************************************
......
......@@ -248,7 +248,7 @@ struct priv
};
static int ni65_probe1(struct net_device *dev,int);
static void ni65_interrupt(int irq, void * dev_id, struct pt_regs *regs);
static irqreturn_t ni65_interrupt(int irq, void * dev_id, struct pt_regs *regs);
static void ni65_recv_intr(struct net_device *dev,int);
static void ni65_xmit_intr(struct net_device *dev,int);
static int ni65_open(struct net_device *dev);
......@@ -307,7 +307,6 @@ static int ni65_open(struct net_device *dev)
if(ni65_lance_reinit(dev))
{
netif_start_queue(dev);
MOD_INC_USE_COUNT;
return 0;
}
else
......@@ -341,7 +340,6 @@ static int ni65_close(struct net_device *dev)
}
#endif
free_irq(dev->irq,dev);
MOD_DEC_USE_COUNT;
return 0;
}
......@@ -512,7 +510,7 @@ static int __init ni65_probe1(struct net_device *dev,int ioaddr)
}
dev->base_addr = ioaddr;
SET_MODULE_OWNER(dev);
dev->open = ni65_open;
dev->stop = ni65_close;
dev->hard_start_xmit = ni65_send_packet;
......@@ -839,7 +837,7 @@ static int ni65_lance_reinit(struct net_device *dev)
/*
* interrupt handler
*/
static void ni65_interrupt(int irq, void * dev_id, struct pt_regs * regs)
static irqreturn_t ni65_interrupt(int irq, void * dev_id, struct pt_regs * regs)
{
int csr0 = 0;
struct net_device *dev = dev_id;
......@@ -940,7 +938,7 @@ static void ni65_interrupt(int irq, void * dev_id, struct pt_regs * regs)
else
writedatareg(CSR0_INEA);
return;
return IRQ_HANDLED;
}
/*
......
......@@ -298,7 +298,7 @@ static struct net_device_stats * dmfe_get_stats(struct DEVICE *);
static void dmfe_set_filter_mode(struct DEVICE *);
static int dmfe_do_ioctl(struct DEVICE *, struct ifreq *, int);
static u16 read_srom_word(long ,int);
static void dmfe_interrupt(int , void *, struct pt_regs *);
static irqreturn_t dmfe_interrupt(int , void *, struct pt_regs *);
static void dmfe_descriptor_init(struct dmfe_board_info *, unsigned long);
static void allocate_rx_buffer(struct dmfe_board_info *);
static void update_cr6(u32, unsigned long);
......@@ -726,7 +726,7 @@ static int dmfe_stop(struct DEVICE *dev)
* receive the packet to upper layer, free the transmitted packet
*/
static void dmfe_interrupt(int irq, void *dev_id, struct pt_regs *regs)
static irqreturn_t dmfe_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{
struct DEVICE *dev = dev_id;
struct dmfe_board_info *db = (struct dmfe_board_info *) dev->priv;
......@@ -737,7 +737,7 @@ static void dmfe_interrupt(int irq, void *dev_id, struct pt_regs *regs)
if (!dev) {
DMFE_DBUG(1, "dmfe_interrupt() without DEVICE arg", 0);
return;
return IRQ_NONE;
}
spin_lock_irqsave(&db->lock, flags);
......@@ -747,7 +747,7 @@ static void dmfe_interrupt(int irq, void *dev_id, struct pt_regs *regs)
outl(db->cr5_data, ioaddr + DCR5);
if ( !(db->cr5_data & 0xc1) ) {
spin_unlock_irqrestore(&db->lock, flags);
return;
return IRQ_HANDLED;
}
/* Disable all interrupt in CR7 to solve the interrupt edge problem */
......@@ -760,7 +760,7 @@ static void dmfe_interrupt(int irq, void *dev_id, struct pt_regs *regs)
db->reset_fatal++;
db->wait_reset = 1; /* Need to RESET */
spin_unlock_irqrestore(&db->lock, flags);
return;
return IRQ_HANDLED;
}
/* Received the coming packet */
......@@ -786,6 +786,7 @@ static void dmfe_interrupt(int irq, void *dev_id, struct pt_regs *regs)
outl(db->cr7_data, ioaddr + DCR7);
spin_unlock_irqrestore(&db->lock, flags);
return IRQ_HANDLED;
}
......
......@@ -385,7 +385,7 @@ static void tx_timeout(struct net_device *dev);
static int alloc_ringdesc(struct net_device *dev);
static void free_ringdesc(struct netdev_private *np);
static int start_tx(struct sk_buff *skb, struct net_device *dev);
static void intr_handler(int irq, void *dev_instance, struct pt_regs *regs);
static irqreturn_t intr_handler(int irq, void *dev_instance, struct pt_regs *regs);
static void netdev_error(struct net_device *dev, int intr_status);
static int netdev_rx(struct net_device *dev);
static u32 __set_rx_mode(struct net_device *dev);
......@@ -1165,15 +1165,16 @@ static void netdev_tx_done(struct net_device *dev)
/* The interrupt handler does all of the Rx thread work and cleans up
after the Tx thread. */
static void intr_handler(int irq, void *dev_instance, struct pt_regs *rgs)
static irqreturn_t intr_handler(int irq, void *dev_instance, struct pt_regs *rgs)
{
struct net_device *dev = (struct net_device *)dev_instance;
struct netdev_private *np = dev->priv;
long ioaddr = dev->base_addr;
int work_limit = max_interrupt_work;
int handled = 0;
if (!netif_device_present(dev))
return;
return IRQ_NONE;
do {
u32 intr_status = readl(ioaddr + IntrStatus);
......@@ -1187,6 +1188,8 @@ static void intr_handler(int irq, void *dev_instance, struct pt_regs *rgs)
if ((intr_status & (NormalIntr|AbnormalIntr)) == 0)
break;
handled = 1;
if (intr_status & (IntrRxDone | RxNoBuf))
netdev_rx(dev);
if (intr_status & RxNoBuf)
......@@ -1222,6 +1225,7 @@ static void intr_handler(int irq, void *dev_instance, struct pt_regs *rgs)
if (debug > 3)
printk(KERN_DEBUG "%s: exiting interrupt, status=%#4.4x.\n",
dev->name, (int)readl(ioaddr + IntrStatus));
return IRQ_RETVAL(handled);
}
/* This routine is logically part of the interrupt handler, but separated
......
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