Skip to contentSkip to conversation

gpio: tegra: Use platform_irq_count()

PATCH In review Thierry Reding 3 participants 5 messages Jul 20, 2017 – Aug 2, 2017 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 gpio: tegra: Use platform_irq_count()

From: Thierry Reding <[email protected]>

Use platform_irq_count() instead of open-coding the same code sequence.

---
 drivers/gpio/gpio-tegra.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/gpio/gpio-tegra.c +6 -7
index 88529d3c06c9..cdbff018a0f4 100644
@@ -588,13 +588,12 @@ static int tegra_gpio_probe(struct platform_device *pdev)
 	tgi->soc = config;
 	tgi->dev = &pdev->dev;
 
-	for (;;) {
-		res = platform_get_resource(pdev, IORESOURCE_IRQ,
-					    tgi->bank_count);
-		if (!res)
-			break;
-		tgi->bank_count++;
-	}
+	ret = platform_irq_count(pdev);
+	if (ret < 0)
+		return ret;
+
+	tgi->bank_count = ret;
+
 	if (!tgi->bank_count) {
 		dev_err(&pdev->dev, "Missing IRQ resource\n");
 		return -ENODEV;
Signature · 1 line
2.13.3
#2 lore raw

PATCH 2/2 gpio: tegra: Use platform_get_irq()

In reply to a message not in the archive

From: Thierry Reding <[email protected]>

Instead of using platform_get_resource() and getting the interrupts from the resource, use platform_get_irq() which is slightly easier to use and covers some special cases that the former doesn't.

---
 drivers/gpio/gpio-tegra.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpio/gpio-tegra.c +5 -5
index cdbff018a0f4..17725c83821f 100644
@@ -640,15 +640,15 @@ static int tegra_gpio_probe(struct platform_device *pdev)
 		return -ENODEV;
 
 	for (i = 0; i < tgi->bank_count; i++) {
-		res = platform_get_resource(pdev, IORESOURCE_IRQ, i);
-		if (!res) {
-			dev_err(&pdev->dev, "Missing IRQ resource\n");
-			return -ENODEV;
+		ret = platform_get_irq(pdev, i);
+		if (ret < 0) {
+			dev_err(&pdev->dev, "Missing IRQ resource: %d\n", ret);
+			return ret;
 		}
 
 		bank = &tgi->bank_info[i];
 		bank->bank = i;
-		bank->irq = res->start;
+		bank->irq = ret;
 		bank->tgi = tgi;
 	}
 
Signature · 1 line
2.13.3