提交 2b49abac 编写于 作者: R Russell King

[PATCH] Serial: Convert 8250_hp300 to use serial8250_{un,}register_port

Convert 8250_hp300 to use serial8250_register_port() and
serial8250_unregister_port().

Tested by Kars de Jong, 4/4/2005.
Signed-off-by: NRussell King <rmk@arm.linux.org.uk>
上级 2a9604b8
...@@ -9,15 +9,15 @@ ...@@ -9,15 +9,15 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/tty.h>
#include <linux/serial.h> #include <linux/serial.h>
#include <linux/serialP.h>
#include <linux/serial_core.h> #include <linux/serial_core.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/dio.h> #include <linux/dio.h>
#include <linux/console.h> #include <linux/console.h>
#include <asm/io.h> #include <asm/io.h>
#include "8250.h"
#if !defined(CONFIG_HPDCA) && !defined(CONFIG_HPAPCI) #if !defined(CONFIG_HPDCA) && !defined(CONFIG_HPAPCI)
#warning CONFIG_8250 defined but neither CONFIG_HPDCA nor CONFIG_HPAPCI defined, are you sure? #warning CONFIG_8250 defined but neither CONFIG_HPDCA nor CONFIG_HPAPCI defined, are you sure?
#endif #endif
...@@ -163,7 +163,7 @@ int __init hp300_setup_serial_console(void) ...@@ -163,7 +163,7 @@ int __init hp300_setup_serial_console(void)
static int __devinit hpdca_init_one(struct dio_dev *d, static int __devinit hpdca_init_one(struct dio_dev *d,
const struct dio_device_id *ent) const struct dio_device_id *ent)
{ {
struct serial_struct serial_req; struct uart_port port;
int line; int line;
#ifdef CONFIG_SERIAL_8250_CONSOLE #ifdef CONFIG_SERIAL_8250_CONSOLE
...@@ -172,21 +172,22 @@ static int __devinit hpdca_init_one(struct dio_dev *d, ...@@ -172,21 +172,22 @@ static int __devinit hpdca_init_one(struct dio_dev *d,
return 0; return 0;
} }
#endif #endif
memset(&serial_req, 0, sizeof(struct serial_struct)); memset(&port, 0, sizeof(struct uart_port));
/* Memory mapped I/O */ /* Memory mapped I/O */
serial_req.io_type = SERIAL_IO_MEM; port.iotype = UPIO_MEM;
serial_req.flags = UPF_SKIP_TEST | UPF_SHARE_IRQ | UPF_BOOT_AUTOCONF; port.flags = UPF_SKIP_TEST | UPF_SHARE_IRQ | UPF_BOOT_AUTOCONF;
serial_req.irq = d->ipl; port.irq = d->ipl;
serial_req.baud_base = HPDCA_BAUD_BASE; port.uartclk = HPDCA_BAUD_BASE * 16;
serial_req.iomap_base = (d->resource.start + UART_OFFSET); port.mapbase = (d->resource.start + UART_OFFSET);
serial_req.iomem_base = (char *)(serial_req.iomap_base + DIO_VIRADDRBASE); port.membase = (char *)(port.mapbase + DIO_VIRADDRBASE);
serial_req.iomem_reg_shift = 1; port.regshift = 1;
line = register_serial(&serial_req); port.dev = &d->dev;
line = serial8250_register_port(&port);
if (line < 0) { if (line < 0) {
printk(KERN_NOTICE "8250_hp300: register_serial() DCA scode %d" printk(KERN_NOTICE "8250_hp300: register_serial() DCA scode %d"
" irq %d failed\n", d->scode, serial_req.irq); " irq %d failed\n", d->scode, port.irq);
return -ENOMEM; return -ENOMEM;
} }
...@@ -209,7 +210,7 @@ static int __init hp300_8250_init(void) ...@@ -209,7 +210,7 @@ static int __init hp300_8250_init(void)
#ifdef CONFIG_HPAPCI #ifdef CONFIG_HPAPCI
int line; int line;
unsigned long base; unsigned long base;
struct serial_struct serial_req; struct uart_port uport;
struct hp300_port *port; struct hp300_port *port;
int i; int i;
#endif #endif
...@@ -251,25 +252,25 @@ static int __init hp300_8250_init(void) ...@@ -251,25 +252,25 @@ static int __init hp300_8250_init(void)
if (!port) if (!port)
return -ENOMEM; return -ENOMEM;
memset(&serial_req, 0, sizeof(struct serial_struct)); memset(&uport, 0, sizeof(struct uart_port));
base = (FRODO_BASE + FRODO_APCI_OFFSET(i)); base = (FRODO_BASE + FRODO_APCI_OFFSET(i));
/* Memory mapped I/O */ /* Memory mapped I/O */
serial_req.io_type = SERIAL_IO_MEM; uport.iotype = UPIO_MEM;
serial_req.flags = UPF_SKIP_TEST | UPF_SHARE_IRQ | UPF_BOOT_AUTOCONF; uport.flags = UPF_SKIP_TEST | UPF_SHARE_IRQ | UPF_BOOT_AUTOCONF;
/* XXX - no interrupt support yet */ /* XXX - no interrupt support yet */
serial_req.irq = 0; uport.irq = 0;
serial_req.baud_base = HPAPCI_BAUD_BASE; uport.uartclk = HPAPCI_BAUD_BASE * 16;
serial_req.iomap_base = base; uport.mapbase = base;
serial_req.iomem_base = (char *)(serial_req.iomap_base + DIO_VIRADDRBASE); uport.membase = (char *)(base + DIO_VIRADDRBASE);
serial_req.iomem_reg_shift = 2; uport.regshift = 2;
line = register_serial(&serial_req); line = serial8250_register_port(&uport);
if (line < 0) { if (line < 0) {
printk(KERN_NOTICE "8250_hp300: register_serial() APCI %d" printk(KERN_NOTICE "8250_hp300: register_serial() APCI %d"
" irq %d failed\n", i, serial_req.irq); " irq %d failed\n", i, uport.irq);
kfree(port); kfree(port);
continue; continue;
} }
...@@ -299,7 +300,7 @@ static void __devexit hpdca_remove_one(struct dio_dev *d) ...@@ -299,7 +300,7 @@ static void __devexit hpdca_remove_one(struct dio_dev *d)
/* Disable board-interrupts */ /* Disable board-interrupts */
out_8(d->resource.start + DIO_VIRADDRBASE + DCA_IC, 0); out_8(d->resource.start + DIO_VIRADDRBASE + DCA_IC, 0);
} }
unregister_serial(line); serial8250_unregister_port(line);
} }
#endif #endif
...@@ -309,7 +310,7 @@ static void __exit hp300_8250_exit(void) ...@@ -309,7 +310,7 @@ static void __exit hp300_8250_exit(void)
struct hp300_port *port, *to_free; struct hp300_port *port, *to_free;
for (port = hp300_ports; port; ) { for (port = hp300_ports; port; ) {
unregister_serial(port->line); serial8250_unregister_port(port->line);
to_free = port; to_free = port;
port = port->next; port = port->next;
kfree(to_free); kfree(to_free);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册