Message ID | 20221028164120.2798-1-soha@lohu.info |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp934726wru; Fri, 28 Oct 2022 09:48:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM72W9LyOn6kU1rw8khAiLgpxWm10azrXjz+LBXMP93kL9204jrTyQ8Iltrbg7W3bJWc7cTa X-Received: by 2002:a17:903:244e:b0:186:c41e:ce9e with SMTP id l14-20020a170903244e00b00186c41ece9emr80323pls.100.1666975733158; Fri, 28 Oct 2022 09:48:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666975733; cv=none; d=google.com; s=arc-20160816; b=fIIt2FHocbulhrMm9A6imSqXYe3CuW/e9TC+g7DAvoOEO02WCY/CjYSdMgDac3fK00 oKYwVxmywpCEXchyzvnNLiHx0aIzOrWoJEO+laLl08gXwcovqTaG4xj4RWPFS1rUkjfM a/0H82YCftS+yVO1ym3ZvMlVwofcHBauZpT0MoeC/cC7LPwMx7J9LVVp6IjNS/RQKFZF +R0SkyaMgYCBTtR4f79j8aX+OLLS92KOYlXA8NQODugEOPOYXWqvACNJR/y2eaSV8iG2 rm4QbER0m6RHJoyJGDmPifIrMXnDAKrWo4hxBnj6qKHEc/rysi98A5tfgMyhvSnGMssN FeVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:feedback-id:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from; bh=BNgRr9tT6hHdCCAlJrNRVKrdNKa1DKiFMsny6IBcdXg=; b=YS4IDKWUEiSK50PzLU1rpbhuTV7XahTrTlUVlqLHjUNXoi12CtxcPY2RQXDmjNY40C ZECfpprLejwhH7GlJK8JtuDT/CskjAvLpNcl5Mj6WibDW74BUtXXgIt/MioaAebxKrq5 vjIFiASMLbUZc0nLsAYqBf7h6fq2dTvzyc0nih5HFuBF1530iNKK7d0BdBwWuXgqmqn5 9K7FFqpYlCY5iClOOr1UIw3QcE/CchtXTlvEKUVjzt6+7ziPOP9honvh3vzSw4h0Hc3R /3JBbcH9DRqyb1L6+0rZ6irVHConm9UlrPMm6QCr2C5dwRf0/I0tpU+/S8JheXx4o2rw PDdA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=lohu.info Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m8-20020a654c88000000b0046b3ba2c807si5610162pgt.143.2022.10.28.09.48.39; Fri, 28 Oct 2022 09:48:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=lohu.info Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229716AbiJ1QnH (ORCPT <rfc822;chrisfriedt@gmail.com> + 99 others); Fri, 28 Oct 2022 12:43:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229544AbiJ1QnF (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 28 Oct 2022 12:43:05 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.155.67.158]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7EA351E3ECD for <linux-kernel@vger.kernel.org>; Fri, 28 Oct 2022 09:43:00 -0700 (PDT) X-QQ-mid: bizesmtp65t1666975373t3ojrg6p Received: from localhost.localdomain ( [139.227.214.232]) by bizesmtp.qq.com (ESMTP) with id ; Sat, 29 Oct 2022 00:42:25 +0800 (CST) X-QQ-SSF: 01100000002000G0Z000B00A0000000 X-QQ-FEAT: HIVLo4mOhq4qihiPUl/eRaSVdgWUX71V7R5uJ06BDbmcypBb+mqsGkSrPIOFf sKrNbRzeGR6sCZ1H3OiUHjyt+wfn5os6fTIYkTsB8pe2tenL2s5BycrsMwOrBWv2Sc00ike dudrKmbBzDD9ngtWBXSrX9TfUwsISaJr2Nc1GRNoaaq0jUvajcgDRrpt30FBewM+WA+GDMI 6fHE8Uq6iqKKPyAeTo02wzRG8Kn8H/XSBu65Cpseho3ea17A7+ID7un6v/ml2/0CLbvuL0q dfEiplYMi8kIvgkrbRe2xqipb4XtqgBSWbr2DJm8zVYinnK2bOVqGo5AvqksVpFyy06DF+2 5lduiK4MFuxQZlV+Z4pTZ9qmrWvdQ== X-QQ-GoodBg: 0 From: Soha Jin <soha@lohu.info> To: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: "Rafael J. Wysocki" <rafael@kernel.org>, linux-kernel@vger.kernel.org, Wende Tan <twd2.me@gmail.com>, Soha Jin <soha@lohu.info> Subject: [PATCH v2] platform: use fwnode_irq_get_byname instead of of_irq_get_byname to get irq Date: Sat, 29 Oct 2022 00:41:20 +0800 Message-Id: <20221028164120.2798-1-soha@lohu.info> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:lohu.info:qybglogicsvr:qybglogicsvr3 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747950746277314688?= X-GMAIL-MSGID: =?utf-8?q?1747950746277314688?= |
Series |
[v2] platform: use fwnode_irq_get_byname instead of of_irq_get_byname to get irq
|
|
Commit Message
Soha Jin
Oct. 28, 2022, 4:41 p.m. UTC
Not only platform devices described by OF have named interrupts, but devices described by ACPI also have named interrupts. The fwnode is an abstraction to different standards, and using fwnode_irq_get_byname can support more devices. Moreover, when CONFIG_OF_IRQ is not enabled, there will be a stub method always returning 0, the if statement can be removed safely. Signed-off-by: Soha Jin <soha@lohu.info> Tested-by: Wende Tan <twd2.me@gmail.com> --- drivers/base/platform.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
Comments
> -----Original Message----- > From: Soha Jin <soha@lohu.info> > Sent: Saturday, October 29, 2022 12:41 AM > > Not only platform devices described by OF have named interrupts, but > devices described by ACPI also have named interrupts. The fwnode is an > abstraction to different standards, and using fwnode_irq_get_byname can > support more devices. > > Moreover, when CONFIG_OF_IRQ is not enabled, there will be a stub method > always returning 0, the if statement can be removed safely. > > Signed-off-by: Soha Jin <soha@lohu.info> > Tested-by: Wende Tan <twd2.me@gmail.com> > --- > drivers/base/platform.c | 8 +++----- > 1 file changed, 3 insertions(+), 5 deletions(-) > > diff --git a/drivers/base/platform.c b/drivers/base/platform.c index > 51bb2289865c..6cd7fd478c5f 100644 > --- a/drivers/base/platform.c > +++ b/drivers/base/platform.c > @@ -441,11 +441,9 @@ static int __platform_get_irq_byname(struct > platform_device *dev, > struct resource *r; > int ret; > > - if (IS_ENABLED(CONFIG_OF_IRQ) && dev->dev.of_node) { > - ret = of_irq_get_byname(dev->dev.of_node, name); > - if (ret > 0 || ret == -EPROBE_DEFER) > - return ret; > - } > + ret = fwnode_irq_get_byname(dev_fwnode(&dev->dev), name); > + if (ret > 0 || ret == -EPROBE_DEFER) > + return ret; > > r = platform_get_resource_byname(dev, IORESOURCE_IRQ, name); > if (r) { > -- > 2.30.2 > Hello Greg, I noticed the original patch is merged into -next branch, but as I said in the mail yesterday (maybe you did not see it), I already composed a v2 patch 2 weeks ago. Except the formatting fix, this patch also removed a useless if-branch. Are there any chance to correct this mistake? Regards, Soha
On Fri, Nov 11, 2022 at 08:30:46AM +0000, Soha Jin wrote: > > -----Original Message----- > > From: Soha Jin <soha@lohu.info> > > Sent: Saturday, October 29, 2022 12:41 AM > > > > Not only platform devices described by OF have named interrupts, but > > devices described by ACPI also have named interrupts. The fwnode is an > > abstraction to different standards, and using fwnode_irq_get_byname can > > support more devices. > > > > Moreover, when CONFIG_OF_IRQ is not enabled, there will be a stub method > > always returning 0, the if statement can be removed safely. > > > > Signed-off-by: Soha Jin <soha@lohu.info> > > Tested-by: Wende Tan <twd2.me@gmail.com> > > --- > > drivers/base/platform.c | 8 +++----- > > 1 file changed, 3 insertions(+), 5 deletions(-) > > > > diff --git a/drivers/base/platform.c b/drivers/base/platform.c index > > 51bb2289865c..6cd7fd478c5f 100644 > > --- a/drivers/base/platform.c > > +++ b/drivers/base/platform.c > > @@ -441,11 +441,9 @@ static int __platform_get_irq_byname(struct > > platform_device *dev, > > struct resource *r; > > int ret; > > > > - if (IS_ENABLED(CONFIG_OF_IRQ) && dev->dev.of_node) { > > - ret = of_irq_get_byname(dev->dev.of_node, name); > > - if (ret > 0 || ret == -EPROBE_DEFER) > > - return ret; > > - } > > + ret = fwnode_irq_get_byname(dev_fwnode(&dev->dev), name); > > + if (ret > 0 || ret == -EPROBE_DEFER) > > + return ret; > > > > r = platform_get_resource_byname(dev, IORESOURCE_IRQ, name); > > if (r) { > > -- > > 2.30.2 > > > > Hello Greg, > > I noticed the original patch is merged into -next branch, but as I said in > the mail yesterday (maybe you did not see it), I already composed a v2 > patch 2 weeks ago. Except the formatting fix, this patch also removed a > useless if-branch. > > Are there any chance to correct this mistake? Please submit a fixup patch, sorry, I can't rebase that branch now. greg k-h
> -----Original Message----- > From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > Sent: Friday, November 11, 2022 4:52 PM > > Please submit a fixup patch, sorry, I can't rebase that branch now. > > greg k-h Got it, I withdraw this patch. Soha
diff --git a/drivers/base/platform.c b/drivers/base/platform.c index 51bb2289865c..6cd7fd478c5f 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c @@ -441,11 +441,9 @@ static int __platform_get_irq_byname(struct platform_device *dev, struct resource *r; int ret; - if (IS_ENABLED(CONFIG_OF_IRQ) && dev->dev.of_node) { - ret = of_irq_get_byname(dev->dev.of_node, name); - if (ret > 0 || ret == -EPROBE_DEFER) - return ret; - } + ret = fwnode_irq_get_byname(dev_fwnode(&dev->dev), name); + if (ret > 0 || ret == -EPROBE_DEFER) + return ret; r = platform_get_resource_byname(dev, IORESOURCE_IRQ, name); if (r) {