diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2022-02-14 18:55:50 +0100 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2022-02-14 18:55:50 +0100 |
commit | a47381055bd50ffb369b94dde91b9c6f3d761000 (patch) | |
tree | fe69a7467e678195179e82b494a5b6b1c23cfafc /drivers/base | |
parent | 754e0b0e35608ed5206d6a67a791563c631cec07 (diff) | |
parent | a263a84088f689bf0c1552a510b25d0bcc45fcae (diff) |
Merge branch 'i2c/alert-for-acpi' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux
Pull i2c material for 5.18 that is depended on by subsequent device
properties changes.
* 'i2c/alert-for-acpi' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
i2c: smbus: Use device_*() functions instead of of_*()
docs: firmware-guide: ACPI: Add named interrupt doc
device property: Add fwnode_irq_get_byname
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/property.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/drivers/base/property.c b/drivers/base/property.c index e6497f6877ee..fc59e0f7f9cc 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 |