[alsa-devel] [PATCH v2 2/2] ASoC: omap-mcpdm: Replace legacy driver

Lars-Peter Clausen lars at metafoo.de
Mon Aug 22 15:39:15 CEST 2011

On 08/22/2011 01:34 PM, Péter Ujfalusi wrote:
> On Friday 19 August 2011 10:49:08 Lars-Peter Clausen wrote:
>> sorry:
>> struct omap_mcpdm *mcpdm =  snd_soc_platform_get_drvdata(w->platform);
>>> This would avoid having to add the private_data field to the widget
>>> struct. In it's current form it will only really work, if there is just
>>> one instance of the driver using the widget. And if that's the case you
>>> can use a global variable directly anyway.
> The other option was to use global variable to get the *mcpdm for the widget.
> Generally I try to avoid global variables as much as I can, since the use of 
> them looks really hackish.

omap_mcpdm_widgets is a global variable. You assign to it in asoc_mcpdm_probe
and read from it in omap_mcpdm_add_dapm_widget. The fact that you hide your
*mcpdm in a void pointer doesn't make it less hackish.

More information about the Alsa-devel mailing list