To: linux-m68k@phil.uni-sb.de
Subject: Re: L68K: [2.1.33] doesn't compile...
References: <199704141724.TAA19120@odysseus.techfak.uni-bielefeld.de>
From: Jes Sorensen <Jes.Sorensen@cern.ch>
Date: 15 Apr 1997 09:29:42 +0200
In-Reply-To: Torsten Scherer's message of Mon, 14 Apr 1997 19:24:54 +0200 (MET DST)
Sender: owner-linux-m68k@phil.uni-sb.de
Reply-To: linux-m68k@phil.uni-sb.de

>>>>> "Torsten" == Torsten Scherer <itschere@TechFak.Uni-Bielefeld.DE> writes:

Torsten>  ...because of 'currcons' not known in putc_2_plane() in
Torsten> arch/m68k/console/ fbcon.c. I can only see that

Torsten>  a) this must be due to a macro expanding 'x' into
Torsten> '(vc_cons[currcons].d-> vc_x)' as included from
Torsten> ../../../drivers/char/console_struct.h

Correct, a situation I am not exactly pleased with but still I thought
I had them all.

Torsten>  b) all other functions that I've found take 'currcons' as
Torsten> parameter, so I don't know where to take it from in
Torsten> putc_2_plane() because I consider all this console stuff
Torsten> weird.

Please the patch appended below.

Jes

PS: fbcon.c is really messy with totally messed up indentions (or
rather missing indentions) - if no-one objects I would like to run it
through C-x C-M-\.

--- release/linux-2.1.33/arch/m68k/console/fbcon.c	Sun Apr 13 19:26:03 1997
+++ linux/arch/m68k/console/fbcon.c	Tue Apr 15 09:23:28 1997
@@ -2656,8 +2656,8 @@
 		 * done with memmove()
 		 */
 		mymemmove(p->screen_base + dy * p->next_line * p->fontheight,
-				   p->screen_base + sy * p->next_line * p->fontheight,
-				   p->next_line * height * p->fontheight);
+			  p->screen_base + sy * p->next_line * p->fontheight,
+			  p->next_line * height * p->fontheight);
     } else {
         int rows, cols;
         u_char *src;
@@ -2764,8 +2764,8 @@
     int bytes = p->next_line;
     int lines = height * p->fontheight;
     ulong  size;
-	u_long          cval;
-	u_short			pcval;
+    u_long          cval;
+    u_short			pcval;
 
     cval = expand2l (COLOR_2P (attr_bgcol_ec(p,conp)));
 
@@ -2807,28 +2807,29 @@
 }
 
 
-static void putc_2_plane(struct vc_data *conp, struct display *p, int c, int yy,
-                         int xx)
+static void putc_2_plane(struct vc_data *conp, struct display *p, int
+			 c, int yy, int xx)
 {
-   u_char   *dest;
-    u_char   *cdat;
-    int rows;
-    int bytes = p->next_line;
-	ulong			  eorx, fgx, bgx, fdx;
+	u_char   *dest;
+	u_char   *cdat;
+	int rows;
+	int bytes = p->next_line;
+	ulong    eorx, fgx, bgx, fdx;
 
 	c &= 0xff;
 
-    dest  = p->screen_base + yy * p->fontheight * bytes + (x>>1)*4 + (xx & 1);
-    cdat  = p->fontdata + (c * p->fontheight);
+	dest  = p->screen_base + yy * p->fontheight * bytes +
+		(xx >> 1)*4 + (xx & 1);
+	cdat  = p->fontdata + (c * p->fontheight);
 
 	fgx   = expand2w(COLOR_2P(attr_fgcol(p,conp)));
 	bgx   = expand2w(COLOR_2P(attr_bgcol(p,conp)));
 	eorx  = fgx ^ bgx;
 
-    for(rows = p->fontheight ; rows-- ; dest += bytes) {
+	for(rows = p->fontheight ; rows-- ; dest += bytes) {
 		fdx = dup2w(*cdat++);
 		__asm__ __volatile__ ("movepw %1,%0@(0)" : /* no outputs */
-							   : "a" (dest), "d" ((fdx & eorx) ^ bgx));
+				      : "a" (dest), "d" ((fdx & eorx) ^ bgx));
 	}
 }
 
