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, 25 Aug 2022 19:04:28 +0200
From:   "Rafael J. Wysocki" <rafael@...nel.org>
To:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc:     "Rafael J. Wysocki" <rafael.j.wysocki@...el.com>,
        ACPI Devel Maling List <linux-acpi@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        "Rafael J. Wysocki" <rafael@...nel.org>,
        Len Brown <lenb@...nel.org>
Subject: Re: [PATCH v1 5/5] ACPI: bus: Use the matching table, if ACPI driver
 has it

On Thu, Aug 25, 2022 at 6:41 PM Andy Shevchenko
<andriy.shevchenko@...ux.intel.com> wrote:
>
> In case we have an ACPI driver, check its ID table for matching,
> This allows to use some generic device property APIs in such
> drivers.

No new provisions for ACPI drivers, please.

> Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
> ---
>  drivers/acpi/bus.c | 20 ++++++++++++++++++--
>  1 file changed, 18 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
> index 3c0f2d050d47..17c98e826bde 100644
> --- a/drivers/acpi/bus.c
> +++ b/drivers/acpi/bus.c
> @@ -1049,14 +1049,30 @@ static const void *acpi_of_device_get_match_data(const struct device *dev)
>         return match->data;
>  }
>
> +static const struct acpi_device_id *acpi_device_get_ids(const struct device *dev)
> +{
> +       if (dev->driver->acpi_match_table)
> +               return dev->driver->acpi_match_table;
> +
> +       if (dev_is_acpi(dev)) {
> +               struct acpi_driver *drv = to_acpi_driver(dev->driver);
> +
> +               if (drv->ids)
> +                       return drv->ids;
> +       }
> +
> +       return NULL;
> +}
> +
>  const void *acpi_device_get_match_data(const struct device *dev)
>  {
> +       const struct acpi_device_id *ids = acpi_device_get_ids(dev);
>         const struct acpi_device_id *match;
>
> -       if (!dev->driver->acpi_match_table)
> +       if (!ids)
>                 return acpi_of_device_get_match_data(dev);
>
> -       match = acpi_match_device(dev->driver->acpi_match_table, dev);
> +       match = acpi_match_device(ids, dev);
>         if (!match)
>                 return NULL;
>
> --
> 2.35.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