* [PATCH] ASoC: max98090 not need to return fail if fail to request hpdet irq.
@ 2014-07-30 1:50 jianqun
2014-07-30 6:29 ` Jarkko Nikula
2014-07-30 8:54 ` [PATCH] ASoC: max98090 add irq valid check jianqun
0 siblings, 2 replies; 5+ messages in thread
From: jianqun @ 2014-07-30 1:50 UTC (permalink / raw)
To: broonie, lgirdwood, perex, tiwai, tbleung, dgreid, kevin.strasser,
jarkko.nikula, swarren, ralph.birt
Cc: heiko, alsa-devel, linux-kernel, xujianqun
From: xujianqun <xjq@rock-chips.com>
Since hardware may not MUST to use IRQ pin of max98090 as jack detect, the
driver can work well without it, can report jack trigger to CPU by a GPIO.
But here driver will register fail caused by failed to request irq.
Signed-off-by: xujianqun <xjq@rock-chips.com>
---
sound/soc/codecs/max98090.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c
index 566919c..bc124ff 100644
--- a/sound/soc/codecs/max98090.c
+++ b/sound/soc/codecs/max98090.c
@@ -2515,6 +2515,8 @@ static int max98090_probe(struct snd_soc_codec *codec)
max98090_add_widgets(codec);
+ return 0;
+
err_access:
return ret;
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] ASoC: max98090 not need to return fail if fail to request hpdet irq.
2014-07-30 1:50 [PATCH] ASoC: max98090 not need to return fail if fail to request hpdet irq jianqun
@ 2014-07-30 6:29 ` Jarkko Nikula
2014-07-30 9:00 ` Jianqun
2014-07-30 8:54 ` [PATCH] ASoC: max98090 add irq valid check jianqun
1 sibling, 1 reply; 5+ messages in thread
From: Jarkko Nikula @ 2014-07-30 6:29 UTC (permalink / raw)
To: jianqun, broonie, lgirdwood, perex, tiwai, tbleung, dgreid,
kevin.strasser, swarren, ralph.birt
Cc: heiko, alsa-devel, linux-kernel
On 07/30/2014 04:50 AM, jianqun wrote:
> From: xujianqun <xjq@rock-chips.com>
>
> Since hardware may not MUST to use IRQ pin of max98090 as jack detect, the
> driver can work well without it, can report jack trigger to CPU by a GPIO.
>
> But here driver will register fail caused by failed to request irq.
>
> Signed-off-by: xujianqun <xjq@rock-chips.com>
> ---
> sound/soc/codecs/max98090.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c
> index 566919c..bc124ff 100644
> --- a/sound/soc/codecs/max98090.c
> +++ b/sound/soc/codecs/max98090.c
> @@ -2515,6 +2515,8 @@ static int max98090_probe(struct snd_soc_codec *codec)
>
> max98090_add_widgets(codec);
>
> + return 0;
> +
> err_access:
> return ret;
> }
I would say it's better to call request_threaded_irq() conditionally
when max98090->irq is valid in the same max98090_probe(). Also code
should return instantly in case of request_threaded_irq() fails for
valid irq.
Now code is still printing needless error message in case max98090->irq
is invalid or not specified and continue probing in case
request_threaded_irq() fails for valid irq.
--
Jarkko
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] ASoC: max98090 add irq valid check
2014-07-30 1:50 [PATCH] ASoC: max98090 not need to return fail if fail to request hpdet irq jianqun
2014-07-30 6:29 ` Jarkko Nikula
@ 2014-07-30 8:54 ` jianqun
2014-07-30 14:21 ` [alsa-devel] " Jarkko Nikula
1 sibling, 1 reply; 5+ messages in thread
From: jianqun @ 2014-07-30 8:54 UTC (permalink / raw)
To: broonie, lgirdwood, perex, tiwai, tbleung, dgreid, kevin.strasser,
jarkko.nikula, swarren, ralph.birt
Cc: heiko, alsa-devel, linux-kernel, Jianqun
From: Jianqun <xjq@rock-chips.com>
Since IRQ pin from max98090 may NC, the irq number will be zero, that is
invalid for request_threaded_irq, so just add irq valid check there.
Since hardware may not MUST to use IRQ pin of max98090 as jack detect, the
driver can work well without it, can report jack trigger to CPU by a GPIO.
But here driver will register fail caused by failed to request irq.
Signed-off-by: Jianqun <xjq@rock-chips.com>
---
sound/soc/codecs/max98090.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c
index 566919c..9dc0e8c 100644
--- a/sound/soc/codecs/max98090.c
+++ b/sound/soc/codecs/max98090.c
@@ -2478,12 +2478,14 @@ static int max98090_probe(struct snd_soc_codec *codec)
/* Register for interrupts */
dev_dbg(codec->dev, "irq = %d\n", max98090->irq);
- ret = request_threaded_irq(max98090->irq, NULL,
- max98090_interrupt, IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
- "max98090_interrupt", codec);
- if (ret < 0) {
- dev_err(codec->dev, "request_irq failed: %d\n",
- ret);
+ if (max98090->irq) {
+ ret = request_threaded_irq(max98090->irq, NULL,
+ max98090_interrupt, IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
+ "max98090_interrupt", codec);
+ if (ret < 0) {
+ dev_err(codec->dev, "request_irq failed: %d\n",
+ ret);
+ }
}
/*
--
1.7.9.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] ASoC: max98090 not need to return fail if fail to request hpdet irq.
2014-07-30 6:29 ` Jarkko Nikula
@ 2014-07-30 9:00 ` Jianqun
0 siblings, 0 replies; 5+ messages in thread
From: Jianqun @ 2014-07-30 9:00 UTC (permalink / raw)
To: Jarkko Nikula, broonie, lgirdwood, perex, tiwai, tbleung, dgreid,
kevin.strasser, swarren, ralph.birt
Cc: heiko, alsa-devel, linux-kernel
On 2014年07月30日 14:29, Jarkko Nikula wrote:
> On 07/30/2014 04:50 AM, jianqun wrote:
>> From: xujianqun <xjq@rock-chips.com>
>>
>> Since hardware may not MUST to use IRQ pin of max98090 as jack detect, the
>> driver can work well without it, can report jack trigger to CPU by a GPIO.
>>
>> But here driver will register fail caused by failed to request irq.
>>
>> Signed-off-by: xujianqun <xjq@rock-chips.com>
>> ---
>> sound/soc/codecs/max98090.c | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>> diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c
>> index 566919c..bc124ff 100644
>> --- a/sound/soc/codecs/max98090.c
>> +++ b/sound/soc/codecs/max98090.c
>> @@ -2515,6 +2515,8 @@ static int max98090_probe(struct snd_soc_codec *codec)
>> max98090_add_widgets(codec);
>> + return 0;
>> +
>> err_access:
>> return ret;
>> }
> I would say it's better to call request_threaded_irq() conditionally when max98090->irq is valid in the same max98090_probe(). Also code should return instantly in case of request_threaded_irq() fails for valid irq.
>
> Now code is still printing needless error message in case max98090->irq is invalid or not specified and continue probing in case request_threaded_irq() fails for valid irq.
>
Add a valid check could be better, thanks Jarkko~
I'm working a board with max98090, this is a really problem for me now,
the IRQ shouldn't cause the driver fail to register.
--
-------------
许 剑 群 Jay
Rockchip Electronics Co.Ltd
****************************************************************************
*IMPORTANT NOTICE:*This email is from Fuzhou Rockchip Electronics Co.,
Ltd .The contents of this email and any attachments may contain
information that is privileged, confidential and/or exempt from
disclosure under applicable law and relevant NDA. If you are not the
intended recipient, you are hereby notified that any disclosure,
copying, distribution, or use of the information is STRICTLY PROHIBITED.
Please immediately contact the sender as soon as possible and destroy
the material in its entirety in any format. Thank you.
****************************************************************************
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [alsa-devel] [PATCH] ASoC: max98090 add irq valid check
2014-07-30 8:54 ` [PATCH] ASoC: max98090 add irq valid check jianqun
@ 2014-07-30 14:21 ` Jarkko Nikula
0 siblings, 0 replies; 5+ messages in thread
From: Jarkko Nikula @ 2014-07-30 14:21 UTC (permalink / raw)
To: jianqun, broonie, lgirdwood, perex, tiwai, tbleung, dgreid,
kevin.strasser, swarren, ralph.birt
Cc: alsa-devel, heiko, linux-kernel
Hi
On 07/30/2014 11:54 AM, jianqun wrote:
> From: Jianqun <xjq@rock-chips.com>
>
> Since IRQ pin from max98090 may NC, the irq number will be zero, that is
> invalid for request_threaded_irq, so just add irq valid check there.
>
> Since hardware may not MUST to use IRQ pin of max98090 as jack detect, the
> driver can work well without it, can report jack trigger to CPU by a GPIO.
>
> But here driver will register fail caused by failed to request irq.
>
> Signed-off-by: Jianqun <xjq@rock-chips.com>
> ---
> sound/soc/codecs/max98090.c | 14 ++++++++------
> 1 file changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c
> index 566919c..9dc0e8c 100644
> --- a/sound/soc/codecs/max98090.c
> +++ b/sound/soc/codecs/max98090.c
> @@ -2478,12 +2478,14 @@ static int max98090_probe(struct snd_soc_codec *codec)
> /* Register for interrupts */
> dev_dbg(codec->dev, "irq = %d\n", max98090->irq);
>
> - ret = request_threaded_irq(max98090->irq, NULL,
> - max98090_interrupt, IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
> - "max98090_interrupt", codec);
> - if (ret < 0) {
> - dev_err(codec->dev, "request_irq failed: %d\n",
> - ret);
> + if (max98090->irq) {
> + ret = request_threaded_irq(max98090->irq, NULL,
> + max98090_interrupt, IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
> + "max98090_interrupt", codec);
> + if (ret < 0) {
> + dev_err(codec->dev, "request_irq failed: %d\n",
> + ret);
> + }
> }
>
Remember to add also "return ret;" at the end of if () {} in case
request_threaded_irq() fails since code should not continue probing now
after adding a test for valid irq.
Should the if (max98090->irq) test be >0? I'm not sure is there
possibility that can i2c->irq actually pass both -1 and 0 depending how
struct i2c_board_info etc are initialized?
I forgot that I have a fix changing request_threaded_irq() to
devm_request_threaded_irq() so you should redo your patch on top of
for-next branch of
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git.
--
Jarkko
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-07-30 14:21 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-30 1:50 [PATCH] ASoC: max98090 not need to return fail if fail to request hpdet irq jianqun
2014-07-30 6:29 ` Jarkko Nikula
2014-07-30 9:00 ` Jianqun
2014-07-30 8:54 ` [PATCH] ASoC: max98090 add irq valid check jianqun
2014-07-30 14:21 ` [alsa-devel] " Jarkko Nikula
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).