From patchwork Sat Mar 4 16:23:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 9604123 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 53540602B4 for ; Sat, 4 Mar 2017 16:32:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 46C0426E1A for ; Sat, 4 Mar 2017 16:32:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3BA492833B; Sat, 4 Mar 2017 16:32:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D323426E1A for ; Sat, 4 Mar 2017 16:32:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752458AbdCDQcU (ORCPT ); Sat, 4 Mar 2017 11:32:20 -0500 Received: from mail-wm0-f47.google.com ([74.125.82.47]:38445 "EHLO mail-wm0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752386AbdCDQcS (ORCPT ); Sat, 4 Mar 2017 11:32:18 -0500 Received: by mail-wm0-f47.google.com with SMTP id t193so35698115wmt.1 for ; Sat, 04 Mar 2017 08:32:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=NwrZJrGpraB+uzM6pGhfGVo6PYGFoCdC8SPIH8A15Hc=; b=b7BvdeZ04I9aHbhsOh++4ZNrfEDIY6dG/OGXApEeVxmR17HqisvgWa/zKwS6Wugtcm TI+w8Ho+2HmRgA+25GoSB8o3oDnUFEU6RMUt0/Yr1kWjsOzhEgKmDHPzNnvhji12RqWn qKEiJgYJviTYQE89sOctLlqFVdKVVyQmL+uVdEbRMSzla+H1NvzZ0JaUVWBKj7LC7SGn SiabtlqEALBaiHCXa/r6bHm2RLZqyopiljPt5F9+ujK5n9ZbzzZYKeQofFS9K9vh+bOt UWnjRpcBX0kqOnwqDjf3KqzrQL+MJ/mz+VJU/J1iwjIOpsFc1LZfKZts3054yYiEOfJj q8aw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=NwrZJrGpraB+uzM6pGhfGVo6PYGFoCdC8SPIH8A15Hc=; b=UoVDrB5o05TQGTek2LR1cZQiGUCg22FXypr+J3udBVmFUqSV7gXiyLZ4B6+VdUi/PJ qFmdl7vss9b5JD0MIrVEk+k23DybC4tm0sl/bxCs6oyMn5d/B8C12GMXXL2vBvl2+kji N79fbShDAT0LYcoxB4AXpo1OqAdsZvn5NiWA9KaVdbu/JdQNfFgY8g7Df4cd244DpC8N 9gnRpNe8vAUl/NOhCmr2BNi/9yu7a5w3hnZ3FVroWDF8Wr8TtEQuHACZrv831SpEvdVB 9WUdZhbRy8SBmsc3vtl324OTzSK1+OGa0sHmFllYUTvNjH8x61oyfGKyEsOwnYBR0VCm OUVw== X-Gm-Message-State: AMke39kBSr18Jtn727RVRSP0DvkFQC9vOy5uBMo2AOxt0DtCFwX9zacKqXuGpKngmA33pcZj X-Received: by 10.28.217.136 with SMTP id q130mr6665738wmg.132.1488644658017; Sat, 04 Mar 2017 08:24:18 -0800 (PST) Received: from bgdev-debian.lan (jua06-1-82-242-157-225.fbx.proxad.net. [82.242.157.225]) by smtp.gmail.com with ESMTPSA id b17sm7545753wma.33.2017.03.04.08.24.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 04 Mar 2017 08:24:17 -0800 (PST) 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-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 = {