[PATCH 01/38] ASoC: ak5558: drop of_match_ptr from of_device_id table

Krzysztof Kozlowski krzk at kernel.org
Mon Nov 23 15:58:31 CET 2020


On Mon, Nov 23, 2020 at 01:50:06PM +0000, Mark Brown wrote:
> On Mon, Nov 23, 2020 at 01:41:29PM +0100, Krzysztof Kozlowski wrote:
> > On Mon, Nov 23, 2020 at 12:37:31PM +0000, Mark Brown wrote:
> 
> > > That feels like something that should be done with Kconfig dependencies
> > > like a direct OF dependency (possibly a !PRP0001 dependency?) for the
> > > driver or possibly with having a variant of_match_ptr() for things that
> > > really don't want to support PRP0001.  Just removing all the use of
> > > of_match_ptr() is both noisy and confusing in that it looks like it's
> > > creating issues to fix, it makes it hard to understand when and why one
> > > should use the macro.
> 
> > For the OF-only drivers (without other ID table), there is no point to
> > use the macro. Driver can bind only with DT, so what is the point of
> > of_match_ptr? To skip the OF table when building without OF? Driver
> > won't be usable at all in such case. So maybe for compile testing?
> > There is no need to remove OF table for simple build tests.
> 
> If nothing else it means you don't have to check if the driver is OF
> only or not.  I can see not bothering to add it but actively going round
> removing some instances of it doesn't seem great, and it seems like
> people will constantly be adding new uses on the basis that it's just
> such an obviously correct thing to do.

If my patch was not changing anything, I would agree that it might be
just a churn. But the patch fixes a real warning.

The other way of fixing warning is the one you proposed at beginning -
adding maybe_unused. Here we go to the second reason:

Having these of_match_ptr() for OF-only drivers is not the correct way
but rather something which is copied from existing drivers into new
ones. This is another reason for removing them - people will stop
copying this code all over again.

Best regards,
Krzysztof



More information about the Alsa-devel mailing list