From patchwork Tue Oct 22 17:26:57 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 3084051 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 74A179F2B7 for ; Tue, 22 Oct 2013 17:27:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 57C9920216 for ; Tue, 22 Oct 2013 17:27:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4743120211 for ; Tue, 22 Oct 2013 17:27:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754613Ab3JVR1S (ORCPT ); Tue, 22 Oct 2013 13:27:18 -0400 Received: from mail-la0-f50.google.com ([209.85.215.50]:52618 "EHLO mail-la0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753768Ab3JVR1P (ORCPT ); Tue, 22 Oct 2013 13:27:15 -0400 Received: by mail-la0-f50.google.com with SMTP id ec20so3733670lab.9 for ; Tue, 22 Oct 2013 10:27:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=OaHrfqaadbwnHzTA5FhLoyNq34xEn40FbRXn6hKkliI=; b=CQi6knPmLcSZT7D2iY2wHnFo/UFb+gahIfDzonseMysJDanTLHchi2ZIg7aY/m+6GZ NyztJ6BNUeOLLz5p17aDUwvdNRpn6nXQg/N1l5OwLHlca3NUtuV1pWS/snJdTsBfnbqG ZVjKDKA0mUxFGk5qFrau+ECZT1d45Oq0b6HlNQCO7lgZW5wWXZm+CKXJbDD6mJFg+h92 1DCW/WWi+n0KHtDhSswjp7RVz3Jt9syFNQgForYwEqeHdiSdTbP8on6ivyZ/dpHdA+bz 1cdo/AoeturMsOjRn3J2LUItKCS2jjvqdT9b9JAp1DqiupPY+WjdaddMWUCxGzmPOr2j eFjA== X-Received: by 10.152.27.67 with SMTP id r3mr2143798lag.50.1382462834207; Tue, 22 Oct 2013 10:27:14 -0700 (PDT) Received: from xi.terra (c193-14-141-227.cust.tele2.se. [193.14.141.227]) by mx.google.com with ESMTPSA id l10sm16434164lbh.13.2013.10.22.10.27.11 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 22 Oct 2013 10:27:11 -0700 (PDT) Received: from johan by xi.terra with local (Exim 4.80.1) (envelope-from ) id 1VYfja-0007SO-79; Tue, 22 Oct 2013 19:27:10 +0200 From: Johan Hovold To: Richard Purdie , Jingoo Han Cc: Nicolas Ferre , linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 7/9] backlight: atmel-pwm-bl: use gpio_is_valid Date: Tue, 22 Oct 2013 19:26:57 +0200 Message-Id: <1382462819-28576-8-git-send-email-jhovold@gmail.com> X-Mailer: git-send-email 1.8.4 In-Reply-To: <1382462819-28576-1-git-send-email-jhovold@gmail.com> References: <1382462819-28576-1-git-send-email-jhovold@gmail.com> Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use gpio_is_valid rather than open coding the more restrictive != -1 test. Signed-off-by: Johan Hovold Acked-by: Jingoo Han --- drivers/video/backlight/atmel-pwm-bl.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/video/backlight/atmel-pwm-bl.c b/drivers/video/backlight/atmel-pwm-bl.c index db68cab..ffc30d2 100644 --- a/drivers/video/backlight/atmel-pwm-bl.c +++ b/drivers/video/backlight/atmel-pwm-bl.c @@ -48,7 +48,7 @@ static int atmel_pwm_bl_set_intensity(struct backlight_device *bd) pwm_duty = pwmbl->pdata->pwm_duty_min; if (!intensity) { - if (pwmbl->gpio_on != -1) { + if (gpio_is_valid(pwmbl->gpio_on)) { gpio_set_value(pwmbl->gpio_on, 0 ^ pwmbl->pdata->on_active_low); } @@ -57,7 +57,7 @@ static int atmel_pwm_bl_set_intensity(struct backlight_device *bd) } else { pwm_channel_enable(&pwmbl->pwmc); pwm_channel_writel(&pwmbl->pwmc, PWM_CUPD, pwm_duty); - if (pwmbl->gpio_on != -1) { + if (gpio_is_valid(pwmbl->gpio_on)) { gpio_set_value(pwmbl->gpio_on, 1 ^ pwmbl->pdata->on_active_low); } @@ -146,7 +146,7 @@ static int atmel_pwm_bl_probe(struct platform_device *pdev) if (retval) return retval; - if (pwmbl->gpio_on != -1) { + if (gpio_is_valid(pwmbl->gpio_on)) { retval = devm_gpio_request(&pdev->dev, pwmbl->gpio_on, "gpio_atmel_pwm_bl"); if (retval) @@ -196,7 +196,7 @@ static int atmel_pwm_bl_remove(struct platform_device *pdev) { struct atmel_pwm_bl *pwmbl = platform_get_drvdata(pdev); - if (pwmbl->gpio_on != -1) { + if (gpio_is_valid(pwmbl->gpio_on)) { gpio_set_value(pwmbl->gpio_on, 0 ^ pwmbl->pdata->on_active_low); }