mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* 8250 - sparse error fixes
@ 2005-03-17 23:30 Ben Dooks
  0 siblings, 0 replies; only message in thread
From: Ben Dooks @ 2005-03-17 23:30 UTC (permalink / raw)
  To: rmk+serial, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 4457 bytes --]

Ensure __iomem on the correct bits of the serial_struct
and other definitions.

Remove the attempts to size zero length arrays, which
causes problems from sparse.

Signed-off-by: Ben Dooks <ben-linux@fluff.org>

diff -urN -X ../dontdiff linux-2.6.11.3-bk3/include/linux/serial.h linux-2.6.11.3-bk3-fix1/include/linux/serial.h
--- linux-2.6.11.3-bk3/include/linux/serial.h	2005-03-02 07:37:50.000000000 +0000
+++ linux-2.6.11.3-bk3-fix1/include/linux/serial.h	2005-03-17 23:08:53.000000000 +0000
@@ -45,7 +45,7 @@
 	int	hub6;
 	unsigned short	closing_wait; /* time to wait before closing */
 	unsigned short	closing_wait2; /* no longer used... */
-	unsigned char	*iomem_base;
+	unsigned char __iomem *iomem_base;
 	unsigned short	iomem_reg_shift;
 	unsigned int	port_high;
 	unsigned long	iomap_base;	/* cookie passed into ioremap */
diff -urN -X ../dontdiff linux-2.6.11.3-bk3/drivers/serial/8250.c linux-2.6.11.3-bk3-fix1/drivers/serial/8250.c
--- linux-2.6.11.3-bk3/drivers/serial/8250.c	2005-03-17 22:58:47.000000000 +0000
+++ linux-2.6.11.3-bk3-fix1/drivers/serial/8250.c	2005-03-17 23:23:39.000000000 +0000
@@ -111,15 +111,41 @@
  * standard enumeration mechanism.   Platforms that can find all
  * serial ports via mechanisms like ACPI or PCI need not supply it.
  */
-#ifndef SERIAL_PORT_DFNS
-#define SERIAL_PORT_DFNS
-#endif
 
+#ifdef SERIAL_PORT_DFNS
 static struct old_serial_port old_serial_port[] = {
 	SERIAL_PORT_DFNS /* defined in asm/serial.h */
 };
 
+static inline void __init serial8240_isa_init_asmdefs(void)
+{
+	struct uart_8250_port *up;
+	int i;
+
+	for (i = 0, up = serial8250_ports; i < ARRAY_SIZE(old_serial_port);
+	     i++, up++) {
+		up->port.iobase   = old_serial_port[i].port;
+		up->port.irq      = irq_canonicalize(old_serial_port[i].irq);
+		up->port.uartclk  = old_serial_port[i].baud_base * 16;
+		up->port.flags    = old_serial_port[i].flags;
+		up->port.hub6     = old_serial_port[i].hub6;
+		up->port.membase  = old_serial_port[i].iomem_base;
+		up->port.iotype   = old_serial_port[i].io_type;
+		up->port.regshift = old_serial_port[i].iomem_reg_shift;
+		if (share_irqs)
+			up->port.flags |= UPF_SHARE_IRQ;
+	}
+}
+
 #define UART_NR	(ARRAY_SIZE(old_serial_port) + CONFIG_SERIAL_8250_NR_UARTS)
+#else
+
+#define UART_NR	(CONFIG_SERIAL_8250_NR_UARTS)
+
+static inline void __init serial8240_isa_init_asmdefs(void)
+{
+}
+#endif
 
 #ifdef CONFIG_SERIAL_8250_RSA
 
@@ -2021,9 +2047,9 @@
 		return;
 	first = 0;
 