@@ -2837,13 +2838,14 @@
                           const char *s, int count, int yy, int xx)
 {
 	u_char   *dest, *dest0;
-    u_char   *cdat, c;
-    int rows;
-    int bytes;
-	ulong			  eorx, fgx, bgx, fdx;
-
-    bytes = p->next_line;
-    dest0 = p->screen_base + yy * p->fontheight * bytes + (x>>1)*4 + (xx & 1);
+	u_char   *cdat, c;
+	int rows;
+	int bytes;
+	ulong    eorx, fgx, bgx, fdx;
+
+	bytes = p->next_line;
+	dest0 = p->screen_base + yy * p->fontheight * bytes
+		+ (xx >> 1)*4 + (xx & 1);
 	fgx   = expand2w(COLOR_2P(attr_fgcol(p,conp)));
 	bgx   = expand2w(COLOR_2P(attr_bgcol(p,conp)));
 	eorx  = fgx ^ bgx;
@@ -2856,7 +2858,7 @@
 		for(rows = p->fontheight, dest = dest0; rows-- ; dest += bytes) {
 			fdx = dup2w(*cdat++);
 			__asm__ __volatile__ ("movepw %1,%0@(0)" : /* no outputs */
-								   : "a" (dest), "d" ((fdx & eorx) ^ bgx));
+					      : "a" (dest), "d" ((fdx & eorx) ^ bgx));
 		}
 		INC_2P(dest0);
 	}
@@ -2865,23 +2867,24 @@
 
 static void rev_char_2_plane(struct display *p, int xx, int yy)
 {
-   u_char *dest;
-   int j;
-   int bytes;
-
-   dest = p->screen_base + yy * p->fontheight * p->next_line + (x>>1)*4 + (xx & 1);
-   j = p->fontheight;
-   bytes = p->next_line;
-   while (j--)
-     {
-      /* This should really obey the individual character's
-       * background and foreground colors instead of simply
-       * inverting.
-       */
-       dest[0] = ~dest[0];
-       dest[2] = ~dest[2];
-       dest += bytes;
-     }
+	u_char *dest;
+	int j;
+	int bytes;
+
+	dest = p->screen_base + yy * p->fontheight * p->next_line +
+		(xx >> 1)*4 + (xx & 1);
+	j = p->fontheight;
+	bytes = p->next_line;
+	while (j--)
+	{
+		/* This should really obey the individual character's
+		 * background and foreground colors instead of simply
+		 * inverting.
+		 */
+		dest[0] = ~dest[0];
+		dest[2] = ~dest[2];
+		dest += bytes;
+	}
 }
 #endif /* CONFIG_FBCON_2PLANE */
 
