From patchwork Mon Nov 26 11:49:46 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Kamat X-Patchwork-Id: 13211 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 9149B23FC6 for ; Mon, 26 Nov 2012 11:56:58 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id 47E89A1967E for ; Mon, 26 Nov 2012 11:56:58 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id c10so4419020ieb.11 for ; Mon, 26 Nov 2012 03:56:58 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=PlmEmNeJUTwectBsCvmhjG+NP7nkDa8LVa6wdfQXTto=; b=NFnEcwCpDjQLKTUir841zFfhqT8wRwkOnVbbrruqxNT8a+EZQTSq/qWuX/1X3LKbsD B8kkLAfjuDWsKqOahEClmQDwAP+TPbuOeFTFkfAhKe49WfXQIm+edF0VNGCKESeT8w3L gDydWn+G+g3kbzgPRFqPhoGtOgQn989r8MRZNDVUGvxIT04vpRZJtRsaE07DkEAdLYRB 5OH5Xq/eq8jsOwN4Rfd/OIV/023zOX6ohLg4M/ecN0tU8Ep7zpcYIXVGLnQPZqXN9RC2 BRzLtfMJRibVRc1+AbHGJEHL4LXNC919xPECWlro8KNSWU+YiRu6YOfVxLVoCPL7/t9u K6Og== Received: by 10.50.173.34 with SMTP id bh2mr10658000igc.70.1353931018092; Mon, 26 Nov 2012 03:56:58 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.67.148 with SMTP id n20csp245128igt; Mon, 26 Nov 2012 03:56:57 -0800 (PST) Received: by 10.68.234.100 with SMTP id ud4mr36469435pbc.82.1353931017596; Mon, 26 Nov 2012 03:56:57 -0800 (PST) Received: from mail-pb0-f53.google.com (mail-pb0-f53.google.com [209.85.160.53]) by mx.google.com with ESMTPS id o4si18834257paw.54.2012.11.26.03.56.57 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 26 Nov 2012 03:56:57 -0800 (PST) Received-SPF: neutral (google.com: 209.85.160.53 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) client-ip=209.85.160.53; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.160.53 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) smtp.mail=sachin.kamat@linaro.org Received: by mail-pb0-f53.google.com with SMTP id jt11so8711343pbb.26 for ; Mon, 26 Nov 2012 03:56:57 -0800 (PST) Received: by 10.68.238.34 with SMTP id vh2mr37341085pbc.6.1353931017365; Mon, 26 Nov 2012 03:56:57 -0800 (PST) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPS id kb3sm8677482pbc.27.2012.11.26.03.56.54 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 26 Nov 2012 03:56:56 -0800 (PST) From: Sachin Kamat To: alsa-devel@alsa-project.org Cc: broonie@opensource.wolfsonmicro.com, lrg@ti.com, tiwai@suse.de, sachin.kamat@linaro.org, patches@linaro.org Subject: [PATCH 13/14] ASoC: wm8993: Use devm_regmap_init_i2c() Date: Mon, 26 Nov 2012 17:19:46 +0530 Message-Id: <1353930587-12907-14-git-send-email-sachin.kamat@linaro.org> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1353930587-12907-1-git-send-email-sachin.kamat@linaro.org> References: <1353930587-12907-1-git-send-email-sachin.kamat@linaro.org> X-Gm-Message-State: ALoCoQlABm4813yzwVO+btjKncSi6OK9cdB5bv4rCNk0zRmIkcuCoNdpod4XSAl4QQ6xjdT3KOkp devm_regmap_init_i2c() is device managed and makes error handling and code cleanup simpler. Signed-off-by: Sachin Kamat --- sound/soc/codecs/wm8993.c | 9 +++------ 1 files changed, 3 insertions(+), 6 deletions(-) diff --git a/sound/soc/codecs/wm8993.c b/sound/soc/codecs/wm8993.c index c3d3107..347a359 100644 --- a/sound/soc/codecs/wm8993.c +++ b/sound/soc/codecs/wm8993.c @@ -1660,7 +1660,7 @@ static __devinit int wm8993_i2c_probe(struct i2c_client *i2c, wm8993->dev = &i2c->dev; init_completion(&wm8993->fll_lock); - wm8993->regmap = regmap_init_i2c(i2c, &wm8993_regmap); + wm8993->regmap = devm_regmap_init_i2c(i2c, &wm8993_regmap); if (IS_ERR(wm8993->regmap)) { ret = PTR_ERR(wm8993->regmap); dev_err(&i2c->dev, "Failed to allocate regmap: %d\n", ret); @@ -1676,14 +1676,14 @@ static __devinit int wm8993_i2c_probe(struct i2c_client *i2c, wm8993->supplies); if (ret != 0) { dev_err(&i2c->dev, "Failed to request supplies: %d\n", ret); - goto err; + return ret; } ret = regulator_bulk_enable(ARRAY_SIZE(wm8993->supplies), wm8993->supplies); if (ret != 0) { dev_err(&i2c->dev, "Failed to enable supplies: %d\n", ret); - goto err; + return ret; } ret = regmap_read(wm8993->regmap, WM8993_SOFTWARE_RESET, ®); @@ -1742,8 +1742,6 @@ err_irq: free_irq(i2c->irq, wm8993); err_enable: regulator_bulk_disable(ARRAY_SIZE(wm8993->supplies), wm8993->supplies); -err: - regmap_exit(wm8993->regmap); return ret; } @@ -1754,7 +1752,6 @@ static __devexit int wm8993_i2c_remove(struct i2c_client *i2c) snd_soc_unregister_codec(&i2c->dev); if (i2c->irq) free_irq(i2c->irq, wm8993); - regmap_exit(wm8993->regmap); regulator_bulk_disable(ARRAY_SIZE(wm8993->supplies), wm8993->supplies); return 0;