OMAP: eliminate OMAP_MAX_NR_PORTS
Subsystems (4)
RFC PATCH 1/1 OMAP: eliminate OMAP_MAX_NR_PORTS
From: Alexander Shishkin <[email protected]>
--- arch/arm/mach-omap1/serial.c | 2 +- arch/arm/mach-omap2/serial.c | 6 +++--- arch/arm/plat-omap/include/mach/serial.h | 4 ---- 3 files changed, 4 insertions(+), 8 deletions(-)
arch/arm/mach-omap1/serial.c +1 -1
@@ -123,7 +123,7 @@ void __init omap_serial_init(void) 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); i++) {unsigned char reg;switch (i) {
arch/arm/mach-omap2/serial.c +3 -3
@@ -549,7 +549,7 @@ static inline void omap_uart_idle_init(struct omap_uart_state *uart) {}#define DEV_CREATE_FILE (dev, attr)#endif /* CONFIG_PM */ -static struct omap_uart_state omap_uart[OMAP_MAX_NR_PORTS ] = { +static struct omap_uart_state omap_uart[] = { { .pdev = { .name ="serial8250" ,
@@ -599,7 +599,7 @@ void __init omap_serial_early_init(void)* 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 platform_device *pdev = &uart->pdev;struct device *dev = &pdev->dev;
@@ -641,7 +641,7 @@ void __init omap_serial_init(void) {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 platform_device *pdev = &uart->pdev;struct device *dev = &pdev->dev;
arch/arm/plat-omap/include/mach/serial.h +0 -4
@@ -20,26 +20,22 @@#define OMAP_UART1_BASE 0xfffb0000#define OMAP_UART2_BASE 0xfffb0800#define OMAP_UART3_BASE 0xfffb9800 -#define OMAP_MAX_NR_PORTS 3#elif defined(CONFIG_ARCH_OMAP2 )/* OMAP2 serial ports */ #define OMAP_UART1_BASE 0x4806a000#define OMAP_UART2_BASE 0x4806c000#define OMAP_UART3_BASE 0x4806e000 -#define OMAP_MAX_NR_PORTS 3#elif defined(CONFIG_ARCH_OMAP3 )/* OMAP3 serial ports */ #define OMAP_UART1_BASE 0x4806a000#define OMAP_UART2_BASE 0x4806c000#define OMAP_UART3_BASE 0x49020000 -#define OMAP_MAX_NR_PORTS 3#elif defined(CONFIG_ARCH_OMAP4 )/* OMAP4 serial ports */ #define OMAP_UART1_BASE 0x4806a000#define OMAP_UART2_BASE 0x4806c000#define OMAP_UART3_BASE 0x48020000#define OMAP_UART4_BASE 0x4806e000 -#define OMAP_MAX_NR_PORTS 4#endif #define OMAP1510_BASE_BAUD (12000000/16)
Signature · 1 line
1.6.3.3
Quoted 3 lines · [email protected] writes:
From: Alexander Shishkin <[email protected]>
Signed-off-by Alexander Shishkin <[email protected]>
Looks like a good cleanup to me.
Quoted 88 lines
--- arch/arm/mach-omap1/serial.c | 2 +- arch/arm/mach-omap2/serial.c | 6 +++--- arch/arm/plat-omap/include/mach/serial.h | 4 ---- 3 files changed, 4 insertions(+), 8 deletions(-)arch/arm/mach-omap1/serial.c +1
-1@@ -123,7 +123,7 @@ void __init omap_serial_init(void) 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); i++) {unsigned char reg;switch (i) {arch/arm/mach-omap2/serial.c +3
-3@@ -549,7 +549,7 @@ static inline void omap_uart_idle_init(struct omap_uart_state *uart) {}#define DEV_CREATE_FILE (dev, attr)#endif /* CONFIG_PM */ -static struct omap_uart_state omap_uart[OMAP_MAX_NR_PORTS ] = { +static struct omap_uart_state omap_uart[] = { { .pdev = { .name ="serial8250" ,@@ -599,7 +599,7 @@ void __init omap_serial_early_init(void)* 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 platform_device *pdev = &uart->pdev;struct device *dev = &pdev->dev;@@ -641,7 +641,7 @@ void __init omap_serial_init(void) {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 platform_device *pdev = &uart->pdev;struct device *dev = &pdev->dev;arch/arm/plat-omap/include/mach/serial.h +0
-4@@ -20,26 +20,22 @@#define OMAP_UART1_BASE 0xfffb0000#define OMAP_UART2_BASE 0xfffb0800#define OMAP_UART3_BASE 0xfffb9800 -#define OMAP_MAX_NR_PORTS 3#elif defined(CONFIG_ARCH_OMAP2 )/* OMAP2 serial ports */ #define OMAP_UART1_BASE 0x4806a000#define OMAP_UART2_BASE 0x4806c000#define OMAP_UART3_BASE 0x4806e000 -#define OMAP_MAX_NR_PORTS 3#elif defined(CONFIG_ARCH_OMAP3 )/* OMAP3 serial ports */ #define OMAP_UART1_BASE 0x4806a000#define OMAP_UART2_BASE 0x4806c000#define OMAP_UART3_BASE 0x49020000 -#define OMAP_MAX_NR_PORTS 3#elif defined(CONFIG_ARCH_OMAP4 )/* OMAP4 serial ports */ #define OMAP_UART1_BASE 0x4806a000#define OMAP_UART2_BASE 0x4806c000#define OMAP_UART3_BASE 0x48020000#define OMAP_UART4_BASE 0x4806e000 -#define OMAP_MAX_NR_PORTS 4#endif #define OMAP1510_BASE_BAUD (12000000/16)Signature · 6 lines
1.6.3.3 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Tony Lindgren
maintainerRFC PATCH 1/1 OMAP: eliminate OMAP_MAX_NR_PORTS
In reply to [email protected]This patch has been applied to the linux-omap
by youw fwiendly patch wobot.
Branch in linux-omap: omap2-upstream
Initial commit ID (Likely to change): 439d2c69335a28ffdb5a9795ff384b6755ca0f7f
PatchWorks
http://patchwork.kernel.org/patch/52477/
Git (Likely to change, and takes a while to get mirrored)
http://git.kernel.org/?p=linux/kernel/git/tmlind/linux-omap-2.6.git;a=commit;h=439d2c69335a28ffdb5a9795ff384b6755ca0f7f
Quoted 5 lines · Tony Lindgren
This patch has been applied to the linux-omap
by youw fwiendly patch wobot.Branch in linux-omap: omap2-upstream
Quoted 7 lines
Initial commit ID (Likely to change):
439d2c69335a28ffdb5a9795ff384b6755ca0f7fPatchWorks
http://patchwork.kernel.org/patch/52477/Git (Likely to change, and takes a while to get mirrored)
http://git.kernel.org/?p=linux/kernel/git/tmlind/linux-omap-2.6.git;a=commit;h=439d2c69335a28ffdb5a9795ff384b6755ca0f7f
This patch broke all OMAP1 boards. NULL terminator entry for omap1 serial_platform_data cannot be removed just because serial driver uses is as last entry marker. Without it we end this way:
Unable to handle kernel NULL pointer dereference at virtual address 00000028 pgd = c0004000 [00000028] *pgd=00000000 Internal error: Oops: 80000005 [#1] last sysfs file: Modules linked in: CPU: 0 Not tainted (2.6.32-rc5-06314-g4155da6-dirty #12)
PC is at 0x28
LR is at serial8250_config_port+0x184/0xc34
(...etc...)
Please consider following fix (and while there fix OMAP2 too as patch broke it as well (untested))
arch/arm/mach-omap1/serial.c +4 -2
@@ -86,7 +86,9 @@ static struct plat_serial8250_port serial_platform_data[] = { .iotype = UPIO_MEM, .regshift = 2, .uartclk = OMAP16XX_BASE_BAUD * 16, - }, + }, { + } + }; static struct platform_device serial_device = {
@@ -119,7 +121,7 @@ void __init omap_serial_init(void) serial_platform_data[2 ].uartclk =OMAP1510_BASE_BAUD *16 ; } -for (i =0 ; i <ARRAY_SIZE (serial_platform_data); i++) { +for (i =0 ; i <ARRAY_SIZE (serial_platform_data) -1 ; i++) {unsigned char reg;/* Static mapping, never released */
arch/arm/mach-omap2/serial.c +2 -2
@@ -585,7 +585,7 @@ void __init omap_serial_early_init(void)* if not needed. */ -for (i =0 ; i <ARRAY_SIZE (omap_uart); i++) { +for (i =0 ; i <ARRAY_SIZE (omap_uart) -1 ; i++) {struct omap_uart_state *uart = &omap_uart[i];struct platform_device *pdev = &uart->pdev;struct device *dev = &pdev->dev;
@@ -637,7 +637,7 @@ void __init omap_serial_init(void) {int i; -for (i =0 ; i <ARRAY_SIZE (omap_uart); i++) { +for (i =0 ; i <ARRAY_SIZE (omap_uart) -1 ; i++) {struct omap_uart_state *uart = &omap_uart[i];struct platform_device *pdev = &uart->pdev;struct device *dev = &pdev->dev;
Tony Lindgren
maintainerQuoted 24 lines · * [email protected] <[email protected]> [091020 14:53]:
Quoted 5 lines · Tony Lindgren
This patch has been applied to the linux-omap
by youw fwiendly patch wobot.Branch in linux-omap: omap2-upstream
Quoted 7 lines
Initial commit ID (Likely to change):
439d2c69335a28ffdb5a9795ff384b6755ca0f7fPatchWorks
http://patchwork.kernel.org/patch/52477/Git (Likely to change, and takes a while to get mirrored)
http://git.kernel.org/?p=linux/kernel/git/tmlind/linux-omap-2.6.git;a=commit;h=439d2c69335a28ffdb5a9795ff384b6755ca0f7fThis patch broke all OMAP1 boards. NULL terminator entry for omap1
serial_platform_datacannot be removed just because serial driver uses is as last entry marker. Without it we end this way:Unable to handle kernel NULL pointer dereference at virtual address 00000028 pgd = c0004000 [00000028] *pgd=00000000 Internal error: Oops: 80000005 [#1] last sysfs file: Modules linked in: CPU: 0 Not tainted (2.6.32-rc5-06314-g4155da6-dirty #12)
Quoted 6 lines
PC is at
0x28
LR is atserial8250_config_port+0x184/0xc34
(...etc...)Please consider following fix (and while there fix OMAP2 too as patch broke it as well (untested))
Thanks, I already refreshed the original patch with the same fix few days ago :) It should be there in for-next branch and master branch.
Tony
Quoted 48 lines
Signed-off-by Ladislav Michl <[email protected]>arch/arm/mach-omap1/serial.c +4
-2@@ -86,7 +86,9 @@ static struct plat_serial8250_port serial_platform_data[] = { .iotype = UPIO_MEM, .regshift = 2, .uartclk = OMAP16XX_BASE_BAUD * 16, - }, + }, { + } + }; static struct platform_device serial_device = {@@ -119,7 +121,7 @@ void __init omap_serial_init(void) serial_platform_data[2 ].uartclk =OMAP1510_BASE_BAUD *16 ; } -for (i =0 ; i <ARRAY_SIZE (serial_platform_data); i++) { +for (i =0 ; i <ARRAY_SIZE (serial_platform_data) -1 ; i++) {unsigned char reg;/* Static mapping, never released */ arch/arm/mach-omap2/serial.c +2
-2@@ -585,7 +585,7 @@ void __init omap_serial_early_init(void)* if not needed. */ -for (i =0 ; i <ARRAY_SIZE (omap_uart); i++) { +for (i =0 ; i <ARRAY_SIZE (omap_uart) -1 ; i++) {struct omap_uart_state *uart = &omap_uart[i];struct platform_device *pdev = &uart->pdev;struct device *dev = &pdev->dev;@@ -637,7 +637,7 @@ void __init omap_serial_init(void) {int i; -for (i =0 ; i <ARRAY_SIZE (omap_uart); i++) { +for (i =0 ; i <ARRAY_SIZE (omap_uart) -1 ; i++) {struct omap_uart_state *uart = &omap_uart[i];struct platform_device *pdev = &uart->pdev;struct device *dev = &pdev->dev;
Tony Lindgren
maintainerQuoted 29 lines · Tony Lindgren
Quoted 28 lines · * [email protected] <[email protected]> [091020 14:53]:
Quoted 5 lines · Tony Lindgren
This patch has been applied to the linux-omap
by youw fwiendly patch wobot.Branch in linux-omap: omap2-upstream
Quoted 7 lines
Initial commit ID (Likely to change):
439d2c69335a28ffdb5a9795ff384b6755ca0f7fPatchWorks
http://patchwork.kernel.org/patch/52477/Git (Likely to change, and takes a while to get mirrored)
http://git.kernel.org/?p=linux/kernel/git/tmlind/linux-omap-2.6.git;a=commit;h=439d2c69335a28ffdb5a9795ff384b6755ca0f7fThis patch broke all OMAP1 boards. NULL terminator entry for omap1
serial_platform_datacannot be removed just because serial driver uses is as last entry marker. Without it we end this way:Unable to handle kernel NULL pointer dereference at virtual address 00000028 pgd = c0004000 [00000028] *pgd=00000000 Internal error: Oops: 80000005 [#1] last sysfs file: Modules linked in: CPU: 0 Not tainted (2.6.32-rc5-06314-g4155da6-dirty #12)PC is at
0x28
LR is atserial8250_config_port+0x184/0xc34
(...etc...)
Quoted 5 lines
Quoted 2 lines
Please consider following fix (and while there fix OMAP2 too as patch broke it as well (untested))
Thanks, I already refreshed the original patch with the same fix few days ago :) It should be there in for-next branch and master branch.
Correction, sorry looks like I did not really read your patch. It seems to be the right solution for mach-omap1, but not needed for mach-omap2 because the array is not plat_serial8250_port on mach-omap2.
Quoted 54 lines
Tony
Quoted 40 lines
Signed-off-by Ladislav Michl <[email protected]>arch/arm/mach-omap1/serial.c +4
-2@@ -86,7 +86,9 @@ static struct plat_serial8250_port serial_platform_data[] = { .iotype = UPIO_MEM, .regshift = 2, .uartclk = OMAP16XX_BASE_BAUD * 16, - }, + }, { + } + }; static struct platform_device serial_device = {@@ -119,7 +121,7 @@ void __init omap_serial_init(void) serial_platform_data[2 ].uartclk =OMAP1510_BASE_BAUD *16 ; } -for (i =0 ; i <ARRAY_SIZE (serial_platform_data); i++) { +for (i =0 ; i <ARRAY_SIZE (serial_platform_data) -1 ; i++) {unsigned char reg;/* Static mapping, never released */ arch/arm/mach-omap2/serial.c +1
-1@@ -585,7 +585,7 @@ void __init omap_serial_early_init(void)* if not needed. */ -for (i =0 ; i <ARRAY_SIZE (omap_uart); i++) { +for (i =0 ; i <ARRAY_SIZE (omap_uart) -1 ; i++) {struct omap_uart_state *uart = &omap_uart[i];struct platform_device *pdev = &uart->pdev;struct device *dev = &pdev->dev;arch/arm/mach-omap2/serial.c void __init omap_serial_init(void) · line 643
Quoted 8 lines
arch/arm/mach-omap2/serial.c +1
-1@@ -637,7 +637,7 @@ void __init omap_serial_init(void) {int i; -for (i =0 ; i <ARRAY_SIZE (omap_uart); i++) { +for (i =0 ; i <ARRAY_SIZE (omap_uart) -1 ; i++) {struct omap_uart_state *uart = &omap_uart[i];struct platform_device *pdev = &uart->pdev;struct device *dev = &pdev->dev;--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Tony Lindgren
maintainerQuoted 33 lines · Tony Lindgren
Quoted 32 lines · Tony Lindgren
Quoted 30 lines · * [email protected] <[email protected]> [091020 14:53]:
Quoted 5 lines · Tony Lindgren
This patch has been applied to the linux-omap
by youw fwiendly patch wobot.Branch in linux-omap: omap2-upstream
Quoted 7 lines
Initial commit ID (Likely to change):
439d2c69335a28ffdb5a9795ff384b6755ca0f7fPatchWorks
http://patchwork.kernel.org/patch/52477/Git (Likely to change, and takes a while to get mirrored)
http://git.kernel.org/?p=linux/kernel/git/tmlind/linux-omap-2.6.git;a=commit;h=439d2c69335a28ffdb5a9795ff384b6755ca0f7fThis patch broke all OMAP1 boards. NULL terminator entry for omap1
serial_platform_datacannot be removed just because serial driver uses is as last entry marker. Without it we end this way:Unable to handle kernel NULL pointer dereference at virtual address 00000028 pgd = c0004000 [00000028] *pgd=00000000 Internal error: Oops: 80000005 [#1] last sysfs file: Modules linked in: CPU: 0 Not tainted (2.6.32-rc5-06314-g4155da6-dirty #12)PC is at
0x28
LR is atserial8250_config_port+0x184/0xc34
(...etc...)Please consider following fix (and while there fix OMAP2 too as patch broke it as well (untested))
Quoted 6 lines
Quoted 2 lines
Thanks, I already refreshed the original patch with the same fix few days ago :) It should be there in for-next branch and master branch.
Correction, sorry looks like I did not really read your patch. It seems to be the right solution for mach-omap1, but not needed for mach-omap2 because the array is not
plat_serial8250_porton mach-omap2.
I've refreshed the original serial.c patch in for-next branch by leaving out the mach-omap2 changes. Also updated in the master branch, can you please check?
Thanks,
Tony
Quoted 59 lines
Quoted 46 lines
Tony
Quoted 43 lines
Signed-off-by Ladislav Michl <[email protected]>arch/arm/mach-omap1/serial.c +4
-2@@ -86,7 +86,9 @@ static struct plat_serial8250_port serial_platform_data[] = { .iotype = UPIO_MEM, .regshift = 2, .uartclk = OMAP16XX_BASE_BAUD * 16, - }, + }, { + } + }; static struct platform_device serial_device = {@@ -119,7 +121,7 @@ void __init omap_serial_init(void) serial_platform_data[2 ].uartclk =OMAP1510_BASE_BAUD *16 ; } -for (i =0 ; i <ARRAY_SIZE (serial_platform_data); i++) { +for (i =0 ; i <ARRAY_SIZE (serial_platform_data) -1 ; i++) {unsigned char reg;/* Static mapping, never released */ arch/arm/mach-omap2/serial.c +1
-1@@ -585,7 +585,7 @@ void __init omap_serial_early_init(void)* if not needed. */ -for (i =0 ; i <ARRAY_SIZE (omap_uart); i++) { +for (i =0 ; i <ARRAY_SIZE (omap_uart) -1 ; i++) {struct omap_uart_state *uart = &omap_uart[i];struct platform_device *pdev = &uart->pdev;struct device *dev = &pdev->dev;@@ -637,7 +637,7 @@ void __init omap_serial_init(void) {int i;Quoted 9 lines
arch/arm/mach-omap2/serial.c void __init omap_serial_early_init(void) · line 591
Quoted 5 lines
arch/arm/mach-omap2/serial.c +1
-1-for (i =0 ; i <ARRAY_SIZE (omap_uart); i++) { +for (i =0 ; i <ARRAY_SIZE (omap_uart) -1 ; i++) {struct omap_uart_state *uart = &omap_uart[i];struct platform_device *pdev = &uart->pdev;struct device *dev = &pdev->dev;--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 14 lines · Tony Lindgren
Quoted 14 lines
Quoted 14 lines
Quoted 13 lines
Unable to handle kernel NULL pointer dereference at virtual address 00000028 pgd = c0004000 [00000028] *pgd=00000000 Internal error: Oops: 80000005 [#1] last sysfs file: Modules linked in: CPU: 0 Not tainted (2.6.32-rc5-06314-g4155da6-dirty #12)PC is at
0x28
LR is atserial8250_config_port+0x184/0xc34
(...etc...)Please consider following fix (and while there fix OMAP2 too as patch broke it as well (untested))
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
Thanks, I already refreshed the original patch with the same fix few days ago :) It should be there in for-next branch and master branch.
Correction, sorry looks like I did not really read your patch. It seems to be the right solution for mach-omap1, but not needed for mach-omap2 because the array is not
plat_serial8250_porton mach-omap2.
Ach, sorry. Now it was me who didn't read code carefully.
Quoted 3 lines
I've refreshed the original
serial.cpatch in for-next branch by leaving out the mach-omap2 changes. Also updated in the master branch, can you please check?
Just pulled master branch and succesfully booted on OMAP5910 board.
Thank you,
ladis