Resent-Date: Fri, 20 Aug 1999 12:18:45 +0200 (MET DST)
Date: Fri, 20 Aug 1999 10:47:32 +0100
From: Lars Hecking <lhecking@nmrc.ucc.ie>
To: linux-m68k@lists.linux-m68k.org
Subject: [Fwd: Re: 2.3.14 clgen fix and oops]
Mail-Followup-To: linux-m68k@lists.linux-m68k.org
User-Agent: Mutt/0.96.4i
Resent-From: linux-m68k@phil.uni-sb.de


 Seeing that 2.3.14 comes with clgen 1.94.1, here is a patch
 from Jeff to fix an off-by-one error on Zorro and PCI.

 Still doesn't work on my 3000, but I'll do some more testing tonight.

----- Forwarded message from Jeff Garzik <jgarzik@pobox.com> -----

Attached is a patch to clgenfb 1.9.4.1, as found in 2.3.14 or via e-mail
notice.

This patch corrects an off-by-one error on both PCI and Zorro (doh!)
which could definitely make things go bonkers.  Any testing feedback of
this patch is greatly appreciated.

	Jeff

[...]

Index: drivers/video/clgenfb.c
===================================================================
RCS file: /home/cvsgarzik/linux_2_3/drivers/video/clgenfb.c,v
retrieving revision 1.1.1.5
diff -u -r1.1.1.5 clgenfb.c
--- clgenfb.c	1999/08/19 03:37:08	1.1.1.5
+++ clgenfb.c	1999/08/19 14:54:21
@@ -31,7 +31,7 @@
  *
  */
 
-#define CLGEN_VERSION "1.9.4.1"
+#define CLGEN_VERSION "1.9.4.2"
 
 #include <linux/module.h>
 #include <linux/kernel.h>
@@ -98,7 +98,6 @@
         if(!(expr)) { \
         printk( "Assertion failed! %s,%s,%s,line=%d\n",\
         #expr,__FILE__,__FUNCTION__,__LINE__); \
-        *(int*)0 = 0;\
         }
 #else
 #define assert(expr)
@@ -635,18 +634,18 @@
 		switch (_par->var.bits_per_pixel) {
 		case 1:
 		case 8:
-			fix->smem_start = (char *) _info->fbmem_phys;
+			fix->smem_start = _info->fbmem_phys;
 			break;
 		case 16:
-			fix->smem_start = (char *) _info->fbmem_phys + 1 * MB_;
+			fix->smem_start = _info->fbmem_phys + 1 * MB_;
 			break;
 		case 24:
 		case 32:
-			fix->smem_start = (char *) _info->fbmem_phys + 2 * MB_;
+			fix->smem_start = _info->fbmem_phys + 2 * MB_;
 			break;
 		}
 	} else {
-		fix->smem_start = (char *) _info->fbmem_phys;
+		fix->smem_start = _info->fbmem_phys;
 	}
 
 	/* monochrome: only 1 memory plane */
@@ -662,7 +661,7 @@
 	fix->line_length = _par->line_length;
 
 	/* FIXME: map region at 0xB8000 if available, fill in here */
-	fix->mmio_start = (char *) NULL;
+	fix->mmio_start = 0;
 	fix->mmio_len = 0;
 	fix->accel = FB_ACCEL_NONE;
 
@@ -831,7 +830,7 @@
 	if (_par->var.yoffset > _par->var.yres_virtual - _par->var.yres)
 		_par->var.yoffset = _par->var.yres_virtual - _par->var.yres - 1;
 
-	switch (var->bits_per_pixel) {
+	switch (_par->var.bits_per_pixel) {
 	case 1:
 		_par->line_length = _par->var.xres_virtual / 8;
 		_par->visual = FB_VISUAL_MONO10;
@@ -900,7 +899,8 @@
 		break;
 
 	default:
-		assert (0);
+		DPRINTK("Unsupported bpp size: %d\n", _par->var.bits_per_pixel);
+		assert (FALSE);
 		/* should never occur */
 		break;
 	}
@@ -951,7 +951,7 @@
 
 	bestclock (freq, &_par->freq, &_par->nom, &_par->den, &_par->div,
 		   maxclock);
-	_par->mclk = clgen_get_mclk (freq, var->bits_per_pixel, &_par->divMCLK);
+	_par->mclk = clgen_get_mclk (freq, _par->var.bits_per_pixel, &_par->divMCLK);
 
 	xres = _par->var.xres;
 	hfront = _par->var.right_margin;
@@ -2326,7 +2326,7 @@
 					clgen_pci_probe_list[i].device, NULL);
 	
 	if (pdev)
-		*btype = clgen_pci_probe_list[i].btype;
+		*btype = clgen_pci_probe_list[i - 1].btype;
 
 	DPRINTK ("EXIT, returning %p\n", pdev);
 	return pdev;
@@ -2485,7 +2485,7 @@
 			*key2_o = zorro_find (clgen_zorro_probe_list[i].key2, 0, 0);
 		else
 			*key2_o = 0;
-		*btype = clgen_zorro_probe_list[i].btype;
+		*btype = clgen_zorro_probe_list[i - 1].btype;
 		
 		printk (KERN_INFO "clgen: %s board detected; ",
 			clgen_board_info[*btype].name);
@@ -3277,7 +3277,7 @@
 			break;
 		default:
 			/* should never occur */
-			assert (0);
+			assert (FALSE);
 			break;
 		}
 

----- End forwarded message -----

