From patchwork Fri Aug 9 14:19:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 170929 Delivered-To: patch@linaro.org Received: by 2002:ac9:2daa:0:0:0:0:0 with SMTP id g42csp9553740oce; Fri, 9 Aug 2019 07:19:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqxmKf8qiROb0TXN4TWzop2YbgyMOF2WLFGZxeBQrOEtyZ0pUg3yIlfxUP4eyOxNO1/vrjbt X-Received: by 2002:a17:90a:30e4:: with SMTP id h91mr9358603pjb.37.1565360363169; Fri, 09 Aug 2019 07:19:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565360363; cv=none; d=google.com; s=arc-20160816; b=aSYMQVNkwjE6ZdAJfQD84oSNzxtmkdL/6hAZ1N38OQjQnJoKH+460Ke79vXJ1ZstJw L8RJqWrUpfImB7VT28NmrkTYo9dwAcJeUym0jLwckpSJsgdqJWVejXKziPltVNEDQXBN m2YNrnJPgwJQRl5UQ+AhsBlIzKx0Q7N/oUQxAZVlmqvUBPcSusZ23g/YirAKPzI1YmOe yOoJVdvXNjpYytpP7WzhmIJgqqyisWm2abSaAZUjR1oaDIz/Adn+/bl0+jvxLKLds6rb R/U4P/x/Jwd0DK0sHp4KHOWQRmkwfF5dyFsSCl2fK0qQziHDO9n3YTjzTqZ+hYakkHIT ze/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=aFP4PggmTnA76WxebWrxZeo52ZgN+d3Rg6ECCeeNQTw=; b=OW7LTXBV1owXdmHve5zSIw0VSCWX+tvns6rYcax1oBf2GXiv4hK3KWvm42CIDiDGwi rHjOicRnjk68Ij62e0Wns+1M/Ec6EMeNF2Jp2vrKa6kF20DUxMJCqNX5fBgU/SS79OG4 nFaZFhRS3SSFx4r13U3wesBde9gyWzF9VfOs6s9ru20fg8kf8R6R7PIsZfo++cQQ8BiO kDX7+60xqxoDyoHOz4vdHxL5sJh7CRtYJjk58/H9Tvot5qaQbVS4lyuItt29e/fqgZn9 MxjG7n2CY0Q50mdy4wOWAmOjpit/E+3AOXJUcnRm9I8ByEbOI9WItgqKLre5+WCkui+s HFMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AmeOH44d; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z21si53536029pgu.376.2019.08.09.07.19.22; Fri, 09 Aug 2019 07:19:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AmeOH44d; spf=pass (google.com: best guess record for domain of linux-gpio-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406871AbfHIOTW (ORCPT + 5 others); Fri, 9 Aug 2019 10:19:22 -0400 Received: from mail-lj1-f195.google.com ([209.85.208.195]:43400 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726232AbfHIOTW (ORCPT ); Fri, 9 Aug 2019 10:19:22 -0400 Received: by mail-lj1-f195.google.com with SMTP id y17so67699869ljk.10 for ; Fri, 09 Aug 2019 07:19:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=aFP4PggmTnA76WxebWrxZeo52ZgN+d3Rg6ECCeeNQTw=; b=AmeOH44d9zaQIoh4t7SQaqj5WAnEzreTtf/lAQSJHCswVeKqdzmz/2rj5lnDg8nHqe upuurrM+99+woP4LSyayLMU+/AHrmUkBCQlIeTd1NthyZtjE81avVZuzjFkz/tY7AMYU 2on2mLtT3Gvd/hl4CgfiYxr2DbqBeSxWKejJxTtOcunU3kFYZEcMSaQa5bifcM0snrMU fl87VUJaEYtBTu9q2evT9HLDgMqis7RPIQvuzpPObSoP+M92+XG+pBs0f1Pp0OGlcIPo TtVScQc19rYK0Q8QQFBEO9NEjUSVtKiPj08ZbPSNF8hIqPTov1RVQV3UVmEEMDlp6W6q vTEw== 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:mime-version :content-transfer-encoding; bh=aFP4PggmTnA76WxebWrxZeo52ZgN+d3Rg6ECCeeNQTw=; b=IVylP9IpFHVEGB+gosftH7Rm10V+7EEuXhrDbHI4swJRtX2wVblSzSXyXcgojoLe6U yq8K/gcpgKCcnCJjMraitAV/KWBlMp4H3Ryf/SSbG+AIV8QvjMVHw7cIEgQ9nx6OLiPY 7x4U52zZHQOvB2PxhDaiI8nfmhS8GtXf+PvuPN+YalqniITZcoAch6UNy9vAI9Brapje /c3A2GlYfFAIydvbrbfo8VZH4Ycsi5I2xzhKvwMOTy38+P1qca2TyQeBnUkUIGRqZ7io fCAeB9BboALre68vGB58b5Kuxa4/Xl8XaJQFc/Qvl9o3gEb281+LTGuE9jzLQQHIf6f/ XguA== X-Gm-Message-State: APjAAAXniRXT6NPFzJAg32P7zWH79qAL2fvi8+HG3TWDr5Q83Ygbe6c6 qnNa0SC6AkJgjuOSDoh7EjIjzl+sF8Q= X-Received: by 2002:a2e:8650:: with SMTP id i16mr11615763ljj.178.1565360360156; Fri, 09 Aug 2019 07:19:20 -0700 (PDT) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id l25sm19110785lja.76.2019.08.09.07.19.18 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 09 Aug 2019 07:19:19 -0700 (PDT) From: Linus Walleij To: linux-gpio@vger.kernel.org Cc: Bartosz Golaszewski , Linus Walleij , Andrey Smirnov , Andrew Lunn , Dong Aisheng , Stefan Agner , Thierry Reding Subject: [PATCH] gpio: vf610: Pass irqchip when adding gpiochip Date: Fri, 9 Aug 2019 16:19:16 +0200 Message-Id: <20190809141916.20999-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org We need to convert all old gpio irqchips to pass the irqchip setup along when adding the gpio_chip. For more info see drivers/gpio/TODO. For chained irqchips this is a pretty straight-forward conversion. Cc: Andrey Smirnov Cc: Andrew Lunn Cc: Dong Aisheng Cc: Stefan Agner Cc: Thierry Reding Signed-off-by: Linus Walleij --- drivers/gpio/gpio-vf610.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) -- 2.21.0 diff --git a/drivers/gpio/gpio-vf610.c b/drivers/gpio/gpio-vf610.c index 7ba668db171b..58776f2d69ff 100644 --- a/drivers/gpio/gpio-vf610.c +++ b/drivers/gpio/gpio-vf610.c @@ -243,6 +243,7 @@ static int vf610_gpio_probe(struct platform_device *pdev) struct device_node *np = dev->of_node; struct vf610_gpio_port *port; struct gpio_chip *gc; + struct gpio_irq_chip *girq; struct irq_chip *ic; int i; int ret; @@ -318,10 +319,6 @@ static int vf610_gpio_probe(struct platform_device *pdev) ic->irq_set_type = vf610_gpio_irq_set_type; ic->irq_set_wake = vf610_gpio_irq_set_wake; - ret = devm_gpiochip_add_data(dev, gc, port); - if (ret < 0) - return ret; - /* Mask all GPIO interrupts */ for (i = 0; i < gc->ngpio; i++) vf610_gpio_writel(0, port->base + PORT_PCR(i)); @@ -329,15 +326,20 @@ static int vf610_gpio_probe(struct platform_device *pdev) /* Clear the interrupt status register for all GPIO's */ vf610_gpio_writel(~0, port->base + PORT_ISFR); - ret = gpiochip_irqchip_add(gc, ic, 0, handle_edge_irq, IRQ_TYPE_NONE); - if (ret) { - dev_err(dev, "failed to add irqchip\n"); - return ret; - } - gpiochip_set_chained_irqchip(gc, ic, port->irq, - vf610_gpio_irq_handler); + girq = &gc->irq; + girq->chip = ic; + girq->parent_handler = vf610_gpio_irq_handler; + girq->num_parents = 1; + girq->parents = devm_kcalloc(&pdev->dev, 1, + sizeof(*girq->parents), + GFP_KERNEL); + if (!girq->parents) + return -ENOMEM; + girq->parents[0] = port->irq; + girq->default_type = IRQ_TYPE_NONE; + girq->handler = handle_edge_irq; - return 0; + return devm_gpiochip_add_data(dev, gc, port); } static struct platform_driver vf610_gpio_driver = {