All of lore.kernel.org
 help / color / mirror / Atom feed
From: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>,
	Kevin Hilman <khilman@linaro.org>,
	Tony Lindgren <tony@atomide.com>, Paul Walmsley <paul@pwsan.com>,
	Aaro Koskinen <aaro.koskinen@iki.fi>, Nishanth Menon <nm@ti.com>,
	linux-gpio@vger.kernel.org, linux-omap@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Subject: [PATCH 1/5] gpio: omap: convert to use irq_domain_add_simple()
Date: Sun,  6 Apr 2014 16:58:13 +0200	[thread overview]
Message-ID: <1396796297-13002-2-git-send-email-javier.martinez@collabora.co.uk> (raw)
In-Reply-To: <1396796297-13002-1-git-send-email-javier.martinez@collabora.co.uk>

The GPIO OMAP driver supports different OMAP SoC families and
not all of them have the needed support to use the linear IRQ
domain mapping like OMAP1 that use the legacy domain mapping.

But this special check is not necessary since the simple IRQ
domain mapping is able to handle both cases. Having a zero
IRQ offset will be interpreted as a linear domain case while
a non-zero value will be interpreted as a legacy domain case.

Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
---
 drivers/gpio/gpio-omap.c | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
index 19b886c..3ee9b8d 100644
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -1138,9 +1138,7 @@ static int omap_gpio_probe(struct platform_device *pdev)
 	const struct omap_gpio_platform_data *pdata;
 	struct resource *res;
 	struct gpio_bank *bank;
-#ifdef CONFIG_ARCH_OMAP1
-	int irq_base;
-#endif
+	int irq_base = 0;
 
 	match = of_match_device(of_match_ptr(omap_gpio_match), dev);
 
@@ -1185,21 +1183,16 @@ static int omap_gpio_probe(struct platform_device *pdev)
 #ifdef CONFIG_ARCH_OMAP1
 	/*
 	 * REVISIT: Once we have OMAP1 supporting SPARSE_IRQ, we can drop
-	 * irq_alloc_descs() and irq_domain_add_legacy() and just use a
-	 * linear IRQ domain mapping for all OMAP platforms.
+	 * irq_alloc_descs() since a base IRQ offset will no longer be needed.
 	 */
 	irq_base = irq_alloc_descs(-1, 0, bank->width, 0);
 	if (irq_base < 0) {
 		dev_err(dev, "Couldn't allocate IRQ numbers\n");
 		return -ENODEV;
 	}
-
-	bank->domain = irq_domain_add_legacy(node, bank->width, irq_base,
-					     0, &irq_domain_simple_ops, NULL);
-#else
-	bank->domain = irq_domain_add_linear(node, bank->width,
-					     &irq_domain_simple_ops, NULL);
 #endif
+	bank->domain = irq_domain_add_simple(node, bank->width, irq_base,
+					     &irq_domain_simple_ops, NULL);
 	if (!bank->domain) {
 		dev_err(dev, "Couldn't register an IRQ domain\n");
 		return -ENODEV;
-- 
1.9.0


WARNING: multiple messages have this Message-ID (diff)
From: javier.martinez@collabora.co.uk (Javier Martinez Canillas)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/5] gpio: omap: convert to use irq_domain_add_simple()
Date: Sun,  6 Apr 2014 16:58:13 +0200	[thread overview]
Message-ID: <1396796297-13002-2-git-send-email-javier.martinez@collabora.co.uk> (raw)
In-Reply-To: <1396796297-13002-1-git-send-email-javier.martinez@collabora.co.uk>

The GPIO OMAP driver supports different OMAP SoC families and
not all of them have the needed support to use the linear IRQ
domain mapping like OMAP1 that use the legacy domain mapping.

But this special check is not necessary since the simple IRQ
domain mapping is able to handle both cases. Having a zero
IRQ offset will be interpreted as a linear domain case while
a non-zero value will be interpreted as a legacy domain case.

Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
---
 drivers/gpio/gpio-omap.c | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
index 19b886c..3ee9b8d 100644
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -1138,9 +1138,7 @@ static int omap_gpio_probe(struct platform_device *pdev)
 	const struct omap_gpio_platform_data *pdata;
 	struct resource *res;
 	struct gpio_bank *bank;
-#ifdef CONFIG_ARCH_OMAP1
-	int irq_base;
-#endif
+	int irq_base = 0;
 
 	match = of_match_device(of_match_ptr(omap_gpio_match), dev);
 
