From patchwork Mon Nov 26 11:49:40 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Kamat X-Patchwork-Id: 13205 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 6537923FC6 for ; Mon, 26 Nov 2012 11:56:38 +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 17D7CA18312 for ; Mon, 26 Nov 2012 11:56:37 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id c10so4419020ieb.11 for ; Mon, 26 Nov 2012 03:56:37 -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=FERl42kLQCbAnuutXYV2tv208iAUEr4qxTLfKg46SYg=; b=W74stg4diSwrWWQLbJItoXl7yEK1/uRfDjfOSSRhcUE/+LEovDCDmGLiKhYTwev61y IVWiCTDkz5JAy49wSwPh2j597jbXNF4m/w6ENZyellYhfcPTa25gwUFD+8SmBT1RS7O3 0bKZJPGSOaj4ViMZDfyNKy5UtvhfM0c1tpKO5lbGH3NESdUM4lCESaswlbeWpkNQ4Uc+ OIWd9R+ZH22KTtu7q+yymWXjRaCr9lNLnE77u0n4+wyIxaL23QWeQKJ/yitZAJF1AD0k Nb4OT97tRblb8rZax0AQgypEWldl2GRedp1oE26gnhAP61zKGaVjz00BCyqwFRJ/41JK toog== Received: by 10.50.91.195 with SMTP id cg3mr13361215igb.57.1353930997880; Mon, 26 Nov 2012 03:56:37 -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 n20csp245094igt; Mon, 26 Nov 2012 03:56:37 -0800 (PST) Received: by 10.68.225.232 with SMTP id rn8mr36907528pbc.34.1353930997354; Mon, 26 Nov 2012 03:56:37 -0800 (PST) Received: from mail-pa0-f47.google.com (mail-pa0-f47.google.com [209.85.220.47]) by mx.google.com with ESMTPS id j9si18821451paw.96.2012.11.26.03.56.37 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 26 Nov 2012 03:56:37 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.47 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) client-ip=209.85.220.47; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.47 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-f47.google.com with SMTP id fa10so2464248pad.6 for ; Mon, 26 Nov 2012 03:56:37 -0800 (PST) Received: by 10.68.138.198 with SMTP id qs6mr37081019pbb.151.1353930997099; Mon, 26 Nov 2012 03:56:37 -0800 (PST) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPS id kb3sm8677482pbc.27.2012.11.26.03.56.33 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 26 Nov 2012 03:56:36 -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 07/14] ASoC: lm49453: Use devm_regmap_init_i2c() Date: Mon, 26 Nov 2012 17:19:40 +0530 Message-Id: <1353930587-12907-8-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: ALoCoQniSJbH6ryviVd7MFyR+Jh5gnNQxOgoNup5QUDvMM2csayzfqgf+X2zvYFFWIYNGxQvfkVN devm_regmap_init_i2c() is device managed and makes error handling and code cleanup simpler. Signed-off-by: Sachin Kamat --- sound/soc/codecs/lm49453.c | 10 ++-------- 1 files changed, 2 insertions(+), 8 deletions(-) diff --git a/sound/soc/codecs/lm49453.c b/sound/soc/codecs/lm49453.c index 99b0a9d..096b6aa 100644 --- a/sound/soc/codecs/lm49453.c +++ b/sound/soc/codecs/lm49453.c @@ -1497,7 +1497,7 @@ static __devinit int lm49453_i2c_probe(struct i2c_client *i2c, i2c_set_clientdata(i2c, lm49453); - lm49453->regmap = regmap_init_i2c(i2c, &lm49453_regmap_config); + lm49453->regmap = devm_regmap_init_i2c(i2c, &lm49453_regmap_config); if (IS_ERR(lm49453->regmap)) { ret = PTR_ERR(lm49453->regmap); dev_err(&i2c->dev, "Failed to allocate register map: %d\n", @@ -1508,21 +1508,15 @@ static __devinit int lm49453_i2c_probe(struct i2c_client *i2c, ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_lm49453, lm49453_dai, ARRAY_SIZE(lm49453_dai)); - if (ret < 0) { + if (ret < 0) dev_err(&i2c->dev, "Failed to register codec: %d\n", ret); - regmap_exit(lm49453->regmap); - return ret; - } return ret; } static int __devexit lm49453_i2c_remove(struct i2c_client *client) { - struct lm49453_priv *lm49453 = i2c_get_clientdata(client); - snd_soc_unregister_codec(&client->dev); - regmap_exit(lm49453->regmap); return 0; }