linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
To: Linus Walleij <linus.walleij@linaro.org>,
	Alexandre Courbot <gnurou@gmail.com>,
	Bamvor Jian Zhang <bamvor.zhangjian@linaro.org>,
	Grygorii Strashko <grygorii.strashko@ti.com>,
	Santosh Shilimkar <ssantosh@kernel.org>,
	Kevin Hilman <khilman@kernel.org>,
	Robert Jarzmik <robert.jarzmik@free.fr>
Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-omap@vger.kernel.org, Thomas Gleixner <tglx@linutronix.de>,
	Marc Zyngier <marc.zyngier@arm.com>,
	Bartosz Golaszewski <bgolaszewski@baylibre.com>
Subject: [PATCH 09/12] gpio: sodaville: use resource management for irqs
Date: Sat,  4 Mar 2017 17:23:37 +0100	[thread overview]
Message-ID: <1488644620-11488-10-git-send-email-bgolaszewski@baylibre.com> (raw)
In-Reply-To: <1488644620-11488-1-git-send-email-bgolaszewski@baylibre.com>

Use device resource managed variants of irq_alloc_descs() and
request_irq() and remove the code manually freeing irq resources.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
 drivers/gpio/gpio-sodaville.c | 28 +++++++++++-----------------
 1 file changed, 11 insertions(+), 17 deletions(-)

diff --git a/drivers/gpio/gpio-sodaville.c b/drivers/gpio/gpio-sodaville.c
index 7da9e6c..f60da83 100644
--- a/drivers/gpio/gpio-sodaville.c
+++ b/drivers/gpio/gpio-sodaville.c
@@ -135,7 +135,8 @@ static int sdv_register_irqsupport(struct sdv_gpio_chip_data *sd,
 	struct irq_chip_type *ct;
 	int ret;
 
-	sd->irq_base = irq_alloc_descs(-1, 0, SDV_NUM_PUB_GPIOS, -1);
+	sd->irq_base = devm_irq_alloc_descs(&pdev->dev, -1, 0,
+					    SDV_NUM_PUB_GPIOS, -1);
 	if (sd->irq_base < 0)
 		return sd->irq_base;
 
@@ -143,10 +144,11 @@ static int sdv_register_irqsupport(struct sdv_gpio_chip_data *sd,
 	writel(0, sd->gpio_pub_base + GPIO_INT);
 	writel((1 << 11) - 1, sd->gpio_pub_base + GPSTR);
 
-	ret = request_irq(pdev->irq, sdv_gpio_pub_irq_handler, IRQF_SHARED,
-			"sdv_gpio", sd);
+	ret = devm_request_irq(&pdev->dev, pdev->irq,
+			       sdv_gpio_pub_irq_handler, IRQF_SHARED,
+			       "sdv_gpio", sd);
 	if (ret)
-		goto out_free_desc;
+		return ret;
 
 	/*
 	 * This gpio irq controller latches level irqs. Testing shows that if
@@ -155,10 +157,8 @@ static int sdv_register_irqsupport(struct sdv_gpio_chip_data *sd,
 	 */
 	sd->gc = irq_alloc_generic_chip("sdv-gpio", 1, sd->irq_base,
 			sd->gpio_pub_base, handle_fasteoi_irq);
-	if (!sd->gc) {
-		ret = -ENOMEM;
-		goto out_free_irq;
-	}
+	if (!sd->gc)
+		return -ENOMEM;
 
 	sd->gc->private = sd;
 	ct = sd->gc->chip_types;
@@ -176,16 +176,10 @@ static int sdv_register_irqsupport(struct sdv_gpio_chip_data *sd,
 
 	sd->id = irq_domain_add_legacy(pdev->dev.of_node, SDV_NUM_PUB_GPIOS,
 				sd->irq_base, 0, &irq_domain_sdv_ops, sd);
-	if (!sd->id) {
-		ret = -ENODEV;
-		goto out_free_irq;
-	}
+	if (!sd->id)
+		return -ENODEV;
+
 	return 0;
-out_free_irq:
-	free_irq(pdev->irq, sd);
-out_free_desc:
-	irq_free_descs(sd->irq_base, SDV_NUM_PUB_GPIOS);
-	return ret;
 }
 
 static int sdv_gpio_probe(struct pci_dev *pdev,
-- 
2.9.3

  parent reply	other threads:[~2017-03-04 16:23 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-04 16:23 [PATCH 00/12] gpio: use resource management for irq descriptors Bartosz Golaszewski
2017-03-04 16:23 ` [PATCH 01/12] gpio: mockup: use devm_irq_alloc_descs() Bartosz Golaszewski
2017-03-08  8:21   ` Bamvor Zhang Jian
2017-03-14 15:08   ` Linus Walleij
2017-03-04 16:23 ` [PATCH 02/12] gpio: twl4030: " Bartosz Golaszewski
2017-03-14 15:08   ` Linus Walleij
2017-03-04 16:23 ` [PATCH 03/12] gpio: omap: " Bartosz Golaszewski
2017-03-06 16:50   ` Tony Lindgren
2017-03-14 15:09   ` Linus Walleij
2017-03-04 16:23 ` [PATCH 04/12] gpio: pch: use resource management for irqs Bartosz Golaszewski
2017-03-14 15:10   ` Linus Walleij
2017-03-04 16:23 ` [PATCH 05/12] gpio: ml-ioh: " Bartosz Golaszewski
2017-03-14 15:11   ` Linus Walleij
2017-03-04 16:23 ` [PATCH 06/12] gpio: xlp: " Bartosz Golaszewski
2017-03-14 15:11   ` Linus Walleij
2017-03-04 16:23 ` [PATCH 07/12] gpio: pxa: use devm_irq_alloc_descs() Bartosz Golaszewski
2017-03-04 20:31   ` Robert Jarzmik
2017-03-14 15:12   ` Linus Walleij
2017-03-04 16:23 ` [PATCH 08/12] gpio: davinci: " Bartosz Golaszewski
2017-03-06  4:59   ` Keerthy
2017-03-14 15:13   ` Linus Walleij
2017-03-04 16:23 ` Bartosz Golaszewski [this message]
2017-03-14 15:14   ` [PATCH 09/12] gpio: sodaville: use resource management for irqs Linus Walleij
2017-03-04 16:23 ` [PATCH 10/12] gpio: mxc: use devm_irq_alloc_descs() Bartosz Golaszewski
2017-03-14 15:15   ` Linus Walleij
2017-03-04 16:23 ` [PATCH 11/12] gpio: mxs: " Bartosz Golaszewski
2017-03-14 15:16   ` Linus Walleij
2017-03-04 16:23 ` [PATCH 12/12] gpio: sta2x11: use resource management for irqs Bartosz Golaszewski
2017-03-14 15:16   ` Linus Walleij
2017-03-14 15:18 ` [PATCH 00/12] gpio: use resource management for irq descriptors Linus Walleij
2017-03-14 15:45   ` Bartosz Golaszewski

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=1488644620-11488-10-git-send-email-bgolaszewski@baylibre.com \
    --to=bgolaszewski@baylibre.com \
    --cc=bamvor.zhangjian@linaro.org \
    --cc=gnurou@gmail.com \
    --cc=grygorii.strashko@ti.com \
    --cc=khilman@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=marc.zyngier@arm.com \
    --cc=robert.jarzmik@free.fr \
    --cc=ssantosh@kernel.org \
    --cc=tglx@linutronix.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).