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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200826095356.GG1891694@smile.fi.intel.com>
Date:   Wed, 26 Aug 2020 12:53:56 +0300
From:   Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To:     Sergey Senozhatsky <sergey.senozhatsky@...il.com>
Cc:     Wolfram Sang <wsa@...nel.org>,
        Mika Westerberg <mika.westerberg@...ux.intel.com>,
        linux-i2c@...r.kernel.org, linux-acpi@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] i2c: consider devices with of_match_table during i2c
 device probing

On Wed, Aug 26, 2020 at 02:25:44PM +0900, Sergey Senozhatsky wrote:
> On (20/08/26 07:08), Wolfram Sang wrote:
> > On Wed, Aug 26, 2020 at 01:29:37PM +0900, Sergey Senozhatsky wrote:
> > > Unlike acpi_match_device(), acpi_driver_match_device() does
> > > consider devices that provide of_match_table and performs
> > > of_compatible() matching for such devices. The key point here is
> > > that ACPI of_compatible() matching - acpi_of_match_device() - is
> > > part of ACPI and does not depend on CONFIG_OF.
> > > 
> > > Consider the following case:
> > > o !CONFIG_OF system
> > > o probing of i2c device that provides .of_match_table, but no .id_table
> > > 
> > >  i2c_device_probe()
> > >  ...
> > >    if (!driver->id_table &&
> > >        !i2c_acpi_match_device(dev->driver->acpi_match_table, client) &&
> > >        !i2c_of_match_device(dev->driver->of_match_table, client)) {
> > >        status = -ENODEV;
> > >        goto put_sync_adapter;
> > >    }
> > > 
> > > i2c_of_match_device() depends on CONFIG_OF and, thus, is always false.
> > > i2c_acpi_match_device() does ACPI match only, no of_comtatible() matching
> > > takes place, even though the device provides .of_match_table and ACPI,
> > > technically, is capable of matching such device. The result is -ENODEV.
> > > Probing will succeed, however, if we'd use .of_match_table aware ACPI
> > > matching.

Looks like you read same StackOverflow question :-)

> > > Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@...il.com>
> > 
> > We have currently this in for-current which is even removing
> > i2c_acpi_match_device():
> > 
> > http://patchwork.ozlabs.org/project/linux-i2c/list/?series=196990&state=*
> 
> Oh, nice!
> Can we go a bit further and use i2c_device_match() in i2c_device_probe()
> instead of a mix of APIs from different subsystems?

> E.g.
> 
>         if (!driver->id_table &&
> -           !i2c_acpi_match_device(dev->driver->acpi_match_table, client) &&
> -           !i2c_of_match_device(dev->driver->of_match_table, client)) {
> +           !(client && i2c_device_match(&client->dev, dev->driver))) {

You probably meant simply:

	if (!i2c_device_match(dev, dev->driver)) {

>                 status = -ENODEV;
>                 goto put_sync_adapter;
>         }

On the first glance it will work the same way but slightly longer in case of ID
table matching.

Send a patch!

-- 
With Best Regards,
Andy Shevchenko


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