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

[Xen-changelog] Cleanups.



ChangeSet 1.1359, 2005/03/24 08:46:03+00:00, kaf24@xxxxxxxxxxxxxxxxxxxx

        Cleanups.
        Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>



 linux-2.6.11-xen-sparse/drivers/xen/console/console.c |   62 +++++++++---------
 xen/common/physdev.c                                  |   14 +---
 xen/drivers/char/serial.c                             |   15 +---
 xen/include/xen/physdev.h                             |    8 +-
 4 files changed, 43 insertions(+), 56 deletions(-)


diff -Nru a/linux-2.6.11-xen-sparse/drivers/xen/console/console.c 
b/linux-2.6.11-xen-sparse/drivers/xen/console/console.c
--- a/linux-2.6.11-xen-sparse/drivers/xen/console/console.c     2005-03-24 
04:02:53 -05:00
+++ b/linux-2.6.11-xen-sparse/drivers/xen/console/console.c     2005-03-24 
04:02:54 -05:00
@@ -77,19 +77,18 @@
     else if ( !strncmp(str, "off", 3) )
         xc_mode = XC_OFF;
 
-    switch (xc_mode)
+    switch ( xc_mode )
     {
     case XC_SERIAL:
-       n  = simple_strtol( str+4, &q, 10 );
-       if ( q>str+4 ) xc_num = n;
-       break;
-
+        n = simple_strtol( str+4, &q, 10 );
+        if ( q > (str + 4) ) xc_num = n;
+        break;
     case XC_TTY:
-       n  = simple_strtol( str+3, &q, 10 );
-       if ( q>str+3 ) xc_num = n;
-       break;
+        n = simple_strtol( str+3, &q, 10 );
+        if ( q > (str + 3) ) xc_num = n;
+        break;
     }
-printk("xc_num = %d\n",xc_num);
+
     return 1;
 }
 __setup("xencons=", xencons_setup);
@@ -148,16 +147,12 @@
 {
     int rc;
 
-    while ( count > 0 )
+    while ( (count > 0) &&
+            ((rc = HYPERVISOR_console_io(
+                CONSOLEIO_write, count, (char *)s)) > 0) )
     {
-        if ( (rc = HYPERVISOR_console_io(CONSOLEIO_write,
-                                         count, (char *)s)) > 0 )
-        {
-            count -= rc;
-            s += rc;
-        }
-       else
-           break;
+        count -= rc;
+        s += rc;
     }
 }
 
@@ -194,8 +189,8 @@
             xc_mode = XC_SERIAL;
         kcons_info.write = kcons_write_dom0;
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-       if ( xc_mode == XC_SERIAL )
-           kcons_info.flags |= CON_ENABLED;
+        if ( xc_mode == XC_SERIAL )
+            kcons_info.flags |= CON_ENABLED;
 #endif
     }
     else
@@ -209,14 +204,14 @@
     {
     case XC_SERIAL:
         strcpy(kcons_info.name, "ttyS");
-       if ( xc_num == -1 ) xc_num = 0;
-       break;
+        if ( xc_num == -1 ) xc_num = 0;
+        break;
 
     case XC_TTY:
         strcpy(kcons_info.name, "tty");
-       if ( xc_num == -1 ) xc_num = 1;
-       break;
-       
+        if ( xc_num == -1 ) xc_num = 1;
+        break;
+
     default:
         return __RETCODE;
     }
@@ -261,7 +256,7 @@
      * We use dangerous control-interface functions that require a quiescent
      * system and no interrupts. Try to ensure this with a global cli().
      */
-    local_irq_disable();       /* XXXsmp */
+    local_irq_disable(); /* XXXsmp */
 
     /* Spin until console data is flushed through to the domain controller. */
     while ( (wc != wp) && !ctrl_if_transmitter_empty() )
@@ -502,8 +497,10 @@
 }
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-static int xencons_write(struct tty_struct *tty, const unsigned char *buf,
-                        int count)
+static int xencons_write(
+    struct tty_struct *tty,
+    const unsigned char *buf,
+    int count)
 {
     int i;
     unsigned long flags;
@@ -525,8 +522,11 @@
     return i;
 }
 #else
