[PATCH 1/8] gpio: pxa: add OF support
From: arnd@arndb.de (Arnd Bergmann)
Date: 2012-03-01 09:40:36
Also in:
linux-devicetree
On Thursday 01 March 2012, Haojian Zhuang wrote:
+#ifdef CONFIG_OF
+static int __devinit pxa_gpio_probe_dt(struct platform_device *pdev,
+ int *irq0, int *irq1, int *irq_mux)
+{
+ struct device_node *np = pdev->dev.of_node;
+ const __be32 *irq;
+
+ irq = of_get_property(np, "mrvl,gpio-irq0", NULL);
+ if (irq)
+ *irq0 = be32_to_cpup(irq);
+ irq = of_get_property(np, "mrvl,gpio-irq1", NULL);
+ if (irq)
+ *irq1 = be32_to_cpup(irq);
+ *irq_mux = platform_get_irq(pdev, 0);
+ return 0;
+}
+#else
+static int __devinit pxa_gpio_probe_dt(struct platform_device *pdev,
+ int *irq0, int *irq1, int *irq_mux)
+{
+ return 1;
+}
+#endif
+It seems that you are not following the regular IRQ binding. This should probably use irq_of_parse_and_map(). For other code like the one above, I suggest you use of_property_read_u32_array(), which will already compile to nothing if CONFIG_OF is not set, so you don't have to provide two versions of the fucntion. Arnd