Subject: [PATCH] const mips_io_port_base !?

From: Florian Lohoff <[email-masked]>
Date: Tue, 27 Nov 2001 01:02:14 +0100

For the reason of compilability one should build a consensus ...

diff -u -r1.29 io.h
--- include/asm-mips/io.h	2001/11/26 11:14:37	1.29
+++ include/asm-mips/io.h	2001/11/27 01:00:07
@@ -60,7 +60,7 @@
  * instruction, so the lower 16 bits must be zero.  Should be true on
  * on any sane architecture; generic code does not use this assumption.
  */
-extern const unsigned long mips_io_port_base;
+extern unsigned long mips_io_port_base;
 
 #define set_io_port_base(base)	\
 	do { * (unsigned long *) &mips_io_port_base = (base); } while (0)

Or the other way round ...

Flo
-- 
Florian Lohoff                  [email-masked]             +49-5201-669912
Nine nineth on september the 9th              Welcome to the new billenium

---

From: Ralf Baechle <[email-masked]>
Date: Tue, 27 Nov 2001 17:15:44 +1100

On Tue, Nov 27, 2001 at 01:02:14AM +0100, Florian Lohoff wrote:

Blame whoever designed C that there is no sane way to give a variable an
attribute like "will never change again after the first initalization thus
keeping the value in a register beyond function calls and any other kind
of memory barrier is ok".  This inconsistence merily achieves a better
optimization of the code; the set_* function is intended to hide this cute
little standard violation away ...

  Ralf

---

From: Florian Lohoff <[email-masked]>
Date: Wed, 28 Nov 2001 14:13:39 +0100

> little standard violation away ...

The problem is that it doesnt build without the patch:

mipsel-linux-gcc -I /home/mnt/mips/dec/linux/include/asm/gcc
-D__KERNEL__ -I/home/mnt/mips/dec/linux/include -Wall
-Wstrict-prototypes -Wno-trigraphs -O2 -fomit-frame-pointer
-fno-strict-aliasing -fno-common -G 0 -mno-abicalls -fno-pic -mcpu=r4600
-mips2 -Wa,--trap -pipe    -DEXPORT_SYMTAB -c setup.c
Assembler messages:
Warning: The -mcpu option is deprecated.  Please use -march and -mtune
instead.
Warning: The -march option is incompatible to -mipsN and therefore
ignored.
setup.c:109: conflicting types for `mips_io_port_base'
/home/mnt/mips/dec/linux/include/asm/io.h:63: previous declaration of
`mips_io_port_base'
setup.c: In function `setup_arch':
setup.c:678: warning: unused variable `tmp'
setup.c:679: warning: unused variable `initrd_header'
make[1]: *** [setup.o] Error 1
make[1]: Leaving directory `/home/mnt/mips/dec/linux/arch/mips/kernel'
make: *** [_dir_arch/mips/kernel] Error 2
(flo@paradigm)/home/mnt/mips/dec/linux# 

(flo@paradigm)/home/mnt/mips/dec/linux# mipsel-linux-gcc -v
Reading specs from /usr/local/lib/gcc-lib/mipsel-linux/3.0.2/specs
Configured with: ./configure --target=mipsel-linux --enable-languages=c
--disable-shared
Thread model: single
gcc version 3.0.2 20010825 (Debian prerelease)
(flo@paradigm)/home/mnt/mips/dec/linux# mipsel-linux-as --version
GNU assembler 2.11.92.0.10 Debian/GNU Linux
Copyright 2001 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms
of
the GNU General Public License.  This program has absolutely no
warranty.
This assembler was configured for a target of `mipsel-linux'.

---

From: "H . J . Lu" <[email-masked]>
Date: Wed, 28 Nov 2001 09:16:55 -0800

> GNU assembler 2.11.92.0.10 Debian/GNU Linux

You need binutils 2.11.92.0.12 and also read my README.

H.J.

---

From: James Simmons <[email-masked]>
Date: Wed, 28 Nov 2001 09:23:10 -0800 (PST)

Ralph please apply this patch to arch/mips/kernel/setup.c. Some compilers
don't like the conflict of definition in io.h and setup.c. Thanks.
 
--- setup.c.orig	Wed Nov 28 10:19:09 2001
+++ setup.c	Wed Nov 28 10:19:20 2001
@@ -106,7 +106,7 @@
  * mips_io_port_base is the begin of the address space to which x86 style
  * I/O ports are mapped.
  */
-unsigned long mips_io_port_base;	EXPORT_SYMBOL(mips_io_port_base);
+const unsigned long mips_io_port_base;	EXPORT_SYMBOL(mips_io_port_base);

 /*

---

From: Ralf Baechle <[email-masked]>
Date: Thu, 29 Nov 2001 14:55:13 +1100

> don't like the conflict of definition in io.h and setup.c. Thanks.

Will do.  For curiosity's sake, which compilers do complain?

  Ralf

---

From: Paul Mundt <[email-masked]>
Date: Wed, 28 Nov 2001 20:14:33 -0800

> Will do.  For curiosity's sake, which compilers do complain?
GCC 3.0.2 was the one that complained for me.. 2.95.3 had no problems.

Regards,

-- 
Paul Mundt <[email-masked]>
MontaVista Software, Inc.

---

From: Ralf Baechle <[email-masked]>
Date: Fri, 30 Nov 2001 01:18:57 +1100

> GCC 3.0.2 was the one that complained for me.. 2.95.3 had no problems.

Thanks, fix is now in cvs.

  Ralf