-	for (i = 0; i < UART_NR; i++) {
-		struct uart_8250_port *up = &serial8250_ports[i];
+	up = &serial8250_ports[0];
 
+	for (i = 0; i < UART_NR; i++, up++) {
 		up->port.line = i;
 		spin_lock_init(&up->port.lock);
 
@@ -2039,19 +2065,7 @@
 		up->port.ops = &serial8250_pops;
 	}
 
-	for (i = 0, up = serial8250_ports; i < ARRAY_SIZE(old_serial_port);
-	     i++, up++) {
-		up->port.iobase   = old_serial_port[i].port;
-		up->port.irq      = irq_canonicalize(old_serial_port[i].irq);
-		up->port.uartclk  = old_serial_port[i].baud_base * 16;
-		up->port.flags    = old_serial_port[i].flags;
-		up->port.hub6     = old_serial_port[i].hub6;
-		up->port.membase  = old_serial_port[i].iomem_base;
-		up->port.iotype   = old_serial_port[i].io_type;
-		up->port.regshift = old_serial_port[i].iomem_reg_shift;
-		if (share_irqs)
-			up->port.flags |= UPF_SHARE_IRQ;
-	}
+	serial8240_isa_init_asmdefs();
 }
 
 static void __init
diff -urN -X ../dontdiff linux-2.6.11.3-bk3/drivers/serial/8250.h linux-2.6.11.3-bk3-fix1/drivers/serial/8250.h
--- linux-2.6.11.3-bk3/drivers/serial/8250.h	2005-03-02 07:37:30.000000000 +0000
+++ linux-2.6.11.3-bk3-fix1/drivers/serial/8250.h	2005-03-17 23:07:10.000000000 +0000
@@ -30,7 +30,7 @@
 	unsigned int flags;
 	unsigned char hub6;
 	unsigned char io_type;
-	unsigned char *iomem_base;
+	unsigned char __iomem *iomem_base;
 	unsigned short iomem_reg_shift;
 };
 
diff -urN -X ../dontdiff linux-2.6.11.3-bk3/drivers/serial/serial_core.c linux-2.6.11.3-bk3-fix1/drivers/serial/serial_core.c
--- linux-2.6.11.3-bk3/drivers/serial/serial_core.c	2005-03-02 07:37:50.000000000 +0000
+++ linux-2.6.11.3-bk3-fix1/drivers/serial/serial_core.c	2005-03-17 23:09:36.000000000 +0000
@@ -592,7 +592,7 @@
 	tmp.hub6	    = port->hub6;
 	tmp.io_type         = port->iotype;
 	tmp.iomem_reg_shift = port->regshift;
-	tmp.iomem_base      = (void *)port->mapbase;
+	tmp.iomem_base      = (void __iomem *)port->mapbase;
 
 	if (copy_to_user(retinfo, &tmp, sizeof(*retinfo)))
 		return -EFAULT;

