intel_th: Pick up irq number from resources
authorAlexander Shishkin <alexander.shishkin@linux.intel.com>
Wed, 23 Aug 2017 06:47:19 +0000 (09:47 +0300)
committerAlexander Shishkin <alexander.shishkin@linux.intel.com>
Wed, 28 Mar 2018 15:47:21 +0000 (18:47 +0300)
Platform devices pass their IRQs around as resources, so as a convenience
for the glue layer code, allow them pass the IRQ to the core driver in
the resources array.

Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
drivers/hwtracing/intel_th/core.c

index d295b22..8f820c1 100644 (file)
@@ -805,7 +805,14 @@ intel_th_alloc(struct device *dev, struct intel_th_drvdata *drvdata,
               struct resource *devres, unsigned int ndevres, int irq)
 {
        struct intel_th *th;
-       int err;
+       int err, r;
+
+       if (irq == -1)
+               for (r = 0; r < ndevres; r++)
+                       if (devres[r].flags & IORESOURCE_IRQ) {
+                               irq = devres[r].start;
+                               break;
+                       }
 
        th = kzalloc(sizeof(*th), GFP_KERNEL);
        if (!th)