[alsa-devel] [RFC 3/3] ALSA: hda - add soc hda bus wrapper

Mark Brown broonie at kernel.org
Mon Apr 6 19:08:04 CEST 2015


On Thu, Apr 02, 2015 at 03:27:31PM +0530, Vinod Koul wrote:

> index 000000000000..09ef831b8513
> --- /dev/null
> +++ b/sound/soc/hda/Kconfig
> @@ -0,0 +1,4 @@
> +config SND_SOC_HDA_BUS
> +	tristate "SoC HDA bus wrapper"
> +	help
> +	 This adds support the SOC HDA Bus wrapper

ASoC (in both places please).

> +void snd_soc_hdac_device_put(struct snd_soc_hdac_device *pdev)
> +{
> +	if (pdev)
> +		put_device(&pdev->hdac.dev);
> +}
> +EXPORT_SYMBOL_GPL(snd_soc_hdac_device_put);
> +
> +/**
> + * snd_soc_hdac_device_add_data - add platform-specific data to a hda device
> + * @pdev: hda device allocated by platform_device_alloc to add resources to
> + * @data: hda specific data for this hda device
> + * @size: size of platform specific data
> + *
> + */
> +int snd_soc_hdac_device_add_data(struct snd_soc_hdac_device *pdev,
> +	const void *data, size_t size)
> +{
> +	void *d = NULL;
> +
> +	if (data) {
> +		d = kmemdup(data, size, GFP_KERNEL);
> +		if (!d)
> +			return -ENOMEM;
> +	}
> +
> +	kfree(pdev->hdac.dev.platform_data);
> +	pdev->hdac.dev.platform_data = d;
> +	return 0;
> +}
> +EXPORT_SYMBOL_GPL(snd_soc_hdac_device_add_data);

I didn't notice the put function cleaning this up?

> +/**
> + * hda_device_unregister - unregister a hda device
> + * @pdev: hda device we're unregistering
> + *
> + * Unregistration is done in 2 steps. First we release all resources
> + * and remove it from the subsystem, then we drop reference count by
> + * calling hda_device_put().
> + */
> +void snd_soc_hdac_device_unregister(struct snd_soc_hdac_device *pdev)
> +{
> +	snd_hdac_device_exit(&pdev->hdac);
> +	snd_hdac_device_unregister(&pdev->hdac);
> +	snd_soc_hdac_device_put(pdev);
> +}
> +EXPORT_SYMBOL_GPL(snd_soc_hdac_device_unregister);

Takashi queried bits of this too...  I have to say I don't entirely
understand how this device management is supposed to work and the lack
of any users in the current series isn't giving me anything to refer to
here, perhaps it's all obvious given them but I don't have them just
now.  A lot of this looks like it's boilerplate which should be
duplicating something device modelish and there certainly seem to be
some things with object lifetimes that need paying attention to.

All the commit message says is "create asoc wrppers on top of hdac", can
we have more words please?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20150406/27e5330d/attachment-0001.sig>


More information about the Alsa-devel mailing list