diff mbox

[Xen-devel,v2] ns16550: make some initialisation common

Message ID 1395397293-23286-1-git-send-email-ian.campbell@citrix.com
State Superseded
Headers show

Commit Message

Ian Campbell March 21, 2014, 10:21 a.m. UTC
Should avoid accidents like forgetting to init lsr_mask for DT devices in the
future.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Julien Grall <julien.grall@linaro.org>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
v2: remember to cc xen-devel...

Depends on "ns16550: setup default lsr_mask for DT systems too"
---
 xen/drivers/char/ns16550.c |   35 +++++++++++++++++++----------------
 1 file changed, 19 insertions(+), 16 deletions(-)

Comments

Keir Fraser March 21, 2014, 11:16 a.m. UTC | #1
Ian Campbell wrote:
> Should avoid accidents like forgetting to init lsr_mask for DT devices in the
> future.
>
> Signed-off-by: Ian Campbell<ian.campbell@citrix.com>
> Acked-by: Julien Grall<julien.grall@linaro.org>
> Reviewed-by: Jan Beulich<jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
Ian Campbell March 21, 2014, 12:21 p.m. UTC | #2
On Fri, 2014-03-21 at 11:16 +0000, Keir Fraser wrote:
> Ian Campbell wrote:
> > Should avoid accidents like forgetting to init lsr_mask for DT devices in the
> > future.
> >
> > Signed-off-by: Ian Campbell<ian.campbell@citrix.com>
> > Acked-by: Julien Grall<julien.grall@linaro.org>
> > Reviewed-by: Jan Beulich<jbeulich@suse.com>
> Acked-by: Keir Fraser <keir@xen.org>

Thanks, do you also ack
http://bugs.xenproject.org/xen/mid/%3C1395335099.3104.41.camel@kazak.uk.xensource.com%3E
which is the actual bug fix (which this patch depends on)?

Ian
Konrad Rzeszutek Wilk March 21, 2014, 1:32 p.m. UTC | #3
On Fri, Mar 21, 2014 at 11:16:11AM +0000, Keir Fraser wrote:
> Ian Campbell wrote:
> >Should avoid accidents like forgetting to init lsr_mask for DT devices in the
> >future.
> >
> >Signed-off-by: Ian Campbell<ian.campbell@citrix.com>
> >Acked-by: Julien Grall<julien.grall@linaro.org>
> >Reviewed-by: Jan Beulich<jbeulich@suse.com>
> Acked-by: Keir Fraser <keir@xen.org>


I think I should join the party too!

Reviewd-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>

> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
Ian Campbell March 21, 2014, 1:44 p.m. UTC | #4
On Fri, 2014-03-21 at 09:32 -0400, Konrad Rzeszutek Wilk wrote:
> On Fri, Mar 21, 2014 at 11:16:11AM +0000, Keir Fraser wrote:
> > Ian Campbell wrote:
> > >Should avoid accidents like forgetting to init lsr_mask for DT devices in the
> > >future.
> > >
> > >Signed-off-by: Ian Campbell<ian.campbell@citrix.com>
> > >Acked-by: Julien Grall<julien.grall@linaro.org>
> > >Reviewed-by: Jan Beulich<jbeulich@suse.com>
> > Acked-by: Keir Fraser <keir@xen.org>
> 
> 
> I think I should join the party too!

Wouldn't want you to feel left out ;-)


> Reviewd-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> 
> > 
> > _______________________________________________
> > Xen-devel mailing list
> > Xen-devel@lists.xen.org
> > http://lists.xen.org/xen-devel
diff mbox

Patch

diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c
index 2dd32b2..44e13b7 100644
--- a/xen/drivers/char/ns16550.c
+++ b/xen/drivers/char/ns16550.c
@@ -1076,6 +1076,21 @@  static void __init ns16550_parse_port_config(
     serial_register_uart(uart - ns16550_com, &ns16550_driver, uart);
 }
 
+static void ns16550_init_common(struct ns16550 *uart)
+{
+    uart->clock_hz  = UART_CLOCK_HZ;
+
+#ifdef HAS_PCI
+    uart->enable_ro = 0;
+#endif
+
+    /* Default is no transmit FIFO. */
+    uart->fifo_size = 1;
+
+    /* Default lsr_mask = UART_LSR_THRE */
+    uart->lsr_mask  = UART_LSR_THRE;
+}
+
 void __init ns16550_init(int index, struct ns16550_defaults *defaults)
 {
     struct ns16550 *uart;
@@ -1085,10 +1100,11 @@  void __init ns16550_init(int index, struct ns16550_defaults *defaults)
 
     uart = &ns16550_com[index];
 
+    ns16550_init_common(uart);
+
     uart->baud      = (defaults->baud ? :
                        console_has((index == 0) ? "com1" : "com2")
                        ? BAUD_AUTO : 0);
-    uart->clock_hz  = UART_CLOCK_HZ;
     uart->data_bits = defaults->data_bits;
     uart->parity    = parse_parity_char(defaults->parity);
     uart->stop_bits = defaults->stop_bits;
@@ -1098,16 +1114,6 @@  void __init ns16550_init(int index, struct ns16550_defaults *defaults)
     uart->reg_width = 1;
     uart->reg_shift = 0;
 
-#ifdef HAS_PCI
-    uart->enable_ro = 0;
-#endif
-
-    /* Default is no transmit FIFO. */
-    uart->fifo_size = 1;
-
-    /* Default lsr_mask = UART_LSR_THRE */
-    uart->lsr_mask = UART_LSR_THRE;
-
     ns16550_parse_port_config(uart, (index == 0) ? opt_com1 : opt_com2);
 }
 
@@ -1122,15 +1128,12 @@  static int __init ns16550_uart_dt_init(struct dt_device_node *dev,
 
     uart = &ns16550_com[0];
 
+    ns16550_init_common(uart);
+
     uart->baud      = BAUD_AUTO;
-    uart->clock_hz  = UART_CLOCK_HZ;
     uart->data_bits = 8;
     uart->parity    = UART_PARITY_NONE;
     uart->stop_bits = 1;
-    /* Default is no transmit FIFO. */
-    uart->fifo_size = 1;
-    /* Default lsr_mask = UART_LSR_THRE */
-    uart->lsr_mask = UART_LSR_THRE;
 
     res = dt_device_get_address(dev, 0, &uart->io_base, &io_size);
     if ( res )