From patchwork Wed Oct 23 09:55:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 3087381 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 45DC69F2B7 for ; Wed, 23 Oct 2013 09:56:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2FC84202E6 for ; Wed, 23 Oct 2013 09:56:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 78BFF202BE for ; Wed, 23 Oct 2013 09:56:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752882Ab3JWJ4A (ORCPT ); Wed, 23 Oct 2013 05:56:00 -0400 Received: from mail-la0-f41.google.com ([209.85.215.41]:61610 "EHLO mail-la0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752798Ab3JWJz7 (ORCPT ); Wed, 23 Oct 2013 05:55:59 -0400 Received: by mail-la0-f41.google.com with SMTP id el20so447491lab.28 for ; Wed, 23 Oct 2013 02:55:57 -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=KctI6nJ28V/TB1a2ExHerd1igQH66M5QkR+yhkMVUxM=; b=CZNc2Rzxou2q6kg0iqhFxyGIutk8r6X6uwO2w+84pWifaxtSi57j9k4i6cyXihxbbd oL5OCV6TcMBytpy8hmWds621N7WQflakPpPG68haxynuDaPFc1/9rjCTQdkzZwfmUo+j lKop2IRKEQ53djKue26q5XLDYmXI32sLNjBm+MF1+ieBdaoFfBOp3p3stuGGYgFZmMbC fXj2tfHLY2j+gaoLO53eUp86k9yhXyhN8VFTEFEmdu29VC9JV6o7Ti/EUW4J0LI8PEVr gQcyfktAoMXl/cUMHSObN1WTlUi88W1wSn7DMxEK6m93mSCqGgl5gKIAJZtaMkn1IMOn 9JZg== X-Received: by 10.112.136.163 with SMTP id qb3mr1534516lbb.14.1382522157703; Wed, 23 Oct 2013 02:55:57 -0700 (PDT) Received: from xi.terra (c193-14-141-227.cust.tele2.se. [193.14.141.227]) by mx.google.com with ESMTPSA id ac2sm18784616lbc.10.2013.10.23.02.55.56 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 23 Oct 2013 02:55:56 -0700 (PDT) Received: from johan by xi.terra with local (Exim 4.80.1) (envelope-from ) id 1VYvAP-0008Ma-P2; Wed, 23 Oct 2013 11:55:53 +0200 From: Johan Hovold To: Richard Purdie , Jingoo Han Cc: Nicolas Ferre , Tomi Valkeinen , Jean-Christophe Plagniol-Villard , Andrew Morton , linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 5/9] backlight: atmel-pwm-bl: clean up get_intensity Date: Wed, 23 Oct 2013 11:55:39 +0200 Message-Id: <1382522143-32072-6-git-send-email-jhovold@gmail.com> X-Mailer: git-send-email 1.8.4 In-Reply-To: <1382522143-32072-1-git-send-email-jhovold@gmail.com> References: <1382522143-32072-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 Clean up get_intensity to increase readability. Acked-by: Jingoo Han Signed-off-by: Johan Hovold --- drivers/video/backlight/atmel-pwm-bl.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/video/backlight/atmel-pwm-bl.c b/drivers/video/backlight/atmel-pwm-bl.c index 52a8134..504061c 100644 --- a/drivers/video/backlight/atmel-pwm-bl.c +++ b/drivers/video/backlight/atmel-pwm-bl.c @@ -70,15 +70,14 @@ static int atmel_pwm_bl_set_intensity(struct backlight_device *bd) static int atmel_pwm_bl_get_intensity(struct backlight_device *bd) { struct atmel_pwm_bl *pwmbl = bl_get_data(bd); + u32 cdty; u32 intensity; - if (pwmbl->pdata->pwm_active_low) { - intensity = pwm_channel_readl(&pwmbl->pwmc, PWM_CDTY) - - pwmbl->pdata->pwm_duty_min; - } else { - intensity = pwmbl->pdata->pwm_duty_max - - pwm_channel_readl(&pwmbl->pwmc, PWM_CDTY); - } + cdty = pwm_channel_readl(&pwmbl->pwmc, PWM_CDTY); + if (pwmbl->pdata->pwm_active_low) + intensity = cdty - pwmbl->pdata->pwm_duty_min; + else + intensity = pwmbl->pdata->pwm_duty_max - cdty; return (u16)intensity; }