[alsa-devel] [PATCH] Allow passing platform_data to devices attached to AC97 bus

Takashi Iwai tiwai at suse.de
Tue Jul 21 16:50:26 CEST 2009


At Tue, 21 Jul 2009 16:33:14 +0200,
Marek Vasut wrote:
> 
> diff --git a/include/sound/ac97_codec.h b/include/sound/ac97_codec.h
> index 251fc1c..c6b24e2 100644
> --- a/include/sound/ac97_codec.h
> +++ b/include/sound/ac97_codec.h
> @@ -642,4 +642,7 @@ int snd_ac97_pcm_double_rate_rules(struct snd_pcm_runtime *runtime);
>  /* ad hoc AC97 device driver access */
>  extern struct bus_type ac97_bus_type;
>  
> +/* AC97 platform_data adding function */
> +void snd_ac97_dev_add_pdata(struct snd_ac97 *ac97, void *data);

The get/set accessors would be more consistent, I think.
Also, such a small one can be inline function.  We don't always need
to grow exported symbols.

> diff --git a/sound/arm/pxa2xx-ac97.c b/sound/arm/pxa2xx-ac97.c
> index c570ebd..cfab74e 100644
> --- a/sound/arm/pxa2xx-ac97.c
> +++ b/sound/arm/pxa2xx-ac97.c
> @@ -170,6 +170,8 @@ static int __devinit pxa2xx_ac97_probe(struct platform_device *dev)
>  	struct snd_ac97_bus *ac97_bus;
>  	struct snd_ac97_template ac97_template;
>  	int ret;
> +	pxa2xx_audio_ops_t *pdata = dev->dev.platform_data;

Use the get function.

>  /* register ac97 codec to bus */
>  static int snd_ac97_dev_register(struct snd_device *device)
>  {
> diff --git a/sound/soc/pxa/pxa2xx-ac97.c b/sound/soc/pxa/pxa2xx-ac97.c
> index d9c94d7..dea18ee 100644
> --- a/sound/soc/pxa/pxa2xx-ac97.c
> +++ b/sound/soc/pxa/pxa2xx-ac97.c
> @@ -22,6 +22,7 @@
>  #include <mach/hardware.h>
>  #include <mach/regs-ac97.h>
>  #include <mach/dma.h>
> +#include <mach/audio.h>
>  
>  #include "pxa2xx-pcm.h"
>  #include "pxa2xx-ac97.h"
> @@ -241,9 +242,13 @@ EXPORT_SYMBOL_GPL(soc_ac97_ops);
>  static int __devinit pxa2xx_ac97_dev_probe(struct platform_device *pdev)
>  {
>  	int i;
> +	pxa2xx_audio_ops_t *pdata = pdev->dev.platform_data;

Use the get function.

> diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
> index 1d70829..0b12fe5 100644
> --- a/sound/soc/soc-core.c
> +++ b/sound/soc/soc-core.c
> @@ -1381,8 +1381,11 @@ int snd_soc_init_card(struct snd_soc_device *socdev)
>  				continue;
>  			}
>  		}
> -		if (card->dai_link[i].codec_dai->ac97_control)
> +		if (card->dai_link[i].codec_dai->ac97_control) {
>  			ac97 = 1;
> +			codec->ac97->dev.platform_data =
> +				card->dai_link[i].cpu_dai->ac97_pdata;

Use the set function.

Also, at the next time, add Russell or linux-arm to Cc so that he
knows at least that a file in arch/arm will be changed.


thanks,

Takashi


More information about the Alsa-devel mailing list