linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paul Mundt <lethal@linux-sh.org>
To: linux-fbdev@vger.kernel.org
Subject: Re: [PATCH] lxfb: Program panel v/h sync output polarity correctly
Date: Tue, 16 Nov 2010 09:52:32 +0000	[thread overview]
Message-ID: <20101116095232.GE1330@linux-sh.org> (raw)
In-Reply-To: <20101114141231.414F29D401B@zog.reactivated.net>

On Tue, Nov 16, 2010 at 09:33:52AM +0000, Daniel Drake wrote:
> On 16 November 2010 08:26, Michael Grzeschik <mgr@pengutronix.de> wrote:
> > I rechecked the Datasheet and it seems you are right with that.
> > But i don't like the logical mess in the statements. So here is what i
> > would prefer.
> >
> >>
> >> - ? ? ? ? ? ? if (info->var.sync & FB_SYNC_HOR_HIGH_ACT)
> >> + ? ? ? ? ? ? if (!(info->var.sync & FB_SYNC_HOR_HIGH_ACT))
> >> ? ? ? ? ? ? ? ? ? ? ? temp |= FP_PT2_HSP;
> >
> > Instead i would like to see something like this:
> >
> >
> > ? ? ? ? ? ? ? ?if (info->var.sync & FB_SYNC_HOR_HIGH_ACT)
> > ? ? ? ? ? ? ? ? ? ? ? ?temp &= ~(FP_PT2_HSP);
> 
> You'd have to add an else condition to actually set the bit (in the
> active low case) though.
> I'd be happy to do that, but my opinion is that my original version is cleaner.
> Apples vs oranges. Paul, which approach do you prefer?
> 
I'm fairly ambivalent. Some people like to write these things out
verbosely so it's immediately apparent what is going on, which can often
help when staring at non-obvious logic inversion. However, your original
version matches the current variable utilization fine, and the cases
involved are not that sufficiently complex that they're likely to be
misinterpreted.

The trying to make inverted logic appear more obvious angle is what
necessitated this change in the first place, so keeping it simple and
concise is certainly preferable (and indeed, another subtle bug would
have been introduced by flipping it around in the way proposed, as you
pointed out). Given that, and that we now have Michael's implicit
acknowledgement of the problem, I'll just take your original patch.

I can of course apply a follow-up patch that brings it in line with a
stylistic consensus if you two manage to come up with one at a later
point in time ;-)

      parent reply	other threads:[~2010-11-16  9:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-14 14:12 [PATCH] lxfb: Program panel v/h sync output polarity correctly Daniel Drake
2010-11-16  1:21 ` Paul Mundt
2010-11-16  8:26 ` Michael Grzeschik
2010-11-16  9:33 ` Daniel Drake
2010-11-16  9:52 ` Paul Mundt [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=20101116095232.GE1330@linux-sh.org \
    --to=lethal@linux-sh.org \
    --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;
as well as URLs for NNTP newsgroup(s).