@@ -2920,8 +2923,8 @@
 		 * done with memmove()
 		 */
 		mymemmove(p->screen_base + dy * p->next_line * p->fontheight,
-				   p->screen_base + sy * p->next_line * p->fontheight,
-				   p->next_line * height * p->fontheight);
+			  p->screen_base + sy * p->next_line * p->fontheight,
+			  p->next_line * height * p->fontheight);
     } else {
         int rows, cols;
         u_char *src;
@@ -3028,9 +3031,9 @@
     int bytes = p->next_line;
     int lines = height * p->fontheight;
     ulong  size;
-	u_long          cval1, cval2, pcval;
+    u_long          cval1, cval2, pcval;
 
-	expand4dl(attr_bgcol_ec(p,conp), &cval1, &cval2);
+    expand4dl(attr_bgcol_ec(p,conp), &cval1, &cval2);
 
     if (sx == 0 && width == bytes/4) {
 
@@ -3070,28 +3073,29 @@
 }
 
 
-static void putc_4_plane(struct vc_data *conp, struct display *p, int c, int yy,
-                         int xx)
+static void putc_4_plane(struct vc_data *conp, struct display *p, int
+			 c, int yy, int xx)
 {
 	u_char   *dest;
-    u_char   *cdat;
-    int rows;
-    int bytes = p->next_line;
-	ulong			  eorx, fgx, bgx, fdx;
+	u_char   *cdat;
+	int rows;
+	int bytes = p->next_line;
+	ulong	  eorx, fgx, bgx, fdx;
 
 	c &= 0xff;
 
-    dest  = p->screen_base + yy * p->fontheight * bytes + (x>>1)*8 + (x & 1);
-    cdat  = p->fontdata + (c * p->fontheight);
+	dest  = p->screen_base + yy * p->fontheight * bytes +
+		(xx >> 1)*8 + (xx & 1);
+	cdat  = p->fontdata + (c * p->fontheight);
 
 	fgx   = expand4l(attr_fgcol(p,conp));
 	bgx   = expand4l(attr_bgcol(p,conp));
 	eorx  = fgx ^ bgx;
 
-    for(rows = p->fontheight ; rows-- ; dest += bytes) {
+	for(rows = p->fontheight ; rows-- ; dest += bytes) {
 		fdx = dup4l(*cdat++);
 		__asm__ __volatile__ ("movepl %1,%0@(0)" : /* no outputs */
-							   : "a" (dest), "d" ((fdx & eorx) ^ bgx));
+				      : "a" (dest), "d" ((fdx & eorx) ^ bgx));
 	}
 }
 
@@ -3100,13 +3104,14 @@
                           const char *s, int count, int yy, int xx)
 {
 	u_char   *dest, *dest0;
-    u_char   *cdat, c;
-    int rows;
-    int bytes;
-	ulong			  eorx, fgx, bgx, fdx;
-
-    bytes = p->next_line;
-    dest0 = p->screen_base + yy * p->fontheight * bytes + (x>>1)*8 + (x & 1);
+	u_char   *cdat, c;
+	int rows;
+	int bytes;
+	ulong	  eorx, fgx, bgx, fdx;
+
+	bytes = p->next_line;
+	dest0 = p->screen_base + yy * p->fontheight * bytes
+		+ (xx >> 1)*8 + (xx & 1);
 	fgx   = expand4l(attr_fgcol(p,conp));
 	bgx   = expand4l(attr_bgcol(p,conp));
 	eorx  = fgx ^ bgx;
@@ -3126,7 +3131,7 @@
 		for(rows = p->fontheight, dest = dest0; rows-- ; dest += bytes) {
 			fdx = dup4l(*cdat++);
 			__asm__ __volatile__ ("movepl %1,%0@(0)" : /* no outputs */
-								   : "a" (dest), "d" ((fdx & eorx) ^ bgx));
+					      : "a" (dest), "d" ((fdx & eorx) ^ bgx));
 		}
 		INC_4P(dest0);
 	}
@@ -3139,7 +3144,8 @@
    int j;
    int bytes;
 
-   dest = p->screen_base + yy * p->fontheight * p->next_line + (x>>1)*8 + (x & 1);
+   dest = p->screen_base + yy * p->fontheight * p->next_line +
+	   (xx >> 1)*8 + (xx & 1);
    j = p->fontheight;
    bytes = p->next_line;
 
@@ -3307,15 +3313,16 @@
     int bytes = p->next_line;
     int lines = height * p->fontheight;
     ulong  size;
-	u_long          cval1, cval2, cval3, cval4, pcval1, pcval2;
+    u_long          cval1, cval2, cval3, cval4, pcval1, pcval2;
 
