[alsa-devel] [PATCHv2 1/7] OMAP4: PMIC: Add support for twl6030 codec

Mark Brown broonie at opensource.wolfsonmicro.com
Mon Sep 28 15:56:06 CEST 2009


On Fri, Sep 25, 2009 at 09:02:32PM -0500, Lopez Cruz, Misael wrote:

> +#if defined(CONFIG_SND_SOC_TWL6030)
> +#define twl_has_codec()	true
> +#else
> +#define twl_has_codec()	false
> +#endif

This ifdef won't match if the CODEC driver is modular.

> +
> +	if (twl_has_codec() && pdata->codec) {
> +		child = add_child(CODEC_SUB_CHIP_ID, "twl6030_codec",
> +			pdata->codec, sizeof(*pdata->codec), false,
> +			0, 0);
> +		if (IS_ERR(child))
> +			return PTR_ERR(child);
> +	}

I'd be inclined to print a warning here if no platform data is supplied,
or have the CODEC handle missing platform data to make it easier for
people to diagnose any problems with instantiating the device.


More information about the Alsa-devel mailing list