Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp609268pxj; Wed, 2 Jun 2021 07:12:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyxdjnQJJl5iF7Wv6P0vnV056/5g8ROLbfeW3fn6OqbRYPVq9GUY4JRvdt/XFhrrQH3yMC0 X-Received: by 2002:a17:906:2896:: with SMTP id o22mr33815498ejd.524.1622643153801; Wed, 02 Jun 2021 07:12:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622643153; cv=none; d=google.com; s=arc-20160816; b=lyPj+UvByzMcnZWFcV8tIprfVclxgS336/07d7eFbNSgVGRZuQiZKO6Q9vwmhIG8GK fZl4FrrbheQCoLdcLr2356Y9L+KgfuK+4BVoyaMN3Yq3MC56FKbQJnTL9737zRv4gwke i4NEnvNBIzXXDbR+b84WZqK1vBByf+yecHffXGMiHeVb5A1PIpyLmyTAjPIp9nzfe9tw 3nAg6Cx/ifEM4QDtZfhTh8rEiA+zK+tHlpph/H9E8sG5pg4dsq7Lxie6QSuIag11rN2S tptIYrgBuzCXwkuLkfdfGvbN3Gev978ef7wIqrpyCuuCXB6blegQ1REN3opFLDoi0xcd 5k8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=KdxBgrkTHaGnbv5FNkwfi4kgcv5bVNJ5V1Q55kmGe4Q=; b=DBmo8cMOl2/mxFo3aGPw4K6+otlKgsdmQzbSE4wSlEwmuj2DIXe4SMggYzWyPf4h8P g0G84STWq9yE/eErSND3WquVxxNZAgViziTKcnpJOrIy/HBWyPj74cU7zLbbiLl8IHTZ 2NWUhXuYKQowpmYyO/vK0NdKy0EGPLT/aeuDFLNvqdT/fP9Ij5nO4mKS3NN5+O82zeJ1 5wei/gvhQXmB2PxVYYHpFYaCB+sni0kj3WICO7oZWJOjr9PCTmHNpDDppjTv/yR85KqK wMC/EppxTBv7Wq8bD54uN0vZwwR09zpvPXvwvhGJhI0kmsoE+XnKJkG+KT9ekKtGxJIL PT+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=RxtAA5bA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y25si3527ejb.0.2021.06.02.07.12.10; Wed, 02 Jun 2021 07:12:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=RxtAA5bA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229938AbhFBOKB (ORCPT + 99 others); Wed, 2 Jun 2021 10:10:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231481AbhFBOIS (ORCPT ); Wed, 2 Jun 2021 10:08:18 -0400 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE839C06138D; Wed, 2 Jun 2021 07:05:50 -0700 (PDT) Received: by mail-lf1-x12d.google.com with SMTP id r5so3602628lfr.5; Wed, 02 Jun 2021 07:05:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=KdxBgrkTHaGnbv5FNkwfi4kgcv5bVNJ5V1Q55kmGe4Q=; b=RxtAA5bAgEPWgRrGj90AWvc3hVZJZBfazmw0mYh+4CYDNHqsAHDFZnKjPfRildod9V c0JOBwQLTWXeBGciuc43DqJaVutNFGVhvek8BdG1yOS3eaB2mYt8xpsTa/QJeXTvCfhG ynMufMVsmh0G5jXkKAgaXxu4sTrooYPi9e/0ZnBMhAI+mDPOR114O+tjlUJrCiEzl6z2 RfaRxL5DD4sGNYhNY5rPXfgwMFPzwfSTzrsOsP4ITVwjv8m2rHgsfiSofke3xHHkNbSm EcRJK/ouh1JwWRm8dbit/nwMuIqM+H3RfDPTh2+b6cBJq/q5Krl6nHn675g1Mr7iP5lz 5jeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=KdxBgrkTHaGnbv5FNkwfi4kgcv5bVNJ5V1Q55kmGe4Q=; b=TILQ9qEFW018cyoLW1LW5T8GDtmw5PKOZjpSxWaZ38mm744vyeER7YZg9spFXmcq+W UddvtuBoVZBDEVR21CX8Wh7lWMzU8Ojxxip0Km1ccFN9Hd8vamJ2SITbzMgZ8zu7kiiG vntk87vssQIptaCXNP+2i8DJ7Pcm4UIK7sB1R/XUBFBMg13BDLgrGzY4LL8CjZjoDErZ r823H+QHsvkWiUklf7kEnlZAQnUzajAoJZZ/Xrpmk8vHKNvVNHctvKobUSOGM4Yd8p7V QxP6ey0BdWpDVph6QQK9Zxd5qm6f4O2+vm/v/S3yyYOWyIVUWHB8KJlAwX4/uEaokGxv PyTQ== X-Gm-Message-State: AOAM532uVMa3ehANP0dycNp02d/BZs2BEY44eltNMKAghfiOoJZLoxTE ANnMFo0CLaOykVWYSqC/YzU= X-Received: by 2002:ac2:5a5c:: with SMTP id r28mr23530287lfn.126.1622642749058; Wed, 02 Jun 2021 07:05:49 -0700 (PDT) Received: from mobilestation ([95.79.127.110]) by smtp.gmail.com with ESMTPSA id h28sm2010944lfv.187.2021.06.02.07.05.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Jun 2021 07:05:48 -0700 (PDT) Date: Wed, 2 Jun 2021 17:05:46 +0300 From: Serge Semin To: Andy Shevchenko Cc: Serge Semin , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Hoan Tran , Linus Walleij , Bartosz Golaszewski Subject: Re: [PATCH v1 2/2] gpio: dwapb: Switch to use fwnode_irq_get() Message-ID: <20210602140546.b7o43jnrvdmtdam4@mobilestation> References: <20210601162128.35663-1-andriy.shevchenko@linux.intel.com> <20210601162128.35663-2-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210601162128.35663-2-andriy.shevchenko@linux.intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello Andy On Tue, Jun 01, 2021 at 07:21:28PM +0300, Andy Shevchenko wrote: > We have open coded variant of fwnode_irq_get() in dwapb_get_irq(). > Replace it with a simple call. Sometime ago I was trying to figure out a way to simplify this part of the driver by using the platform_get_irq_optional() method for both ACPI and OF cases. As you must have already found out by yourself it didn't work out because of DW APB GPIO DT-nodes are supposed to have sub-nodes with ports description. The OF-descriptors of these sub-nodes aren't touched by the platform_get_irq_optional() method, it just fails to detect IRQ-controller because it only works with the device OF-node. So I gave up and decided to leave the code as is. I can't remember now why I haven't used fwnode_irq_get() here. Most likely I just preferred a direct of_irq_get() invocation here just for clarity, since the only way we'd be calling fwnode_irq_get() here is to actually get IRQ number from the OF-node anyway, while the acpi_irq_get() method call made from the method fwnode_irq_get() will hardly ever be required here. If you think otherwise or I missing something please tell me. Anyway by applying your patch at least we'll save a few lines of the code and may in future have swnode-base IRQs support in the fwnode_irq_get() method. So it still worths merging in. Thanks for suggesting this change. Acked-by: Serge Semin Tested-by: Serge Semin -Sergey > > Signed-off-by: Andy Shevchenko > --- > drivers/gpio/gpio-dwapb.c | 12 ++++-------- > 1 file changed, 4 insertions(+), 8 deletions(-) > > diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c > index 939701c1465e..7d61f5821e32 100644 > --- a/drivers/gpio/gpio-dwapb.c > +++ b/drivers/gpio/gpio-dwapb.c > @@ -528,17 +528,13 @@ static int dwapb_gpio_add_port(struct dwapb_gpio *gpio, > static void dwapb_get_irq(struct device *dev, struct fwnode_handle *fwnode, > struct dwapb_port_property *pp) > { > - struct device_node *np = NULL; > - int irq = -ENXIO, j; > - > - if (fwnode_property_read_bool(fwnode, "interrupt-controller")) > - np = to_of_node(fwnode); > + int irq, j; > > for (j = 0; j < pp->ngpio; j++) { > - if (np) > - irq = of_irq_get(np, j); > - else if (has_acpi_companion(dev)) > + if (has_acpi_companion(dev)) > irq = platform_get_irq_optional(to_platform_device(dev), j); > + else > + irq = fwnode_irq_get(fwnode, j); > if (irq > 0) > pp->irq[j] = irq; > } > -- > 2.30.2 >