[linux-sunxi] [PATCH 3.4 3/3] serial: 8250_sunxi: UART port selection
Signed-off-by: Paul Kocialkowski --- drivers/tty/serial/8250/8250_sunxi.c | 22 -- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/8250/8250_sunxi.c b/drivers/tty/serial/8250/8250_sunxi.c index 25fdcff..1eb7927 100644 --- a/drivers/tty/serial/8250/8250_sunxi.c +++ b/drivers/tty/serial/8250/8250_sunxi.c @@ -335,7 +335,9 @@ static int __init sw_serial_init(void) int ret; int i, max = sw_serial_get_max_ports(); int used = 0; + int port = 0; char uart_para[16]; + unsigned int id = 0; uart_used = 0; for (i = 0; i < max; i++, used = 0) { @@ -345,10 +347,26 @@ static int __init sw_serial_init(void) ret = script_parser_fetch(uart_para, "uart_used", &used, sizeof(int)); if (ret) pr_err("failed to get uart%d's used information\n", i); - pr_debug("uart:%d used:%d\n", i, used); + + port = sw_uart_dev[i].id; + + ret = script_parser_fetch(uart_para, "uart_port", &port, sizeof(int)); + if (ret) + pr_err("failed to get uart%d's port information\n", i); + + pr_debug("uart:%d used:%d port:%d\n", i, used, port); + if (used) { uart_used |= 1 << i; - platform_device_register(&sw_uart_dev[i]); + + if ((id & (1 << port)) == 0) { + sw_uart_dev[i].id = port; + id |= (1 << port); + + platform_device_register(&sw_uart_dev[i]); + } else { + pr_err("failed to set uart%d's port (duplicate)\n", i); + } } } -- 1.7.9.5 -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [linux-sunxi] [PATCH 3.4 3/3] serial: 8250_sunxi: UART port selection
On Sat, 18 Oct 2014 23:47:14 +0200 Paul Kocialkowski wrote: > Signed-off-by: Paul Kocialkowski > --- > drivers/tty/serial/8250/8250_sunxi.c | 22 -- > 1 file changed, 20 insertions(+), 2 deletions(-) This patch needs a commit message, explaining why we might want to have it applied. Does it solve some real practical problem? > diff --git a/drivers/tty/serial/8250/8250_sunxi.c > b/drivers/tty/serial/8250/8250_sunxi.c > index 25fdcff..1eb7927 100644 > --- a/drivers/tty/serial/8250/8250_sunxi.c > +++ b/drivers/tty/serial/8250/8250_sunxi.c > @@ -335,7 +335,9 @@ static int __init sw_serial_init(void) > int ret; > int i, max = sw_serial_get_max_ports(); > int used = 0; > + int port = 0; > char uart_para[16]; > + unsigned int id = 0; > > uart_used = 0; > for (i = 0; i < max; i++, used = 0) { > @@ -345,10 +347,26 @@ static int __init sw_serial_init(void) > ret = script_parser_fetch(uart_para, "uart_used", &used, > sizeof(int)); > if (ret) > pr_err("failed to get uart%d's used information\n", i); > - pr_debug("uart:%d used:%d\n", i, used); > + > + port = sw_uart_dev[i].id; > + > + ret = script_parser_fetch(uart_para, "uart_port", &port, > sizeof(int)); > + if (ret) > + pr_err("failed to get uart%d's port information\n", i); > + > + pr_debug("uart:%d used:%d port:%d\n", i, used, port); > + > if (used) { > uart_used |= 1 << i; > - platform_device_register(&sw_uart_dev[i]); > + > + if ((id & (1 << port)) == 0) { > + sw_uart_dev[i].id = port; > + id |= (1 << port); > + > + platform_device_register(&sw_uart_dev[i]); > + } else { > + pr_err("failed to set uart%d's port > (duplicate)\n", i); > + } > } > } > -- Best regards, Siarhei Siamashka -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[linux-sunxi] [PATCH 3.4 3/3] serial: 8250_sunxi: UART port selection
Signed-off-by: Paul Kocialkowski --- drivers/tty/serial/8250/8250_sunxi.c | 22 -- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/8250/8250_sunxi.c b/drivers/tty/serial/8250/8250_sunxi.c index 25fdcff..1eb7927 100644 --- a/drivers/tty/serial/8250/8250_sunxi.c +++ b/drivers/tty/serial/8250/8250_sunxi.c @@ -335,7 +335,9 @@ static int __init sw_serial_init(void) int ret; int i, max = sw_serial_get_max_ports(); int used = 0; + int port = 0; char uart_para[16]; + unsigned int id = 0; uart_used = 0; for (i = 0; i < max; i++, used = 0) { @@ -345,10 +347,26 @@ static int __init sw_serial_init(void) ret = script_parser_fetch(uart_para, "uart_used", &used, sizeof(int)); if (ret) pr_err("failed to get uart%d's used information\n", i); - pr_debug("uart:%d used:%d\n", i, used); + + port = sw_uart_dev[i].id; + + ret = script_parser_fetch(uart_para, "uart_port", &port, sizeof(int)); + if (ret) + pr_err("failed to get uart%d's port information\n", i); + + pr_debug("uart:%d used:%d port:%d\n", i, used, port); + if (used) { uart_used |= 1 << i; - platform_device_register(&sw_uart_dev[i]); + + if ((id & (1 << port)) == 0) { + sw_uart_dev[i].id = port; + id |= (1 << port); + + platform_device_register(&sw_uart_dev[i]); + } else { + pr_err("failed to set uart%d's port (duplicate)\n", i); + } } } -- 1.7.9.5 -- You received this message because you are subscribed to the Google Groups "linux-sunxi" group. To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.