[alsa-devel] [PATCH] ASoC: imx-spdif: Use module_init() to handle platform_device_register()

Mark Brown broonie at kernel.org
Mon Dec 16 23:17:10 CET 2013

On Mon, Dec 16, 2013 at 09:19:58PM +0000, Russell King - ARM Linux wrote:
> On Mon, Dec 16, 2013 at 07:47:17PM +0000, Mark Brown wrote:

> > The crucial bit of information here is what the "inappropriate
> > condition" is - what is this trying to fix?  The code doesn't look
> > obviously wrong though it does rely on the platform device registration
> > taking effect immediately to actually probe which is a bit of an

> It's an exact copy-n-paste of the same problem which Kirkwood stuff had
> when I first looked at spdif there (presumably because Kirkwood had copied
> it from somewhere.)  The basic problem is this:

Indeed - that was a comment on the qualty of the changelog as much as

> > What should work right now is for the module to ensure that the S/PDIF
> > CODEC drivers are loaded before it is by linking to some symbol from
> > there.  This is a total hack though.  Nicer would be for the machine
> > driver to either directly register S/PDIF DAIs (rather than devices that
> > then register the DAIs) or to create a card subdevice in parallel with
> > the S/PDIF ones and hook the card registration off that.

> That creates much more complexity though, and adds yet more possibility
> for unreliability into this.  "Keep it simple" is well worth following.

I don't see registering the DAIs directly as adding complexity here;
it's essentially what the current code is trying to do and doesn't
change the normal device registration flow at all.  I do agree that the
card subdevice is more complex, I don't particularly like that idea

> The simple thing here is to declare the codec device in the module init,
> before registering the card driver, and cleaning it up at the appropriate
> moment.  That way, the card platform driver gets registered and it can

It's certainly simple and it's definitely what I'd recommend for non-DT
systems.  For DT systems it'll cause issues if two drivers both try to
register the same device on module load and the second one to get loaded
checks for errors.  Another way is just to do that in the core so we
don't need to worry about individual drivers conflicting and convert all
the drivers that do this to reference the core copies.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20131216/7c5fe52a/attachment.sig>

More information about the Alsa-devel mailing list