[alsa-devel] [PATCH] ASoC: Make register_card API available to drivers

Mark Brown broonie at opensource.wolfsonmicro.com
Thu Jan 13 12:26:08 CET 2011


On Thu, Jan 13, 2011 at 12:19:18PM +0530, Koul, Vinod wrote:

> The register_card is an internal API which soc_probe uses to register the card.
> In order to create multiple cards we need to create multiple instances of
> soc-audio device. If we exposes the register card API for drivers to use, then
> machine driver can register their cards directly

> This patch makes register_card and unregister_card API available to machine
> drivers. This also maintains compatibility with older method of registration
> which can be marked depreciated and removed eventually.

This is probably mostly OK but it'd be good if you could break it down
into a small patch series.  At present it does a bunch of refactoring
and also adds the API - it'd be better if there were a sequence of
patches, each doing a single refactor, followed by a final patch which
exports the API.

Splitting it up like this will allow bisection if there's a problem
introduced by the change and makes review very much easier as there's
only one change to think about in a given patch.

> @@ -1870,16 +1868,12 @@ static int soc_probe(struct platform_device *pdev)
>  	struct snd_soc_card *card = platform_get_drvdata(pdev);
>  	int ret = 0;
>  
> +	/* no card, so machine driver will register explictly */
> +	if (!card)
> +		return 0;
> +

Hrm, this looks a bit surprising.  When we're registering directly from
the machine drivers I'd not expect us to end up going through soc-probe
at all and...

>  	/* Bodge while we unpick instantiation */
>  	card->dev = &pdev->dev;

...that the card device would be something passed in from the machine
driver (probably something that the architecture code registered in
order to allow the machine driver to probe, but possibly something
else).


More information about the Alsa-devel mailing list