From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: linux-fbdev@vger.kernel.org
Subject: Re: [PATCH 27/57] fbdev: sh_mobile_lcdc: Pass a video mode to the notify callback
Date: Mon, 19 Dec 2011 01:29:55 +0000 [thread overview]
Message-ID: <201112190229.57229.laurent.pinchart@ideasonboard.com> (raw)
In-Reply-To: <1323784972-24205-28-git-send-email-laurent.pinchart@ideasonboard.com>
Hi Guennadi,
On Friday 16 December 2011 11:33:55 Guennadi Liakhovetski wrote:
> On Fri, 16 Dec 2011, Laurent Pinchart wrote:
> > On Thursday 15 December 2011 20:01:54 Guennadi Liakhovetski wrote:
> > > On Tue, 13 Dec 2011, Laurent Pinchart wrote:
> > > > Pass pointers to struct fb_videomode and struct fb_monspecs instead
> > > > of struct fb_var_screeninfo to the notify callback.
> > > >
> > > > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > > > ---
> > > >
> > > > drivers/video/sh_mobile_hdmi.c | 59
> > > > +++++++++++++++++--------------------
> > > > drivers/video/sh_mobile_lcdcfb.c
> > > >
> > > > | 40 ++++++++++++++----------- drivers/video/sh_mobile_lcdcfb.h |
> > > >
> > > > 3 +-
> > > > 3 files changed, 51 insertions(+), 51 deletions(-)
> > >
> > > [snip]
> > >
> > > > diff --git a/drivers/video/sh_mobile_lcdcfb.c
> > > > b/drivers/video/sh_mobile_lcdcfb.c index 21e5f10..4ec216e 100644
> > > > --- a/drivers/video/sh_mobile_lcdcfb.c
> > > > +++ b/drivers/video/sh_mobile_lcdcfb.c
> > >
> > > [ditto]
> > >
> > > > @@ -433,12 +432,17 @@ static int sh_mobile_lcdc_display_notify(struct
> > > > sh_mobile_lcdc_chan *ch,
> > > >
> > > > }
> > > > break;
> > > >
> > > > - case SH_MOBILE_LCDC_EVENT_DISPLAY_MODE:
> > > > + case SH_MOBILE_LCDC_EVENT_DISPLAY_MODE: {
> > > > + struct fb_var_screeninfo var;
> > > > +
> > > >
> > > > /* Validate a proposed new mode */
> > > >
> > > > - var->bits_per_pixel = info->var.bits_per_pixel;
> > > > - ret = info->fbops->fb_check_var(var, info);
> > > > + fb_videomode_to_var(&var, mode);
> > > > + var.bits_per_pixel = info->var.bits_per_pixel;
> > > > + var.grayscale = info->var.grayscale;
> > > > + ret = info->fbops->fb_check_var(&var, info);
> > > >
> > > > break;
> > > >
> > > > }
> > > >
> > > > + }
> > >
> > > nitpick - please, realign:-)
> >
> > It's common in driver code not to increase the identation level twice in
> > a case statement if braces are needed. However, those "braced"
> > statements are usually not the last ones in the switch. In this
> > particular case this creates an alignment issue at the end, as your
> > correctly pointed out. However, I'd like to avoid increasing the
> > indentation of the whole block. Increasing the indentation of the
> > closing brace only also causes an alignment issue. I can add a default
> > case that returns an error to fix this, but that's adding code to fix a
> > cosmetic problem :-) What's your preference.
>
> Personally, I don't like just using braces without a related statement
> like "if," "do," etc. In such "case" cases I usually avoid adding own
> braces and just put any declarations, that are needed there in the
> enclosing block, e.g., the function.
Using braces with case statements is a common practice in the kernel, without
adding an extra indentation level.
In this particular case I can move the variable declaration at the top of the
function, as the generated code on ARM (at least with gcc ('cs2009q3-67-hard-
sb4') 4.4.1) doesn't differ.
> If you really don't want either, I would probably prefer a style like
>
> switch (x) {
> case X:
> {
> int y;
> my_statement(y);
> break;
> }
> }
>
> You could also do
>
> switch (x) {
> case X:
> do {
> int y;
> my_statement(y);
> break;
> } while (0);
> }
>
> So, choose your poison:-)
--
Regards,
Laurent Pinchart
prev parent reply other threads:[~2011-12-19 1:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-13 14:02 [PATCH 27/57] fbdev: sh_mobile_lcdc: Pass a video mode to the notify callback Laurent Pinchart
2011-12-15 19:01 ` [PATCH 27/57] fbdev: sh_mobile_lcdc: Pass a video mode to the Guennadi Liakhovetski
2011-12-16 10:10 ` [PATCH 27/57] fbdev: sh_mobile_lcdc: Pass a video mode to the notify callback Laurent Pinchart
2011-12-16 10:33 ` [PATCH 27/57] fbdev: sh_mobile_lcdc: Pass a video mode to the Guennadi Liakhovetski
2011-12-19 1:29 ` Laurent Pinchart [this message]
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=201112190229.57229.laurent.pinchart@ideasonboard.com \
--to=laurent.pinchart@ideasonboard.com \
--cc=linux-fbdev@vger.kernel.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