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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Y4gaZeqLj4RgLv6W@google.com>
Date:   Thu, 1 Dec 2022 11:07:17 +0800
From:   Tzung-Bi Shih <tzungbi@...nel.org>
To:     Raul Rangel <rrangel@...omium.org>
Cc:     Mark Hasemeyer <markhas@...omium.org>,
        LKML <linux-kernel@...r.kernel.org>,
        Bhanu Prakash Maiya <bhanumaiya@...omium.org>,
        Benson Leung <bleung@...omium.org>,
        Enric Balletbo i Serra <enric.balletbo@...labora.com>,
        Guenter Roeck <groeck@...omium.org>,
        chrome-platform@...ts.linux.dev
Subject: Re: [PATCH v7 3/3] platform/chrome: cros_ec_uart: Add DT enumeration
 support

On Wed, Nov 30, 2022 at 09:52:29AM -0700, Raul Rangel wrote:
> On Wed, Nov 30, 2022 at 12:10 AM Tzung-Bi Shih <tzungbi@...nel.org> wrote:
> >
> > On Tue, Nov 29, 2022 at 11:13:04AM -0700, Mark Hasemeyer wrote:
> > > > > @@ -392,6 +393,12 @@ static int __maybe_unused cros_ec_uart_resume(struct device *dev)
> > > > >  static SIMPLE_DEV_PM_OPS(cros_ec_uart_pm_ops, cros_ec_uart_suspend,
> > > > >                        cros_ec_uart_resume);
> > > > >
> > > > > +static const struct of_device_id cros_ec_uart_of_match[] = {
> > > > > +     { .compatible = "google,cros-ec-uart" },
> > > > > +     {}
> > > > > +};
> > > > > +MODULE_DEVICE_TABLE(of, cros_ec_uart_of_match);
> > > >
> > > > It would need a guard for checking CONFIG_OF.  Similar to what
> > > > `cros_ec_uart_acpi_id` does.
> > > >
> > > > > @@ -405,6 +412,7 @@ static struct serdev_device_driver cros_ec_uart_driver = {
> > > > >       .driver = {
> > > > >               .name   = "cros-ec-uart",
> > > > >               .acpi_match_table = ACPI_PTR(cros_ec_uart_acpi_id),
> > > > > +             .of_match_table = cros_ec_uart_of_match,
> > > >
> > > > It would need be wrapped by `of_match_ptr()`.  Similar to what
> > > > `ACPI_PTR()` does.
> > >
> > > I'm not sure we want a guard in this case because we compile the kernel without
> > > CONFIG_OF enabled for (most?) x86 platforms. Yet we still need the device
> > > tree code to enumerate using the PRP0001 _HID method.
> >
> 
> > I'm not familiar to ACPI.  However, I thought it should add the compatible
> > string in the _DSD instead of using of_match for the case.  See example
> > in [1].
> >
> > [1]: https://www.kernel.org/doc/html/latest/firmware-guide/acpi/enumeration.html#device-tree-namespace-link-device-id
> 
> Correct, we need to add the compatible string inside the _DSD. This is
> what we currently do for all of our released devices:
> ```
>     Device (CRFP)
>     {
>         Name (_HID, "PRP0001")  // _HID: Hardware ID
>         Name (_UID, Zero)  // _UID: Unique ID
>         Name (_DDN, "Fingerprint Reader")  // _DDN: DOS Device Name
>         Name (_DSD, Package (0x02)  // _DSD: Device-Specific Data
>         {
>             ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301") /* Device
> Properties for _DSD */,
>             Package (0x03)
>             {
>                 Package (0x02)
>                 {
>                     "compatible",
>                     "google,cros-ec-uart"
>                 },
>                 ...
>             }
>         }
>     }
> ```
> 
> Since we define our `_HID` as `PRP0001` we need the `of_match_table`
> so the ACPI node can bind.

I see.  I also found some more examples:
- 3c3969a0c99b ("iio:adc:ti-adc12138: Switch to generic firmware properties
                 and drop of_match_ptr")
- a70bbbe387d0 ("nfc: pn533: drop of_match_ptr from device ID table")

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