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: 1944671 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 0B73A3FC5A for ; Tue, 8 Jan 2013 09:27:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753626Ab3AHJ1y (ORCPT ); Tue, 8 Jan 2013 04:27:54 -0500 Received: from mail-da0-f50.google.com ([209.85.210.50]:59213 "EHLO mail-da0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751429Ab3AHJ1w (ORCPT ); Tue, 8 Jan 2013 04:27:52 -0500 Received: by mail-da0-f50.google.com with SMTP id h15so106063dan.37 for ; Tue, 08 Jan 2013 01:27:51 -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 :x-gm-message-state; bh=H/aMYPmNFLLihPskzLH0K1CM3k5OpAW0AgdFe6jT3GA=; b=YHPUXwRsX5GWnQGMqVsMy1jRXjXxGl6xfcTZeas8uCK1Aodwca30+rdlD7mubDisiu ynFPZuacSJ4BoLekFW1PYoeUmGT1GF24pfhQqIlsx4Famn3OndhuiFcjQv7FMOxqfJJx mcFiKhmgWRMIPtScnD/GcULih6RRh/XwUnEOARNP85x/CR59A5+pp4fwPEqmo6lU7bOj g1mJibYBzDPCmx+vdOHidGMlt+GAlAJfDvNB9RUoo23IWTgenLfQMBxztQ7aYc5GibAC nM2lt4tuCUSOBOmqbwokt43qQ2RoEzbOCJXrmq1nrjOOZGo2dY7sw/LT9l8MlntANb6a kbVA== 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: ALoCoQmNiixNO54BliGUN0jE+37vMBTBRSZVu8GobIwfg0fLqrC3sPgvfWWV+BNx3lAzhdGBixjW Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org 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; }