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: 13909 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 4D12823E21 for ; Tue, 8 Jan 2013 09:27:57 +0000 (UTC) Received: from mail-vb0-f46.google.com (mail-vb0-f46.google.com [209.85.212.46]) by fiordland.canonical.com (Postfix) with ESMTP id 17620A180A1 for ; Tue, 8 Jan 2013 09:27:57 +0000 (UTC) Received: by mail-vb0-f46.google.com with SMTP id b13so157026vby.33 for ; Tue, 08 Jan 2013 01:27:56 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state; bh=0i2xk67KDi801fUz0nBUs7sPqK2NsJN4PfQ6tbTIHWo=; b=WZZ6GJStD2n99NFSVxiM95ADcR1bpNt/9tK7ODzJw7pGzmxqtBNpfmztzIv/yN/xOJ PozTlXrC4e21g2Q3BsXHRwikXxzIjfANRW4bla72E//Ph0gt/05c58kgf6/3nRVj9nFj 0smb0t0lyU6FwDRI4DY+DwbwFAen2j173sQbtRX4AanmIIKVp/VMiQvUczjJ0oYHK+T8 VcRNYYjscn8R7Xm/mRMqBCdbFk6svxRFMk3q2MMAZ0c7UjE1+IuS8FW86RRlYIpw9EJq P/EPfIXlfHRd3Dp9UMFZnItya40tCjTvkpJEmfTVJOivtEbwa7+ASBP2vdJBZp7EsSi/ 6RXA== X-Received: by 10.220.218.197 with SMTP id hr5mr84109750vcb.8.1357637276583; Tue, 08 Jan 2013 01:27:56 -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.58.145.101 with SMTP id st5csp101003veb; Tue, 8 Jan 2013 01:27:55 -0800 (PST) X-Received: by 10.68.219.164 with SMTP id pp4mr195954210pbc.72.1357637275238; Tue, 08 Jan 2013 01:27:55 -0800 (PST) Received: from mail-pb0-f52.google.com (mail-pb0-f52.google.com [209.85.160.52]) by mx.google.com with ESMTPS id qc4si61976545pbb.26.2013.01.08.01.27.54 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 08 Jan 2013 01:27:55 -0800 (PST) Received-SPF: neutral (google.com: 209.85.160.52 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) client-ip=209.85.160.52; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.160.52 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-f52.google.com with SMTP id ro2so134363pbb.11 for ; Tue, 08 Jan 2013 01:27:54 -0800 (PST) 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: ALoCoQlfCbLSsfBisknnDZohyv9ROe/6vFqxugQyv/+fsOWMHlTKyqv0ZSeGAzJVQuHtDO1DtfAJ 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; }