[alsa-devel] 答复: 答复: [PATCH] ASoC: pass snd_soc_jack_gpio to jack_status_check callback

肖翔 xiaoxiang at xiaomi.com
Sun Feb 23 07:04:53 CET 2014

Sure, I will update the change per your suggestion.

发件人: Mark Brown [mailto:broonie at kernel.org] 
发送时间: 2014年2月22日 11:22
收件人: 肖翔
抄送: lgirdwood at gmail.com; alsa-devel at alsa-project.org
主题: Re: 答复: [PATCH] ASoC: pass snd_soc_jack_gpio to jack_status_check callback

On Wed, Feb 19, 2014 at 02:20:07PM +0000, 肖翔 wrote:
> The new parameter isn't used to get the internal field of snd_soc_jack_gpio.
> the usage is very like work_struct, here is the demo code:
> struct xxx_priv {
> 	truct snd_soc_jack_gpio gpio;
> };
> static int xxx_ jack_status_check(struct snd_soc_jack_gpio *gpio) {
> 	struct xxx_priv *xxx = container_of(gpio, struct xxx_priv, gpio);
> 	......
> }
> Without this parameter, codec driver has to save xxx_priv as a global variable.

OK, this makes sense as a reason for passing the argument in however how about instead of passing in the structure adding a void * to it which gets passed as the argument instead?  The user can then assign it to point to the data they want directly without it looking like they should be using the private data for the core code.

More information about the Alsa-devel mailing list