From patchwork Mon Nov 26 11:49:36 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Kamat X-Patchwork-Id: 13201 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 1F71423FC6 for ; Mon, 26 Nov 2012 11:56:25 +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 DD5B5A1967E for ; Mon, 26 Nov 2012 11:56:24 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id c10so4419020ieb.11 for ; Mon, 26 Nov 2012 03:56:24 -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=ghHk8TNC21q902aFZTstleclnQMpgN6auFnVJN9UgPw=; b=n6dcmwvjZHyJkBeoPDB3Ir2RNIvLv3fHmeaN/oebPN/Qj7fNpwAjbpMhD6bTi9jx6d UyX/Fu/cKPeD64QLaMmZn7dyIVd4P8yqKoIzewM8vi/EqLoZ8Bbg/Phn0h5TLbOLkdm9 muqNj0YWs4apbLbu8oPOIGK29jIVAhSMQHZ9VOVAvCWwKQczjZ1RWo9hnBc75x+zPA1m DC/+hLH7B7q54DRC/zSY34avpns3UEKBgtIvS8zt0G0GrqosfE1oBQJaeMuzgSlX5O3Y nGxi5l93KMOfoTImkDSVgYibwjgOdF+7cyc4HIoqm0GC3i2/cEoFi5dPoSEycxY/fhmc btIQ== Received: by 10.50.91.195 with SMTP id cg3mr13360528igb.57.1353930984634; Mon, 26 Nov 2012 03:56:24 -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 n20csp245066igt; Mon, 26 Nov 2012 03:56:24 -0800 (PST) Received: by 10.66.79.195 with SMTP id l3mr29628426pax.82.1353930984090; Mon, 26 Nov 2012 03:56:24 -0800 (PST) Received: from mail-da0-f41.google.com (mail-da0-f41.google.com [209.85.210.41]) by mx.google.com with ESMTPS id ax10si19320466pbd.104.2012.11.26.03.56.23 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 26 Nov 2012 03:56:24 -0800 (PST) Received-SPF: neutral (google.com: 209.85.210.41 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) client-ip=209.85.210.41; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.210.41 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-da0-f41.google.com with SMTP id e20so3603935dak.0 for ; Mon, 26 Nov 2012 03:56:23 -0800 (PST) Received: by 10.66.87.202 with SMTP id ba10mr32058233pab.72.1353930983837; Mon, 26 Nov 2012 03:56:23 -0800 (PST) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPS id kb3sm8677482pbc.27.2012.11.26.03.56.20 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 26 Nov 2012 03:56:23 -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 03/14] ASoC: wm8400: Use devm_regulator_bulk_get Date: Mon, 26 Nov 2012 17:19:36 +0530 Message-Id: <1353930587-12907-4-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: ALoCoQmG+23Q3ZzJ1+BDZgi5L20tMFUPB/wMzf7sMve9x8T0Q+nib6AU0PJCKGhcXXG/ZiG7dC/u devm_regulator_bulk_get() is device managed and makes error handling and code cleanup simpler. Signed-off-by: Sachin Kamat --- sound/soc/codecs/wm8400.c | 14 +++----------- 1 files changed, 3 insertions(+), 11 deletions(-) diff --git a/sound/soc/codecs/wm8400.c b/sound/soc/codecs/wm8400.c index 5d277a9..262c440 100644 --- a/sound/soc/codecs/wm8400.c +++ b/sound/soc/codecs/wm8400.c @@ -1373,7 +1373,7 @@ static int wm8400_codec_probe(struct snd_soc_codec *codec) codec->control_data = priv->wm8400 = wm8400; priv->codec = codec; - ret = regulator_bulk_get(wm8400->dev, + ret = devm_regulator_bulk_get(wm8400->dev, ARRAY_SIZE(power), &power[0]); if (ret != 0) { dev_err(codec->dev, "Failed to get regulators: %d\n", ret); @@ -1398,15 +1398,9 @@ static int wm8400_codec_probe(struct snd_soc_codec *codec) snd_soc_write(codec, WM8400_LEFT_OUTPUT_VOLUME, 0x50 | (1<<8)); snd_soc_write(codec, WM8400_RIGHT_OUTPUT_VOLUME, 0x50 | (1<<8)); - if (!schedule_work(&priv->work)) { - ret = -EINVAL; - goto err_regulator; - } + if (!schedule_work(&priv->work)) + return -EINVAL; return 0; - -err_regulator: - regulator_bulk_free(ARRAY_SIZE(power), power); - return ret; } static int wm8400_codec_remove(struct snd_soc_codec *codec) @@ -1417,8 +1411,6 @@ static int wm8400_codec_remove(struct snd_soc_codec *codec) snd_soc_write(codec, WM8400_POWER_MANAGEMENT_1, reg & (~WM8400_CODEC_ENA)); - regulator_bulk_free(ARRAY_SIZE(power), power); - return 0; }