[alsa-devel] [PATCH] ASoC: rt5640: ifdef for ACPI module table

Olof Johansson olof at lixom.net
Wed Sep 18 19:36:20 CEST 2013


On Wed, Sep 18, 2013 at 06:28:58PM +0100, Mark Brown wrote:
> > The problem doesn't show up when you build the driver as a module, because by
> > then the MODULE_DEVICE_TABLE() reference means the table is referenced. But
> > when you don't build as a module, MODULE_GENERIC_TABLE() reduces down to
> > nothing, thus causing this.
> 
> I'd have expected the folks doing the allyesconfig builds to have
> complained then...

Allyes will probably turn on CONFIG_ACPI and thus reference the variable
in the struct device.

> > Only way to avoid is as I see it is to mark the table __maybe_unused,
> > which in this case doesn't look like much of a better option.
> 
> > Most other drivers, for example those using pci or of module tables, have
> > Kconfig dependencies such that there's no need to ifdef. There are plenty of
> > examples of drivers ifdeffing on CONFIG_OF for those tables though.
> 
> Yes, you used to have to ifdef everything but there was a thing about
> stopping bothering doing that.  The same issue applies to the PM
> functions.  It's certainly annoying to have to faff around with the
> ifdefs all the time.
> 
> ISTR Arnd was telling me about this stuff, CCing him.

The PM case is particularly annoying because the device struct members
aren't there when PM is off, so you need the ifdef in the struct device
definition.

With the new of_match_ptr() and ACPI_PTR() you get rid of the
ifdef in struct device for those, but you still want it around
MODULE_DEVICE_TABLE() and the actual definition of the match table.


-Olof


More information about the Alsa-devel mailing list