From patchwork Sat Mar 4 16:23:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 9604121 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 D9003602B4 for ; Sat, 4 Mar 2017 16:32:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CC8CA26E1A for ; Sat, 4 Mar 2017 16:32:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C165F27F81; Sat, 4 Mar 2017 16:32:20 +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 6E0A826E1A for ; Sat, 4 Mar 2017 16:32:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752391AbdCDQcS (ORCPT ); Sat, 4 Mar 2017 11:32:18 -0500 Received: from mail-wm0-f41.google.com ([74.125.82.41]:36617 "EHLO mail-wm0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752388AbdCDQcQ (ORCPT ); Sat, 4 Mar 2017 11:32:16 -0500 Received: by mail-wm0-f41.google.com with SMTP id n11so35551004wma.1 for ; Sat, 04 Mar 2017 08:32:15 -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=JCnbNDrOlgjHXShZebD4qIF/fpVNmTh+VLhrh8wmoi0=; b=zcd+Ds0X7+3JmvzQ6jxLJNJQbgfootTqS1YHU+BKF4jLcd3wjtieRTWBk/IKv0129a D0EmP19QyEok7m3iyKTmxn5Ge25Gu+An3O8upcjSuX6IQIrXDFxvDfAoL5AExnTHdPgE mLewQVJOCAyEuvYus/wwxTSh+vANbOkpTKzhWzrhUO+ET1Qzy3fLAxTUk84ANn78bflT KgLKQXKLXyeLqCVr0WHQzgsHQjno0cVf50Jm7W3sXEucgk6Sjgzs7Csg0y3kyKMrheuo 3IR5jWRjPkREIcfY9fIEBvI55Mwq8tOy04wkjWslKgUz1WAY5eiz/xJFuIhZHI9Y/EuB dj7Q== 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=JCnbNDrOlgjHXShZebD4qIF/fpVNmTh+VLhrh8wmoi0=; b=NNHF3HPTqd6eVI8SMUHEy4073zwZupneRM2O5XiAYQurAEqy8T/3yrLVWaKYsffZy/ I40OHSZSSnNlmmQ0wu3K1P0e6sT2pNG7F8NYYir83l9aKROUB8RRR4UyH3Q4ebb19ovz YyxHj/Zxf3z0J3Po3ZE59Yg4N6zlGgbV15AuiPJPff0n2KmD/ZlNuZdjZe0NqYQ1WnVx 2XSrLn3NYfPHqDp/3rjbPrR9De+C+qdJi3ohcbnmDxkuVxHVL6RIkSafu2eLgbSlxp8w Tu1Polx2qBXFc9XyVk3YtArFCoW4XVut8THLTiKAuB3KH8+J8BXGyBG4Sxe5kqb+Qveq J8LA== X-Gm-Message-State: AMke39mYAj/5RJSCMxde04M7eR8f2aCvZySlXiKhx/gORwB4f/lQuwms4hqmiiWD0kpK68Af X-Received: by 10.28.226.215 with SMTP id z206mr6720875wmg.92.1488644645816; Sat, 04 Mar 2017 08:24:05 -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.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 04 Mar 2017 08:24:05 -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 04/12] gpio: pch: use resource management for irqs Date: Sat, 4 Mar 2017 17:23:32 +0100 Message-Id: <1488644620-11488-5-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-pch.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/gpio/gpio-pch.c b/drivers/gpio/gpio-pch.c index 7c7135d..71bc6da 100644 --- a/drivers/gpio/gpio-pch.c +++ b/drivers/gpio/gpio-pch.c @@ -403,7 +403,8 @@ static int pch_gpio_probe(struct pci_dev *pdev, goto err_gpiochip_add; } - irq_base = irq_alloc_descs(-1, 0, gpio_pins[chip->ioh], NUMA_NO_NODE); + irq_base = devm_irq_alloc_descs(&pdev->dev, -1, 0, + gpio_pins[chip->ioh], NUMA_NO_NODE); if (irq_base < 0) { dev_warn(&pdev->dev, "PCH gpio: Failed to get IRQ base num\n"); chip->irq_base = -1; @@ -416,8 +417,8 @@ static int pch_gpio_probe(struct pci_dev *pdev, iowrite32(msk, &chip->reg->imask); iowrite32(msk, &chip->reg->ien); - ret = request_irq(pdev->irq, pch_gpio_handler, - IRQF_SHARED, KBUILD_MODNAME, chip); + ret = devm_request_irq(&pdev->dev, pdev->irq, pch_gpio_handler, + IRQF_SHARED, KBUILD_MODNAME, chip); if (ret != 0) { dev_err(&pdev->dev, "%s request_irq failed\n", __func__); @@ -430,7 +431,6 @@ static int pch_gpio_probe(struct pci_dev *pdev, return 0; err_request_irq: - irq_free_descs(irq_base, gpio_pins[chip->ioh]); gpiochip_remove(&chip->gpio); err_gpiochip_add: @@ -452,12 +452,6 @@ static void pch_gpio_remove(struct pci_dev *pdev) { struct pch_gpio *chip = pci_get_drvdata(pdev); - if (chip->irq_base != -1) { - free_irq(pdev->irq, chip); - - irq_free_descs(chip->irq_base, gpio_pins[chip->ioh]); - } - gpiochip_remove(&chip->gpio); pci_iounmap(pdev, chip->base); pci_release_regions(pdev);