# Re: \[PATCH\] i810fb: Fix console switch regression

- From: Stefan Bauer \<hidden\>
- Date: 2008-03-17 08:21:05 
- List: linux-fbdev
- Page: https://ratatoskr.run/linux-fbdev/2008/03/1075382
- Thread: https://ratatoskr.run/lkml/2008/03/1075208/t.md

```text
Am Sonntag, 16. März 2008 20:48 schrieb Geert Uytterhoeven:
> On Sun, 16 Mar 2008, Stefan Bauer wrote:
> > --- linux-2.6/drivers/video/i810/i810_main.c.orig
> > +++ linux-2.6/drivers/video/i810/i810_main.c
> > @@ -1476,7 +1476,7 @@ static int i810fb_cursor(struct fb_info
> > 	struct i810fb_par *par = info->par;
> > 	u8 __iomem *mmio = par->mmio_start_virtual;
> >
> > -	if (!(par->dev_flags & LOCKUP))
> > +	if (!par->dev_flags & LOCKUP)
> > 		return -ENXIO;
>
> However, the original expression didn't make sense, as LOCKUP is 8 and
> !par->dev_flags is either 0 or 1, so `!par->dev_flags & LOCKUP' is
> always 0.
>
> I took a quick look at the usage of the LOCKUP flag. Apparently when a
> lock-up is detected, this flag is set, and the driver will fall back to
> software operations instead of hardware accelerated operations.
>
> Is it possible the intended code was
>
> 	if (par->dev_flags & LOCKUP)
> 		return -ENXIO;
>
> ?

Yes, IMO you are right. 4c7ffe0 ("fbdev: prevent drivers that have hardware 
cursors from calling software cursor code") introduced the senseless code.

I'm going on testing today, but I think that's it.

Again, please CC me, thanks.

---
From: Stefan Bauer <redacted>

Since 4c7ffe0b9f7f40bd818fe3af51342f64c483908e ("fbdev: prevent drivers that 
have hardware cursors from calling software cursor code") every call of 
i810fb_cursor fails with -ENXIO because of a incorrect "!".

This hasn't striked until eaa0ff15c30dc9799eb4d12660edb73aeb6d32c5 ("fix ! 
versus & precedence in various places") surrounded the expression with 
braces, so that the intended behavior was inverted. That caused 'pixel 
waste' - the same line of multi-colored pixels repeated over the whole 
screen - during console switch.

This switches back to the original pre-4c7ffe0 behavior.

Signed-off-by: Stefan Bauer <redacted>
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Antonino Daplas <redacted>

---
--- linux-2.6/drivers/video/i810/i810_main.c.orig
+++ linux-2.6/drivers/video/i810/i810_main.c
@@ -1476,7 +1476,7 @@ static int i810fb_cursor(struct fb_info
        struct i810fb_par *par = info->par;
        u8 __iomem *mmio = par->mmio_start_virtual;

-       if (!(par->dev_flags & LOCKUP))
+       if (par->dev_flags & LOCKUP)
                return -ENXIO;

        if (cursor->image.width > 64 || cursor->image.height > 64)

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
```
