From: Mark Brown <broonie@kernel.org>
To: 肖翔 <xiaoxiang@xiaomi.com>
Cc: "alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
"lgirdwood@gmail.com" <lgirdwood@gmail.com>
Subject: Re: 答复: [PATCH] ASoC: pass snd_soc_jack_gpio to jack_status_check callback
Date: Sat, 22 Feb 2014 12:21:40 +0900 [thread overview]
Message-ID: <20140222032140.GW25940@sirena.org.uk> (raw)
In-Reply-To: <C5331076FE79984AAD7207DE353CEA4E40858C60@ex-mbox1.xiaomi.net>
[-- Attachment #1.1: Type: text/plain, Size: 844 bytes --]
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.
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
next prev parent reply other threads:[~2014-02-22 23:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-16 5:36 [PATCH] ASoC: pass snd_soc_jack_gpio to jack_status_check callback xiangxiao
2014-02-18 1:16 ` Mark Brown
[not found] ` <C5331076FE79984AAD7207DE353CEA4E40858C60@ex-mbox1.xiaomi.net>
2014-02-22 3:21 ` Mark Brown [this message]
2014-02-23 6:04 ` 答复: 答复: " 肖翔
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140222032140.GW25940@sirena.org.uk \
--to=broonie@kernel.org \
--cc=alsa-devel@alsa-project.org \
--cc=lgirdwood@gmail.com \
--cc=xiaoxiang@xiaomi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox