Commit 9d30b99f authored by Alexander Shishkin's avatar Alexander Shishkin Committed by Tony Lindgren

omap: Eliminate OMAP_MAX_NR_PORTS

Eliminate OMAP_MAX_NR_PORTS

Note that also the null terminator entry for omap1
serial_platform_data needs to be now removed to avoid
oopsing.

Note that mach-omap1 uses struct plat_serial8250_port
array, which requires a null terminator at the end,
and that's why we need to use ARRAY_SIZE - 1. This
is not needed on mach-omap2 as the array used is
struct omap_uart_state, and does not use a null
terminator.
Signed-off-by: default avatarAlexander Shishkin <virtuoso@slind.org>
Acked-by: default avatarKevin Hilman <khilman@deeprootsystems.com>
Signed-off-by: default avatarLadislav Michl <ladis@linux-mips.org>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent f014ee32
...@@ -120,7 +120,7 @@ void __init omap_serial_init(void) ...@@ -120,7 +120,7 @@ void __init omap_serial_init(void)
serial_platform_data[2].uartclk = OMAP1510_BASE_BAUD * 16; serial_platform_data[2].uartclk = OMAP1510_BASE_BAUD * 16;
} }
for (i = 0; i < OMAP_MAX_NR_PORTS; i++) { for (i = 0; i < ARRAY_SIZE(serial_platform_data) - 1; i++) {
/* Static mapping, never released */ /* Static mapping, never released */
serial_platform_data[i].membase = serial_platform_data[i].membase =
......
...@@ -533,7 +533,7 @@ static inline void omap_uart_idle_init(struct omap_uart_state *uart) {} ...@@ -533,7 +533,7 @@ static inline void omap_uart_idle_init(struct omap_uart_state *uart) {}
#define DEV_CREATE_FILE(dev, attr) #define DEV_CREATE_FILE(dev, attr)
#endif /* CONFIG_PM */ #endif /* CONFIG_PM */
static struct omap_uart_state omap_uart[OMAP_MAX_NR_PORTS] = { static struct omap_uart_state omap_uart[] = {
{ {
.pdev = { .pdev = {
.name = "serial8250", .name = "serial8250",
...@@ -583,7 +583,7 @@ void __init omap_serial_early_init(void) ...@@ -583,7 +583,7 @@ void __init omap_serial_early_init(void)
* if not needed. * if not needed.
*/ */
for (i = 0; i < OMAP_MAX_NR_PORTS; i++) { for (i = 0; i < ARRAY_SIZE(omap_uart); i++) {
struct omap_uart_state *uart = &omap_uart[i]; struct omap_uart_state *uart = &omap_uart[i];
struct platform_device *pdev = &uart->pdev; struct platform_device *pdev = &uart->pdev;
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
...@@ -635,7 +635,7 @@ void __init omap_serial_init(void) ...@@ -635,7 +635,7 @@ void __init omap_serial_init(void)
{ {
int i; int i;
for (i = 0; i < OMAP_MAX_NR_PORTS; i++) { for (i = 0; i < ARRAY_SIZE(omap_uart); i++) {
struct omap_uart_state *uart = &omap_uart[i]; struct omap_uart_state *uart = &omap_uart[i];
struct platform_device *pdev = &uart->pdev; struct platform_device *pdev = &uart->pdev;
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
......
...@@ -20,26 +20,22 @@ ...@@ -20,26 +20,22 @@
#define OMAP_UART1_BASE 0xfffb0000 #define OMAP_UART1_BASE 0xfffb0000
#define OMAP_UART2_BASE 0xfffb0800 #define OMAP_UART2_BASE 0xfffb0800
#define OMAP_UART3_BASE 0xfffb9800 #define OMAP_UART3_BASE 0xfffb9800
#define OMAP_MAX_NR_PORTS 3
#elif defined(CONFIG_ARCH_OMAP2) #elif defined(CONFIG_ARCH_OMAP2)
/* OMAP2 serial ports */ /* OMAP2 serial ports */
#define OMAP_UART1_BASE 0x4806a000 #define OMAP_UART1_BASE 0x4806a000
#define OMAP_UART2_BASE 0x4806c000 #define OMAP_UART2_BASE 0x4806c000
#define OMAP_UART3_BASE 0x4806e000 #define OMAP_UART3_BASE 0x4806e000
#define OMAP_MAX_NR_PORTS 3
#elif defined(CONFIG_ARCH_OMAP3) #elif defined(CONFIG_ARCH_OMAP3)
/* OMAP3 serial ports */ /* OMAP3 serial ports */
#define OMAP_UART1_BASE 0x4806a000 #define OMAP_UART1_BASE 0x4806a000
#define OMAP_UART2_BASE 0x4806c000 #define OMAP_UART2_BASE 0x4806c000
#define OMAP_UART3_BASE 0x49020000 #define OMAP_UART3_BASE 0x49020000
#define OMAP_MAX_NR_PORTS 3
#elif defined(CONFIG_ARCH_OMAP4) #elif defined(CONFIG_ARCH_OMAP4)
/* OMAP4 serial ports */ /* OMAP4 serial ports */
#define OMAP_UART1_BASE 0x4806a000 #define OMAP_UART1_BASE 0x4806a000
#define OMAP_UART2_BASE 0x4806c000 #define OMAP_UART2_BASE 0x4806c000
#define OMAP_UART3_BASE 0x48020000 #define OMAP_UART3_BASE 0x48020000
#define OMAP_UART4_BASE 0x4806e000 #define OMAP_UART4_BASE 0x4806e000
#define OMAP_MAX_NR_PORTS 4
#endif #endif
#define OMAP1510_BASE_BAUD (12000000/16) #define OMAP1510_BASE_BAUD (12000000/16)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment