Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752665AbdCDQcx (ORCPT ); Sat, 4 Mar 2017 11:32:53 -0500 Received: from mail-wm0-f42.google.com ([74.125.82.42]:34101 "EHLO mail-wm0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752493AbdCDQcG (ORCPT ); Sat, 4 Mar 2017 11:32:06 -0500 From: Bartosz Golaszewski To: Linus Walleij , Alexandre Courbot , Bamvor Jian Zhang , Grygorii Strashko , Santosh Shilimkar , Kevin Hilman , Robert Jarzmik Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, Thomas Gleixner , Marc Zyngier , Bartosz Golaszewski Subject: [PATCH 12/12] gpio: sta2x11: use resource management for irqs Date: Sat, 4 Mar 2017 17:23:40 +0100 Message-Id: <1488644620-11488-13-git-send-email-bgolaszewski@baylibre.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1488644620-11488-1-git-send-email-bgolaszewski@baylibre.com> References: <1488644620-11488-1-git-send-email-bgolaszewski@baylibre.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1829 Lines: 58 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 --- drivers/gpio/gpio-sta2x11.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/drivers/gpio/gpio-sta2x11.c b/drivers/gpio/gpio-sta2x11.c index 853ca23..39df062 100644 --- a/drivers/gpio/gpio-sta2x11.c +++ b/drivers/gpio/gpio-sta2x11.c @@ -392,7 +392,8 @@ static int gsta_probe(struct platform_device *dev) gsta_set_config(chip, i, gpio_pdata->pinconfig[i]); /* 384 was used in previous code: be compatible for other drivers */ - err = irq_alloc_descs(-1, 384, GSTA_NR_GPIO, NUMA_NO_NODE); + err = devm_irq_alloc_descs(&dev->dev, -1, 384, + GSTA_NR_GPIO, NUMA_NO_NODE); if (err < 0) { dev_warn(&dev->dev, "sta2x11 gpio: Can't get irq base (%i)\n", -err); @@ -401,29 +402,23 @@ static int gsta_probe(struct platform_device *dev) chip->irq_base = err; gsta_alloc_irq_chip(chip); - err = request_irq(pdev->irq, gsta_gpio_handler, - IRQF_SHARED, KBUILD_MODNAME, chip); + err = devm_request_irq(&dev->dev, pdev->irq, gsta_gpio_handler, + IRQF_SHARED, KBUILD_MODNAME, chip); if (err < 0) { dev_err(&dev->dev, "sta2x11 gpio: Can't request irq (%i)\n", -err); - goto err_free_descs; + return err; } err = devm_gpiochip_add_data(&dev->dev, &chip->gpio, chip); if (err < 0) { dev_err(&dev->dev, "sta2x11 gpio: Can't register (%i)\n", -err); - goto err_free_irq; + return err; } platform_set_drvdata(dev, chip); return 0; - -err_free_irq: - free_irq(pdev->irq, chip); -err_free_descs: - irq_free_descs(chip->irq_base, GSTA_NR_GPIO); - return err; } static struct platform_driver sta2x11_gpio_platform_driver = { -- 2.9.3