Shawn Guo wrote:
So something like this?
/* * If codec-handle property is missing from SSI node, we assume * that the machine driver uses new binding which does not require * SSI driver to trigger machine driver's probe. */ if (!of_get_property(np, "codec-handle", NULL)) { if (ssi_private->ssi_on_imx) { ssi_private->imx_pcm_pdev = platform_device_register_simple("imx-pcm-audio", -1, NULL, 0); if (IS_ERR(ssi_private->imx_pcm_pdev)) { ret = PTR_ERR(ssi_private->imx_pcm_pdev); goto error_dev; } } /* success for new binding case */ return 0; }
It does not reduce any reference to "imx" actually. If you think it's worth another iteration of the series, I will post v5 for it.
I had something more like this in mind:
/* * If codec-handle property is missing from SSI node, we assume * that the machine driver uses new binding which does not require * SSI driver to trigger machine driver's probe. */ if (!of_get_property(np, "codec-handle", NULL)) ssi_private->new_binding = true;
if (ssi_private->ssi_on_imx) { ssi_private->imx_pcm_pdev = platform_device_register_simple("imx-pcm-audio", -1, NULL, 0); if (IS_ERR(ssi_private->imx_pcm_pdev)) { ret = PTR_ERR(ssi_private->imx_pcm_pdev); goto error_dev; } } /* success for new binding case */ return 0; }
Well, it's not perfect, but the idea is that we keep track of new vs. old binding separately from imx vs. powerpc. Although I'm thinking there might be a way to general the call to platform_device_register_simple. Maybe we could put "imx-pcm-audio" in the device tree?