[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75Vc+uN8MTM4cSMQ5gk7GvgkZwJ7aoKwnFiNjQVM4QTqPVg@mail.gmail.com>
Date: Wed, 12 Jan 2022 17:53:45 +0200
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Akhil R <akhilrajeev@...dia.com>
Cc: Christian Koenig <christian.koenig@....com>,
Dmitry Osipenko <digetx@...il.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jon Hunter <jonathanh@...dia.com>,
Laxman Dewangan <ldewangan@...dia.com>,
linux-i2c <linux-i2c@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-tegra <linux-tegra@...r.kernel.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Sumit Semwal <sumit.semwal@...aro.org>,
Thierry Reding <thierry.reding@...il.com>,
Wolfram Sang <wsa@...nel.org>, Len Brown <lenb@...nel.org>,
ACPI Devel Maling List <linux-acpi@...r.kernel.org>
Subject: Re: [PATCH v2 1/3] device property: Add device_irq_get_byname
On Wed, Jan 12, 2022 at 4:14 PM Akhil R <akhilrajeev@...dia.com> wrote:
In the subject line: device_irq_get_byname()
> Get interrupt by name from ACPI table as well.
an interrupt
the ACPI
> Add option to use 'interrupt-names' in _DSD which can map to interrupt by
can be mapped
Interrupt() resource
(The last one is very important to point out this is only about
Interrupt() resources for now).
> index. The implementation is similar to 'interrupt-names' in devicetree.
the Device Tree
> Also add a common routine to get irq by name from devicetree and ACPI
IRQ
Device Tree
> table.
...
> /**
> + * fwnode_irq_get_byname - Get IRQ from a fwnode using its name
> + * @fwnode: Pointer to the firmware node
> + * @name: IRQ name in interrupt-names property in fwnode
> + *
> + * Returns Linux IRQ number on success, errno otherwise.
negative errno
> + */
> +int fwnode_irq_get_byname(const struct fwnode_handle *fwnode, const char *name)
> +{
> + int index;
> + if (unlikely(!name))
Don't use unlikely() here.
> + return -EINVAL;
> +
> + index = fwnode_property_match_string(fwnode, "interrupt-names", name);
> + if (index < 0)
> + return index;
> +
> + return fwnode_irq_get(fwnode, index);
> +}
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists