lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 20 Jan 2022 16:57:49 +0200
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Akhil R <akhilrajeev@...dia.com>
Cc:     Uwe Kleine-König 
        <u.kleine-koenig@...gutronix.de>,
        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>,
        Len Brown <lenb@...nel.org>,
        ACPI Devel Maling List <linux-acpi@...r.kernel.org>,
        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>
Subject: Re: [PATCH v3 1/3] device property: Add device_irq_get_byname

On Thu, Jan 20, 2022 at 3:45 PM Akhil R <akhilrajeev@...dia.com> 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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