Commit 96cc55a1 authored by Jeff Garzik's avatar Jeff Garzik

[arcnet com20020] misc fixes

* com20020_close expects two arguments (and actually uses the
  second argument), but the arcnet layer only passes one arg.
  Fun ensues.
* Remove __devinit markers, this is a library module.
* Move request_region up in com20020_found, to make the call
  occur before the first I/O access in the function.
parent 811a4386
......@@ -55,7 +55,7 @@ static void com20020_copy_to_card(struct net_device *dev, int bufnum,
static void com20020_copy_from_card(struct net_device *dev, int bufnum,
int offset, void *buf, int count);
static void com20020_set_mc_list(struct net_device *dev);
static void com20020_close(struct net_device *, bool);
static void com20020_close(struct net_device *);
static void com20020_copy_from_card(struct net_device *dev, int bufnum,
int offset, void *buf, int count)
......@@ -86,7 +86,7 @@ static void com20020_copy_to_card(struct net_device *dev, int bufnum,
/* Reset the card and check some basic stuff during the detection stage. */
int __devinit com20020_check(struct net_device *dev)
int com20020_check(struct net_device *dev)
{
int ioaddr = dev->base_addr, status;
struct arcnet_local *lp = dev->priv;
......@@ -152,7 +152,7 @@ int __devinit com20020_check(struct net_device *dev)
/* Set up the struct net_device associated with this card. Called after
* probing succeeds.
*/
int __devinit com20020_found(struct net_device *dev, int shared)
int com20020_found(struct net_device *dev, int shared)
{
struct arcnet_local *lp;
int ioaddr = dev->base_addr;
......@@ -180,6 +180,10 @@ int __devinit com20020_found(struct net_device *dev, int shared)
if (!dev->dev_addr[0])
dev->dev_addr[0] = inb(ioaddr + 8); /* FIXME: do this some other way! */
/* reserve the I/O region */
if (!request_region(ioaddr, ARCNET_TOTAL_SIZE, "arcnet (COM20020)"))
return -EBUSY;
SET_SUBADR(SUB_SETUP1);
outb(lp->setup, _XREG);
......@@ -203,13 +207,10 @@ int __devinit com20020_found(struct net_device *dev, int shared)
if (request_irq(dev->irq, &arcnet_interrupt, shared,
"arcnet (COM20020)", dev)) {
BUGMSG(D_NORMAL, "Can't get IRQ %d!\n", dev->irq);
release_region(ioaddr, ARCNET_TOTAL_SIZE);
return -ENODEV;
}
/* reserve the I/O region */
if (!request_region(ioaddr, ARCNET_TOTAL_SIZE, "arcnet (COM20020)")) {
free_irq(dev->irq, dev);
return -EBUSY;
}
dev->base_addr = ioaddr;
BUGMSG(D_NORMAL, "%s: station %02Xh found at %03lXh, IRQ %d.\n",
......@@ -226,8 +227,8 @@ int __devinit com20020_found(struct net_device *dev, int shared)
clockrates[3 - ((lp->setup2 & 0xF0) >> 4) + ((lp->setup & 0x0F) >> 1)]);
if (!dev->init && register_netdev(dev)) {
free_irq(dev->irq, dev);
release_region(ioaddr, ARCNET_TOTAL_SIZE);
free_irq(dev->irq, dev);
return -EIO;
}
return 0;
......@@ -298,16 +299,14 @@ static int com20020_status(struct net_device *dev)
return ASTATUS();
}
static void com20020_close(struct net_device *dev, bool open)
static void com20020_close(struct net_device *dev)
{
struct arcnet_local *lp = (struct arcnet_local *) dev->priv;
int ioaddr = dev->base_addr;
if (!open) {
/* disable transmitter */
lp->config &= ~TXENcfg;
SETCONF;
}
/* disable transmitter */
lp->config &= ~TXENcfg;
SETCONF;
}
/* Set or clear the multicast filter for this adaptor.
......@@ -339,7 +338,7 @@ static void com20020_set_mc_list(struct net_device *dev)
}
}
void __devexit com20020_remove(struct net_device *dev)
void com20020_remove(struct net_device *dev)
{
unregister_netdev(dev);
free_irq(dev->irq, dev);
......
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