From: Nikolaus Voss <nikolaus.voss@loewensteinmedical.de>
To: Javier Martinez Canillas <javier@dowhile0.org>
Cc: Javier Martinez Canillas <javierm@redhat.com>,
Andy Shevchenko <andy.shevchenko@gmail.com>,
Jonathan Cameron <jic23@kernel.org>,
Hartmut Knaack <knaack.h@gmx.de>,
Lars-Peter Clausen <lars@metafoo.de>,
Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>,
Linus Walleij <linus.walleij@linaro.org>,
Xiongfeng Wang <xiongfeng.wang@linaro.org>,
linux-iio <linux-iio@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
nv@vosn.de
Subject: Re: [PATCH v2 2/2] IIO: st_accel_i2c.c: Use probe_new() instead of probe()
Date: Wed, 4 Jul 2018 13:46:19 +0200 (CEST) [thread overview]
Message-ID: <alpine.DEB.2.20.1807041332340.9872@fox.voss.local> (raw)
In-Reply-To: <CABxcv==_JaiX7-++MRFTHmaikWbNin_YbaWuiqiuZAAuWPgvwQ@mail.gmail.com>
Hi Javier,
On Wed, 4 Jul 2018, Javier Martinez Canillas wrote:
> Hi Nikolaus,
>
> On Wed, Jul 4, 2018 at 1:15 PM, Nikolaus Voss
> <nikolaus.voss@loewensteinmedical.de> wrote:
>> On Wed, 4 Jul 2018, Javier Martinez Canillas wrote:
>
> [snip]
>
>>> I think Nikolaus is correct, assuming that the driver can be used on
>>> legacy
>>> platforms that register the I2C devices using board files / platform data.
>>> In that case you still need a I2C device ID table for (a) and (c) as he
>>> said.
>>>
>>> I don't buy on (b) though, that's a bug in my opinion. If you register an
>>> I2C
>>> device via DT then you must have a OF device ID entry that matches the
>>> device
>>> and the same for ACPI. You can't rely on the I2C device table to do the
>>> match.
>>
>>
>> Ok, in my opinion it is an elegant way of not bloating the driver when no
>> explicit handling (e.g. reading DT properties) is needed. Just adding an
>> of_device_id doesn't change any driver functionality then but only maps to
>> an already existing i2c_table_id.
>>
>
> I disagree, in the case of OF for example a compatible string is
> composed of both a vendor a device, the complete tuple is what should
> be matched.
>
> But with the fallback, only the device portion would be used so both
> <foo,bar> and <baz,bar> will match against the i2c device with id
> "bar". It may or may not be correct but the vendor portion is very
> important to disambiguate.
Disambiguation via DT implies there is already a name collision in i2c
modalias name space, so adding an of_id would work around this collision
for DT enumeration. I2c_board_info driver binding would still be broken.
The right fix would be to remove the name collision.
>>>
>>> I would also remove the struct i2c_device_id .driver_data fields from the
>>> I2C
>>> device ID table, since are not used and just makes reading the code
>>> confusing
>>> (only the struct i2c_device_id .name is used as far as I can see).
>>
>>
>> Valid point, thanks. I will change that.
>>
>>>
>>>> Javier, just a summary of the above. Nikolaus switched one driver to
>>>> use ->probe_new() hook and left i2c ID table at the same time.
>>>> My understanding that this table is not anymore in use.
>>>>
>>>> But I have to admit I didn't see entire picture of this. Can you shed a
>>>> light?
>>>>
>>>
>>> So to shed some light, in the past even {OF,ACPI}-only drivers needed an
>>> I2C ID
>>> table because: 1) the .probe callback had a struct i2c_device_id *
>>> parameter
>>> and 2) the I2C core always reported a modalias of the form i2c:<foo> even
>>> for
>>> devices registered via OF.
>>
>>
>> It could have been a null pointer and device driver binding (and
>> auto-loading) done just via driver.name.
>>
>
> I'm not sure I understood this comment.
What I was trying to say is that if the i2c_device_id table information
was not needed (i.d. only one single id), even the old probe() could be
used without defining an i2c_device_id table, the i2c_device_id* argument
to probe() being a nullptr.
Niko
next prev parent reply other threads:[~2018-07-04 11:46 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-03 6:34 [PATCH v2 0/2] IIO: st_sensors_i2c: improve device enumeration Nikolaus Voss
2018-07-03 5:41 ` [PATCH v2 1/2] IIO: st_accel_i2c.c: Simplify access to driver data Nikolaus Voss
2018-07-03 21:07 ` Andy Shevchenko
2018-07-04 6:56 ` Nikolaus Voss
2018-07-04 9:00 ` Andy Shevchenko
2018-07-03 6:06 ` [PATCH v2 2/2] IIO: st_accel_i2c.c: Use probe_new() instead of probe() Nikolaus Voss
2018-07-03 22:54 ` Andy Shevchenko
2018-07-04 6:37 ` Nikolaus Voss
2018-07-04 8:58 ` Andy Shevchenko
2018-07-04 9:09 ` Nikolaus Voss
2018-07-04 9:16 ` Andy Shevchenko
2018-07-04 9:42 ` Nikolaus Voss
2018-07-04 10:19 ` Andy Shevchenko
2018-07-04 10:49 ` Javier Martinez Canillas
2018-07-04 11:15 ` Nikolaus Voss
2018-07-04 11:26 ` Javier Martinez Canillas
2018-07-04 11:32 ` Javier Martinez Canillas
2018-07-04 11:46 ` Nikolaus Voss [this message]
2018-07-04 12:09 ` Javier Martinez Canillas
2018-07-04 12:31 ` Nikolaus Voss
2018-07-04 12:37 ` Javier Martinez Canillas
2018-07-04 13:24 ` Nikolaus Voss
2018-07-04 13:44 ` Javier Martinez Canillas
2018-07-04 16:11 ` Andy Shevchenko
2018-07-04 18:53 ` Javier Martinez Canillas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.2.20.1807041332340.9872@fox.voss.local \
--to=nikolaus.voss@loewensteinmedical.de \
--cc=andy.shevchenko@gmail.com \
--cc=javier@dowhile0.org \
--cc=javierm@redhat.com \
--cc=jic23@kernel.org \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linus.walleij@linaro.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lorenzo.bianconi83@gmail.com \
--cc=nv@vosn.de \
--cc=pmeerw@pmeerw.net \
--cc=xiongfeng.wang@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox