Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp4772816pxb; Tue, 25 Jan 2022 19:11:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJyHxZuf2cW6BhERidPNL069XDzDTWu8KdLsnkOcDIWCwazXAdI2MtWzQJowt0Oa8iHGZ5/v X-Received: by 2002:a17:902:8a89:b0:149:a833:af2a with SMTP id p9-20020a1709028a8900b00149a833af2amr22137449plo.153.1643166662462; Tue, 25 Jan 2022 19:11:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643166662; cv=none; d=google.com; s=arc-20160816; b=sAk3CBZu/HKx1660nutN8+RKMlKwtRVcIJb2d7SoUCF/JCX/lpMX3Inw/Tg6uOB3SD ioPZL/XLYLAcyVFpddAS2TT0hPSvCHf8L+qsmawXTU+j+AHjqKq3uj231JUFiPe8ksKC Ktm5KVFQr1iRRMoinpPs1zlibriVJrytTJoUe3Wa2iqS22UMsMA8qStYYexHA8x9zZOl Ak9YF5YIzuCWnOEh0m9hPo2d0ElHNIOxWzeXwvmfCvH2L5sU2I/qlDXeiP2hBkFfcftI Z9FJsMbgwCbJ0XAN8tt1elJw4wFlgPLETkHaKP5Sr3h4FciyL8kOhpcoBVTiKJtjydmB 1guQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=+j1GpCpGfNY2lH8frLrkCg4vSgaS4ibnLkUccs79nQA=; b=R7AKfJ1Fwvzbth0oWPi1+knxPFmwsOYkdgvCHxnvXox8X+YUV6V3A4gcapfNLHFjI2 Z0/Sbik9PyewWPTboEYiOWRUwFY2Z+FALG12HwjChTf2/uEoml4EbRLdDGcc6aRnX2hK 08mC5ymEvU4NFst+nWoVXrwthwA+ToecfEMrb0ss+ir3AlhGKWr1yGHe85zqVIptLnZb TnBFQsnPHS5biOWlg7YwXCTuc8R2sozAhOWMfXEh7xqwAyCuzfrc0Q4Ri3z19EtNGPSE 3tN1ZGWDPZGGdEP4riHKFT4goK0HHvPWup7m7502SZGj4E8RfJaUekDvcroNloOog6tg jRJQ== ARC-Authentication-Results: i=1; mx.google.com; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 21si16723636pgx.637.2022.01.25.19.10.50; Tue, 25 Jan 2022 19:11:02 -0800 (PST) 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; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243360AbiAYRxQ (ORCPT + 99 others); Tue, 25 Jan 2022 12:53:16 -0500 Received: from mail-yb1-f171.google.com ([209.85.219.171]:43911 "EHLO mail-yb1-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243629AbiAYRwr (ORCPT ); Tue, 25 Jan 2022 12:52:47 -0500 Received: by mail-yb1-f171.google.com with SMTP id g81so63955733ybg.10; Tue, 25 Jan 2022 09:52:46 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+j1GpCpGfNY2lH8frLrkCg4vSgaS4ibnLkUccs79nQA=; b=RzcIeeIMikSwVSQ9Yza37NYqsfFrm0hOqPP/KK8YyAjiRunShioLLHtBjsimPmUmi3 Eopc3HhOpeMnQKM7ym9MJAt/wDGuoj3yoD/HDh4cT5oB16sis6auVObMBy8oZ1Y77B7N 6+Vriqme2ChbJepG2DAlOXPssIElDlFtA8pm9ea/B7qpCV9+r1vKxcewScZ4y742RbeC i5UCoNv3F6jq9cZC6QSlI/fF8FWVjt6/lkdARhb54JHGhDtbfy2Hj+wes4rEw6QbCwBb 5NiIu98aWjOUnuO7m6gzKdqEam6ZYvdwSXoHROeg+I/fU6WYB9Is+2SeCgNayW2Xeh8a qAvw== X-Gm-Message-State: AOAM5320hUWHXk2MI3tUMmNmGvH2JkzUnGWajZnkOnSfYnUIUp5za9s5 f2JofaoVdVi/RNpBUrYbK3YvQQVyphL9lKran8g= X-Received: by 2002:a25:bb93:: with SMTP id y19mr30844335ybg.466.1643133165102; Tue, 25 Jan 2022 09:52:45 -0800 (PST) MIME-Version: 1.0 References: <1642851166-27096-1-git-send-email-akhilrajeev@nvidia.com> <1642851166-27096-2-git-send-email-akhilrajeev@nvidia.com> In-Reply-To: <1642851166-27096-2-git-send-email-akhilrajeev@nvidia.com> From: "Rafael J. Wysocki" Date: Tue, 25 Jan 2022 18:52:34 +0100 Message-ID: Subject: Re: [PATCH v4 1/3] device property: Add fwnode_irq_get_byname To: Akhil R Cc: =?UTF-8?Q?Uwe_Kleine=2DK=C3=B6nig?= , Andy Shevchenko , =?UTF-8?Q?Christian_K=C3=B6nig?= , Dmitry Osipenko , Greg Kroah-Hartman , Jon Hunter , Laxman Dewangan , Len Brown , ACPI Devel Maling List , linux-i2c , Linux Kernel Mailing List , linux-tegra , "Rafael J. Wysocki" , Sumit Semwal , Thierry Reding , Wolfram Sang Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jan 22, 2022 at 12:33 PM Akhil R wrote: > > Add fwnode_irq_get_byname() to get an interrupt by name from either > ACPI table or Device Tree, whichever is used for enumeration. > > In the ACPI case, this allow us to use 'interrupt-names' in > _DSD which can be mapped to Interrupt() resource by index. > The implementation is similar to 'interrupt-names' in the > Device Tree. > > Signed-off-by: Akhil R Acked-by: Rafael J. Wysocki > --- > drivers/base/property.c | 29 +++++++++++++++++++++++++++++ > include/linux/property.h | 1 + > 2 files changed, 30 insertions(+) > > diff --git a/drivers/base/property.c b/drivers/base/property.c > index e6497f6..fc59e0f 100644 > --- a/drivers/base/property.c > +++ b/drivers/base/property.c > @@ -936,6 +936,35 @@ void __iomem *fwnode_iomap(struct fwnode_handle *fwnode, int index) > EXPORT_SYMBOL(fwnode_iomap); > > /** > + * fwnode_irq_get_byname - Get IRQ from a fwnode using its name > + * @fwnode: Pointer to the firmware node > + * @name: IRQ name > + * > + * Description: > + * Find a match to the string @name in the 'interrupt-names' string array > + * in _DSD for ACPI, or of_node for Device Tree. Then get the Linux IRQ > + * number of the IRQ resource corresponding to the index of the matched > + * string. > + * > + * Return: > + * Linux IRQ number on success, or negative errno otherwise. > + */ > +int fwnode_irq_get_byname(const struct fwnode_handle *fwnode, const char *name) > +{ > + int index; > + > + if (!name) > + return -EINVAL; > + > + index = fwnode_property_match_string(fwnode, "interrupt-names", name); > + if (index < 0) > + return index; > + > + return fwnode_irq_get(fwnode, index); > +} > +EXPORT_SYMBOL(fwnode_irq_get_byname); > + > +/** > * fwnode_graph_get_next_endpoint - Get next endpoint firmware node > * @fwnode: Pointer to the parent firmware node > * @prev: Previous endpoint node or %NULL to get the first > diff --git a/include/linux/property.h b/include/linux/property.h > index 7399a0b..95d56a5 100644 > --- a/include/linux/property.h > +++ b/include/linux/property.h > @@ -121,6 +121,7 @@ struct fwnode_handle *fwnode_handle_get(struct fwnode_handle *fwnode); > void fwnode_handle_put(struct fwnode_handle *fwnode); > > int fwnode_irq_get(const struct fwnode_handle *fwnode, unsigned int index); > +int fwnode_irq_get_byname(const struct fwnode_handle *fwnode, const char *name); > > void __iomem *fwnode_iomap(struct fwnode_handle *fwnode, int index); > > -- > 2.7.4 >