Subject: [PATCH 23/32] rt2x00: Make correct cast in USB interrupt

From: Ivo van Doorn <[email-masked]>
Date: Fri, 28 Apr 2006 00:03:14 +0200

From: Ivo van Doorn <[email-masked]>

The USB interrupt handler receives the entry
in the ring and not the ring itself.
Also check if the status indicates an error
before queueing the work.

Signed-off-by: Ivo van Doorn <[email-masked]>

diff -uprN wireless-dev-rt2x00/drivers/net/wireless/d80211/rt2x00/rt2500usb.c wireless-dev-rt2x00-patch/drivers/net/wireless/d80211/rt2x00/rt2500usb.c
--- wireless-dev-rt2x00/drivers/net/wireless/d80211/rt2x00/rt2500usb.c	2006-04-27 21:53:13.000000000 +0200
+++ wireless-dev-rt2x00-patch/drivers/net/wireless/d80211/rt2x00/rt2500usb.c	2006-04-27 21:54:33.000000000 +0200
@@ -856,11 +856,14 @@ rt2500usb_txdone(void *data)
 static void
 rt2500usb_interrupt(struct urb *urb, struct pt_regs *regs)
 {
-	struct data_ring	*ring = (struct data_ring*)urb->context;
+	struct data_entry	*entry = (struct data_entry*)urb->context;
 	struct rt2x00_usb	*rt2x00usb =
-		ieee80211_dev_hw_data(ring->net_dev);
+		ieee80211_dev_hw_data(entry->ring->net_dev);
 
-	queue_work(rt2x00usb->workqueue, &ring->irq_work);
+	if (urb->status)
+		return;
+
+	queue_work(rt2x00usb->workqueue, &entry->ring->irq_work);
 }
 
 /*
@@ -1064,7 +1067,6 @@ rt2500usb_init_txring(struct rt2x00_usb 
 	}
 }
 
-
 static int
 rt2500usb_init_rings(struct rt2x00_usb *rt2x00usb)
 {
@@ -1798,7 +1800,7 @@ rt2500usb_init_hw_channels(struct rt2x00
 		for (counter = 0; counter < ARRAY_SIZE(vals); counter++)
 			channels[counter].val = vals[counter] | rf2_base;
 	} else if (rt2x00_rf(&rt2x00usb->chip, RF2525E)) {
-		u32 vals[] = {
+		static u32 vals[] = {
 			0x0000089a, 0x0000089e, 0x0000089e, 0x000008a2,
 			0x000008a2, 0x000008a6, 0x000008a6, 0x000008aa,
 			0x000008aa, 0x000008ae, 0x000008ae, 0x000008b2,