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

[Xen-changelog] [linux-2.6.18-xen] xencons: cleanup



# HG changeset patch
# User Jan Beulich <jbeulich@xxxxxxxx>
# Date 1331815220 -3600
# Node ID 80ed6519816209ea16ab606a58f868eb8b90e909
# Parent  484947c99e63975cd812738ff02b0d237fc45095
xencons: cleanup

- move private declarations into a separate (private) header
- don't include unneeded headers
- declare xprintk()
- move resume-only code from xencons_ring_init() into xencons_resume()

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


diff -r 484947c99e63 -r 80ed65198162 drivers/xen/console/console.c
--- a/drivers/xen/console/console.c     Thu Mar 15 13:38:55 2012 +0100
+++ b/drivers/xen/console/console.c     Thu Mar 15 13:40:20 2012 +0100
@@ -30,7 +30,6 @@
  * IN THE SOFTWARE.
  */
 
-#include <linux/version.h>
 #include <linux/module.h>
 #include <linux/errno.h>
 #include <linux/signal.h>
@@ -40,7 +39,6 @@
 #include <linux/tty_flip.h>
 #include <linux/serial.h>
 #include <linux/major.h>
-#include <linux/ptrace.h>
 #include <linux/ioport.h>
 #include <linux/mm.h>
 #include <linux/slab.h>
@@ -50,15 +48,9 @@
 #include <linux/sysrq.h>
 #include <linux/screen_info.h>
 #include <linux/vt.h>
-#include <asm/io.h>
-#include <asm/irq.h>
-#include <asm/uaccess.h>
 #include <xen/interface/xen.h>
 #include <xen/interface/event_channel.h>
-#include <asm/hypervisor.h>
-#include <xen/evtchn.h>
-#include <xen/xenbus.h>
-#include <xen/xencons.h>
+#include "xencons.h"
 
 /*
  * Modes:
@@ -252,7 +244,7 @@
 console_initcall(xen_console_init);
 
 /*** Useful function for console debugging -- goes straight to Xen. ***/
-asmlinkage int xprintk(const char *fmt, ...)
+int xprintk(const char *fmt, ...)
 {
        va_list args;
        int printk_len;
diff -r 484947c99e63 -r 80ed65198162 drivers/xen/console/xencons.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/drivers/xen/console/xencons.h     Thu Mar 15 13:40:20 2012 +0100
@@ -0,0 +1,12 @@
+#include <xen/evtchn.h>
+#include <xen/xencons.h>
+
+void xencons_force_flush(void);
+
+/* Interrupt work hooks. Receive data, or kick data out. */
+struct pt_regs;
+void xencons_rx(char *buf, unsigned len, struct pt_regs *);
+void xencons_tx(void);
+
+int xencons_ring_init(void);
+int xencons_ring_send(const char *data, unsigned len);
diff -r 484947c99e63 -r 80ed65198162 drivers/xen/console/xencons_ring.c
--- a/drivers/xen/console/xencons_ring.c        Thu Mar 15 13:38:55 2012 +0100
+++ b/drivers/xen/console/xencons_ring.c        Thu Mar 15 13:40:20 2012 +0100
@@ -24,29 +24,10 @@
  * IN THE SOFTWARE.
  */
 
-#include <linux/version.h>
-#include <linux/module.h>
 #include <linux/errno.h>
-#include <linux/signal.h>
-#include <linux/sched.h>
 #include <linux/interrupt.h>
-#include <linux/tty.h>
-#include <linux/tty_flip.h>
-#include <linux/serial.h>
-#include <linux/major.h>
-#include <linux/ptrace.h>
-#include <linux/ioport.h>
-#include <linux/mm.h>
-#include <linux/slab.h>
-
-#include <asm/hypervisor.h>
-#include <xen/evtchn.h>
-#include <xen/xencons.h>
-#include <linux/wait.h>
-#include <linux/interrupt.h>
-#include <linux/sched.h>
-#include <linux/err.h>
 #include <xen/interface/io/console.h>
+#include "xencons.h"
 
 static int xencons_irq;
 
@@ -112,13 +93,7 @@
 {
        int irq;
 
-       if (xencons_irq)
-               unbind_from_irqhandler(xencons_irq, NULL);
-       xencons_irq = 0;
-
-       if (!is_running_on_xen() ||
-           is_initial_xendomain() ||
-           !xen_start_info->console.domU.evtchn)
+       if (!xen_start_info->console.domU.evtchn)
                return -ENODEV;
 
        irq = bind_caller_port_to_irqhandler(
@@ -131,13 +106,18 @@
 
        xencons_irq = irq;
 
-       /* In case we have in-flight data after save/restore... */
-       notify_daemon();
-
        return 0;
 }
 
 void xencons_resume(void)
 {
-       (void)xencons_ring_init();
+       if (xencons_irq)
+               unbind_from_irqhandler(xencons_irq, NULL);
+       xencons_irq = 0;
+
+       if (is_running_on_xen() && !is_initial_xendomain())
+               xencons_ring_init();
+
+       /* In case we have in-flight data after save/restore... */
+       notify_daemon();
 }
diff -r 484947c99e63 -r 80ed65198162 include/xen/xencons.h
--- a/include/xen/xencons.h     Thu Mar 15 13:38:55 2012 +0100
+++ b/include/xen/xencons.h     Thu Mar 15 13:40:20 2012 +0100
@@ -1,17 +1,12 @@
 #ifndef __ASM_XENCONS_H__
 #define __ASM_XENCONS_H__
 
+int xprintk(const char *, ...) __attribute__ ((__format__(__printf__, 1, 2)));
+
 struct dom0_vga_console_info;
 void dom0_init_screen_info(const struct dom0_vga_console_info *, size_t);
 
 void xencons_force_flush(void);
 void xencons_resume(void);
 
-/* Interrupt work hooks. Receive data, or kick data out. */
-void xencons_rx(char *buf, unsigned len, struct pt_regs *regs);
-void xencons_tx(void);
-
-int xencons_ring_init(void);
-int xencons_ring_send(const char *data, unsigned len);
-
 #endif /* __ASM_XENCONS_H__ */

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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