From: Philipp Zabel <p.zabel@pengutronix.de>
To: linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 1/3] video: fbdev: imxfb: fix semantic of .get_power and .set_power
Date: Tue, 08 Mar 2016 07:55:30 +0000 [thread overview]
Message-ID: <1457423730.4174.4.camel@pengutronix.de> (raw)
In-Reply-To: <1457380425-20244-2-git-send-email-u.kleine-koenig@pengutronix.de>
Hi Uwe,
Am Montag, den 07.03.2016, 20:53 +0100 schrieb Uwe Kleine-König:
> .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.
I'd try to somehow work this information into the code to avoid future
confusion.
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
> drivers/video/fbdev/imxfb.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/video/fbdev/imxfb.c b/drivers/video/fbdev/imxfb.c
> index cee88603efc9..c5fcedde2a60 100644
> --- a/drivers/video/fbdev/imxfb.c
> +++ b/drivers/video/fbdev/imxfb.c
> @@ -759,9 +759,9 @@ 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);
> + return !regulator_is_enabled(fbi->lcd_pwr);
>
> - return 1;
> + return 0;
How about making it explicit:
if (!IS_ERR(fbi->lcd_pwr) &&
!regulator_is_enabled(fbi->lcd_pwr))
return FB_BLANK_POWERDOWN;
return FB_BLANK_UNBLANK;
> }
>
> static int imxfb_lcd_set_power(struct lcd_device *lcddev, int power)
> @@ -769,7 +769,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)
Same here:
if (power = FB_BLANK_UNBLANK)
> return regulator_enable(fbi->lcd_pwr);
> else
> return regulator_disable(fbi->lcd_pwr);
regards
Philipp
next prev parent reply other threads:[~2016-03-08 7:55 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-07 19:53 [PATCH 0/3] video: fbdev: imxfb: make it work again Uwe Kleine-König
2016-03-07 19:53 ` [PATCH 1/3] video: fbdev: imxfb: fix semantic of .get_power and .set_power Uwe Kleine-König
2016-03-08 7:55 ` Philipp Zabel [this message]
2016-03-08 8:30 ` Uwe Kleine-König
2016-03-07 19:53 ` [PATCH 2/3] video: fbdev: imxfb: enable lcd regulator in .probe Uwe Kleine-König
2016-03-11 11:22 ` Tomi Valkeinen
2016-04-20 19:17 ` Uwe Kleine-König
2016-07-05 10:09 ` Uwe Kleine-König
2016-07-05 12:08 ` Lothar Waßmann
2016-07-05 12:22 ` Uwe Kleine-König
2016-07-27 19:57 ` Uwe Kleine-König
2016-08-10 10:29 ` Tomi Valkeinen
2016-03-07 19:53 ` [PATCH 3/3] video: fbdev: imxfb: add some error handling Uwe Kleine-König
2016-03-08 8:00 ` Philipp Zabel
2016-03-11 11:26 ` Tomi Valkeinen
2016-03-07 20:03 ` [PATCH 0/3] video: fbdev: imxfb: make it work again Fabio Estevam
2016-03-07 20:10 ` Uwe Kleine-König
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1457423730.4174.4.camel@pengutronix.de \
--to=p.zabel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).