ARM: sa11x0: neponset: get parent IRQ from neponset device resource
authorRussell King <rmk+kernel@arm.linux.org.uk>
Tue, 24 Jan 2012 23:05:08 +0000 (23:05 +0000)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Thu, 9 Feb 2012 15:34:16 +0000 (15:34 +0000)
Obtain the parent IRQ from the neponset device resource rather than
hard-coding it into the code.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/mach-sa1100/neponset.c

index 47681960783be7eb62d89c951d2987f69caa36a8..f4d587151770e2616810998bdfc78f15172de240 100644 (file)
@@ -207,7 +207,11 @@ static int __devinit neponset_probe(struct platform_device *dev)
                .res = smc91x_resources,
                .num_res = ARRAY_SIZE(smc91x_resources),
        };
-       int ret;
+       int ret, irq;
+
+       irq = ret = platform_get_irq(dev, 0);
+       if (ret < 0)
+               goto err_alloc;
 
        d = kzalloc(sizeof(*d), GFP_KERNEL);
        if (!d) {
@@ -234,16 +238,16 @@ static int __devinit neponset_probe(struct platform_device *dev)
        set_irq_flags(d->irq_base + NEP_IRQ_USAR, IRQF_VALID | IRQF_PROBE);
        irq_set_chip(d->irq_base + NEP_IRQ_SA1111, &nochip);
 
-       irq_set_irq_type(IRQ_GPIO25, IRQ_TYPE_EDGE_RISING);
-       irq_set_handler_data(IRQ_GPIO25, d);
-       irq_set_chained_handler(IRQ_GPIO25, neponset_irq_handler);
+       irq_set_irq_type(irq, IRQ_TYPE_EDGE_RISING);
+       irq_set_handler_data(irq, d);
+       irq_set_chained_handler(irq, neponset_irq_handler);
 
        /*
         * We would set IRQ_GPIO25 to be a wake-up IRQ, but unfortunately
         * something on the Neponset activates this IRQ on sleep (eth?)
         */
 #if 0
-       enable_irq_wake(IRQ_GPIO25);
+       enable_irq_wake(irq);
 #endif
 
        dev_info(&dev->dev, "Neponset daughter board, providing IRQ%u-%u\n",
@@ -275,12 +279,13 @@ static int __devinit neponset_probe(struct platform_device *dev)
 static int __devexit neponset_remove(struct platform_device *dev)
 {
        struct neponset_drvdata *d = platform_get_drvdata(dev);
+       int irq = platform_get_irq(dev, 0);
 
        if (!IS_ERR(d->sa1111))
                platform_device_unregister(d->sa1111);
        if (!IS_ERR(d->smc91x))
                platform_device_unregister(d->smc91x);
-       irq_set_chained_handler(IRQ_GPIO25, NULL);
+       irq_set_chained_handler(irq, NULL);
        irq_free_descs(d->irq_base, NEP_IRQ_NR);
        kfree(d);
 
@@ -325,7 +330,8 @@ static struct platform_driver neponset_device_driver = {
 };
 
 static struct resource neponset_resources[] = {
-       [0] = DEFINE_RES_MEM(0x10000000, 0x08000000),
+       DEFINE_RES_MEM(0x10000000, 0x08000000),
+       DEFINE_RES_IRQ(IRQ_GPIO25),
 };
 
 static struct platform_device neponset_device = {