Re: [PATCH v2 1/3] device property: Add device_irq_get_byname

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jan 12, 2022 at 4:14 PM Akhil R <akhilrajeev@xxxxxxxxxx> 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



[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux