From patchwork Tue Jan 12 07:55:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 8014651 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id AB921BEEE5 for ; Tue, 12 Jan 2016 07:55:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D75E620361 for ; Tue, 12 Jan 2016 07:55:34 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 9D9CF2034B for ; Tue, 12 Jan 2016 07:55:32 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id A32B42654B4; Tue, 12 Jan 2016 08:55:31 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_NONE, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 20F3F265328; Tue, 12 Jan 2016 08:55:28 +0100 (CET) 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 DCA4026533F; Tue, 12 Jan 2016 08:55:26 +0100 (CET) Received: from mail-pa0-f68.google.com (mail-pa0-f68.google.com [209.85.220.68]) by alsa0.perex.cz (Postfix) with ESMTP id 4093D265312 for ; Tue, 12 Jan 2016 08:55:21 +0100 (CET) Received: by mail-pa0-f68.google.com with SMTP id yy13so25499622pab.1 for ; Mon, 11 Jan 2016 23:55:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ingics-com.20150623.gappssmtp.com; s=20150623; h=message-id:subject:from:to:cc:date:in-reply-to:references :content-type:mime-version:content-transfer-encoding; bh=/8DQQdGKkI9hYZHcgwHKStlSXbKY0ovtpYbTaCZU/Cc=; b=lxvjDnvjTNPN4SeedgzyGl7c4qvlbNOLUlvtKZYVzqogvqrJ+odOVRfbo4bkUk1IZ8 oujDSYgWklb1g+t6Iik7l1lWAFb8BmER6Tlz5QbT4+zGvRsleVHTDmDgkga3kbHDnhxU I5MfzT11J5sw/Q/aqLjLvcAaHjJbJvGWeF2/Fm4xaBfJASb+D3ylexXRyRXKjVT8RB10 9ZAnhoVNs7rFzWYBTptuamWrjhqqsvSpCUDXJ9PZFqB4n30h5Sv3IZ666rUqokHJkY2u fcM7BDsHvcwPXPFf77lBOFp+DOjwAN9i9KAfaBt4CYgaoW4CXUuf5hgcs3yj7/2rCzQC FkXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:content-type:mime-version:content-transfer-encoding; bh=/8DQQdGKkI9hYZHcgwHKStlSXbKY0ovtpYbTaCZU/Cc=; b=jGlEIYkTPaA1AO0X7T985mqDv2277zg76mOcKiM/lC+jWvSedw7A4mT3x1Jz4KlE9R +Wg59dJv5KfFwf5crEdmxuW4BotakzSuJZSicxRfHkAzY6qfhYj2GWFCyIC01BTQI4yc A2oUcTZjWLYXZh2q3jjHosg4haRrlkY/fJlhk9I88Cv0JC0YJYTLQuQOMVfajuuhHeSW 79Ii+/nxSY6LjhT8FCRtXUWXgHOWEeqtfl7AvQpyLX/8Fw1t60BII5tfjES+Wy5JsZhf 9F1w/9S1M0oEkNcBioVTfLgwET/ZJusP5Fx7tuU9OaWy6PTY8QhTKkxxZzRLkQYVJfxE 7Trg== X-Gm-Message-State: ALoCoQkw/GNrwGqqccExEl0jVj+hloiqudlD5K/IHcWt/Xxzw14vHXycwZlEqATklnMUEJdm5+0rjp4oi7bbpy/sthxDWPSg5w== X-Received: by 10.66.124.200 with SMTP id mk8mr71091397pab.43.1452585319933; Mon, 11 Jan 2016 23:55:19 -0800 (PST) Received: from phoenix (218-164-29-251.dynamic.hinet.net. [218.164.29.251]) by smtp.gmail.com with ESMTPSA id v86sm28126990pfa.83.2016.01.11.23.55.18 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 11 Jan 2016 23:55:19 -0800 (PST) Message-ID: <1452585317.5282.2.camel@ingics.com> From: Axel Lin To: Mark Brown Date: Tue, 12 Jan 2016 15:55:17 +0800 In-Reply-To: <1452585226.5282.0.camel@ingics.com> References: <1452585226.5282.0.camel@ingics.com> X-Mailer: Evolution 3.12.11-0ubuntu3 Mime-Version: 1.0 Cc: Oder Chiou , Bard Liao , alsa-devel@alsa-project.org, Liam Girdwood Subject: [alsa-devel] [PATCH 2/2] ASoC: rt5659: Fix irq leak 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Use devm_request_threaded_irq to ensure the irq is freed when unload the module. The rt5659->i2c is no longer used after this conversion, thus remove it as well. Signed-off-by: Axel Lin --- sound/soc/codecs/rt5659.c | 16 ++++------------ sound/soc/codecs/rt5659.h | 1 - 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/sound/soc/codecs/rt5659.c b/sound/soc/codecs/rt5659.c index 47c717f4..1701c29 100644 --- a/sound/soc/codecs/rt5659.c +++ b/sound/soc/codecs/rt5659.c @@ -3985,7 +3985,6 @@ static int rt5659_i2c_probe(struct i2c_client *i2c, if (rt5659 == NULL) return -ENOMEM; - rt5659->i2c = i2c; i2c_set_clientdata(i2c, rt5659); if (pdata) @@ -4157,24 +4156,17 @@ static int rt5659_i2c_probe(struct i2c_client *i2c, INIT_DELAYED_WORK(&rt5659->jack_detect_work, rt5659_jack_detect_work); - if (rt5659->i2c->irq) { - ret = request_threaded_irq(rt5659->i2c->irq, NULL, rt5659_irq, - IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING + if (i2c->irq) { + ret = devm_request_threaded_irq(&i2c->dev, i2c->irq, NULL, + rt5659_irq, IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, "rt5659", rt5659); if (ret) dev_err(&i2c->dev, "Failed to reguest IRQ: %d\n", ret); } - ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_rt5659, + return snd_soc_register_codec(&i2c->dev, &soc_codec_dev_rt5659, rt5659_dai, ARRAY_SIZE(rt5659_dai)); - - if (ret) { - if (rt5659->i2c->irq) - free_irq(rt5659->i2c->irq, rt5659); - } - - return 0; } static int rt5659_i2c_remove(struct i2c_client *i2c) diff --git a/sound/soc/codecs/rt5659.h b/sound/soc/codecs/rt5659.h index 8f07ee9..d31c9e5 100644 --- a/sound/soc/codecs/rt5659.h +++ b/sound/soc/codecs/rt5659.h @@ -1792,7 +1792,6 @@ struct rt5659_priv { struct snd_soc_codec *codec; struct rt5659_platform_data pdata; struct regmap *regmap; - struct i2c_client *i2c; struct gpio_desc *gpiod_ldo1_en; struct gpio_desc *gpiod_reset; struct snd_soc_jack *hs_jack;