ia64/xen-unstable

changeset 7895:419b32f72179

Remove conditionally-compiled code for Linux 2.4.

Signed-off-by: Vincent Hanquez <vincent@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Fri Nov 18 13:46:18 2005 +0100 (2005-11-18)
parents 7209244ea3d1
children 51bb139329b2
files linux-2.6-xen-sparse/arch/xen/i386/mm/hypervisor.c linux-2.6-xen-sparse/arch/xen/kernel/evtchn.c linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c linux-2.6-xen-sparse/drivers/xen/console/console.c linux-2.6-xen-sparse/drivers/xen/evtchn/evtchn.c linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c linux-2.6-xen-sparse/include/asm-xen/asm-i386/hypervisor.h
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/xen/i386/mm/hypervisor.c	Fri Nov 18 13:02:33 2005 +0100
     1.2 +++ b/linux-2.6-xen-sparse/arch/xen/i386/mm/hypervisor.c	Fri Nov 18 13:46:18 2005 +0100
     1.3 @@ -37,16 +37,10 @@
     1.4  #include <asm-xen/balloon.h>
     1.5  #include <asm-xen/xen-public/memory.h>
     1.6  #include <linux/module.h>
     1.7 -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
     1.8  #include <linux/percpu.h>
     1.9  #include <asm/tlbflush.h>
    1.10 -#endif
    1.11  
    1.12 -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
    1.13 -#define pte_offset_kernel pte_offset
    1.14 -#define pud_t pgd_t
    1.15 -#define pud_offset(d, va) d
    1.16 -#elif defined(CONFIG_X86_64)
    1.17 +#ifdef CONFIG_X86_64
    1.18  #define pmd_val_ma(v) (v).pmd
    1.19  #else
    1.20  #ifdef CONFIG_X86_PAE
     2.1 --- a/linux-2.6-xen-sparse/arch/xen/kernel/evtchn.c	Fri Nov 18 13:02:33 2005 +0100
     2.2 +++ b/linux-2.6-xen-sparse/arch/xen/kernel/evtchn.c	Fri Nov 18 13:46:18 2005 +0100
     2.3 @@ -121,11 +121,7 @@ static void init_evtchn_cpu_bindings(voi
     2.4  
     2.5  /* Upcall to generic IRQ layer. */
     2.6  #ifdef CONFIG_X86
     2.7 -#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9)
     2.8  extern fastcall unsigned int do_IRQ(struct pt_regs *regs);
     2.9 -#else
    2.10 -extern asmlinkage unsigned int do_IRQ(struct pt_regs *regs);
    2.11 -#endif
    2.12  #if defined (__i386__)
    2.13  #define IRQ_REG orig_eax
    2.14  #elif defined (__x86_64__)
     3.1 --- a/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c	Fri Nov 18 13:02:33 2005 +0100
     3.2 +++ b/linux-2.6-xen-sparse/drivers/xen/balloon/balloon.c	Fri Nov 18 13:46:18 2005 +0100
     3.3 @@ -91,7 +91,6 @@ static void balloon_process(void *unused
     3.4  static DECLARE_WORK(balloon_worker, balloon_process, NULL);
     3.5  static struct timer_list balloon_timer;
     3.6  
     3.7 -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
     3.8  /* Use the private and mapping fields of struct page as a list. */
     3.9  #define PAGE_TO_LIST(p) ((struct list_head *)&p->private)
    3.10  #define LIST_TO_PAGE(l)				\
    3.11 @@ -102,19 +101,6 @@ static struct timer_list balloon_timer;
    3.12  		p->mapping = NULL;		\
    3.13  		p->private = 0;			\
    3.14  	} while(0)
    3.15 -#else
    3.16 -/* There's a dedicated list field in struct page we can use.    */
    3.17 -#define PAGE_TO_LIST(p) ( &p->list )
    3.18 -#define LIST_TO_PAGE(l) ( list_entry(l, struct page, list) )
    3.19 -#define UNLIST_PAGE(p)  ( list_del(&p->list) )
    3.20 -#define pte_offset_kernel pte_offset
    3.21 -#define pud_t pgd_t
    3.22 -#define pud_offset(d, va) d
    3.23 -#define pud_none(d) 0
    3.24 -#define pud_bad(d) 0
    3.25 -#define subsys_initcall(_fn) __initcall(_fn)
    3.26 -#define pfn_to_page(_pfn) (mem_map + (_pfn))
    3.27 -#endif
    3.28  
    3.29  #define IPRINTK(fmt, args...) \
    3.30  	printk(KERN_INFO "xen_mem: " fmt, ##args)
     4.1 --- a/linux-2.6-xen-sparse/drivers/xen/console/console.c	Fri Nov 18 13:02:33 2005 +0100
     4.2 +++ b/linux-2.6-xen-sparse/drivers/xen/console/console.c	Fri Nov 18 13:46:18 2005 +0100
     4.3 @@ -128,12 +128,7 @@ static spinlock_t xencons_lock = SPIN_LO
     4.4  /* Common transmit-kick routine. */
     4.5  static void __xencons_tx_flush(void);
     4.6  
     4.7 -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
     4.8  static struct tty_driver *xencons_driver;
     4.9 -#else
    4.10 -static struct tty_driver xencons_driver;
    4.11 -#endif
    4.12 -
    4.13  
    4.14  /******************** Kernel console driver ********************************/
    4.15  
    4.16 @@ -170,18 +165,11 @@ static void kcons_write_dom0(
    4.17  	}
    4.18  }
    4.19  
    4.20 -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
    4.21  static struct tty_driver *kcons_device(struct console *c, int *index)
    4.22  {
    4.23  	*index = c->index;
    4.24  	return xencons_driver;
    4.25  }
    4.26 -#else
    4.27 -static kdev_t kcons_device(struct console *c)
    4.28 -{
    4.29 -	return MKDEV(TTY_MAJOR, (xc_mode == XC_SERIAL) ? 64 : 1);
    4.30 -}
    4.31 -#endif
    4.32  
    4.33  static struct console kcons_info = {
    4.34  	.device	= kcons_device,
    4.35 @@ -189,13 +177,8 @@ static struct console kcons_info = {
    4.36  	.index	= -1,
    4.37  };
    4.38  
    4.39 -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
    4.40  #define __RETCODE 0
    4.41  static int __init xen_console_init(void)
    4.42 -#else
    4.43 -#define __RETCODE
    4.44 -void xen_console_init(void)
    4.45 -#endif
    4.46  {
    4.47  	if (xen_init() < 0)
    4.48  		return __RETCODE;
    4.49 @@ -204,10 +187,8 @@ void xen_console_init(void)
    4.50  		if (xc_mode == XC_DEFAULT)
    4.51  			xc_mode = XC_SERIAL;
    4.52  		kcons_info.write = kcons_write_dom0;
    4.53 -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
    4.54  		if (xc_mode == XC_SERIAL)
    4.55  			kcons_info.flags |= CON_ENABLED;
    4.56 -#endif
    4.57  	} else {
    4.58  		if (xc_mode == XC_DEFAULT)
    4.59  			xc_mode = XC_TTY;
    4.60 @@ -237,9 +218,7 @@ void xen_console_init(void)
    4.61  
    4.62  	return __RETCODE;
    4.63  }
    4.64 -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
    4.65  console_initcall(xen_console_init);
    4.66 -#endif
    4.67  
    4.68  /*** Useful function for console debugging -- goes straight to Xen. ***/
    4.69  asmlinkage int xprintk(const char *fmt, ...)
    4.70 @@ -283,15 +262,8 @@ void xencons_force_flush(void)
    4.71  
    4.72  /******************** User-space console driver (/dev/console) ************/
    4.73  
    4.74 -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
    4.75  #define DRV(_d)         (_d)
    4.76  #define TTY_INDEX(_tty) ((_tty)->index)
    4.77 -#else
    4.78 -static int xencons_refcount;
    4.79 -static struct tty_struct *xencons_table[MAX_NR_CONSOLES];
    4.80 -#define DRV(_d)         (&(_d))
    4.81 -#define TTY_INDEX(_tty) (MINOR((_tty)->device) - xencons_driver.minor_start)
    4.82 -#endif
    4.83  
    4.84  static struct termios *xencons_termios[MAX_NR_CONSOLES];
    4.85  static struct termios *xencons_termios_locked[MAX_NR_CONSOLES];
    4.86 @@ -484,7 +456,6 @@ static inline int __xencons_put_char(int
    4.87  	return 1;
    4.88  }
    4.89  
    4.90 -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
    4.91  static int xencons_write(
    4.92  	struct tty_struct *tty,
    4.93  	const unsigned char *buf,
    4.94 @@ -509,42 +480,6 @@ static int xencons_write(
    4.95  
    4.96  	return i;
    4.97  }
    4.98 -#else
    4.99 -static int xencons_write(
   4.100 -	struct tty_struct *tty, 
   4.101 -	int from_user,
   4.102 -	const u_char *buf, 
   4.103 -	int count)
   4.104 -{
   4.105 -	int i;
   4.106 -	unsigned long flags;
   4.107 -
   4.108 -	if (from_user && verify_area(VERIFY_READ, buf, count))
   4.109 -		return -EINVAL;
   4.110 -
   4.111 -	if (TTY_INDEX(tty) != 0)
   4.112 -		return count;
   4.113 -
   4.114 -	spin_lock_irqsave(&xencons_lock, flags);
   4.115 -
   4.116 -	for (i = 0; i < count; i++) {
   4.117 -		char ch;
   4.118 -		if (from_user)
   4.119 -			__get_user(ch, buf + i);
   4.120 -		else
   4.121 -			ch = buf[i];
   4.122 -		if (!__xencons_put_char(ch))
   4.123 -			break;
   4.124 -	}
   4.125 -
   4.126 -	if (i != 0)
   4.127 -		__xencons_tx_flush();
   4.128 -
   4.129 -	spin_unlock_irqrestore(&xencons_lock, flags);
   4.130 -
   4.131 -	return i;
   4.132 -}
   4.133 -#endif
   4.134  
   4.135  static void xencons_put_char(struct tty_struct *tty, u_char ch)
   4.136  {
   4.137 @@ -629,7 +564,6 @@ static void xencons_close(struct tty_str
   4.138  	}
   4.139  }
   4.140  
   4.141 -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
   4.142  static struct tty_operations xencons_ops = {
   4.143  	.open = xencons_open,
   4.144  	.close = xencons_close,
   4.145 @@ -685,7 +619,6 @@ const struct consw xennull_con = {
   4.146  	.con_scrolldelta =	DUMMY,
   4.147  };
   4.148  #endif
   4.149 -#endif
   4.150  
   4.151  static int __init xencons_init(void)
   4.152  {
   4.153 @@ -699,19 +632,10 @@ static int __init xencons_init(void)
   4.154  
   4.155  	xencons_ring_init();
   4.156  
   4.157 -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
   4.158  	xencons_driver = alloc_tty_driver((xc_mode == XC_SERIAL) ? 
   4.159  					  1 : MAX_NR_CONSOLES);
   4.160  	if (xencons_driver == NULL)
   4.161  		return -ENOMEM;
   4.162 -#else
   4.163 -	memset(&xencons_driver, 0, sizeof(struct tty_driver));
   4.164 -	xencons_driver.magic       = TTY_DRIVER_MAGIC;
   4.165 -	xencons_driver.refcount    = &xencons_refcount;
   4.166 -	xencons_driver.table       = xencons_table;
   4.167 -	xencons_driver.num         =
   4.168 -		(xc_mode == XC_SERIAL) ? 1 : MAX_NR_CONSOLES;
   4.169 -#endif
   4.170  
   4.171  	DRV(xencons_driver)->major           = TTY_MAJOR;
   4.172  	DRV(xencons_driver)->type            = TTY_DRIVER_TYPE_SERIAL;
   4.173 @@ -735,37 +659,18 @@ static int __init xencons_init(void)
   4.174  		DRV(xencons_driver)->name_base   = xc_num;
   4.175  	}
   4.176  
   4.177 -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
   4.178  	tty_set_operations(xencons_driver, &xencons_ops);
   4.179 -#else
   4.180 -	xencons_driver.open            = xencons_open;
   4.181 -	xencons_driver.close           = xencons_close;
   4.182 -	xencons_driver.write           = xencons_write;
   4.183 -	xencons_driver.write_room      = xencons_write_room;
   4.184 -	xencons_driver.put_char        = xencons_put_char;
   4.185 -	xencons_driver.flush_chars     = xencons_flush_chars;
   4.186 -	xencons_driver.chars_in_buffer = xencons_chars_in_buffer;
   4.187 -	xencons_driver.send_xchar      = xencons_send_xchar;
   4.188 -	xencons_driver.flush_buffer    = xencons_flush_buffer;
   4.189 -	xencons_driver.throttle        = xencons_throttle;
   4.190 -	xencons_driver.unthrottle      = xencons_unthrottle;
   4.191 -	xencons_driver.wait_until_sent = xencons_wait_until_sent;
   4.192 -#endif
   4.193  
   4.194  	if ((rc = tty_register_driver(DRV(xencons_driver))) != 0) {
   4.195  		printk("WARNING: Failed to register Xen virtual "
   4.196  		       "console driver as '%s%d'\n",
   4.197  		       DRV(xencons_driver)->name, DRV(xencons_driver)->name_base);
   4.198 -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
   4.199  		put_tty_driver(xencons_driver);
   4.200  		xencons_driver = NULL;
   4.201 -#endif
   4.202  		return rc;
   4.203  	}
   4.204  
   4.205 -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
   4.206  	tty_register_device(xencons_driver, 0, NULL);
   4.207 -#endif
   4.208  
   4.209  	if (xen_start_info->flags & SIF_INITDOMAIN) {
   4.210  		xencons_priv_irq = bind_virq_to_irqhandler(
     5.1 --- a/linux-2.6-xen-sparse/drivers/xen/evtchn/evtchn.c	Fri Nov 18 13:02:33 2005 +0100
     5.2 +++ b/linux-2.6-xen-sparse/drivers/xen/evtchn/evtchn.c	Fri Nov 18 13:46:18 2005 +0100
     5.3 @@ -436,9 +436,7 @@ static struct miscdevice evtchn_miscdev 
     5.4  	.minor        = EVTCHN_MINOR,
     5.5  	.name         = "evtchn",
     5.6  	.fops         = &evtchn_fops,
     5.7 -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
     5.8  	.devfs_name   = "misc/evtchn",
     5.9 -#endif
    5.10  };
    5.11  
    5.12  static int __init evtchn_init(void)
     6.1 --- a/linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c	Fri Nov 18 13:02:33 2005 +0100
     6.2 +++ b/linux-2.6-xen-sparse/drivers/xen/privcmd/privcmd.c	Fri Nov 18 13:46:18 2005 +0100
     6.3 @@ -32,11 +32,6 @@
     6.4  #include <asm-xen/xen-public/dom0_ops.h>
     6.5  #include <asm-xen/xen_proc.h>
     6.6  
     6.7 -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
     6.8 -#define pud_t pgd_t
     6.9 -#define pud_offset(d, va) d
    6.10 -#endif
    6.11 -
    6.12  static struct proc_dir_entry *privcmd_intf;
    6.13  
    6.14  static int privcmd_ioctl(struct inode *inode, struct file *file,
     7.1 --- a/linux-2.6-xen-sparse/include/asm-xen/asm-i386/hypervisor.h	Fri Nov 18 13:02:33 2005 +0100
     7.2 +++ b/linux-2.6-xen-sparse/include/asm-xen/asm-i386/hypervisor.h	Fri Nov 18 13:46:18 2005 +0100
     7.3 @@ -39,15 +39,11 @@
     7.4  #include <asm/ptrace.h>
     7.5  #include <asm/page.h>
     7.6  #if defined(__i386__)
     7.7 -# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
     7.8  #  ifdef CONFIG_X86_PAE
     7.9  #   include <asm-generic/pgtable-nopud.h>
    7.10  #  else
    7.11  #   include <asm-generic/pgtable-nopmd.h>
    7.12  #  endif
    7.13 -# else
    7.14 -#  define pud_t pgd_t
    7.15 -# endif
    7.16  #endif
    7.17  
    7.18  extern shared_info_t *HYPERVISOR_shared_info;
    7.19 @@ -113,22 +109,6 @@ void xen_tlb_flush_mask(cpumask_t *mask)
    7.20  void xen_invlpg_mask(cpumask_t *mask, unsigned long ptr);
    7.21  #endif
    7.22  
    7.23 -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
    7.24 -/* 
    7.25 -** XXX SMH: 2.4 doesn't have percpu.h (or support SMP guests) so just 
    7.26 -** include sufficient #defines to allow the below to build. 
    7.27 -*/
    7.28 -#define DEFINE_PER_CPU(type, name) \
    7.29 -    __typeof__(type) per_cpu__##name
    7.30 -
    7.31 -#define per_cpu(var, cpu)           (*((void)cpu, &per_cpu__##var))
    7.32 -#define __get_cpu_var(var)          per_cpu__##var
    7.33 -#define DECLARE_PER_CPU(type, name) extern __typeof__(type) per_cpu__##name
    7.34 -
    7.35 -#define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(per_cpu__##var)
    7.36 -#define EXPORT_PER_CPU_SYMBOL_GPL(var) EXPORT_SYMBOL_GPL(per_cpu__##var)
    7.37 -#endif /* linux < 2.6.0 */
    7.38 -
    7.39  /* Returns zero on success else negative errno. */
    7.40  int xen_create_contiguous_region(
    7.41      unsigned long vstart, unsigned int order, unsigned int address_bits);