Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp1283396pxb; Fri, 21 Jan 2022 14:18:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJwb9u1A4I2SEPior4IOBVKLpwE6IrvRbUnDsuJws1gfPp0oHQdyxYdNFX1dzPEfc0VGvcYn X-Received: by 2002:a63:f5a:: with SMTP id 26mr4355427pgp.613.1642803494418; Fri, 21 Jan 2022 14:18:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642803494; cv=none; d=google.com; s=arc-20160816; b=tp3oGjhodQ6dvhh1uDYMMUkwJdShm5l3ze8+Oel8u2vrTkkHOJ5G+nZAy0oH+lorDZ Sj8+URyjp1wFlwMGHP/CHfuoOfBQxdsiX3jFPsvzJuhOF2oCzYxrnsPMiW1YUxipK+hs 2hoNWViDQK7LmyjYfdZNwAyjA9owRb79c/mC4Zi5uLST2TL/WrBqw+hDfttWcvSMHBXn d6/jJQKRicNbMnAGtzu0g2AdKgYemH9HkPcHaRKXPWmf/8Hq3zJM3zeMEolXlXA8fXkj d5A3ta1TJioWrE97LUWiCtNnFwmLZMMV43WYflgUCDIqopVvdarPPTq/XPN/Oght/wIH 4R4Q== 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:dkim-signature; bh=Q7/Art4fi7Ys+mKvfMJYfxSvlOJsbRKucqQhRA69bnI=; b=h+yhoESjeW5sIpBtKpwZS58kcOxRTseNoXMVRBpp4j0ldyBcodf5FRX9rcE1+WKrdr fPx+yFfHUSg+1ExBIrO6v3XQ8/Bt+Dsy8OakGj5kqTZ/fJDsK/+bXZpMUBuevoDka+4q krx8lm74XoFhAuPx+RrPDtYHFcF1FUjVXZnBeFSmPYxqdUH5UfJiOeijP1uR6hIgqJWd yu609cO/BnwA+HA6nC72CD52f7SwAgPzv/AdIwYaORYsuqXDo+MTG8fV7vfj0TDyI+r6 fyunQX2au7EZYEFzmHFBd1DxYcWVJF4nBFcOqyYv1kddNU69jW9Vjg1JV3WQdZldR6R/ 6SLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=aCGGxiYL; 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 pi3si15603316pjb.156.2022.01.21.14.18.02; Fri, 21 Jan 2022 14:18:14 -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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=aCGGxiYL; 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 S1359200AbiATO7e (ORCPT + 99 others); Thu, 20 Jan 2022 09:59:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346102AbiATO7d (ORCPT ); Thu, 20 Jan 2022 09:59:33 -0500 Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B6D7C061574; Thu, 20 Jan 2022 06:59:33 -0800 (PST) Received: by mail-ed1-x52a.google.com with SMTP id u18so15694959edt.6; Thu, 20 Jan 2022 06:59:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Q7/Art4fi7Ys+mKvfMJYfxSvlOJsbRKucqQhRA69bnI=; b=aCGGxiYLTv4SVejDvxcNOhoE/tXZlskJXY4VdLXFx7mLuYAEGN0y7HJkr0NsYalnEj qyZxOKRhUUWEWuQ5yuX7PeLNomLeYNJ80ht2YlxtYMHiQPMx57Cr+/GnEVnrm5Hwrz7A Ded9EA6M5zwg/Niqvo4kPTj4BETD1QBYifj1csdmxV0LL0GTRok8pLpKEvZAxEoMpRVf v+21aTOeFoZVzH3cJGmg4/zxgAUrBXr96IklYlqz/fMYRt0gq4SqDWSI34Cd1t9YBWxE 8g4DOcJGTw+2XEzikWXINsbY77/wFQvzbX88dn+RRbeL9bbJ3YH5Z2HnAQASFJZrnz8t g/TA== 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=Q7/Art4fi7Ys+mKvfMJYfxSvlOJsbRKucqQhRA69bnI=; b=q3bjOPX1TY689RRLrJ7rPRz/605+J+PKtX/PN4mtaNyZMH3m843zPBK1uBjBgPk0HT 3FMM/B/lOVo98Pr0YKiN7hzUaBS8lrcOpN1jwYiHSsbM5CS/Y5o0kVxFcEcO9FN86GfP y0XFjapdJerNwaDtniEhKOo3adJF8oorBGe9y/SpYhswk5llfs/3Lgz7EtauOyiVWSl9 LgmpIkSvV7wXnoz6jdWbOE0l+uXNg9KItguWl8DIfX2kYkIhwAOBdgisnOa27JqvMvgA 3+AYr/i+JGcctXMJa0SrNTnlSqaod4PqbblVWD4seHOJfxn6QY5mwIJhlJTY275bEnbv OfAw== X-Gm-Message-State: AOAM5323sNHBc6LnDJqgEexONtKZ65SJB/2lEiA/TRnhMmhuMI6VwGBb AJnEmalfRZjk/uirBGkIssEPZ1MjaplSWlK0iyk= X-Received: by 2002:a17:907:94d3:: with SMTP id dn19mr2304620ejc.77.1642690771754; Thu, 20 Jan 2022 06:59:31 -0800 (PST) MIME-Version: 1.0 References: <1642686255-25951-1-git-send-email-akhilrajeev@nvidia.com> <1642686255-25951-2-git-send-email-akhilrajeev@nvidia.com> In-Reply-To: <1642686255-25951-2-git-send-email-akhilrajeev@nvidia.com> From: Andy Shevchenko Date: Thu, 20 Jan 2022 16:57:49 +0200 Message-ID: Subject: Re: [PATCH v3 1/3] device property: Add device_irq_get_byname To: Akhil R Cc: =?UTF-8?Q?Uwe_Kleine=2DK=C3=B6nig?= , Christian Koenig , 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 Thu, Jan 20, 2022 at 3:45 PM Akhil R wrote: Thanks, my comments below. > Add device_irq_get_byname() to get an interrupt by name from both the > ACPI table and the Device Tree. This needs to be clarified (it's not and, but or), what about: Add device_irq_get_byname() to get an interrupt by name from either ACPI table or Device Tree whichever has it. > This will allow to use 'interrupt-names' in _DSD which can be mapped to In the ACPI case this allow us to > Interrupt() resource by index. The implementation is similar to > 'interrupt-names' in the Device Tree. ... > /** > + * 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 'name' --> @name > + * in _DSD for ACPI, or of_node for device tree. Then get the Linux IRQ Device Tree > + * number of the IRQ resource corresponding to the index of the matched > + * string. > + * > + * Return: > + * Linux IRQ number on success > + * Negative errno otherwise. * 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); > +} ... > +/** > + * device_irq_get_byname - Get IRQ of a device using interrupt name > + * @dev: Device to get the interrupt > + * @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 > + * Negative errno otherwise. > + */ As per above. ... > +int device_irq_get_byname(struct device *dev, const char *name); Since we don't have device_irq_get() perhaps we don't need this one right now (just open code it in the caller). This will satisfy Rafael's request. -- With Best Regards, Andy Shevchenko