Commit e339106d authored by Alan Cox's avatar Alan Cox Committed by Linus Torvalds

[PATCH] bring the cops appletalk driver back

parent 48ccae24
...@@ -182,6 +182,7 @@ struct cops_local ...@@ -182,6 +182,7 @@ struct cops_local
int nodeid; /* Set to 1 once have nodeid. */ int nodeid; /* Set to 1 once have nodeid. */
unsigned char node_acquire; /* Node ID when acquired. */ unsigned char node_acquire; /* Node ID when acquired. */
struct atalk_addr node_addr; /* Full node address */ struct atalk_addr node_addr; /* Full node address */
spinlock_t lock; /* RX/TX lock */
}; };
/* Index to functions, as function prototypes. */ /* Index to functions, as function prototypes. */
...@@ -322,6 +323,7 @@ static int __init cops_probe1(struct net_device *dev, int ioaddr) ...@@ -322,6 +323,7 @@ static int __init cops_probe1(struct net_device *dev, int ioaddr)
lp = (struct cops_local *)dev->priv; lp = (struct cops_local *)dev->priv;
memset(lp, 0, sizeof(struct cops_local)); memset(lp, 0, sizeof(struct cops_local));
spinlock_init(&lp->lock);
/* Copy local board variable to lp struct. */ /* Copy local board variable to lp struct. */
lp->board = board; lp->board = board;
...@@ -759,9 +761,8 @@ static void cops_rx(struct net_device *dev) ...@@ -759,9 +761,8 @@ static void cops_rx(struct net_device *dev)
unsigned long flags; unsigned long flags;
save_flags(flags); spin_lock_irqsave(&lp->lock, flags);
cli(); /* Disable interrupts. */
if(lp->board==DAYNA) if(lp->board==DAYNA)
{ {
outb(0, ioaddr); /* Send out Zero length. */ outb(0, ioaddr); /* Send out Zero length. */
...@@ -779,7 +780,7 @@ static void cops_rx(struct net_device *dev) ...@@ -779,7 +780,7 @@ static void cops_rx(struct net_device *dev)
if(boguscount==1000000) if(boguscount==1000000)
{ {
printk(KERN_WARNING "%s: DMA timed out.\n",dev->name); printk(KERN_WARNING "%s: DMA timed out.\n",dev->name);
restore_flags(flags); spin_unlock_irqrestore(&lp->lock, flags);
return; return;
} }
} }
...@@ -814,7 +815,7 @@ static void cops_rx(struct net_device *dev) ...@@ -814,7 +815,7 @@ static void cops_rx(struct net_device *dev)
if(lp->board==DAYNA) if(lp->board==DAYNA)
outb(1, ioaddr+DAYNA_INT_CARD); /* Interrupt the card */ outb(1, ioaddr+DAYNA_INT_CARD); /* Interrupt the card */
restore_flags(flags); /* Restore interrupts. */ spin_unlock_irqrestore(&lp->lock, flags); /* Restore interrupts. */
/* Check for bad response length */ /* Check for bad response length */
if(pkt_len < 0 || pkt_len > MAX_LLAP_SIZE) if(pkt_len < 0 || pkt_len > MAX_LLAP_SIZE)
...@@ -890,12 +891,13 @@ static int cops_send_packet(struct sk_buff *skb, struct net_device *dev) ...@@ -890,12 +891,13 @@ static int cops_send_packet(struct sk_buff *skb, struct net_device *dev)
netif_stop_queue(dev); netif_stop_queue(dev);
save_flags(flags); spin_lock_irqsave(&lp->lock, flags);
cli(); /* Disable interrupts. */
if(lp->board == DAYNA) /* Wait for adapter transmit buffer. */ if(lp->board == DAYNA) /* Wait for adapter transmit buffer. */
while((inb(ioaddr+DAYNA_CARD_STATUS)&DAYNA_TX_READY)==0); while((inb(ioaddr+DAYNA_CARD_STATUS)&DAYNA_TX_READY)==0)
cpu_relax();
if(lp->board == TANGENT) /* Wait for adapter transmit buffer. */ if(lp->board == TANGENT) /* Wait for adapter transmit buffer. */
while((inb(ioaddr+TANG_CARD_STATUS)&TANG_TX_READY)==0); while((inb(ioaddr+TANG_CARD_STATUS)&TANG_TX_READY)==0)
cpu_relax();
/* Output IO length. */ /* Output IO length. */
outb(skb->len, ioaddr); outb(skb->len, ioaddr);
...@@ -915,7 +917,7 @@ static int cops_send_packet(struct sk_buff *skb, struct net_device *dev) ...@@ -915,7 +917,7 @@ static int cops_send_packet(struct sk_buff *skb, struct net_device *dev)
if(lp->board==DAYNA) /* Dayna requires you kick the card */ if(lp->board==DAYNA) /* Dayna requires you kick the card */
outb(1, ioaddr+DAYNA_INT_CARD); outb(1, ioaddr+DAYNA_INT_CARD);
restore_flags(flags); /* Restore interrupts. */ spin_unlock_irqrestore(&lp->lock, flags); /* Restore interrupts. */
/* Done sending packet, update counters and cleanup. */ /* Done sending packet, update counters and cleanup. */
lp->stats.tx_packets++; lp->stats.tx_packets++;
......
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