-	expand8ql(attr_bgcol_ec(p,conp), cval1, cval2, cval3, cval4);
+    expand8ql(attr_bgcol_ec(p,conp), cval1, cval2, cval3, cval4);
 
     if (sx == 0 && width == bytes/8) {
 
         offset = sy * bytes * p->fontheight;
         size   = lines * bytes;
-		memset_even_8p(p->screen_base+offset, size, cval1, cval2, cval3, cval4);
+		memset_even_8p(p->screen_base+offset, size, cval1,
+			       cval2, cval3, cval4);
 
     } else {
 
@@ -3354,28 +3361,29 @@
                          int xx)
 {
 	u_char   *dest;
-    u_char   *cdat;
-    int rows;
-    int bytes = p->next_line;
-	ulong			  eorx1, eorx2, fgx1, fgx2, bgx1, bgx2, fdx;
+	u_char   *cdat;
+	int rows;
+	int bytes = p->next_line;
+	ulong	  eorx1, eorx2, fgx1, fgx2, bgx1, bgx2, fdx;
 
 	c &= 0xff;
 
-    dest  = p->screen_base + yy * p->fontheight * bytes + (x>>1)*16 + (x & 1);
-    cdat  = p->fontdata + (c * p->fontheight);
+	dest  = p->screen_base + yy * p->fontheight * bytes +
+		(xx >> 1)*16 + (xx & 1);
+	cdat  = p->fontdata + (c * p->fontheight);
 
 	expand8dl(attr_fgcol(p,conp), &fgx1, &fgx2);
 	expand8dl(attr_bgcol(p,conp), &bgx1, &bgx2);
 	eorx1  = fgx1 ^ bgx1; eorx2  = fgx2 ^ bgx2;
 
-    for(rows = p->fontheight ; rows-- ; dest += bytes) {
+	for(rows = p->fontheight ; rows-- ; dest += bytes) {
 		fdx = dup4l(*cdat++);
 		__asm__ __volatile__
 			("movepl %1,%0@(0)\n\t"
-			  "movepl %2,%0@(8)"
-			  : /* no outputs */
-			  : "a" (dest), "d" ((fdx & eorx1) ^ bgx1),
-			    "d" ((fdx & eorx2) ^ bgx2)
+			 "movepl %2,%0@(8)"
+			 : /* no outputs */
+			 : "a" (dest), "d" ((fdx & eorx1) ^ bgx1),
+			 "d" ((fdx & eorx2) ^ bgx2)
 			);
 	}
 }
@@ -3385,13 +3393,14 @@
                           const char *s, int count, int yy, int xx)
 {
 	u_char   *dest, *dest0;
-    u_char   *cdat, c;
-    int rows;
-    int bytes;
-	ulong			  eorx1, eorx2, fgx1, fgx2, bgx1, bgx2, fdx;
-
-    bytes = p->next_line;
-    dest0 = p->screen_base + yy * p->fontheight * bytes + (x>>1)*16 + (x & 1);
+	u_char   *cdat, c;
+	int rows;
+	int bytes;
+	ulong	  eorx1, eorx2, fgx1, fgx2, bgx1, bgx2, fdx;
+
+	bytes = p->next_line;
+	dest0 = p->screen_base + yy * p->fontheight * bytes
+		+ (xx >> 1)*16 + (xx & 1);
 
 	expand8dl(attr_fgcol(p,conp), &fgx1, &fgx2);
 	expand8dl(attr_bgcol(p,conp), &bgx1, &bgx2);
@@ -3426,28 +3435,29 @@
 
 static void rev_char_8_plane(struct display *p, int xx, int yy)
 {
-   u_char *dest;
-   int j;
-   int bytes;
-
-   dest = p->screen_base + yy * p->fontheight * p->next_line + (x>>1)*16 + (x & 1);
-   j = p->fontheight;
-   bytes = p->next_line;
-
-   while (j--)
-     {
-      /* This should really obey the individual character's
-       * background and foreground colors instead of simply
-       * inverting. For 8 plane mode, only the lower 4 bits of the
-       * color are inverted, because only that color registers have
-       * been set up.
-       */
-       dest[0] = ~dest[0];
-       dest[2] = ~dest[2];
-       dest[4] = ~dest[4];
-       dest[6] = ~dest[6];
-       dest += bytes;
-     }
+	u_char *dest;
+	int j;
+	int bytes;
+
+	dest = p->screen_base + yy * p->fontheight * p->next_line
+		+ (xx >> 1)*16 + (xx & 1);
+	j = p->fontheight;
+	bytes = p->next_line;
+
+	while (j--)
+	{
+		/* This should really obey the individual character's
+		 * background and foreground colors instead of simply
+		 * inverting. For 8 plane mode, only the lower 4 bits of the
+		 * color are inverted, because only that color registers have
+		 * been set up.
+		 */
+		dest[0] = ~dest[0];
+		dest[2] = ~dest[2];
+		dest[4] = ~dest[4];
+		dest[6] = ~dest[6];
+		dest += bytes;
+	}
 }
 #endif /* CONFIG_FBCON_8PLANE */
 
