[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 7/8] ns16550: command line parsing adjustments


  • To: "xen-devel" <xen-devel@xxxxxxxxxxxxx>
  • From: "Jan Beulich" <JBeulich@xxxxxxxx>
  • Date: Tue, 11 Sep 2012 11:20:32 +0100
  • Delivery-date: Tue, 11 Sep 2012 10:20:50 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xen.org>

Allow intermediate parts of the command line options to be absent
(expressed by two immediately succeeding commas).

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

--- a/xen/drivers/char/ns16550.c
+++ b/xen/drivers/char/ns16550.c
@@ -556,26 +556,23 @@ static void __init ns16550_parse_port_co
     else if ( (baud = simple_strtoul(conf, &conf, 10)) != 0 )
         uart->baud = baud;
 
-    if ( *conf == '/')
+    if ( *conf == '/' )
     {
         conf++;
         uart->clock_hz = simple_strtoul(conf, &conf, 0) << 4;
     }
 
-    if ( *conf != ',' )
-        goto config_parsed;
-    conf++;
-
-    uart->data_bits = simple_strtoul(conf, &conf, 10);
+    if ( *conf == ',' && *++conf != ',' )
+    {
+        uart->data_bits = simple_strtoul(conf, &conf, 10);
 
-    uart->parity = parse_parity_char(*conf);
-    conf++;
+        uart->parity = parse_parity_char(*conf);
 
-    uart->stop_bits = simple_strtoul(conf, &conf, 10);
+        uart->stop_bits = simple_strtoul(conf + 1, &conf, 10);
+    }
 
-    if ( *conf == ',' )
+    if ( *conf == ',' && *++conf != ',' )
     {
-        conf++;
         if ( strncmp(conf, "pci", 3) == 0 )
         {
             if ( pci_uart_config(uart, 1/* skip AMT */, uart - ns16550_com) )
@@ -592,24 +589,21 @@ static void __init ns16550_parse_port_co
         {
             uart->io_base = simple_strtoul(conf, &conf, 0);
         }
+    }
 
-        if ( *conf == ',' )
-        {
-            conf++;
-            uart->irq = simple_strtoul(conf, &conf, 10);
-            if ( *conf == ',' )
-            {
-                conf++;
-                uart->ps_bdf_enable = 1;
-                parse_pci_bdf(&conf, &uart->ps_bdf[0]);
-                if ( *conf == ',' )
-                {
-                    conf++;
-                    uart->pb_bdf_enable = 1;
-                    parse_pci_bdf(&conf, &uart->pb_bdf[0]);
-                }
-            }
-        }
+    if ( *conf == ',' && *++conf != ',' )
+        uart->irq = simple_strtol(conf, &conf, 10);
+
+    if ( *conf == ',' && *++conf != ',' )
+    {
+        uart->ps_bdf_enable = 1;
+        parse_pci_bdf(&conf, &uart->ps_bdf[0]);
+    }
+
+    if ( *conf == ',' && *++conf != ',' )
+    {
+        uart->pb_bdf_enable = 1;
+        parse_pci_bdf(&conf, &uart->pb_bdf[0]);
     }
 
  config_parsed:



Attachment: sercon-ns16550-parse.patch
Description: Text document

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.