From patchwork Mon Nov 26 11:49:39 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Kamat X-Patchwork-Id: 13204 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 33A4E23FC6 for ; Mon, 26 Nov 2012 11:56:35 +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 D7499A18312 for ; Mon, 26 Nov 2012 11:56:34 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id c10so4419020ieb.11 for ; Mon, 26 Nov 2012 03:56:34 -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=zVFpvHucYQxg4347vq7PQD7CQ/E3jGRG8cBja7zIwG8=; b=WciPyXB2J1/I6X4pR+DPpvEh2rNvLlNj0BzpKds0yBouyKteN6AyMi97McvHNTuORO NL64smAoOL5TKYjUeXM31b6jOUSh94j7svUMhKgrpxWjQEk0FZvziLBPwNTdj0TUuPfk BSE97sh0lFm8YRR5WxzC7QN/JgdAnw1Cul2xkovCEV3CNxkLJbvCIjIuCF2XKs0zZh0n C8n0r+yHXyv/j4+eWM5EfjnjYk2ImZga66dMiAZlf89Df7nh9hUdFwyhVg1iCDQzsk+Q b8W+vW3pup+aA1OnXurg10EbOEEKKaKCP9WcGvLvvyeHS80gRUqD7J8mxfzLTVkClU7p SR6w== Received: by 10.50.161.169 with SMTP id xt9mr13168864igb.62.1353930994492; Mon, 26 Nov 2012 03:56:34 -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 n20csp245087igt; Mon, 26 Nov 2012 03:56:34 -0800 (PST) Received: by 10.68.135.101 with SMTP id pr5mr36601212pbb.140.1353930993974; Mon, 26 Nov 2012 03:56:33 -0800 (PST) Received: from mail-pb0-f46.google.com (mail-pb0-f46.google.com [209.85.160.46]) by mx.google.com with ESMTPS id sh10si19282235pbb.263.2012.11.26.03.56.33 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 26 Nov 2012 03:56:33 -0800 (PST) Received-SPF: neutral (google.com: 209.85.160.46 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) client-ip=209.85.160.46; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.160.46 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-f46.google.com with SMTP id wy7so7886302pbc.33 for ; Mon, 26 Nov 2012 03:56:33 -0800 (PST) Received: by 10.68.234.100 with SMTP id ud4mr36466774pbc.82.1353930993749; Mon, 26 Nov 2012 03:56:33 -0800 (PST) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPS id kb3sm8677482pbc.27.2012.11.26.03.56.30 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 26 Nov 2012 03:56:33 -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 06/14] ASoC: da7210: Use devm_regmap_init_i2c() Date: Mon, 26 Nov 2012 17:19:39 +0530 Message-Id: <1353930587-12907-7-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: ALoCoQlSsyHPOYGTqGErJMYcLYK4AuREHAM0ZkP8kWQM/qzFu1V4BxtzTKyDihmitDMgNoap9oN2 devm_regmap_init_i2c() is device managed and makes error handling and code cleanup simpler. Signed-off-by: Sachin Kamat --- sound/soc/codecs/da7210.c | 13 ++----------- 1 files changed, 2 insertions(+), 11 deletions(-) diff --git a/sound/soc/codecs/da7210.c b/sound/soc/codecs/da7210.c index af5db70..ab1ee5b 100644 --- a/sound/soc/codecs/da7210.c +++ b/sound/soc/codecs/da7210.c @@ -1231,7 +1231,7 @@ static int __devinit da7210_i2c_probe(struct i2c_client *i2c, i2c_set_clientdata(i2c, da7210); - da7210->regmap = regmap_init_i2c(i2c, &da7210_regmap_config_i2c); + da7210->regmap = devm_regmap_init_i2c(i2c, &da7210_regmap_config_i2c); if (IS_ERR(da7210->regmap)) { ret = PTR_ERR(da7210->regmap); dev_err(&i2c->dev, "regmap_init() failed: %d\n", ret); @@ -1245,24 +1245,15 @@ static int __devinit da7210_i2c_probe(struct i2c_client *i2c, ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_da7210, &da7210_dai, 1); - if (ret < 0) { + if (ret < 0) dev_err(&i2c->dev, "Failed to register codec: %d\n", ret); - goto err_regmap; - } - return ret; - -err_regmap: - regmap_exit(da7210->regmap); return ret; } static int __devexit da7210_i2c_remove(struct i2c_client *client) { - struct da7210_priv *da7210 = i2c_get_clientdata(client); - snd_soc_unregister_codec(&client->dev); - regmap_exit(da7210->regmap); return 0; }