All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 7/8] ns16550: command line parsing adjustments
@ 2012-09-11 10:20 Jan Beulich
  2012-09-11 10:22 ` Andrew Cooper
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Beulich @ 2012-09-11 10:20 UTC (permalink / raw)
  To: xen-devel

[-- Attachment #1: Type: text/plain, Size: 2405 bytes --]

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

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- 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 #2: sercon-ns16550-parse.patch --]
[-- Type: text/plain, Size: 2444 bytes --]

ns16550: command line parsing adjustments

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

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- 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 #3: Type: text/plain, Size: 126 bytes --]

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 7/8] ns16550: command line parsing adjustments
  2012-09-11 10:20 [PATCH 7/8] ns16550: command line parsing adjustments Jan Beulich
@ 2012-09-11 10:22 ` Andrew Cooper
  2012-09-11 10:48   ` Jan Beulich
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Cooper @ 2012-09-11 10:22 UTC (permalink / raw)
  To: xen-devel


On 11/09/12 11:20, Jan Beulich wrote:
> Allow intermediate parts of the command line options to be absent
> (expressed by two immediately succeeding commas).
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Can you also update com{1,2} in the docs to reflect this?

>
> --- 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:
>
>
>

-- 
Andrew Cooper - Dom0 Kernel Engineer, Citrix XenServer
T: +44 (0)1223 225 900, http://www.citrix.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 7/8] ns16550: command line parsing adjustments
  2012-09-11 10:22 ` Andrew Cooper
@ 2012-09-11 10:48   ` Jan Beulich
  0 siblings, 0 replies; 3+ messages in thread
From: Jan Beulich @ 2012-09-11 10:48 UTC (permalink / raw)
  To: Andrew Cooper; +Cc: xen-devel

>>> On 11.09.12 at 12:22, Andrew Cooper <andrew.cooper3@citrix.com> wrote:
> On 11/09/12 11:20, Jan Beulich wrote:
>> Allow intermediate parts of the command line options to be absent
>> (expressed by two immediately succeeding commas).
>>
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 
> Can you also update com{1,2} in the docs to reflect this?

Sure - here's the incremental diff.

Jan

--- a/docs/misc/xen-command-line.markdown
+++ b/docs/misc/xen-command-line.markdown
@@ -199,7 +199,7 @@ If set, override Xen's calculation of th
 If set, override Xen's default choice for the platform timer.
 
 ### com1,com2
-> `= <baud>[/<clock_hz>][,DPS[,<io-base>[,<irq>[,<port-bdf>[,<bridge-bdf>]]]] | pci | amt ] `
+> `= <baud>[/<clock_hz>][,[DPS][,[<io-base>|pci|amt][,[<irq>][,[<port-bdf>][,[<bridge-bdf>]]]]]]`
 
 Both option `com1` and `com2` follow the same format.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-09-11 10:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-11 10:20 [PATCH 7/8] ns16550: command line parsing adjustments Jan Beulich
2012-09-11 10:22 ` Andrew Cooper
2012-09-11 10:48   ` Jan Beulich

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.