* [PATCH] ASoC: pass snd_soc_jack_gpio to jack_status_check callback @ 2014-02-16 5:36 xiangxiao 2014-02-18 1:16 ` Mark Brown 0 siblings, 1 reply; 4+ messages in thread From: xiangxiao @ 2014-02-16 5:36 UTC (permalink / raw) To: xiaoxiang, broonie, lgirdwood; +Cc: alsa-devel so the implementation could get the context data Change-Id: I5542613ccf9881deb672e71d0f0c4f603ad761fd Signed-off-by: xiangxiao <xiaoxiang@xiaomi.com> --- include/sound/soc.h | 2 +- sound/soc/soc-jack.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/sound/soc.h b/include/sound/soc.h index 21038e0..e287462 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -613,7 +613,7 @@ struct snd_soc_jack_gpio { struct snd_soc_jack *jack; struct delayed_work work; - int (*jack_status_check)(void); + int (*jack_status_check)(struct snd_soc_jack_gpio *gpio); }; struct snd_soc_jack { diff --git a/sound/soc/soc-jack.c b/sound/soc/soc-jack.c index b12fce6..6028af5 100644 --- a/sound/soc/soc-jack.c +++ b/sound/soc/soc-jack.c @@ -250,7 +250,7 @@ static void snd_soc_jack_gpio_detect(struct snd_soc_jack_gpio *gpio) report = 0; if (gpio->jack_status_check) - report = gpio->jack_status_check(); + report = gpio->jack_status_check(gpio); snd_soc_jack_report(jack, report, gpio->report); } -- 1.8.1.2 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] ASoC: pass snd_soc_jack_gpio to jack_status_check callback 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> 0 siblings, 1 reply; 4+ messages in thread From: Mark Brown @ 2014-02-18 1:16 UTC (permalink / raw) To: xiangxiao; +Cc: alsa-devel, lgirdwood [-- Attachment #1.1: Type: text/plain, Size: 615 bytes --] On Sun, Feb 16, 2014 at 01:36:12PM +0800, xiangxiao wrote: > so the implementation could get the context data > > Change-Id: I5542613ccf9881deb672e71d0f0c4f603ad761fd This shouldn't be on upstream patches. > Signed-off-by: xiangxiao <xiaoxiang@xiaomi.com> > - int (*jack_status_check)(void); > + int (*jack_status_check)(struct snd_soc_jack_gpio *gpio); Why is the callback using details of the implementation of snd_soc_jack_gpio? Perhaps there's a good reason, I'm not sure and you've not included any implementation. I'd have expected to see the jack able to provide its own context here? [-- Attachment #1.2: Digital signature --] [-- Type: application/pgp-signature, Size: 836 bytes --] [-- Attachment #2: Type: text/plain, Size: 0 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <C5331076FE79984AAD7207DE353CEA4E40858C60@ex-mbox1.xiaomi.net>]
* Re: 答复: [PATCH] ASoC: pass snd_soc_jack_gpio to jack_status_check callback [not found] ` <C5331076FE79984AAD7207DE353CEA4E40858C60@ex-mbox1.xiaomi.net> @ 2014-02-22 3:21 ` Mark Brown 2014-02-23 6:04 ` 答复: " 肖翔 0 siblings, 1 reply; 4+ messages in thread From: Mark Brown @ 2014-02-22 3:21 UTC (permalink / raw) To: 肖翔; +Cc: alsa-devel@alsa-project.org, lgirdwood@gmail.com [-- 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 --] ^ permalink raw reply [flat|nested] 4+ messages in thread
* 答复: 答复: [PATCH] ASoC: pass snd_soc_jack_gpio to jack_status_check callback 2014-02-22 3:21 ` 答复: " Mark Brown @ 2014-02-23 6:04 ` 肖翔 0 siblings, 0 replies; 4+ messages in thread From: 肖翔 @ 2014-02-23 6:04 UTC (permalink / raw) To: Mark Brown; +Cc: alsa-devel@alsa-project.org, lgirdwood@gmail.com Sure, I will update the change per your suggestion. -----邮件原件----- 发件人: Mark Brown [mailto:broonie@kernel.org] 发送时间: 2014年2月22日 11:22 收件人: 肖翔 抄送: lgirdwood@gmail.com; alsa-devel@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. _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-02-23 6:04 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2014-02-23 6:04 ` 答复: " 肖翔
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox