[patch] 2.5.62-ac1: fix the compilation of aty128fb.c

From: Adrian Bunk (bunk@fs.tum.de)
Date: Fri Feb 21 2003 - 10:27:25 EST


On Thu, Feb 20, 2003 at 05:33:08PM -0500, Alan Cox wrote:

>...
> Linux 2.5.62-ac1
>...
> o FBdev updates (James Simmons)
>...

gcc 2.95 doesn't like variable declarations in the middle of a function:

<-- snip -->

...
  gcc -Wp,-MD,drivers/video/.aty128fb.o.d -D__KERNEL__ -Iinclude -Wall
-Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -pipe
-mpreferred-stack-boundary=2 -march=k6 -Iinclude/asm-i386/mach-default -nostdinc
-iwithprefix include -DKBUILD_BASENAME=aty128fb -DKBUILD_MODNAME=aty128fb -c -o drivers
/video/aty128fb.o drivers/video/aty128fb.c
drivers/video/aty128fb.c: In function `aty128_map_ROM':
drivers/video/aty128fb.c:1811: parse error before `unsigned'
drivers/video/aty128fb.c:1814: `addr' undeclared (first use in this function)
drivers/video/aty128fb.c:1814: (Each undeclared identifier is reported only once
drivers/video/aty128fb.c:1814: for each function it appears in.)
drivers/video/aty128fb.c: In function `aty128_unmap_ROM':
drivers/video/aty128fb.c:1827: parse error before `struct'
drivers/video/aty128fb.c:1828: `r' undeclared (first use in this function)
make[2]: *** [drivers/video/aty128fb.o] Error 1

<-- snip -->

The following patch fixes the compilation:

--- linux-2.5.62-ac/drivers/video/aty128fb.c.old 2003-02-21 16:14:58.000000000 +0100
+++ linux-2.5.62-ac/drivers/video/aty128fb.c 2003-02-21 16:21:02.000000000 +0100
@@ -1793,6 +1793,8 @@
 #if !defined(CONFIG_PPC) && !defined(__sparc__)
 static void * __init aty128_map_ROM(struct pci_dev *dev)
 {
+ unsigned char *addr;
+
         // If this is a primary card, there is a shadow copy of the
         // ROM somewhere in the first meg. We will just ignore the copy
         // and use the ROM directly.
@@ -1808,7 +1810,7 @@
         if (!(r->flags & PCI_ROM_ADDRESS_ENABLE))
                 pci_write_config_dword(dev, dev->rom_base_reg, r->start | PCI_ROM_ADDRESS_ENABLE);
         
- unsigned char *addr = ioremap(r->start, r->end - r->start + 1);
+ addr = ioremap(r->start, r->end - r->start + 1);
         
         // Very simple test to make sure it appeared
         if (addr && (*addr != 0x55)) {
@@ -1821,10 +1823,12 @@
 
 static void __init aty128_unmap_ROM(struct pci_dev *dev, void * rom)
 {
+ struct resource *r;
+
         iounmap(rom);
         
         // leave it disabled and unassigned
- struct resource *r = &dev->resource[PCI_ROM_RESOURCE];
+ r = &dev->resource[PCI_ROM_RESOURCE];
         r->flags &= !PCI_ROM_ADDRESS_ENABLE;
         r->end -= r->start;
         r->start = 0;

cu
Adrian

-- 

"Is there not promise of rain?" Ling Tan asked suddenly out of the darkness. There had been need of rain for many days. "Only a promise," Lao Er said. Pearl S. Buck - Dragon Seed

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Feb 23 2003 - 22:00:33 EST