* [PATCH] gcc4 fix for sn_serial.c
@ 2005-03-14 19:32 Jesse Barnes
2005-03-15 1:03 ` Adrian Bunk
0 siblings, 1 reply; 5+ messages in thread
From: Jesse Barnes @ 2005-03-14 19:32 UTC (permalink / raw)
To: akpm, pfg, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 540 bytes --]
The sal_console and sal_console_uart structures have a circular relationship
since they both initialize member fields to pointers of one another. The
current code forward declares sal_console_uart as extern so that sal_console
can take its address, but gcc4 complains about this since the real definition
of sal_console_uart is marked 'static'. This patch just removes the static
qualifier from sal_console_uart to avoid the inconsistency. Does it look ok
to you, Pat?
Signed-off-by: Jesse Barnes <jbarnes@sgi.com>
Thanks,
Jesse
[-- Attachment #2: sn-serial-gcc4-fix.patch --]
[-- Type: text/plain, Size: 414 bytes --]
===== drivers/serial/sn_console.c 1.12 vs edited =====
--- 1.12/drivers/serial/sn_console.c 2005-03-07 20:41:31 -08:00
+++ edited/drivers/serial/sn_console.c 2005-03-14 10:57:19 -08:00
@@ -801,7 +801,7 @@
#define SAL_CONSOLE &sal_console
-static struct uart_driver sal_console_uart = {
+struct uart_driver sal_console_uart = {
.owner = THIS_MODULE,
.driver_name = "sn_console",
.dev_name = DEVICE_NAME,
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] gcc4 fix for sn_serial.c 2005-03-14 19:32 [PATCH] gcc4 fix for sn_serial.c Jesse Barnes @ 2005-03-15 1:03 ` Adrian Bunk 2005-03-15 17:48 ` Jesse Barnes 0 siblings, 1 reply; 5+ messages in thread From: Adrian Bunk @ 2005-03-15 1:03 UTC (permalink / raw) To: Jesse Barnes; +Cc: akpm, pfg, linux-kernel On Mon, Mar 14, 2005 at 11:32:39AM -0800, Jesse Barnes wrote: > The sal_console and sal_console_uart structures have a circular relationship > since they both initialize member fields to pointers of one another. The > current code forward declares sal_console_uart as extern so that sal_console > can take its address, but gcc4 complains about this since the real definition > of sal_console_uart is marked 'static'. This patch just removes the static > qualifier from sal_console_uart to avoid the inconsistency. Does it look ok > to you, Pat? >... > ===== drivers/serial/sn_console.c 1.12 vs edited ===== > --- 1.12/drivers/serial/sn_console.c 2005-03-07 20:41:31 -08:00 > +++ edited/drivers/serial/sn_console.c 2005-03-14 10:57:19 -08:00 > @@ -801,7 +801,7 @@ > > #define SAL_CONSOLE &sal_console > > -static struct uart_driver sal_console_uart = { > +struct uart_driver sal_console_uart = { > .owner = THIS_MODULE, > .driver_name = "sn_console", > .dev_name = DEVICE_NAME, Why can't you solve this without making sal_console_uart global? 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 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] gcc4 fix for sn_serial.c 2005-03-15 1:03 ` Adrian Bunk @ 2005-03-15 17:48 ` Jesse Barnes 2005-04-26 22:58 ` Andreas Schwab 0 siblings, 1 reply; 5+ messages in thread From: Jesse Barnes @ 2005-03-15 17:48 UTC (permalink / raw) To: Adrian Bunk; +Cc: akpm, pfg, linux-kernel On Monday, March 14, 2005 5:03 pm, Adrian Bunk wrote: > > -static struct uart_driver sal_console_uart = { > > +struct uart_driver sal_console_uart = { > > .owner = THIS_MODULE, > > .driver_name = "sn_console", > > .dev_name = DEVICE_NAME, > > Why can't you solve this without making sal_console_uart global? I think that would mean moving some of the structure initializaiton into an init function somewhere. But the compiler knows the addrs of these structures, so there must be a better way to do it, I just don't know it. Any suggestions? Jesse ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] gcc4 fix for sn_serial.c 2005-03-15 17:48 ` Jesse Barnes @ 2005-04-26 22:58 ` Andreas Schwab 2005-04-26 23:09 ` Andreas Schwab 0 siblings, 1 reply; 5+ messages in thread From: Andreas Schwab @ 2005-04-26 22:58 UTC (permalink / raw) To: Jesse Barnes; +Cc: Adrian Bunk, akpm, pfg, linux-kernel Jesse Barnes <jbarnes@engr.sgi.com> writes: > On Monday, March 14, 2005 5:03 pm, Adrian Bunk wrote: >> > -static struct uart_driver sal_console_uart = { >> > +struct uart_driver sal_console_uart = { >> > .owner = THIS_MODULE, >> > .driver_name = "sn_console", >> > .dev_name = DEVICE_NAME, >> >> Why can't you solve this without making sal_console_uart global? > > I think that would mean moving some of the structure initializaiton into an > init function somewhere. Just make the tentative definition static. Signed-off-by: Andreas Schwab <schwab@suse.de> --- linux-2.6/drivers/serial/sn_console.c.~1~ 2005-04-26 14:42:39.994841943 +0200 +++ linux-2.6/drivers/serial/sn_console.c 2005-04-27 00:50:40.301718840 +0200 @@ -821,7 +821,7 @@ static void __init sn_sal_switch_to_inte static void sn_sal_console_write(struct console *, const char *, unsigned); static int __init sn_sal_console_setup(struct console *, char *); -extern struct uart_driver sal_console_uart; +static struct uart_driver sal_console_uart; extern struct tty_driver *uart_console_device(struct console *, int *); static struct console sal_console = { Andreas. -- Andreas Schwab, SuSE Labs, schwab@suse.de SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] gcc4 fix for sn_serial.c 2005-04-26 22:58 ` Andreas Schwab @ 2005-04-26 23:09 ` Andreas Schwab 0 siblings, 0 replies; 5+ messages in thread From: Andreas Schwab @ 2005-04-26 23:09 UTC (permalink / raw) To: Jesse Barnes; +Cc: Adrian Bunk, akpm, pfg, linux-kernel Andreas Schwab <schwab@suse.de> writes: > Jesse Barnes <jbarnes@engr.sgi.com> writes: > >> On Monday, March 14, 2005 5:03 pm, Adrian Bunk wrote: >>> > -static struct uart_driver sal_console_uart = { >>> > +struct uart_driver sal_console_uart = { >>> > .owner = THIS_MODULE, >>> > .driver_name = "sn_console", >>> > .dev_name = DEVICE_NAME, >>> >>> Why can't you solve this without making sal_console_uart global? >> >> I think that would mean moving some of the structure initializaiton into an >> init function somewhere. > > Just make the tentative definition static. And this is the complete patch: Make sal_console_uart static again. Signed-off-by: Andreas Schwab <schwab@suse.de> --- linux-2.6/drivers/serial/sn_console.c.~1~ 2005-04-25 00:33:34.000000000 +0200 +++ linux-2.6/drivers/serial/sn_console.c 2005-04-27 01:05:29.000000000 +0200 @@ -787,7 +787,7 @@ static void __init sn_sal_switch_to_inte static void sn_sal_console_write(struct console *, const char *, unsigned); static int __init sn_sal_console_setup(struct console *, char *); -extern struct uart_driver sal_console_uart; +static struct uart_driver sal_console_uart; extern struct tty_driver *uart_console_device(struct console *, int *); static struct console sal_console = { @@ -801,7 +801,7 @@ static struct console sal_console = { #define SAL_CONSOLE &sal_console -struct uart_driver sal_console_uart = { +static struct uart_driver sal_console_uart = { .owner = THIS_MODULE, .driver_name = "sn_console", .dev_name = DEVICE_NAME, Andreas. -- Andreas Schwab, SuSE Labs, schwab@suse.de SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-04-26 23:09 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2005-03-14 19:32 [PATCH] gcc4 fix for sn_serial.c Jesse Barnes 2005-03-15 1:03 ` Adrian Bunk 2005-03-15 17:48 ` Jesse Barnes 2005-04-26 22:58 ` Andreas Schwab 2005-04-26 23:09 ` Andreas Schwab
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.