From patchwork Wed Jul 30 08:54:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: jianqun X-Patchwork-Id: 4646611 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 527C69F32F for ; Wed, 30 Jul 2014 08:55:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 871ED2011D for ; Wed, 30 Jul 2014 08:55:55 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id EBB39200CA for ; Wed, 30 Jul 2014 08:55:53 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id E8ACF26109C; Wed, 30 Jul 2014 10:55:52 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-0.2 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY, URIBL_BLACK autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id E2A8A26089A; Wed, 30 Jul 2014 10:55:42 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 62CEB2608C7; Wed, 30 Jul 2014 10:55:41 +0200 (CEST) Received: from regular1.263xmail.com (regular1.263xmail.com [211.150.99.131]) by alsa0.perex.cz (Postfix) with ESMTP id B7370260859 for ; Wed, 30 Jul 2014 10:55:32 +0200 (CEST) Received: from xjq?rock-chips.com (unknown [192.168.167.129]) by regular1.263xmail.com (Postfix) with SMTP id C2DF12418; Wed, 30 Jul 2014 16:55:27 +0800 (CST) X-263anti-spam: KSV:0; X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-ABS-CHECKED: 4 X-KSVirus-check: 0 Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.263.net (Postfix) with ESMTP id 9E0FA12900; Wed, 30 Jul 2014 16:55:23 +0800 (CST) X-RL-SENDER: xjq@rock-chips.com X-FST-TO: broonie@kernel.org X-SENDER-IP: 127.0.0.1 X-LOGIN-NAME: xjq@rock-chips.com X-UNIQUE-TAG: X-ATTACHMENT-NUM: 0 X-SENDER: xjq@rock-chips.com X-DNS-TYPE: 1 Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.263.net (Postfix) whith ESMTP id 32511O2JDIB; Wed, 30 Jul 2014 16:55:23 +0800 (CST) From: jianqun To: broonie@kernel.org, lgirdwood@gmail.com, perex@perex.cz, tiwai@suse.de, tbleung@chromium.org, dgreid@chromium.org, kevin.strasser@intel.com, jarkko.nikula@linux.intel.com, swarren@nvidia.com, ralph.birt@maximintegrated.com Date: Wed, 30 Jul 2014 16:54:17 +0800 Message-Id: <1406710457-6195-1-git-send-email-xjq@rock-chips.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1406685010-25108-1-git-send-email-xjq@rock-chips.com> References: <1406685010-25108-1-git-send-email-xjq@rock-chips.com> Cc: alsa-devel@alsa-project.org, Jianqun , heiko@sntech.de, linux-kernel@vger.kernel.org Subject: [alsa-devel] [PATCH] ASoC: max98090 add irq valid check X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jianqun 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 --- 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); + } } /*