From patchwork Sat May 16 14:08:10 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 473050 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id E437F140CEB for ; Sun, 17 May 2015 00:08:17 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752578AbbEPOIR (ORCPT ); Sat, 16 May 2015 10:08:17 -0400 Received: from mail-pa0-f46.google.com ([209.85.220.46]:33889 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752482AbbEPOIQ (ORCPT ); Sat, 16 May 2015 10:08:16 -0400 Received: by pabru16 with SMTP id ru16so68132032pab.1 for ; Sat, 16 May 2015 07:08:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:subject:from:to:cc:date:content-type :mime-version:content-transfer-encoding; bh=xpF2iCcYyh7N+0oKVNx7PyEl+5v8vxtaJKmpgYoCm1k=; b=UUm/xYqS3zsnl3IlPwE1NTrBHXUBaFn33pIIoVDavLr//L03L0Ber4Zc5HbPoEtM5o NLPH2iFcb0xsJizmtextTPApYYIfWP382ElABJ5oKWSxKDRC3zh5/UGWOnxkzSaXWZ73 rAXN4cK0+jfOm6dtu36gW79eZg5LRkbM1/eNSTWLGniuqIMVc74KTaGJBKU4PTool4Gv YBgZUyyhybQhcvhuspxsINeRUh9PiDaOO7Wpcv4XlfHfr9Kz8/ntFuSEK7c8Hq+X0lrk QDKrusqPwK2Om5Px+B9hWs1G11xm8cqdbySjdy2yaYmainom6bDQ+vgZt1qdPMSMMPjQ uPag== X-Gm-Message-State: ALoCoQkb0dO6opw8XwdH2vADcGELt/7zi1EYPM5tnRg35Pj40wzg09/brmicStd2ZOmAliBGrnBZ X-Received: by 10.69.27.33 with SMTP id jd1mr25944725pbd.96.1431785295808; Sat, 16 May 2015 07:08:15 -0700 (PDT) Received: from phoenix.local (218-164-135-25.dynamic.hinet.net. [218.164.135.25]) by mx.google.com with ESMTPSA id og11sm4896776pdb.91.2015.05.16.07.08.13 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 16 May 2015 07:08:14 -0700 (PDT) Message-ID: <1431785290.6638.1.camel@ingics.com> Subject: [PATCH] backlight: pwm_bl: Simplify usage of devm_gpiod_get_optional From: Axel Lin To: linux-pwm@vger.kernel.org, linux-fbdev@vger.kernel.org Cc: Thierry Reding , Alexandre Courbot , Jingoo Han , Lee Jones Date: Sat, 16 May 2015 22:08:10 +0800 X-Mailer: Evolution 3.12.10-0ubuntu1~14.10.1 Mime-Version: 1.0 Sender: linux-pwm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pwm@vger.kernel.org Since 39b2bbe3d715 (gpio: add flags argument to gpiod_get*() functions), the gpiod_get* functions take an additional parameter that allows to specify direction and initial value for output. Simplify the usage of devm_gpiod_get_optional accordingly. Signed-off-by: Axel Lin Acked-by: Uwe Kleine-König --- drivers/video/backlight/pwm_bl.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c index 3a145a6..57cb9ec 100644 --- a/drivers/video/backlight/pwm_bl.c +++ b/drivers/video/backlight/pwm_bl.c @@ -241,7 +241,8 @@ static int pwm_backlight_probe(struct platform_device *pdev) pb->dev = &pdev->dev; pb->enabled = false; - pb->enable_gpio = devm_gpiod_get_optional(&pdev->dev, "enable"); + pb->enable_gpio = devm_gpiod_get_optional(&pdev->dev, "enable", + GPIOD_OUT_HIGH); if (IS_ERR(pb->enable_gpio)) { ret = PTR_ERR(pb->enable_gpio); goto err_alloc; @@ -263,9 +264,6 @@ static int pwm_backlight_probe(struct platform_device *pdev) pb->enable_gpio = gpio_to_desc(data->enable_gpio); } - if (pb->enable_gpio) - gpiod_direction_output(pb->enable_gpio, 1); - pb->power_supply = devm_regulator_get(&pdev->dev, "power"); if (IS_ERR(pb->power_supply)) { ret = PTR_ERR(pb->power_supply);