From patchwork Fri Apr 25 01:27:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 4057271 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 22EBA9F1F4 for ; Fri, 25 Apr 2014 01:28:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 636FE20381 for ; Fri, 25 Apr 2014 01:28:50 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 3B6C620377 for ; Fri, 25 Apr 2014 01:28:49 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 5A19226538B; Fri, 25 Apr 2014 03:28:43 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, NO_DNS_FOR_FROM, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 1F061265350; Fri, 25 Apr 2014 03:27:43 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 8737026534C; Fri, 25 Apr 2014 03:27:38 +0200 (CEST) Received: from mail-yk0-f169.google.com (mail-yk0-f169.google.com [209.85.160.169]) by alsa0.perex.cz (Postfix) with ESMTP id 14ED026532E for ; Fri, 25 Apr 2014 03:27:31 +0200 (CEST) Received: by mail-yk0-f169.google.com with SMTP id 142so2792804ykq.14 for ; Thu, 24 Apr 2014 18:27:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=OWBtguucocycToCrFtHNn1B+Z96s/J33XsghgGE3l9k=; b=eSUnCeLu1P7ncyk6M92xMMyhXCMNcnEvWKPZnP+cHIwxR472mfuTkgzVgDmya7IXVu Yw6DH5HIoiHp091x3uWVab8mBtqeYe6HC/3EnlPXjpPiuYKTKNjjkqp+gjhSTfuLPFPM Ms9LxhmvPDjAo/TndNLhO10hTTGK+3gwiVDkmBKNYKr/33w7FiJJHmiL2yg12vlqAtNX +05MK9pVGQqpNC/x1NMmTT5yHmDC4YcnK0TMx6O6pDZot7oQdt2qcGgYZCTSuoaedgpt 7W3YwwpwVspsAZcUNvupgp+SIauJ6IVBdw3EdOp/q+0YzKLVS/AYbP4Jk324TOL9KldE RPCA== X-Received: by 10.236.143.229 with SMTP id l65mr6687280yhj.95.1398389251346; Thu, 24 Apr 2014 18:27:31 -0700 (PDT) Received: from localhost.localdomain ([177.194.43.224]) by mx.google.com with ESMTPSA id z4sm10824878yhc.11.2014.04.24.18.27.30 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 24 Apr 2014 18:27:31 -0700 (PDT) From: Fabio Estevam To: broonie@kernel.org Date: Thu, 24 Apr 2014 22:27:06 -0300 Message-Id: <1398389226-18569-4-git-send-email-festevam@gmail.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1398389226-18569-1-git-send-email-festevam@gmail.com> References: <1398389226-18569-1-git-send-email-festevam@gmail.com> Cc: Fabio Estevam , alsa-devel@alsa-project.org Subject: [alsa-devel] [PATCH 4/4] ASoC: wm8955: Use devm_regulator_bulk_get() X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP From: Fabio Estevam Using devm_regulator_bulk_get() can make the code cleaner and smaller as we do not need to call regulator_bulk_free() in the error and remove paths. Signed-off-by: Fabio Estevam --- sound/soc/codecs/wm8955.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/sound/soc/codecs/wm8955.c b/sound/soc/codecs/wm8955.c index 7e443c4..2a35108 100644 --- a/sound/soc/codecs/wm8955.c +++ b/sound/soc/codecs/wm8955.c @@ -898,7 +898,7 @@ static int wm8955_probe(struct snd_soc_codec *codec) for (i = 0; i < ARRAY_SIZE(wm8955->supplies); i++) wm8955->supplies[i].supply = wm8955_supply_names[i]; - ret = regulator_bulk_get(codec->dev, ARRAY_SIZE(wm8955->supplies), + ret = devm_regulator_bulk_get(codec->dev, ARRAY_SIZE(wm8955->supplies), wm8955->supplies); if (ret != 0) { dev_err(codec->dev, "Failed to request supplies: %d\n", ret); @@ -909,7 +909,7 @@ static int wm8955_probe(struct snd_soc_codec *codec) wm8955->supplies); if (ret != 0) { dev_err(codec->dev, "Failed to enable supplies: %d\n", ret); - goto err_get; + return ret; } ret = wm8955_reset(codec); @@ -961,17 +961,12 @@ static int wm8955_probe(struct snd_soc_codec *codec) err_enable: regulator_bulk_disable(ARRAY_SIZE(wm8955->supplies), wm8955->supplies); -err_get: - regulator_bulk_free(ARRAY_SIZE(wm8955->supplies), wm8955->supplies); return ret; } static int wm8955_remove(struct snd_soc_codec *codec) { - struct wm8955_priv *wm8955 = snd_soc_codec_get_drvdata(codec); - wm8955_set_bias_level(codec, SND_SOC_BIAS_OFF); - regulator_bulk_free(ARRAY_SIZE(wm8955->supplies), wm8955->supplies); return 0; }