From patchwork Wed Aug 9 12:25:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 799758 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-gpio-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=bgdev-pl.20150623.gappssmtp.com header.i=@bgdev-pl.20150623.gappssmtp.com header.b="mJGmPlUQ"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3xS9TV6xJFz9s8V for ; Wed, 9 Aug 2017 22:25:34 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752920AbdHIMZc (ORCPT ); Wed, 9 Aug 2017 08:25:32 -0400 Received: from mail-wm0-f50.google.com ([74.125.82.50]:34212 "EHLO mail-wm0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752810AbdHIMZR (ORCPT ); Wed, 9 Aug 2017 08:25:17 -0400 Received: by mail-wm0-f50.google.com with SMTP id t138so13484858wmt.1 for ; Wed, 09 Aug 2017 05:25:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=tes5reW9LPU+FhHrqhqhfcVr+Ku/IVNgu4rQvtgPYEY=; b=mJGmPlUQ4mvKIjt5PKVBQw00K5oXySBYMxssQXXHCpevF917BCISSiz5HXw/KNiO2G qKnEZut26TyMvBb/0s8D8CAvlQ/B1/+DhzZb4OrOIXjRbuFeHem1FqEBBymbvy/QdC3q tZuPnLjzGlKzmSpq4dYVwLQOOOjG/h2FRegGaDp0PhZOgtYeHS6QyJc2cLGjjbFyPkHC JOvlKO/PVzb07IKIkm18oEnJaC0SaOgAmk4u0w5xs7qAo9VyBMYcuaL7bNqfmp6Ml4iK NoYd1na560p/r0596H8irD6JM1r8xsHcWDvdXJnra6CXulz+IkxMfAPpnxuhSVV66daV Yg2g== 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=tes5reW9LPU+FhHrqhqhfcVr+Ku/IVNgu4rQvtgPYEY=; b=aLmVkOHxPOej+FHg0sZsI1enFKN5nzJFBQNNOBRHtF2HNynG0MLQaPwTbGa4Vw1gNZ qkUJ9q5x87ux9m9ra1qCu3vyHqZJB60CICXNzTrnlPIdZEIYn3SoaXSSf5NGSEiOSrAs P5iLD9pYvtdl0mfz+bL1NhPLpleclizIG3K5kiLxhAAGHgQ/xLujqzxk/AipM9O0xg0e FTTUCYTmoW4n0WgxtEpjdiVGbQv92wOMCcqSEpKSzlG2gJys5cvvsygyYMX0qiID7vVW QqPH3yV9+XkvEpn/Y+14p98LJKIJJTBuSFLg7e2QEJHPVB7t0J6p1hjoncld8UZ3G9Af 2EJw== X-Gm-Message-State: AHYfb5gL+kRXr9dxD+Lzb2Fp22+rUxOdKk2vaxctP8JxImA4shBQvCbO KWTwb6jj3Lxey6O3 X-Received: by 10.28.6.79 with SMTP id 76mr4773509wmg.71.1502281516036; Wed, 09 Aug 2017 05:25:16 -0700 (PDT) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id p45sm5254729wrb.75.2017.08.09.05.25.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Aug 2017 05:25:15 -0700 (PDT) From: Bartosz Golaszewski To: Linus Walleij Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v2 7/8] gpio: mxc: use devres for irq generic chip Date: Wed, 9 Aug 2017 14:25:06 +0200 Message-Id: <20170809122507.11149-8-brgl@bgdev.pl> X-Mailer: git-send-email 2.13.2 In-Reply-To: <20170809122507.11149-1-brgl@bgdev.pl> References: <20170809122507.11149-1-brgl@bgdev.pl> Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Use resource managed variants of irq_alloc_generic_chip() and irq_setup_generic_chip(). Signed-off-by: Bartosz Golaszewski --- drivers/gpio/gpio-mxc.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c index a4d4a3527a24..78da5cbce056 100644 --- a/drivers/gpio/gpio-mxc.c +++ b/drivers/gpio/gpio-mxc.c @@ -66,6 +66,7 @@ struct mxc_gpio_port { int irq_high; struct irq_domain *domain; struct gpio_chip gc; + struct device *dev; u32 both_edges; }; @@ -344,9 +345,10 @@ static int mxc_gpio_init_gc(struct mxc_gpio_port *port, int irq_base) { struct irq_chip_generic *gc; struct irq_chip_type *ct; + int rv; - gc = irq_alloc_generic_chip("gpio-mxc", 1, irq_base, - port->base, handle_level_irq); + gc = devm_irq_alloc_generic_chip(port->dev, "gpio-mxc", 1, irq_base, + port->base, handle_level_irq); if (!gc) return -ENOMEM; gc->private = port; @@ -361,10 +363,11 @@ static int mxc_gpio_init_gc(struct mxc_gpio_port *port, int irq_base) ct->regs.ack = GPIO_ISR; ct->regs.mask = GPIO_IMR; - irq_setup_generic_chip(gc, IRQ_MSK(32), IRQ_GC_INIT_NESTED_LOCK, - IRQ_NOREQUEST, 0); + rv = devm_irq_setup_generic_chip(port->dev, gc, IRQ_MSK(32), + IRQ_GC_INIT_NESTED_LOCK, + IRQ_NOREQUEST, 0); - return 0; + return rv; } static void mxc_gpio_get_hw(struct platform_device *pdev) @@ -418,6 +421,8 @@ static int mxc_gpio_probe(struct platform_device *pdev) if (!port) return -ENOMEM; + port->dev = &pdev->dev; + iores = platform_get_resource(pdev, IORESOURCE_MEM, 0); port->base = devm_ioremap_resource(&pdev->dev, iores); if (IS_ERR(port->base))