[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150325220059.GP23664@lukather>
Date: Wed, 25 Mar 2015 15:00:59 -0700
From: Maxime Ripard <maxime.ripard@...e-electrons.com>
To: Olliver Schinagl <oliver@...inagl.nl>
Cc: Thomas Niederprüm <niederp@...sik.uni-kl.de>,
plagnioj@...osoft.com, tomi.valkeinen@...com,
kernel@...gutronix.de, shawn.guo@...aro.org, robh+dt@...nel.org,
linux-fbdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCHv5 11/11] fbdev: ssd1307fb: Add blank mode
On Wed, Mar 25, 2015 at 04:50:05PM +0100, Olliver Schinagl wrote:
> Hey Thomas,
>
> On 24-03-15 22:23, Thomas Niederprüm wrote:
> >This patch adds ssd1307fb_blank() to make the framebuffer capable
> >of blanking.
> >
> >Signed-off-by: Thomas Niederprüm <niederp@...sik.uni-kl.de>
> >---
> > drivers/video/fbdev/ssd1307fb.c | 13 +++++++++++++
> > 1 file changed, 13 insertions(+)
> >
> >diff --git a/drivers/video/fbdev/ssd1307fb.c b/drivers/video/fbdev/ssd1307fb.c
> >index 061cc95..9101b27 100644
> >--- a/drivers/video/fbdev/ssd1307fb.c
> >+++ b/drivers/video/fbdev/ssd1307fb.c
> >@@ -238,6 +238,18 @@ static ssize_t ssd1307fb_write(struct fb_info *info, const char __user *buf,
> > return count;
> > }
> >
> >+static int ssd1307fb_blank(int blank_mode, struct fb_info *info)
> >+{
> >+ struct ssd1307fb_par *par = info->par;
> >+ int ret;
> >+
> >+ if (blank_mode != FB_BLANK_UNBLANK)
> >+ ret = ssd1307fb_write_cmd(par->client, SSD1307FB_DISPLAY_OFF);
> >+ else
> >+ ret = ssd1307fb_write_cmd(par->client, SSD1307FB_DISPLAY_ON);
> I'd probably add an extra return, or drop the ret var at all and just return
> the function.
>
> or even shorter :)
> return sd1307fb_write_cmd(par->client, (blank_mode != FB_BLANK_UNBLANK) ?
> SSD1307FB_DISPLAY_OFF : SSD1307FB_DISPLAY_ON;
In some domains, shorter is not better ;)
This is one of these cases. It's much clearer as it is.
Maxime
--
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
Download attachment "signature.asc" of type "application/pgp-signature" (820 bytes)
Powered by blists - more mailing lists