From patchwork Tue Jan 8 09:19:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Kamat X-Patchwork-Id: 13908 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 9971D23E21 for ; Tue, 8 Jan 2013 09:27:54 +0000 (UTC) Received: from mail-vb0-f54.google.com (mail-vb0-f54.google.com [209.85.212.54]) by fiordland.canonical.com (Postfix) with ESMTP id 3E9A4A18084 for ; Tue, 8 Jan 2013 09:27:54 +0000 (UTC) Received: by mail-vb0-f54.google.com with SMTP id l1so157935vba.27 for ; Tue, 08 Jan 2013 01:27:53 -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 :x-gm-message-state; bh=H/aMYPmNFLLihPskzLH0K1CM3k5OpAW0AgdFe6jT3GA=; b=nuVPUZuUY68KzoBvrlKPAlfkqMXiLZZCh61kLiyVkjjyuVj9B08svCG82CGq6qvSE4 4SVeoYt9vpf8oWPmT5D8ia6S8KMLa9vUEVACUKwMN7EBb8PZcViBx62cnPBGlU5TTmmi UToPPNcIYWQ8lVpEeH9WjtbVgRFve8G0g+iSeDhIo5WTiDfcnCH79PXAQKaKycIF8Mn8 idtFx3lAHkZwemuLHb8Djcb6EdX3e9W4Mx7zEd0zDcrtu/XIxD4ipl7lG2cqK4491Lb+ /2RkzyL9TDZNXWzqNpXi3pw6+KBVXLLyFgpUGWs8Mx24qde5giI0mRPqYfmi2TZABnt9 zcjA== X-Received: by 10.220.238.139 with SMTP id ks11mr84007437vcb.49.1357637273660; Tue, 08 Jan 2013 01:27:53 -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 st5csp101002veb; Tue, 8 Jan 2013 01:27:52 -0800 (PST) X-Received: by 10.68.137.234 with SMTP id ql10mr195635313pbb.158.1357637272322; Tue, 08 Jan 2013 01:27:52 -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 rr6si61957153pbc.131.2013.01.08.01.27.51 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 08 Jan 2013 01:27:52 -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 ro2so133113pbb.25 for ; Tue, 08 Jan 2013 01:27:51 -0800 (PST) X-Received: by 10.69.0.40 with SMTP id av8mr197253518pbd.117.1357637271746; Tue, 08 Jan 2013 01:27:51 -0800 (PST) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPS id pm8sm39322401pbb.29.2013.01.08.01.27.48 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 08 Jan 2013 01:27:51 -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, Donghwa Lee Subject: [PATCH 1/2] backlight: ld9040: Use devm_regulator_bulk_get API Date: Tue, 8 Jan 2013 14:49:39 +0530 Message-Id: <1357636780-14783-1-git-send-email-sachin.kamat@linaro.org> X-Mailer: git-send-email 1.7.4.1 X-Gm-Message-State: ALoCoQn0UFEhtV/w4eHNUyE7iaJmzMxlYHEajkT1bnA6T7c7x0LIVyla0Qg6IzBE1CEI+IXwY94W devm_regulator_bulk_get is device managed and saves some cleanup and exit code. Signed-off-by: Sachin Kamat Cc: Donghwa Lee --- drivers/video/backlight/ld9040.c | 11 +++-------- 1 files changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/video/backlight/ld9040.c b/drivers/video/backlight/ld9040.c index 24f2c9a..1b642f5 100644 --- a/drivers/video/backlight/ld9040.c +++ b/drivers/video/backlight/ld9040.c @@ -710,17 +710,15 @@ static int ld9040_probe(struct spi_device *spi) mutex_init(&lcd->lock); - ret = regulator_bulk_get(lcd->dev, ARRAY_SIZE(supplies), supplies); + ret = devm_regulator_bulk_get(lcd->dev, ARRAY_SIZE(supplies), supplies); if (ret) { dev_err(lcd->dev, "Failed to get regulators: %d\n", ret); return ret; } ld = lcd_device_register("ld9040", &spi->dev, lcd, &ld9040_lcd_ops); - if (IS_ERR(ld)) { - ret = PTR_ERR(ld); - goto out_free_regulator; - } + if (IS_ERR(ld)) + return PTR_ERR(ld); lcd->ld = ld; @@ -762,8 +760,6 @@ static int ld9040_probe(struct spi_device *spi) out_unregister_lcd: lcd_device_unregister(lcd->ld); -out_free_regulator: - regulator_bulk_free(ARRAY_SIZE(supplies), supplies); return ret; } @@ -775,7 +771,6 @@ static int ld9040_remove(struct spi_device *spi) ld9040_power(lcd, FB_BLANK_POWERDOWN); backlight_device_unregister(lcd->bd); lcd_device_unregister(lcd->ld); - regulator_bulk_free(ARRAY_SIZE(supplies), supplies); return 0; }