mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Christian Trefzer <ctrefzer@gmx.de>
To: Kyle Moffett <mrmacman_g4@mac.com>
Cc: "Antonino A. Daplas" <adaplas@gmail.com>,
	lkml <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] neofb: add more logic to determine sensibility of register readback
Date: Sat, 11 Feb 2006 11:42:54 +0100	[thread overview]
Message-ID: <20060211104253.GA13789@hermes.uziel.local> (raw)
In-Reply-To: <632EF49A-33EB-4FAE-B2E2-F36446F9C8B6@mac.com>

[-- Attachment #1: Type: text/plain, Size: 2616 bytes --]

On Fri, Feb 10, 2006 at 11:41:34AM -0500, Kyle Moffett wrote:
> On Feb 10, 2006, at 06:53, Antonino A. Daplas wrote:
> >Christian Trefzer wrote:
> >>+		par->PanelDispCntlRegRead = 0;
> >>+		par->PanelDispCntlRegRead = 0;
> >>+		par->PanelDispCntlRegRead = 0;
> >>+		par->PanelDispCntlRegRead = 0;
> >>+		par->PanelDispCntlRegRead = 1;
> >
> >You can save a few lines by
> >
> >par->PanelDispCntlRegRead = (blank_mode) ? 0 : 1;
> 
> How about the really simple so-obvious-its-impossible-to-misread  
> solution?
> 
> par->PanelDispCntlRegRead = !blank_mode;

Where is my mind..?

Sure, why not. Guess I had my head too much in the smoke clouds of not
knowing why a dead-sure-to-work implementation still would not do the
right thing, I already thought I got the C representation of true and
false wrong. Even Tony's hint would be clearer than my code, but that
can in turn be condensed into something really obvious. It's just a
negation, after all. Silly me.

Changed patch below. Should be the final one now, right?

Signed-off-by: Christian Trefzer <ctrefzer@gmx.de>


--- a/include/video/neomagic.h	2006-01-03 04:21:10.000000000 +0100
+++ b/include/video/neomagic.h	2006-02-09 20:59:20.164839408 +0100
@@ -159,6 +159,7 @@
 	unsigned char PanelDispCntlReg1;
 	unsigned char PanelDispCntlReg2;
 	unsigned char PanelDispCntlReg3;
+	unsigned char PanelDispCntlRegRead;
 	unsigned char PanelVertCenterReg1;
 	unsigned char PanelVertCenterReg2;
 	unsigned char PanelVertCenterReg3;
--- a/drivers/video/neofb.c	2006-02-08 21:24:05.000000000 +0100
+++ b/drivers/video/neofb.c	2006-02-11 11:39:39.346365480 +0100
@@ -843,6 +843,9 @@
 
 	par->SysIfaceCntl2 = 0xc0;	/* VESA Bios sets this to 0x80! */
 
+	/* Initialize: by default, we want display config register to be read */
+	par->PanelDispCntlRegRead = 1;
+
 	/* Enable any user specified display devices. */
 	par->PanelDispCntlReg1 = 0x00;
 	if (par->internal_display)
@@ -1334,8 +1337,12 @@
 	struct neofb_par *par = (struct neofb_par *)info->par;
 	int seqflags, lcdflags, dpmsflags, reg;
 
-	/* Reload the value stored in the register, might have been changed via FN keystroke */
-	par->PanelDispCntlReg1 = vga_rgfx(NULL, 0x20) & 0x03;
+	/* Reload the value stored in the register, if sensible. It might have been
+	 * changed via FN keystroke. */
+	if (par->PanelDispCntlRegRead && !blank_mode) {
+		par->PanelDispCntlReg1 = vga_rgfx(NULL, 0x20) & 0x03;
+	}
+	par->PanelDispCntlRegRead = !blank_mode;
 	
 	switch (blank_mode) {
 	case FB_BLANK_POWERDOWN:	/* powerdown - both sync lines down */

[-- Attachment #2: Type: application/pgp-signature, Size: 827 bytes --]

      reply	other threads:[~2006-02-11 10:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-08 20:22 [PATCH] neofb: avoid resetting display config on unblank Christian Trefzer
2006-02-10 11:36 ` [PATCH] neofb: add more logic to determine sensibility of register readback Christian Trefzer
2006-02-10 11:53   ` Antonino A. Daplas
2006-02-10 13:57     ` Christian Trefzer
2006-02-10 16:41     ` Kyle Moffett
2006-02-11 10:42       ` Christian Trefzer [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=20060211104253.GA13789@hermes.uziel.local \
    --to=ctrefzer@gmx.de \
    --cc=adaplas@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mrmacman_g4@mac.com \
    /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

all inboxes | Powered by JetHome®