From patchwork Fri Jun 24 18:26:20 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 917122 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p5OIQrl2002469 for ; Fri, 24 Jun 2011 18:26:55 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751845Ab1FXS0b (ORCPT ); Fri, 24 Jun 2011 14:26:31 -0400 Received: from mail-gy0-f174.google.com ([209.85.160.174]:64645 "EHLO mail-gy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751778Ab1FXS0b (ORCPT ); Fri, 24 Jun 2011 14:26:31 -0400 Received: by gyh3 with SMTP id 3so1190826gyh.19 for ; Fri, 24 Jun 2011 11:26:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:cc:subject:date:message-id:x-mailer; bh=cCvaDHSJT8rfzUybVhz5KGPLNdAc246HG2UGVf6+WRs=; b=Ts3LQanv+NyFDe5cM41CQZ300/zZYq5Zd4DRGJH+JyPv1IkC0YHzIo+VQlE4EryTTJ FzeaxacyyhgakTXVOy7NBWtKbqTmz2c8z+u5OIa5uhySX4UFfUpwZ4jNa6aRpxxARDdd Po82Z30vsNg+zFGPMfC3yVt+wqGAJJN22JXiM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=mfujJHaM37jkwjnGpNsSlc+VqYgPqBsXNKF09bAAv1LeqIlCXrax44/NSykYCOG78M 0lTQ/ttNW3h0e+SeiYLVN/Vvl54st5B5BdCLZrc+V3+ivZBBBitkVVgDAXpzZBE8FkX6 B9FLFk2s4MSAsXIZsLpE//1BPBTClMzS87Qd8= Received: by 10.236.179.70 with SMTP id g46mr6357767yhm.54.1308939990024; Fri, 24 Jun 2011 11:26:30 -0700 (PDT) Received: from localhost.localdomain ([186.207.113.66]) by mx.google.com with ESMTPS id c63sm1851538yhe.46.2011.06.24.11.26.27 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 24 Jun 2011 11:26:29 -0700 (PDT) From: Fabio Estevam To: linux-fbdev@vger.kernel.org Cc: rpurdie@rpsys.net, Fabio Estevam , Fabio Estevam Subject: [PATCH] backlight: l4f00242t03: Use gpio_request_one to simplify error handling Date: Fri, 24 Jun 2011 15:26:20 -0300 Message-Id: <1308939980-14341-1-git-send-email-festevam@gmail.com> X-Mailer: git-send-email 1.7.1 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Fri, 24 Jun 2011 18:26:55 +0000 (UTC) Using gpio_request_one can make the error handling simpler. Signed-off-by: Fabio Estevam --- drivers/video/backlight/l4f00242t03.c | 17 +++++------------ 1 files changed, 5 insertions(+), 12 deletions(-) diff --git a/drivers/video/backlight/l4f00242t03.c b/drivers/video/backlight/l4f00242t03.c index 98ad3e5..d6b0812 100644 --- a/drivers/video/backlight/l4f00242t03.c +++ b/drivers/video/backlight/l4f00242t03.c @@ -178,29 +178,22 @@ static int __devinit l4f00242t03_probe(struct spi_device *spi) priv->spi = spi; - ret = gpio_request(pdata->reset_gpio, "lcd l4f00242t03 reset"); + ret = gpio_request_one(pdata->reset_gpio, GPIOF_OUT_INIT_HIGH, + "lcd l4f00242t03 reset"); if (ret) { dev_err(&spi->dev, "Unable to get the lcd l4f00242t03 reset gpio.\n"); goto err; } - ret = gpio_direction_output(pdata->reset_gpio, 1); - if (ret) - goto err2; - - ret = gpio_request(pdata->data_enable_gpio, - "lcd l4f00242t03 data enable"); + ret = gpio_request_one(pdata->data_enable_gpio, GPIOF_OUT_INIT_LOW, + "lcd l4f00242t03 data enable"); if (ret) { dev_err(&spi->dev, "Unable to get the lcd l4f00242t03 data en gpio.\n"); goto err2; } - - ret = gpio_direction_output(pdata->data_enable_gpio, 0); - if (ret) - goto err3; - + if (pdata->io_supply) { priv->io_reg = regulator_get(NULL, pdata->io_supply);