compat-wireless: backport threaded irq for wl12xx_spi
authorHauke Mehrtens <hauke@hauke-m.de>
Thu, 31 Mar 2011 16:22:04 +0000 (09:22 -0700)
committerLuis R. Rodriguez <lrodriguez@atheros.com>
Thu, 31 Mar 2011 19:18:42 +0000 (12:18 -0700)
This backports threaded irq support for kernel < 2.6.31 for wl12xx_spi.
This is only compile tested as I do not have such a device.

Luis please add this into the linux-2.6.39.y branch.

CC: Ido Yariv <ido@wizery.com>
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
patches/09-threaded-irq.patch

index f62933eb0285d77a2f08712c373de78219429492..9822acb96f9b7bf032414ac57fe984e052222a95 100644 (file)
@@ -61,3 +61,64 @@ thread in process context as well.
  };
  
  /* Data structure for the WLAN parts (802.11 cores) of the b43 chip. */
+--- a/drivers/net/wireless/wl12xx/spi.c
++++ b/drivers/net/wireless/wl12xx/spi.c
+@@ -408,9 +408,20 @@ static int __devinit wl1271_probe(struct
+               goto out_free;
+       }
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)
++      ret = compat_request_threaded_irq(&wl->irq_compat, wl->irq,
++                                        wl1271_hardirq, wl1271_irq,
++                                        IRQF_TRIGGER_RISING,
++                                        DRIVER_NAME, wl);
++#else
+       ret = request_threaded_irq(wl->irq, wl1271_hardirq, wl1271_irq,
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)
++                                 IRQF_TRIGGER_RISING,
++#else
+                                  IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
++#endif
+                                  DRIVER_NAME, wl);
++#endif
+       if (ret < 0) {
+               wl1271_error("request_irq() failed: %d", ret);
+               goto out_free;
+@@ -431,7 +442,11 @@ static int __devinit wl1271_probe(struct
+       return 0;
+  out_irq:
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)
++      compat_free_threaded_irq(&wl->irq_compat);
++#else
+       free_irq(wl->irq, wl);
++#endif
+  out_free:
+       wl1271_free_hw(wl);
+@@ -444,7 +459,12 @@ static int __devexit wl1271_remove(struc
+       struct wl1271 *wl = dev_get_drvdata(&spi->dev);
+       wl1271_unregister_hw(wl);
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)
++      compat_free_threaded_irq(&wl->irq_compat);
++      compat_destroy_threaded_irq(&wl->irq_compat);
++#else
+       free_irq(wl->irq, wl);
++#endif
+       wl1271_free_hw(wl);
+       return 0;
+--- a/drivers/net/wireless/wl12xx/wl12xx.h
++++ b/drivers/net/wireless/wl12xx/wl12xx.h
+@@ -544,6 +544,10 @@ struct wl1271 {
+       /* Quirks of specific hardware revisions */
+       unsigned int quirks;
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,31)
++      struct compat_threaded_irq irq_compat;
++#endif
+ };
+ struct wl1271_station {