@@ -1185,21 +1183,16 @@ static int omap_gpio_probe(struct platform_device *pdev)
 #ifdef CONFIG_ARCH_OMAP1
 	/*
 	 * REVISIT: Once we have OMAP1 supporting SPARSE_IRQ, we can drop
-	 * irq_alloc_descs() and irq_domain_add_legacy() and just use a
-	 * linear IRQ domain mapping for all OMAP platforms.
+	 * irq_alloc_descs() since a base IRQ offset will no longer be needed.
 	 */
 	irq_base = irq_alloc_descs(-1, 0, bank->width, 0);
 	if (irq_base < 0) {
 		dev_err(dev, "Couldn't allocate IRQ numbers\n");
 		return -ENODEV;
 	}
-
-	bank->domain = irq_domain_add_legacy(node, bank->width, irq_base,
-					     0, &irq_domain_simple_ops, NULL);
-#else
-	bank->domain = irq_domain_add_linear(node, bank->width,
-					     &irq_domain_simple_ops, NULL);
 #endif
+	bank->domain = irq_domain_add_simple(node, bank->width, irq_base,
+					     &irq_domain_simple_ops, NULL);
 	if (!bank->domain) {
 		dev_err(dev, "Couldn't register an IRQ domain\n");
 		return -ENODEV;
-- 
1.9.0

  reply	other threads:[~2014-04-06 14:58 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-06 14:58 [PATCH 0/5] GPIO OMAP driver changes for v3.16 Javier Martinez Canillas
2014-04-06 14:58 ` Javier Martinez Canillas
2014-04-06 14:58 ` Javier Martinez Canillas [this message]
2014-04-06 14:58   ` [PATCH 1/5] gpio: omap: convert to use irq_domain_add_simple() Javier Martinez Canillas
2014-04-10 17:35   ` Santosh Shilimkar
2014-04-10 17:35     ` Santosh Shilimkar
2014-04-06 14:58 ` [PATCH 2/5] gpio: omap: check gpiochip_add() return value Javier Martinez Canillas
2014-04-06 14:58   ` Javier Martinez Canillas
2014-04-10 17:36   ` Santosh Shilimkar
2014-04-10 17:36     ` Santosh Shilimkar
2014-04-06 14:58 ` [PATCH 3/5] gpio: omap: add a GPIO_OMAP option instead of using ARCH_OMAP Javier Martinez Canillas
2014-04-06 14:58   ` Javier Martinez Canillas
2014-04-10 17:37   ` Santosh Shilimkar
2014-04-10 17:37     ` Santosh Shilimkar
2014-04-06 14:58 ` [PATCH 4/5] gpio: omap: convert driver to use gpiolib irqchip Javier Martinez Canillas
2014-04-06 14:58   ` Javier Martinez Canillas
2014-04-10 17:39   ` Santosh Shilimkar
2014-04-10 17:39     ` Santosh Shilimkar
2014-04-10 17:45     ` Linus Walleij
2014-04-10 17:45       ` Linus Walleij
2014-04-10 18:58       ` Javier Martinez Canillas
2014-04-10 18:58         ` Javier Martinez Canillas
2014-04-06 14:58 ` [PATCH 5/5] MAINTAINERS: update GPIO OMAP driver entry Javier Martinez Canillas
2014-04-06 14:58   ` Javier Martinez Canillas
2014-04-10 17:29 ` [PATCH 0/5] GPIO OMAP driver changes for v3.16 Linus Walleij
2014-04-10 17:29   ` Linus Walleij
2014-04-10 19:30   ` Aaro Koskinen
2014-04-10 19:30     ` Aaro Koskinen
2014-04-10 20:17     ` Javier Martinez Canillas
2014-04-10 20:17       ` Javier Martinez Canillas
2014-04-10 21:22       ` Aaro Koskinen
2014-04-10 21:22         ` Aaro Koskinen
2014-04-11 15:03         ` Javier Martinez Canillas
2014-04-11 15:03           ` Javier Martinez Canillas
2014-04-22 13:00           ` Linus Walleij
2014-04-22 13:00             ` Linus Walleij
2014-04-23 21:48         ` Javier Martinez Canillas
2014-04-23 21:48           ` Javier Martinez Canillas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1396796297-13002-2-git-send-email-javier.martinez@collabora.co.uk \
    --to=javier.martinez@collabora.co.uk \
    --cc=aaro.koskinen@iki.fi \
    --cc=khilman@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=nm@ti.com \
    --cc=paul@pwsan.com \
    --cc=santosh.shilimkar@ti.com \
    --cc=tony@atomide.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.