[-- Attachment #2: 8250-sparse-fix.patch --]
[-- Type: text/plain, Size: 4245 bytes --]

diff -urN -X ../dontdiff linux-2.6.11.3-bk3/include/linux/serial.h linux-2.6.11.3-bk3-fix1/include/linux/serial.h
--- linux-2.6.11.3-bk3/include/linux/serial.h	2005-03-02 07:37:50.000000000 +0000
+++ linux-2.6.11.3-bk3-fix1/include/linux/serial.h	2005-03-17 23:08:53.000000000 +0000
@@ -45,7 +45,7 @@
 	int	hub6;
 	unsigned short	closing_wait; /* time to wait before closing */
 	unsigned short	closing_wait2; /* no longer used... */
-	unsigned char	*iomem_base;
+	unsigned char __iomem *iomem_base;
 	unsigned short	iomem_reg_shift;
 	unsigned int	port_high;
 	unsigned long	iomap_base;	/* cookie passed into ioremap */
diff -urN -X ../dontdiff linux-2.6.11.3-bk3/drivers/serial/8250.c linux-2.6.11.3-bk3-fix1/drivers/serial/8250.c
--- linux-2.6.11.3-bk3/drivers/serial/8250.c	2005-03-17 22:58:47.000000000 +0000
+++ linux-2.6.11.3-bk3-fix1/drivers/serial/8250.c	2005-03-17 23:23:39.000000000 +0000
@@ -111,15 +111,41 @@
  * standard enumeration mechanism.   Platforms that can find all
  * serial ports via mechanisms like ACPI or PCI need not supply it.
  */
-#ifndef SERIAL_PORT_DFNS
-#define SERIAL_PORT_DFNS
-#endif
 
+#ifdef SERIAL_PORT_DFNS
 static struct old_serial_port old_serial_port[] = {
 	SERIAL_PORT_DFNS /* defined in asm/serial.h */
 };
 
+static inline void __init serial8240_isa_init_asmdefs(void)
+{
+	struct uart_8250_port *up;
+	int i;
+
+	for (i = 0, up = serial8250_ports; i < ARRAY_SIZE(old_serial_port);
+	     i++, up++) {
+		up->port.iobase   = old_serial_port[i].port;
+		up->port.irq      = irq_canonicalize(old_serial_port[i].irq);
+		up->port.uartclk  = old_serial_port[i].baud_base * 16;
+		up->port.flags    = old_serial_port[i].flags;
+		up->port.hub6     = old_serial_port[i].hub6;
+		up->port.membase  = old_serial_port[i].iomem_base;
+		up->port.iotype   = old_serial_port[i].io_type;
+		up->port.regshift = old_serial_port[i].iomem_reg_shift;
+		if (share_irqs)
+			up->port.flags |= UPF_SHARE_IRQ;
+	}
+}
+
 #define UART_NR	(ARRAY_SIZE(old_serial_port) + CONFIG_SERIAL_8250_NR_UARTS)
+#else
+
+#define UART_NR	(CONFIG_SERIAL_8250_NR_UARTS)
+
+static inline void __init serial8240_isa_init_asmdefs(void)
+{
+}
+#endif
 
 #ifdef CONFIG_SERIAL_8250_RSA
 
@@ -2021,9 +2047,9 @@
 		return;
 	first = 0;
 
-	for (i = 0; i < UART_NR; i++) {
-		struct uart_8250_port *up = &serial8250_ports[i];
+	up = &serial8250_ports[0];
 
+	for (i = 0; i < UART_NR; i++, up++) {
 		up->port.line = i;
 		spin_lock_init(&up->port.lock);
 
@@ -2039,19 +2065,7 @@
 		up->port.ops = &serial8250_pops;
 	}
 
-	for (i = 0, up = serial8250_ports; i < ARRAY_SIZE(old_serial_port);
-	     i++, up++) {
-		up->port.iobase   = old_serial_port[i].port;
-		up->port.irq      = irq_canonicalize(old_serial_port[i].irq);
-		up->port.uartclk  = old_serial_port[i].baud_base * 16;
-		up->port.flags    = old_serial_port[i].flags;
-		up->port.hub6     = old_serial_port[i].hub6;
-		up->port.membase  = old_serial_port[i].iomem_base;
-		up->port.iotype   = old_serial_port[i].io_type;
-		up->port.regshift = old_serial_port[i].iomem_reg_shift;
-		if (share_irqs)
-			up->port.flags |= UPF_SHARE_IRQ;
-	}
+	serial8240_isa_init_asmdefs();
 }
 
 static void __init
diff -urN -X ../dontdiff linux-2.6.11.3-bk3/drivers/serial/8250.h linux-2.6.11.3-bk3-fix1/drivers/serial/8250.h
--- linux-2.6.11.3-bk3/drivers/serial/8250.h	2005-03-02 07:37:30.000000000 +0000
+++ linux-2.6.11.3-bk3-fix1/drivers/serial/8250.h	2005-03-17 23:07:10.000000000 +0000
@@ -30,7 +30,7 @@
 	unsigned int flags;
 	unsigned char hub6;
 	unsigned char io_type;
-	unsigned char *iomem_base;
+	unsigned char __iomem *iomem_base;
 	unsigned short iomem_reg_shift;
 };
 
diff -urN -X ../dontdiff linux-2.6.11.3-bk3/drivers/serial/serial_core.c linux-2.6.11.3-bk3-fix1/drivers/serial/serial_core.c
--- linux-2.6.11.3-bk3/drivers/serial/serial_core.c	2005-03-02 07:37:50.000000000 +0000
+++ linux-2.6.11.3-bk3-fix1/drivers/serial/serial_core.c	2005-03-17 23:09:36.000000000 +0000
@@ -592,7 +592,7 @@
 	tmp.hub6	    = port->hub6;
 	tmp.io_type         = port->iotype;
 	tmp.iomem_reg_shift = port->regshift;
-	tmp.iomem_base      = (void *)port->mapbase;
+	tmp.iomem_base      = (void __iomem *)port->mapbase;
 
 	if (copy_to_user(retinfo, &tmp, sizeof(*retinfo)))
 		return -EFAULT;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-03-17 23:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-17 23:30 8250 - sparse error fixes Ben Dooks

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®