From patchwork Tue Jan 8 09:19:40 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Kamat X-Patchwork-Id: 1944681 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 262A83FC5A for ; Tue, 8 Jan 2013 09:27:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754590Ab3AHJ15 (ORCPT ); Tue, 8 Jan 2013 04:27:57 -0500 Received: from mail-pa0-f46.google.com ([209.85.220.46]:35450 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754014Ab3AHJ1z (ORCPT ); Tue, 8 Jan 2013 04:27:55 -0500 Received: by mail-pa0-f46.google.com with SMTP id bh2so220176pad.33 for ; Tue, 08 Jan 2013 01:27:54 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=0i2xk67KDi801fUz0nBUs7sPqK2NsJN4PfQ6tbTIHWo=; b=CCYQ9XTdsVJxyMCxi8nGCiuWiJiPR1CzTGT10D2FcNrL12UWIdTvJhYBiA/ZfPcvq8 7i3ut/J8whUEBKWI58fMLF164QFzGpx2zdlKdAFx4yZphPpxAKGUcfG7pVleUTH5PbGn 5OR5Rl2Z+UtKtfthmMCOoKg1j3KmeDjM3BGV7sd/AXDf4NH7Zddkj0hOyAU1ynbRZKw0 Pma4Ej3Xl+vuJyKfvXKtsoTQDivKg4VOvd3BlPqMdDjmiMynabgk205WaRp//So0H+/G KxRPopcE71ZTSCUYUVRXn99GfVfFEgTaTSZm81o3rgazb1d4PvNi5RdwdVBIXfloYG6z FD3g== X-Received: by 10.68.217.4 with SMTP id ou4mr194154630pbc.88.1357637274880; Tue, 08 Jan 2013 01:27:54 -0800 (PST) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPS id pm8sm39322401pbb.29.2013.01.08.01.27.51 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 08 Jan 2013 01:27:54 -0800 (PST) From: Sachin Kamat To: linux-fbdev@vger.kernel.org Cc: rpurdie@rpsys.net, FlorianSchandinat@gmx.de, akpm@linux-foundation.org, sachin.kamat@linaro.org, patches@linaro.org Subject: [PATCH 2/2] backlight: l4f00242t03: Use devm_regulator_get API Date: Tue, 8 Jan 2013 14:49:40 +0530 Message-Id: <1357636780-14783-2-git-send-email-sachin.kamat@linaro.org> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1357636780-14783-1-git-send-email-sachin.kamat@linaro.org> References: <1357636780-14783-1-git-send-email-sachin.kamat@linaro.org> X-Gm-Message-State: ALoCoQlV+yiGHxEfi9EzmIXQAsz2WkUAH5AeCy7obetTevyiI6g+gEwq5EWliO/tJfsSGp/Cvnv0 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org devm_regulator_get is device managed and saves some cleanup and exit code. Signed-off-by: Sachin Kamat --- drivers/video/backlight/l4f00242t03.c | 23 +++++------------------ 1 files changed, 5 insertions(+), 18 deletions(-) diff --git a/drivers/video/backlight/l4f00242t03.c b/drivers/video/backlight/l4f00242t03.c index 9bef9cf..9d18073 100644 --- a/drivers/video/backlight/l4f00242t03.c +++ b/drivers/video/backlight/l4f00242t03.c @@ -190,27 +190,24 @@ static int l4f00242t03_probe(struct spi_device *spi) return ret; } - priv->io_reg = regulator_get(&spi->dev, "vdd"); + priv->io_reg = devm_regulator_get(&spi->dev, "vdd"); if (IS_ERR(priv->io_reg)) { dev_err(&spi->dev, "%s: Unable to get the IO regulator\n", __func__); return PTR_ERR(priv->io_reg); } - priv->core_reg = regulator_get(&spi->dev, "vcore"); + priv->core_reg = devm_regulator_get(&spi->dev, "vcore"); if (IS_ERR(priv->core_reg)) { - ret = PTR_ERR(priv->core_reg); dev_err(&spi->dev, "%s: Unable to get the core regulator\n", __func__); - goto err1; + return PTR_ERR(priv->core_reg); } priv->ld = lcd_device_register("l4f00242t03", &spi->dev, priv, &l4f_ops); - if (IS_ERR(priv->ld)) { - ret = PTR_ERR(priv->ld); - goto err2; - } + if (IS_ERR(priv->ld)) + return PTR_ERR(priv->ld); /* Init the LCD */ l4f00242t03_lcd_init(spi); @@ -220,13 +217,6 @@ static int l4f00242t03_probe(struct spi_device *spi) dev_info(&spi->dev, "Epson l4f00242t03 lcd probed.\n"); return 0; - -err2: - regulator_put(priv->core_reg); -err1: - regulator_put(priv->io_reg); - - return ret; } static int l4f00242t03_remove(struct spi_device *spi) @@ -238,9 +228,6 @@ static int l4f00242t03_remove(struct spi_device *spi) spi_set_drvdata(spi, NULL); - regulator_put(priv->io_reg); - regulator_put(priv->core_reg); - return 0; }