From patchwork Wed May 4 09:43:16 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 9011871 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5C1799F39D for ; Wed, 4 May 2016 09:43:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 73BD120394 for ; Wed, 4 May 2016 09:43:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3E5FA20382 for ; Wed, 4 May 2016 09:43:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757197AbcEDJnb (ORCPT ); Wed, 4 May 2016 05:43:31 -0400 Received: from metis.ext.4.pengutronix.de ([92.198.50.35]:42121 "EHLO metis.ext.4.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757077AbcEDJnb (ORCPT ); Wed, 4 May 2016 05:43:31 -0400 Received: from dude.hi.pengutronix.de ([2001:67c:670:100:1d::7]) by metis.ext.pengutronix.de with esmtps (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1axtKz-0004J8-7z; Wed, 04 May 2016 11:43:21 +0200 Received: from ukl by dude.hi.pengutronix.de with local (Exim 4.87) (envelope-from ) id 1axtKy-0001xO-Hk; Wed, 04 May 2016 11:43:20 +0200 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= To: Jean-Christophe Plagniol-Villard , Tomi Valkeinen Cc: kernel@pengutronix.de, linux-fbdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 1/3] video: fbdev: imxfb: fix semantic of .get_power and .set_power Date: Wed, 4 May 2016 11:43:16 +0200 Message-Id: <1462354998-5792-2-git-send-email-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.8.0.rc3 In-Reply-To: <1462354998-5792-1-git-send-email-u.kleine-koenig@pengutronix.de> References: <1462354998-5792-1-git-send-email-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::7 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-fbdev@vger.kernel.org Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Spam-Status: No, score=-9.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, 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 .set_power gets passed an FB_BLANK_XXX value, not a bool. So 0 signals on; and >1 means off. The same applies for return values of .get_power. Signed-off-by: Uwe Kleine-König Reviewed-by: Philipp Zabel --- Changes since (implicit) v1, sent with Message-Id: 1457380425-20244-2-git-send-email-u.kleine-koenig@pengutronix.de - Make it explicit that we're working on FB_BLANK_XXX values, suggested by Philipp Zabel. drivers/video/fbdev/imxfb.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/video/fbdev/imxfb.c b/drivers/video/fbdev/imxfb.c index 76b6a7784b06..6d402c1a0f2b 100644 --- a/drivers/video/fbdev/imxfb.c +++ b/drivers/video/fbdev/imxfb.c @@ -758,10 +758,11 @@ static int imxfb_lcd_get_power(struct lcd_device *lcddev) { struct imxfb_info *fbi = dev_get_drvdata(&lcddev->dev); - if (!IS_ERR(fbi->lcd_pwr)) - return regulator_is_enabled(fbi->lcd_pwr); + if (!IS_ERR(fbi->lcd_pwr) && + !regulator_is_enabled(fbi->lcd_pwr)) + return FB_BLANK_POWERDOWN; - return 1; + return FB_BLANK_UNBLANK; } static int imxfb_lcd_set_power(struct lcd_device *lcddev, int power) @@ -769,7 +770,7 @@ static int imxfb_lcd_set_power(struct lcd_device *lcddev, int power) struct imxfb_info *fbi = dev_get_drvdata(&lcddev->dev); if (!IS_ERR(fbi->lcd_pwr)) { - if (power) + if (power == FB_BLANK_UNBLANK) return regulator_enable(fbi->lcd_pwr); else return regulator_disable(fbi->lcd_pwr);