[PATCH] handle errors returned by platform_get_irq*()
[linux-2.6] / drivers / serial / 8250_mca.c
1 /*
2  *  linux/drivers/serial/8250_mca.c
3  *
4  *  Copyright (C) 2005 Russell King.
5  *  Data taken from include/asm-i386/serial.h
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License version 2 as
9  * published by the Free Software Foundation.
10  */
11 #include <linux/config.h>
12 #include <linux/module.h>
13 #include <linux/init.h>
14 #include <linux/mca.h>
15 #include <linux/serial_8250.h>
16
17 /*
18  * FIXME: Should we be doing AUTO_IRQ here?
19  */
20 #ifdef CONFIG_SERIAL_8250_DETECT_IRQ
21 #define MCA_FLAGS       UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_AUTO_IRQ
22 #else
23 #define MCA_FLAGS       UPF_BOOT_AUTOCONF | UPF_SKIP_TEST
24 #endif
25
26 #define PORT(_base,_irq)                        \
27         {                                       \
28                 .iobase         = _base,        \
29                 .irq            = _irq,         \
30                 .uartclk        = 1843200,      \
31                 .iotype         = UPIO_PORT,    \
32                 .flags          = MCA_FLAGS,    \
33         }
34
35 static struct plat_serial8250_port mca_data[] = {
36         PORT(0x3220, 3),
37         PORT(0x3228, 3),
38         PORT(0x4220, 3),
39         PORT(0x4228, 3),
40         PORT(0x5220, 3),
41         PORT(0x5228, 3),
42         { },
43 };
44
45 static struct platform_device mca_device = {
46         .name                   = "serial8250",
47         .id                     = PLAT8250_DEV_MCA,
48         .dev                    = {
49                 .platform_data  = mca_data,
50         },
51 };
52
53 static int __init mca_init(void)
54 {
55         if (!MCA_bus)
56                 return -ENODEV;
57         return platform_device_register(&mca_device);
58 }
59
60 module_init(mca_init);
61
62 MODULE_AUTHOR("Russell King");
63 MODULE_DESCRIPTION("8250 serial probe module for MCA ports");
64 MODULE_LICENSE("GPL");