-static int xencons_write(struct tty_struct *tty, int from_user,
-                        const u_char *buf, int count)
+static int xencons_write(
+    struct tty_struct *tty, 
+    int from_user,
+    const u_char *buf, 
+    int count)
 {
     int i;
     unsigned long flags;
@@ -669,7 +669,7 @@
     return 0;
 }
 
-#define DUMMY  (void *)xennullcon_dummy
+#define DUMMY (void *)xennullcon_dummy
 
 /*
  *  The console `switch' structure for the dummy console
diff -Nru a/xen/common/physdev.c b/xen/common/physdev.c
--- a/xen/common/physdev.c      2005-03-24 04:02:53 -05:00
+++ b/xen/common/physdev.c      2005-03-24 04:02:53 -05:00
@@ -105,18 +105,12 @@
     return 0;
 }
 
-void physdev_modify_ioport_access_range( struct domain *d, int enable, 
-                                 int port, int num )
+void physdev_modify_ioport_access_range(
+    struct domain *d, int enable, int port, int num)
 {
     int i;
-    ASSERT( d->arch.iobmp_mask );
-    for ( i = port; i < port+num; i++ )
-    {
-        if(enable)
-            clear_bit(i, d->arch.iobmp_mask);
-        else
-            set_bit(i, d->arch.iobmp_mask);
-    }
+    for ( i = port; i < (port + num); i++ )
+        (enable ? clear_bit : set_bit)(i, d->arch.iobmp_mask);
 }
 
 /* Add a device to a per-domain device-access list. */
diff -Nru a/xen/drivers/char/serial.c b/xen/drivers/char/serial.c
--- a/xen/drivers/char/serial.c 2005-03-24 04:02:54 -05:00
+++ b/xen/drivers/char/serial.c 2005-03-24 04:02:54 -05:00
@@ -480,19 +480,12 @@
         uart->lock = SPIN_LOCK_UNLOCKED;
 }
 
-void serial_endboot()
+void serial_endboot(void)
 {
     int i;
-
-    for (i=0;i<sizeof(com)/sizeof(struct uart);i++)
-    {
-        if( UART_ENABLED(&com[i]) )
-        {
-            /* remove access */
-            physdev_modify_ioport_access_range( dom0, 0, com[i].io_base, 8 );
-        }
-    }
-    
+    for ( i = 0; i < ARRAY_SIZE(com); i++ )
+        if ( UART_ENABLED(&com[i]) )
+            physdev_modify_ioport_access_range(dom0, 0, com[i].io_base, 8);
 }
 
 /*
diff -Nru a/xen/include/xen/physdev.h b/xen/include/xen/physdev.h
--- a/xen/include/xen/physdev.h 2005-03-24 04:02:53 -05:00
+++ b/xen/include/xen/physdev.h 2005-03-24 04:02:53 -05:00
@@ -7,11 +7,11 @@
 
 #include <public/physdev.h>
 
-void physdev_modify_ioport_access_range( struct domain *d, int enable, 
-                                 int port, int num );
+void physdev_modify_ioport_access_range(
+    struct domain *d, int enable, int port, int num );
 void physdev_destroy_state(struct domain *d);
-int physdev_pci_access_modify(domid_t dom, int bus, int dev, int func, 
-                              int enable);
+int physdev_pci_access_modify(
+    domid_t dom, int bus, int dev, int func, int enable);
 int domain_iomem_in_pfn(struct domain *p, unsigned long pfn);
 long do_physdev_op(physdev_op_t *uop);
 void physdev_init_dom0(struct domain *d);


-------------------------------------------------------
This SF.net email is sponsored by Microsoft Mobile & Embedded DevCon 2005
Attend MEDC 2005 May 9-12 in Vegas. Learn more about the latest Windows
Embedded(r) & Windows Mobile(tm) platforms, applications & content.  Register
by 3/29 & save $300 http://ads.osdn.com/?ad_id=6883&alloc_id=15149&op=click
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/xen-changelog


 


Rackspace

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