[alsa-devel] [PATCH 1/3] ASoC: alc5632: add an of_match table

Thierry Reding thierry.reding at gmail.com
Fri Apr 4 11:06:29 CEST 2014

On Tue, Apr 01, 2014 at 12:05:17AM +0100, Mark Brown wrote:
> On Mon, Mar 31, 2014 at 04:53:57PM -0600, Stephen Warren wrote:
> > On 03/31/2014 04:45 PM, Mark Brown wrote:
> > > of_match_ptr() is supposed to avoid the warnings that the ifdefs fixed
> > > more prettily - I suspect you'll find that the ones that don't use it
> > > either predate of_match_ptr() or copied something that did.
> > I believe you either have the ifdef and the of_match_ptr(), or you have
> > neither. The use of of_match_ptr() is required when you wrap the
> > struct/array in an ifdef, so that the struct/array is only referenced
> > when it's declared.
> > I guess from your response you want the struct/array wrapped in an
> > ifdef, and to use of_match_ptr() when referencing it. I'll go ahead with
> > that; no need to reply if that's what you meant.
> No, what I'm saying is you shouldn't need the ifdef any more if you use
> of_match_ptr() and that's the more modern way to do things.

But I don't think that's the way it works. If you drop the #ifdef around
the struct of_device_id table and use of_match_ptr() when referencing it
then you'll get a warning from the compiler because the table is in fact
unreferenced. So all that of_match_ptr() really gives you is a way to
omit the:

	#  define of_match_table NULL

So it doesn't really give you all that much in the end.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20140404/38e0b721/attachment.sig>

More information about the Alsa-devel mailing list