- 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@suse.com> --- a/drivers/xen/console/console.c +++ b/drivers/xen/console/console.c @@ -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 @@ static int __init xen_console_init(void) 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; --- /dev/null +++ a/drivers/xen/console/xencons.h @@ -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); --- a/drivers/xen/console/xencons_ring.c +++ b/drivers/xen/console/xencons_ring.c @@ -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 xencons_ring_init(void) { 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 @@ int xencons_ring_init(void) 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(); } --- a/include/xen/xencons.h +++ b/include/xen/xencons.h @@ -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-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel