[PATCH 07/22] GPIO: xilinx: Do not allocate interrupts for IPs without IRQ support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Michal Simek <michal.simek@xxxxxxxxxx>
Date: Tue, 6 Aug 2013 13:16:36 +0200

Check if IP has IRQ connected. If not ignore IRQ allocation.

Signed-off-by: Michal Simek <michal.simek@xxxxxxxxxx>
Signed-off-by: Alexander Hedges <ahedges@xxxxxxx>
(cherry picked from commit 7c58460d5bb43758d879f391e85b7b857160d488)
---
 drivers/gpio/gpio-xilinx.c | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/drivers/gpio/gpio-xilinx.c b/drivers/gpio/gpio-xilinx.c
index 69233b701629..51cd84fafa24 100644
--- a/drivers/gpio/gpio-xilinx.c
+++ b/drivers/gpio/gpio-xilinx.c
@@ -424,6 +424,12 @@ static int xgpio_irq_setup(struct device_node *np, struct xgpio_instance *chip)
 	u32 pin_num;
 	struct resource res;
 
+	int ret = of_irq_to_resource(np, 0, &res);
+	if (!ret) {
+		pr_info("GPIO IRQ not connected\n");
+		return 0;
+	}
+
 	chip->mmchip.gc.of_xlate = xgpio_xlate;
 	chip->mmchip.gc.of_gpio_n_cells = 2;
 	chip->mmchip.gc.to_irq = xgpiops_to_irq;
@@ -436,7 +442,6 @@ static int xgpio_irq_setup(struct device_node *np, struct xgpio_instance *chip)
 	chip->irq_domain = irq_domain_add_legacy(np, chip->mmchip.gc.ngpio,
 						 chip->irq_base, 0,
 						 &irq_domain_simple_ops, NULL);
-	of_irq_to_resource(np, 0, &res);
 
 	/*
 	 * set the irq chip, handler and irq chip data for callbacks for
@@ -525,19 +530,21 @@ static int xgpio_of_probe(struct platform_device *pdev)
 
 	chip->mmchip.save_regs = xgpio_save_regs;
 
-	status = xgpio_irq_setup(np, chip);
+	/* Call the OF gpio helper to setup and register the GPIO device */
+	status = of_mm_gpiochip_add(np, &chip->mmchip);
 	if (status) {
 		kfree(chip);
-		pr_err("%s: GPIO IRQ initialization failed %d\n",
+		pr_err("%s: error in probe function with status %d\n",
 		       np->full_name, status);
 		return status;
 	}
 
-	/* Call the OF gpio helper to setup and register the GPIO device */
-	status = of_mm_gpiochip_add_data(np, &chip->mmchip, chip);
+	status = xgpio_irq_setup(np, chip);
+
 	if (status) {
-		pr_err("%pOF: error in probe function with status %d\n",
-		       np, status);
+		kfree(chip);
+		pr_err("%s: GPIO IRQ initialization failed %d\n",
+		       np->full_name, status);
 		return status;
 	}
 
-- 
2.17.1

--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux