Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5841769yba; Thu, 11 Apr 2019 06:56:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqySflVaCMBJFhjlIi99wjTmIHsoumGVVcHD9Kt+l6KFtQZUkJFOnQ0yBm5Pfb8q53XqXXTR X-Received: by 2002:a17:902:7893:: with SMTP id q19mr50161304pll.154.1554991002064; Thu, 11 Apr 2019 06:56:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554991002; cv=none; d=google.com; s=arc-20160816; b=vgHaTWOXmBb5Plm/J5VLYq12W64zp0Z1T+tmvesVm3n+6cku6QxlcA/Ipu5Du/B1uP orvcKvwSI7VUJeEZncVAND/3IXu+OYwF+hfuz++Tq9mf0dnAAzUMEdW7J2Sip8CwkMoV WZicwkUVZ4HrHcGFwYsiGOzoG7MGZpE7yCXj3dketMp04lS/PvSLL1ZBGeg6Wwkquf7V Shkg4tl5pbos5mYbiqnrKGFELNZlTdcX/kYK0M/qzgy9uLN29TLxyJxbYf62W9wJiYoa 4cleVgBZL6PwiIW3G5YQW6AtNaPgAAVJXJfdggiOi9/XbCIYOXvpLCRq+aCE9isUcGod yiBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=gWJE0acpGwCNlnQao7yAz7CWnogAQtDzoJbsb4F8LAE=; b=FAWXSkMXdWdl56XqFyeV7QJk4WVw6/+vRGygpjOjcbR073LhXVmIF1NodMVFCTHJwX kM8abh7Gj1FGLxPb+JKibHjXLxTdnCVltNTftny8d9cd97lOuVL4+VZuAqIado0+3Y5f GOCvv4OvaPzKOyfkCOOe57SbKj5b/bYOrNi5WEo8dZMLZi3xlEi5s+AhzDfnDQQu35DA DL5AkKMd7zpikqEkgHndeUmcpjYUBumKE6neSE8LmSbPQ0/zTo5UkrtyaZKoC5VxCI7K Sv0Mow5/n8G57bYe1rfWYm+Q9qieaHFYWMH+Y1UQO4WYTns6yQVqjzv1i85/B+rRVAZe rKjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UinkXU36; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 s34si34857687pgl.97.2019.04.11.06.56.24; Thu, 11 Apr 2019 06:56:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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=UinkXU36; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 S1726767AbfDKNzn (ORCPT + 99 others); Thu, 11 Apr 2019 09:55:43 -0400 Received: from mail-lf1-f68.google.com ([209.85.167.68]:38425 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726106AbfDKNzm (ORCPT ); Thu, 11 Apr 2019 09:55:42 -0400 Received: by mail-lf1-f68.google.com with SMTP id u24so4787734lfg.5 for ; Thu, 11 Apr 2019 06:55:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=gWJE0acpGwCNlnQao7yAz7CWnogAQtDzoJbsb4F8LAE=; b=UinkXU36OFHFvpDJR1xQfcXAi8hSC2HPXHm33rhGGB3rSliW7UZbWw8guKGI4+F7bz f5MpBlxqdaa4SrKr8Hu+vkOUcfzQNpv6HkHaBjeRDulKNiC919/g8PRzuYCVN663P7Z2 C7bGTbEnkoZ2KFYoh6gp9gRar1zW29BWOZKYn7Rj/pgGeVdhr0OYuYNiwCvtZP4k2XlY zC3zVmReKrUK/YzolSZb0JEjkq23yRm/w4ACZZ7qbc6ouiWRHCmEZbNs3CB3Wiv1EWRy XmXqzitwPZKbluVefK2TtDVOC9WFOp9qwKTyCH5XDIf6ppBI8jRpjMgZy9hsn8RKXpZp wieQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=gWJE0acpGwCNlnQao7yAz7CWnogAQtDzoJbsb4F8LAE=; b=cI4SjOvEm1RPaDInrnuslqFDK9YMxH+FViHieWeFUhbhP7gJ7JKXR+IpZHBoAIuyZU ZFYjVkJw6yK2Wd8Btmvg4jfAB+fjwP32j1PXRzYwb2kv4o8VnJHGXb/1HphatCNaFzYS MmogSfcJQJcD5MzrQG+/I0WJEg6COLUu4dHyjluNv2IZ9BfuvQ9qxTvybhzq3+1/qMsw 2n7JUPRZtekpM9GJyRLxW3pg8jE3OQ7mOQVNgSIst5of/ifmc7swl1BFB4pzx0GqAt+b EIbICcMc/LX02p0YeQNj30bMRW6clqfwk1wXN1PZDsqurWM7QQqP4YBURs3/y4JSAu/i Iu3A== X-Gm-Message-State: APjAAAVw4NU5iin36dqn+UUW//viCwj8z1tPaWe6/cCK498hsNSj5ujd d/g/R5RzadMrTDp9GZtL0H0xlCLvMDqCAOuhzSwfwA== X-Received: by 2002:a05:6512:c8:: with SMTP id c8mr8767800lfp.138.1554990940861; Thu, 11 Apr 2019 06:55:40 -0700 (PDT) MIME-Version: 1.0 References: <20190410103926.8781-1-alexandre.belloni@bootlin.com> <20190410103926.8781-3-alexandre.belloni@bootlin.com> In-Reply-To: <20190410103926.8781-3-alexandre.belloni@bootlin.com> From: Linus Walleij Date: Thu, 11 Apr 2019 15:55:29 +0200 Message-ID: Subject: Re: [PATCH 2/3] gpio: lpc32xx: enable interrupt lookup for port 3 To: Alexandre Belloni Cc: Bartosz Golaszewski , Vladimir Zapolskiy , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , "open list:GPIO SUBSYSTEM" , Linux ARM , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 10, 2019 at 12:39 PM Alexandre Belloni wrote: > Interrupt support was disabled "temporarily" in commit 320a6480ef24 ("gpio: > lpc32xx: disable broken to_irq support"). > > Reenable to_irq for port 3 as they are directly connected to an interrupt > controller and a simple lookup is working. > > Signed-off-by: Alexandre Belloni Unfortunately this seems to be one of these hacks for hierarchical interrupts that does not quite cut it. > +static int lpc32xx_gpio_to_irq_p3(struct gpio_chip *chip, unsigned int offset) > + return of_irq_get_byname(chip->of_node, chip->names[offset]); This works as long as consuming drivers pick a GPIO first using gpiod_get() (and variants) and then convert it to an IRQ using gpiod_to_irq(). But it doesn't work when some consumer is just picking an IRQ off of the node without picking the GPIO first. And in DT that is OK, this DT node is definately an interrupt controller. (Leaving out the attribute for interrupt controller as is currently the case doesn't really fix the issue, it is just inconsistent.) Look at Brian Masney's series for the qualcomm pin controller chips for inspiration on how to do things right, see: commit 9d2b563bc23acfa93e7716b3396fd2f79fa8f0cd and down. Also: https://marc.info/?l=linux-gpio&m=154959228527643&w=2 Especially note how he removes the kind of hack you are adding in e.g. commit a796fab2c605d6340512c51c6c3fa1c581357993 Yours, Linus Walleij