From patchwork Mon Nov 26 11:49:41 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Kamat X-Patchwork-Id: 13206 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 9725A23FC6 for ; Mon, 26 Nov 2012 11:56:41 +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 49527A18312 for ; Mon, 26 Nov 2012 11:56:41 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id c10so4419020ieb.11 for ; Mon, 26 Nov 2012 03:56:41 -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=gFuXCS3OQ1LZkgtts+FuyvmvzRILYb5HlKIR7/d23gA=; b=WlhO1JNKEehkiqZCQsw8KbgjXQ+ZpDEWK8kZJCbjqK2nxoejToEMC0g39rlznSUNUs j6LXUavL1/J/wE4svVh6KB6baO9vX0Fjnb+TsKvXq0UpdQ9/aH02VYtpbODTgEYvxoQu bh/r1vwsXscM+GnfpNlM1hYBbREBqnN6I1IeAFt5bpGtG1P5YeblFAsD+1a0fY3g4myn +n26MELG+PlSrewnj3VQVMPUqPO4e03mf3vVDu4I9IgG5bsXm6BlM8LcTmHE4E+/FIBb holqOqvQgxRygYB9ZoQXg8N917wC81ymFqYqbeD6tsrsJVpsX2v8HmaXmmEldHaoCnU1 5F2A== Received: by 10.50.161.169 with SMTP id xt9mr13169170igb.62.1353931001085; Mon, 26 Nov 2012 03:56:41 -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 n20csp245100igt; Mon, 26 Nov 2012 03:56:40 -0800 (PST) Received: by 10.68.238.34 with SMTP id vh2mr37339215pbc.6.1353931000604; Mon, 26 Nov 2012 03:56:40 -0800 (PST) Received: from mail-pa0-f49.google.com (mail-pa0-f49.google.com [209.85.220.49]) by mx.google.com with ESMTPS id f9si18799753paz.174.2012.11.26.03.56.40 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 26 Nov 2012 03:56:40 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.49 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) client-ip=209.85.220.49; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.49 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-pa0-f49.google.com with SMTP id bi1so5490417pad.22 for ; Mon, 26 Nov 2012 03:56:40 -0800 (PST) Received: by 10.66.75.234 with SMTP id f10mr32262410paw.32.1353931000374; Mon, 26 Nov 2012 03:56:40 -0800 (PST) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPS id kb3sm8677482pbc.27.2012.11.26.03.56.37 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 26 Nov 2012 03:56:39 -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 08/14] ASoC: max9768: Use devm_regmap_init_i2c() Date: Mon, 26 Nov 2012 17:19:41 +0530 Message-Id: <1353930587-12907-9-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: ALoCoQnXPRizvWuBO9QduiQ8uG9vWddvJaIb4BlN6wiiTbtNCFZupsiXiFtylMZ4eW0ptLC4hm5J devm_regmap_init_i2c() is device managed and makes error handling and code cleanup simpler. Signed-off-by: Sachin Kamat --- sound/soc/codecs/max9768.c | 7 ++----- 1 files changed, 2 insertions(+), 5 deletions(-) diff --git a/sound/soc/codecs/max9768.c b/sound/soc/codecs/max9768.c index 17b3ec2..a777de6 100644 --- a/sound/soc/codecs/max9768.c +++ b/sound/soc/codecs/max9768.c @@ -187,7 +187,7 @@ static int __devinit max9768_i2c_probe(struct i2c_client *client, i2c_set_clientdata(client, max9768); - max9768->regmap = regmap_init_i2c(client, &max9768_i2c_regmap_config); + max9768->regmap = devm_regmap_init_i2c(client, &max9768_i2c_regmap_config); if (IS_ERR(max9768->regmap)) { err = PTR_ERR(max9768->regmap); goto err_gpio_free; @@ -195,12 +195,10 @@ static int __devinit max9768_i2c_probe(struct i2c_client *client, err = snd_soc_register_codec(&client->dev, &max9768_codec_driver, NULL, 0); if (err) - goto err_regmap_free; + goto err_gpio_free; return 0; - err_regmap_free: - regmap_exit(max9768->regmap); err_gpio_free: if (gpio_is_valid(max9768->shdn_gpio)) gpio_free(max9768->shdn_gpio); @@ -215,7 +213,6 @@ static int __devexit max9768_i2c_remove(struct i2c_client *client) struct max9768 *max9768 = i2c_get_clientdata(client); snd_soc_unregister_codec(&client->dev); - regmap_exit(max9768->regmap); if (gpio_is_valid(max9768->shdn_gpio)) gpio_free(max9768->shdn_gpio);