Patch for irqreturn_t in Linux 2.5.68-bk2

Pavel Roskin proski
Tue Apr 22 17:39:57 PDT 2003


Hello!

This patch updates the IRQ handler to the new kernel API, which is
described here: http://lwn.net/Articles/29555/

Following Linus' advise, I was careful to return IRQ_NONE only it the 
EVSTAT register is available, valid and indicates no events.

Compatibility code is provided in hostap_compat.h.  Yes, "typedef void" is
valid, as funny as it it.

-- 
Regards,
Pavel Roskin
-------------- next part --------------
--- driver/modules/hostap_compat.h
+++ driver/modules/hostap_compat.h
@@ -131,6 +131,14 @@
 #endif /* kernel < 2.4.0 */
 
 
+/* Interrupt handler backwards compatibility for Linux < 2.5.69 */
+#ifndef IRQ_NONE
+#define IRQ_NONE
+#define IRQ_HANDLED
+typedef void irqreturn_t;
+#endif
+
+
 #if WIRELESS_EXT > 12
 #if IW_HANDLER_VERSION < 3
 extern void wireless_send_event(struct net_device *dev,
--- driver/modules/hostap_config.h
+++ driver/modules/hostap_config.h
@@ -42,7 +42,7 @@
 #endif /* PRISM2_BUS_MASTER */
 
 /* Include code for downloading firmware images. */
-/* #define PRISM2_DOWNLOAD_SUPPORT */
+#define PRISM2_DOWNLOAD_SUPPORT
 
 /* Allow kernel configuration to enable download support. */
 #if !defined(PRISM2_DOWNLOAD_SUPPORT) && defined(CONFIG_HOSTAP_FIRMWARE)
--- driver/modules/hostap_hw.c
+++ driver/modules/hostap_hw.c
@@ -3604,7 +3604,7 @@ static inline void prism2_check_magic(lo
 
 
 /* Called only from hardware IRQ */
-static void prism2_interrupt(int irq, void *dev_id, struct pt_regs *regs)
+static irqreturn_t prism2_interrupt(int irq, void *dev_id, struct pt_regs *regs)
 {
 	struct net_device *dev = (struct net_device *) dev_id;
 	local_info_t *local = (local_info_t *) dev->priv;
@@ -3616,7 +3616,7 @@ static void prism2_interrupt(int irq, vo
 	if (local->func->card_present && !local->func->card_present(local)) {
 		printk(KERN_DEBUG "%s: Interrupt, but dev not OK\n",
 		       dev->name);
-		return;
+		return IRQ_HANDLED;
 	}
 
 	prism2_check_magic(local);
@@ -3625,12 +3625,12 @@ static void prism2_interrupt(int irq, vo
 		ev = HFA384X_INW(HFA384X_EVSTAT_OFF);
 		if (ev == 0xffff) {
 			if (local->shutdown)
-				return;
+				return IRQ_HANDLED;
 			HFA384X_OUTW(0xffff, HFA384X_EVACK_OFF);
 			printk(KERN_DEBUG "%s: prism2_interrupt: ev=0xffff\n",
 			       dev->name);
 			PRISM2_SCHEDULE_TASK(&local->reset_queue);
-			return;
+			return IRQ_HANDLED;
 		}
 
 		ev &= local->event_mask;
@@ -3651,13 +3651,13 @@ static void prism2_interrupt(int irq, vo
 			if (ev & HFA384X_EV_CMD)
 				goto next_event;
 			if ((ev & HFA384X_EVENT_MASK) == 0)
-				return;
+				return IRQ_HANDLED;
 			if (local->dev_enabled)
 				printk(KERN_DEBUG "%s: prism2_interrupt: hw "
 				       "not ready; skipping events 0x%04x\n",
 				       dev->name, ev);
 			HFA384X_OUTW(ev, HFA384X_EVACK_OFF);
-			return;
+			return IRQ_HANDLED;
 		}
 
 #if defined(PRISM2_PCI) && defined(PRISM2_BUS_MASTER)
@@ -3711,6 +3711,10 @@ static void prism2_interrupt(int irq, vo
 		}
 	}
 	prism2_io_debug_add(dev, PRISM2_IO_DEBUG_CMD_INTERRUPT, 0, 1);
+	if (events)
+		return IRQ_HANDLED;
+	else
+		return IRQ_NONE;
 }
 
 



More information about the Hostap mailing list