From: Ben Dooks <ben-linux@fluff.org>
To: rmk+serial@arm.linux.org.uk, linux-kernel@vger.kernel.org
Subject: 8250 - sparse error fixes
Date: Thu, 17 Mar 2005 23:30:20 +0000 [thread overview]
Message-ID: <20050317233020.GA29700@home.fluff.org> (raw)
[-- 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;
reply other threads:[~2005-03-17 23:31 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050317233020.GA29700@home.fluff.org \
--to=ben-linux@fluff.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rmk+serial@arm.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®