diff -ruN -X X hnd-linux-trunk/arch/arm/armboot/armboot-asm.S hnd-cleanup/arch/arm/armboot/armboot-asm.S
--- hnd-linux-trunk/arch/arm/armboot/armboot-asm.S	2007-09-17 22:44:24.000000000 +0400
+++ hnd-cleanup/arch/arm/armboot/armboot-asm.S	1970-01-01 03:00:00.000000000 +0300
@@ -1,115 +0,0 @@
-@
-@  lab/modules/armboot-asm.S
-@
-@  Copyright (C) 2003 Joshua Wise
-@  Bootloader port to Linux Kernel, October 07, 2003
-@
-@  ARMBoot kernel loader
-@  assembler routines
-
-	.globl	armboot_asm
-	.globl	relocdone
-
-armboot_asm:
-	mov	r7,r0		@ Backup registers.
-	mov	r8,r1
-	mov	r10,r2
-	mov	r9,r3
-	
-	msr 	cpsr, #0xd3	@ Disable IRQs
-
-	mov	r0,#0x4000	@ MMU stuff taken from Demo's code.
-	sub	r0,r0,#1
-	mcr	p15, 0, r0, c7, c10, 4
-	mrc	p15, 0, r0, c2, c0, 0
-	mov	r0, r0
-	mrc	p15, 0, r3, c1, c0, 0
-	mov	r3, #0x120
-	mcr	p15, 0, r3, c1, c0, 0
-	mrc	p15, 0, r0, c2, c0, 0
-	mov	r0,r0		@ MMU is now disabled.
-	mov	pc,r8		@ Jump into our relocated self.
-
-relocdone:			@ Welcome to relocatedland - the MMU is off.
-	mov	r0,r7		@ Restore zapped register
-	
-	@ At this point, the MMU is off, and in r0 is the address
-	@ of a list of blocks we need to relocate.
-	ldr	r1,[r0],#4
-	ldr	r2,[r0],#4
-	ldr	r3,[r0],#4
-	ldr	r4,[r0],#4
-	
-	@ r1 == old address
-	@ r2 == new address
-	@ r3 == size
-	@ r4 == if this is the last block
-	
-cploop:	cmp	r3,#0		@ Out of bytes to relocate?
-	beq	cpdone		@ All done!
-	ldr	r5,[r1],#4	@ Copy a word...
-	str	r5,[r2],#4
-	sub	r3,r3,#1	@ Subtract from bytes remaining...
-	b	cploop		@ And go loop again.
-	
-cpdone:	cmp	r4,#0		@ We're all done copying words - are we done relocating?
-	bne	rldone		@ Yeah? Stop.
-	
-	ldr	r1,[r0],#4	@ No? Load more values and go again!
-	ldr	r2,[r0],#4
-	ldr	r3,[r0],#4
-	ldr	r4,[r0],#4
-	b	cploop
-	
-rldone:	@ At this point we're done relocating.
-	mov	r0, #0
-	mcr	p15, 0, r0, c7, c7, 0		@ flush I-cache, D-cache and BTB
-	mcr	p15, 0, r0, c7, c10, 4		@ drain write buffer
-
-	mrc	p15, 0, r0, c2, c0, 0
-	mov	r0,r0
-
-	mcr	p15, 0, r0, c8, c7, 0		@ flush I-TLB and D-TLB
-	mrc	p15, 0, r0, c2, c0, 0
-	mov	r0,r0
-
-	@ Print a character
-	mov	r2,	#0x40000000
-	orr	r2,r2,	#0x00100000
-1:
-	ldr	r0,[r2,#0x14]
-	tst	r0,#(1<<6)
-	beq	1b
-	mov	r0,#'B'
-	str	r0,[r2]
-1:
-	ldr	r0,[r2,#0x14]
-	tst	r0,#(1<<6)
-	beq	1b
-	mov	r0,#'O'
-	str	r0,[r2]
-1:
-	ldr	r0,[r2,#0x14]
-	tst	r0,#(1<<6)
-	beq	1b
-	mov	r0,#'O'
-	str	r0,[r2]
-1:
-	ldr	r0,[r2,#0x14]
-	tst	r0,#(1<<6)
-	beq	1b
-	mov	r0,#'T'
-	str	r0,[r2]
-1:
-	ldr	r0,[r2,#0x14]
-	tst	r0,#(1<<6)
-	beq	1b
-	mov	r0,#':'
-	str	r0,[r2]
-
-	@ Now all that's left to do is to jump into the kernel.
-
-	mov	r0,#0	@ r0 must be 0 for jumping into kernel
-	mov	r1,r9	@ r1 must be archtype
-	
-	mov	pc,r10
diff -ruN -X X hnd-linux-trunk/arch/arm/armboot/armboot.c hnd-cleanup/arch/arm/armboot/armboot.c
--- hnd-linux-trunk/arch/arm/armboot/armboot.c	2007-09-17 22:44:24.000000000 +0400
+++ hnd-cleanup/arch/arm/armboot/armboot.c	1970-01-01 03:00:00.000000000 +0300
@@ -1,427 +0,0 @@
-/*
- *  ARMBoot interface based on the code from LAB
- *
- *  by Vladimir "Farcaller" Pouzanov <farcaller@gmail.com>
- *
- *  Original Copyright (C) 2003 Joshua Wise
- *  Bootloader port to Linux Kernel, October 07, 2003
- *
- */
-
-#include <linux/stat.h>
-#include <linux/slab.h>
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/mm.h>
-#include <linux/vmalloc.h>
-#include <linux/fs.h>
-
-#include <asm/types.h>
-#include <asm/setup.h>
-#include <asm/mach-types.h>
-
-#ifndef CONFIG_ARM
-#	error "ARMBoot must be compiled on an ARM system. Duh."
-#endif
-
-#ifdef CONFIG_ARCH_PXA
-#include <asm/hardware.h>
-#	define HAVE_APPROPRIATE_ARCH
-#	define TAGBASE 0xA0000100
-#	define MEMSTART 0xA0000000
-#endif
-
-#ifdef CONFIG_ARCH_SA1100
-#	define HAVE_APPROPRIATE_ARCH
-#	define TAGBASE 0xC0000100
-#	define MEMSTART 0xC0000000
-#endif
-
-#ifdef CONFIG_ARCH_OMAP
-#	define HAVE_APPROPRIATE_ARCH
-#	define TAGBASE 0x10000100
-#	define MEMSTART 0x10000000
-#endif
-
-#ifndef HAVE_APPROPRIATE_ARCH
-#	error "Your ARM architecture is not supported."
-#endif
-
-#ifdef CONFIG_DISCONTIGMEM
-#	error "Memory is discontiguous - can't help you. Sorry."
-#endif
-
-#define DEBUG_ARMBOOT
-
-#ifdef DEBUG_ARMBOOT
-#define DBGK(x, ...) printk(KERN_ERR "ARMBoot: " x "\n", ##__VA_ARGS__)
-#else
-#define DBGK
-#endif
-
-struct physlist {		// 128bit == 16byte
-	int	physaddr;	// old address
-	int	newphysaddr;	// address to relocate to
-	int	size;		// size of block to relocate
-	int	last;		// is this the last block?
-};
-
-extern void armboot_asm(int listaddr, int myaddr, int rambase, int machtype);
-void(*armboot_ptr)(int listaddr, int myaddr, int rambase, int machtype);
-
-extern char* relocdone;
-
-/* This shouldn't return. */
-int armboot(unsigned char* kerneladdr, int size, unsigned char* cmdline,
-		unsigned char* initrd, int size_initrd)
-{
-	struct physlist* addrmap;
-	struct tag* t;
-	unsigned int* asmaddr;
-	int mappos;
-	unsigned int kernaddr, initrdaddr;
-	
-	/* At this point, we will allocate 64k for a list of things that need to be mapped later. */
-	addrmap = (struct physlist*)kmalloc(64 * 1024, GFP_KERNEL);
-	if (!addrmap) {
-		DBGK("kmalloc for addrmap failed");
-		return -ENOMEM;
-	}
-	
-	/* We start at the first element of the map. */
-	mappos = 0;
-	
-	/* Now we need to allocate 64kbytes for our tagged list. */
-	t = (struct tag*)kmalloc(64*1024, GFP_KERNEL);
-	if (!t) {
-		DBGK("kmalloc for t failed");
-		return -ENOMEM;
-	}
-	
-	/* Set up our tagged list reloc block. */
-	addrmap[mappos].physaddr = virt_to_phys(t);
-	addrmap[mappos].newphysaddr = TAGBASE;
-	addrmap[mappos].last = 0;
-	
-	/* Now set up the tagged list. */
-	t->hdr.tag = ATAG_CORE;
-	t->hdr.size = tag_size(tag_core);
-	t->u.core.flags = 1;
-	t->u.core.pagesize = 0x1000;
-	t->u.core.rootdev = 0x100;
-	t = tag_next(t);
-	
-	
-	if (cmdline[0] != '\0') {
-	    t->hdr.tag = ATAG_CMDLINE;
-	    t->hdr.size = (sizeof(struct tag_header)+strlen(cmdline)+4) >> 2;
-	    strcpy(t->u.cmdline.cmdline, cmdline);
-	    t = tag_next(t);
-	}
-	
-	t->hdr.tag = ATAG_MEM;			/* We assume that memory is contiguous,       */
-	t->hdr.size = tag_size(tag_mem32);	/* and we won't let anyone tell us otherwise. */
-	t->u.mem.size = (num_physpages >> (20-PAGE_SHIFT)) * 1024*1024;
-	t->u.mem.start = MEMSTART;
-	t = tag_next(t);
-
-	if(size_initrd) {
-		DBGK("using intrd");
-		t->hdr.tag = ATAG_INITRD2;
-		t->hdr.size = tag_size(tag_initrd);
-		t->u.initrd.start = MEMSTART + 0x0400000;
-		t->u.initrd.size = size_initrd;
-		t = tag_next(t);
-	}
-	
-	t->hdr.tag = ATAG_NONE;
-	t->hdr.size = 0;
-	t = tag_next(t);
-	
-	/* Now just fill in the size, and we can begin relocating the kernel. */
-	addrmap[mappos].size = virt_to_phys(t) - addrmap[mappos].physaddr;
-	mappos++;
-	
-	kernaddr = MEMSTART+0x8000;
-	initrdaddr = MEMSTART+0x0400000;
-	DBGK("kernel PA: %lx\ninitrd PA:%lx", virt_to_phys(kerneladdr), virt_to_phys(initrd));
-	
-	printk(KERN_EMERG "armboot: Placing new kernel %sinto temporary RAM...\n",
-			(size_initrd?"and initrd ":""));
-	
-	/* Begin relocating. We're going to have to trust that the kernel won't give us any addresses in the first few megs of RAM. */
-	while(size) {
-		int relocsize;
-		unsigned char* block;
-		
-		/* Make sure it fits within our block... */
-		relocsize = (size > 64*1024) ? 64*1024 : size;
-		size -= relocsize;
-		
-		/* Allocate said block... (always 64k to please your kmallocness) */
-		block = (unsigned char*)kmalloc(64*1024, GFP_KERNEL);
-		if (!block) {
-			printk(KERN_ERR "Failed to grab mem chunk for kernel.\n"
-					"Still %d bytes waiting\n", size);
-			return -ENOMEM;
-		}
-	
-		/* Copy kernel into said block... */
-		memcpy(block, kerneladdr, relocsize);
-		
-		/* Set up our allocation tables. */
-		addrmap[mappos].physaddr = virt_to_phys(block);
-		addrmap[mappos].newphysaddr = kernaddr;
-		addrmap[mappos].size = relocsize;
-		addrmap[mappos].last = 0;
-		
-		mappos++;
-		kernaddr += relocsize;
-		kerneladdr += relocsize;
-	}
-	DBGK("done moving kernel");
-
-	while(size_initrd) {
-		int relocsize;
-		unsigned char* block;
-		
-		/* Make sure it fits within our block... */
-		relocsize = (size_initrd > 64*1024) ? 64*1024 : size_initrd;
-		size_initrd -= relocsize;
-		
-		/* Allocate said block... (always 64k to please your kmallocness) */
-		block = (unsigned char*)kmalloc(64*1024, GFP_KERNEL);
-		if (!block) {
-			printk(KERN_ERR "Failed to grab mem chunk for initrd.\n"
-					"Still %d bytes waiting\n", size_initrd);
-			return -ENOMEM;
-		}
-		
-		/* Copy kernel into said block... */
-		memcpy(block, initrd, relocsize);
-		
-		/* Set up our allocation tables. */
-		addrmap[mappos].physaddr = virt_to_phys(block);
-		addrmap[mappos].newphysaddr = initrdaddr;
-		addrmap[mappos].size = relocsize;
-		addrmap[mappos].last = 0;
-		
-		mappos++;
-		initrd += relocsize;
-		initrdaddr += relocsize;
-	}
-	DBGK("done moving initrd");
-	
-	addrmap[mappos-1].last = 1;
-	
-	/* Nowadays we get an address from the kernel. */
-	asmaddr = (unsigned int*)kmalloc(64*1024, GFP_KERNEL);
-	memcpy(asmaddr, &armboot_asm, 16384); // 16kb
-	armboot_ptr = (void(*)(int,int,int,int))asmaddr;
-	
-	cpu_proc_fin ();
-
-	printk(KERN_EMERG "armboot: Booting new kernel...\n");
-	armboot_ptr(virt_to_phys(addrmap), ((int)&relocdone) - ((int)&armboot_asm) + virt_to_phys(asmaddr), MEMSTART+0x8000, machine_arch_type);
-	
-	return 0;
-}
-
-// FIXME: clean this hell
-#include <linux/proc_fs.h>
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/stat.h>
-#include <linux/slab.h>
-#include <linux/vmalloc.h>
-#include <linux/fs.h>
-#include <linux/syscalls.h>
-#include <asm/uaccess.h>
-#include <linux/string.h>
-
-static struct proc_dir_entry *proc_intf;
-#define PROCFS_NAME		"armboot"
-#define MAX_BUF_SIZE		202
-#define ARG_MAX_SIZE		200
-
-static char kernel_path	[ARG_MAX_SIZE];
-static char cmdline	[ARG_MAX_SIZE];
-static char initrd_path	[ARG_MAX_SIZE];
-
-static unsigned long procfs_buffer_size = 0;
-
-static unsigned char* get_my_file(int* count, char* filename)
-{
-	unsigned char* ptr, *ptr2;
-	struct stat sstat;
-	int fd;
-	int remaining;
-	int sz, total=0;
-	set_fs(KERNEL_DS);
-	
-	if (sys_newstat(filename, &sstat) < 0)
-		return 0;
-	
-	*count = remaining = sstat.st_size;
-	
-	ptr = ptr2 = vmalloc(sstat.st_size+32);
-	if (!ptr)
-	{
-		printk("lab: AIIIIIIIIIIIIIIIIIGHHH!! out of memory!!\n");
-		printk("lab: I guess we just can't allocate 0x%08x bytes???\n", (unsigned int)sstat.st_size+32);
-		return 0;
- 	}
-	
-	if ((fd=sys_open(filename,O_RDONLY,0)) < 0)
-	{
-		printk("lab: uh. couldn't open the file.\n");
-		vfree(ptr);
-		return 0;
-	}
-	
-	while (remaining)
-	{
-		sz = (1048576 < remaining) ? 1048576 : remaining;
-		total += sz;
-		if (sys_read(fd,ptr2,sz) < sz)
-		{
-			printk("lab: uh. couldn't read from the file.\n");
-			sys_close(fd);
-			vfree(ptr);
-			return 0;
-		}
-		ptr2 += sz;
-		remaining -= sz;
-	}
-	
-	sys_close(fd);
-	return ptr;
-}
-
-static void handle_proc_rq(void)
-{
-	int count;
-	int count_initrd = 0;
-	int retval = 667;
-	unsigned char* data;
-	unsigned char* initrd = 0;
-
-	data = get_my_file(&count,kernel_path);
-	if(initrd_path[0] != '\0')
-		initrd = get_my_file(&count_initrd, initrd_path);
-	if(data!=0)
-		retval = armboot(data, count, cmdline, initrd, count_initrd);
-	printk(KERN_EMERG "ARMBoot failed to boot - system may be in an unstable state (return %d)\n", retval);
-}
-
-int procfile_read(char *buffer, char **buffer_location,
-		off_t offset, int buffer_length, int *eof, void *data)
-{
-	int ret;
-	
-	if (offset > 0) {
-		/* we have finished to read, return 0 */
-		ret  = 0;
-	} else {
-		char out[ARG_MAX_SIZE*3+200];
-		sprintf(out, "Kernel: %s\nCmdline: %s\nInitrd: %s\n", kernel_path,
-				cmdline, initrd_path);
-		/* fill the buffer, return the buffer size */
-		memcpy(buffer, out, strlen(out)+1);
-		ret = strlen(out)+1;
-	}
-
-	return ret;
-}
-
-#define CHECK_LEN(t) if(strlen(procfs_buffer)<3) { \
-	printk(KERN_ERR "ARMBoot: argument for %s is too short\n", t); \
-	return procfs_buffer_size; \
-}
-int procfile_write(struct file *file, const char *buffer, unsigned long count, void *data)
-{
-	char procfs_buffer[MAX_BUF_SIZE];
-	char *shift;
-	/* get buffer size */
-	procfs_buffer_size = count;
-	if (procfs_buffer_size > MAX_BUF_SIZE-1 ) {
-		procfs_buffer_size = MAX_BUF_SIZE-1;
-	}
-	
-	/* write data to the buffer */
-	if ( copy_from_user(procfs_buffer, buffer, procfs_buffer_size) ) {
-		return -EFAULT;
-	}
-	procfs_buffer[procfs_buffer_size+1] = '\0';
-
-	if(procfs_buffer[0] == '\0') {
-		printk(KERN_ERR "ARMBoot: emty call to /proc/%s\n", PROCFS_NAME);
-		return procfs_buffer_size;
-	}
-	
-	shift = strchr(procfs_buffer, '\n');
-	if(shift) *shift = '\0';
-
-	shift = procfs_buffer+2;
-
-	switch(procfs_buffer[0]) {
-		case 'k':
-			CHECK_LEN("kernel_path");
-			strncpy(kernel_path, shift, ARG_MAX_SIZE);
-			break;
-		case 'i':
-			CHECK_LEN("initrd_path");
-			strncpy(initrd_path, shift, ARG_MAX_SIZE);
-			break;
-		case 'c':
-			CHECK_LEN("cmdline");
-			strncpy(cmdline, shift, ARG_MAX_SIZE);
-			break;
-		case 'b':
-			printk(KERN_ERR "\nARMBoot running...\n");
-			handle_proc_rq();
-			break;
-		default:
-			printk(KERN_ERR "ARMBoot: bad request\n");
-			break;
-	}
-	
-	return procfs_buffer_size;
-}
-
-
-int init_module()
-{
-	kernel_path[0] = '\0';
-	cmdline[0] = '\0';
-	initrd_path[0] = '\0';
-	/* create the /proc file */
-	proc_intf = create_proc_entry(PROCFS_NAME, 0644, NULL);
-	
-	if (proc_intf == NULL) {
-		remove_proc_entry(PROCFS_NAME, &proc_root);
-		printk(KERN_ALERT "Error: Could not initialize /proc/%s\n",
-			PROCFS_NAME);
-		return -ENOMEM;
-	}
-
-	proc_intf->write_proc = procfile_write;
-	proc_intf->read_proc  = procfile_read;
-	proc_intf->owner 	  = THIS_MODULE;
-	proc_intf->mode 	  = S_IFREG | S_IWUSR | S_IRUSR;
-	proc_intf->uid 	  = 0;
-	proc_intf->gid 	  = 0;
-	proc_intf->size 	  = 37;
-
-	printk(KERN_INFO "ARMBoot interface v0.2 loaded\n");	
-	return 0;	/* everything is ok */
-}
-
-// INFO: no need for cleanup, because armboot-asm.S make impossible modularization
-module_init(init_module);
-
-MODULE_AUTHOR("Vladimir \"Farcaller\" Pouzanov");
-MODULE_DESCRIPTION("ARMBoot kernel loader");
-MODULE_LICENSE("GPL");
diff -ruN -X X hnd-linux-trunk/arch/arm/armboot/Kconfig hnd-cleanup/arch/arm/armboot/Kconfig
--- hnd-linux-trunk/arch/arm/armboot/Kconfig	2007-09-17 22:44:24.000000000 +0400
+++ hnd-cleanup/arch/arm/armboot/Kconfig	1970-01-01 03:00:00.000000000 +0300
@@ -1,8 +0,0 @@
-config ARMBOOT_PROC
-	bool "ARMBoot Linux booting Linux"
-	depends on ARM
-	help
-	  ARMBoot allows you to boot another kernel using
-	  interface in /proc/armboot.
-	  
-	  Usage: echo -ne '/zImage\0' > /proc/armboot
diff -ruN -X X hnd-linux-trunk/arch/arm/armboot/Makefile hnd-cleanup/arch/arm/armboot/Makefile
--- hnd-linux-trunk/arch/arm/armboot/Makefile	2007-09-17 22:44:24.000000000 +0400
+++ hnd-cleanup/arch/arm/armboot/Makefile	1970-01-01 03:00:00.000000000 +0300
@@ -1 +0,0 @@
-obj-$(CONFIG_ARMBOOT_PROC)             += armboot.o armboot-asm.o
diff -ruN -X X hnd-linux-trunk/arch/arm/configs/asus620_static_defconfig hnd-cleanup/arch/arm/configs/asus620_static_defconfig
--- hnd-linux-trunk/arch/arm/configs/asus620_static_defconfig	2007-09-17 22:44:27.000000000 +0400
+++ hnd-cleanup/arch/arm/configs/asus620_static_defconfig	2007-09-17 23:22:48.000000000 +0400
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.21-hh12
-# Tue Jul 17 20:51:06 2007
+# Linux kernel version: 2.6.21-hh15
+# Mon Sep 10 20:36:40 2007
 #
 CONFIG_ARM=y
 CONFIG_SYS_SUPPORTS_APM_EMULATION=y
@@ -171,8 +171,7 @@
 # CONFIG_MACH_MAGICIAN is not set
 # CONFIG_MACH_HTCAPACHE is not set
 # CONFIG_MACH_BLUEANGEL is not set
-# CONFIG_MACH_HTCBEETLES is not set
-# CONFIG_MACH_HW6900 is not set
+# CONFIG_HTC_HW6X00 is not set
 # CONFIG_MACH_HTCATHENA is not set
 # CONFIG_ARCH_AXIMX3 is not set
 # CONFIG_ARCH_AXIMX5 is not set
@@ -402,58 +401,16 @@
 #
 # CONFIG_NET_PKTGEN is not set
 # CONFIG_HAMRADIO is not set
-CONFIG_IRDA=y
-
-#
-# IrDA protocols
-#
-CONFIG_IRLAN=y
-CONFIG_IRCOMM=y
-CONFIG_IRDA_ULTRA=y
-
-#
-# IrDA options
-#
-CONFIG_IRDA_CACHE_LAST_LSAP=y
-CONFIG_IRDA_FAST_RR=y
-CONFIG_IRDA_DEBUG=y
-
-#
-# Infrared-port device drivers
-#
-
-#
-# SIR device drivers
-#
-CONFIG_IRTTY_SIR=y
-
-#
-# Dongle support
-#
-# CONFIG_DONGLE is not set
-
-#
-# Old SIR device drivers
-#
-# CONFIG_IRPORT_SIR is not set
-
-#
-# Old Serial dongle support
-#
-
-#
-# FIR device drivers
-#
-CONFIG_PXA_FICP=y
+# CONFIG_IRDA is not set
 CONFIG_BT=y
-CONFIG_BT_L2CAP=m
-CONFIG_BT_SCO=m
-CONFIG_BT_RFCOMM=m
+CONFIG_BT_L2CAP=y
+CONFIG_BT_SCO=y
+CONFIG_BT_RFCOMM=y
 CONFIG_BT_RFCOMM_TTY=y
-CONFIG_BT_BNEP=m
+CONFIG_BT_BNEP=y
 CONFIG_BT_BNEP_MC_FILTER=y
 CONFIG_BT_BNEP_PROTO_FILTER=y
-CONFIG_BT_HIDP=m
+CONFIG_BT_HIDP=y
 
 #
 # Bluetooth device drivers
@@ -486,21 +443,19 @@
 #
 # Memory Technology Devices (MTD)
 #
-CONFIG_MTD=y
+CONFIG_MTD=m
 CONFIG_MTD_DEBUG=y
 CONFIG_MTD_DEBUG_VERBOSE=0
-CONFIG_MTD_CONCAT=y
-CONFIG_MTD_PARTITIONS=y
-# CONFIG_MTD_REDBOOT_PARTS is not set
-# CONFIG_MTD_CMDLINE_PARTS is not set
-# CONFIG_MTD_AFS_PARTS is not set
+# CONFIG_MTD_CONCAT is not set
+# CONFIG_MTD_PARTITIONS is not set
 
 #
 # User Modules And Translation Layers
 #
-CONFIG_MTD_CHAR=y
-CONFIG_MTD_BLKDEVS=y
-CONFIG_MTD_BLOCK=y
+CONFIG_MTD_CHAR=m
+# CONFIG_MTD_BLKDEVS is not set
+# CONFIG_MTD_BLOCK is not set
+# CONFIG_MTD_BLOCK_RO is not set
 # CONFIG_FTL is not set
 # CONFIG_NFTL is not set
 # CONFIG_INFTL is not set
@@ -554,17 +509,15 @@
 #
 # NAND Flash Device Drivers
 #
-CONFIG_MTD_NAND=y
+CONFIG_MTD_NAND=m
 # CONFIG_MTD_NAND_VERIFY_WRITE is not set
 # CONFIG_MTD_NAND_ECC_SMC is not set
-# CONFIG_MTD_NAND_H1900 is not set
-CONFIG_MTD_NAND_IDS=y
-CONFIG_MTD_NAND_DISKONCHIP=y
+CONFIG_MTD_NAND_IDS=m
+CONFIG_MTD_NAND_DISKONCHIP=m
 # CONFIG_MTD_NAND_DISKONCHIP_PROBE_ADVANCED is not set
 CONFIG_MTD_NAND_DISKONCHIP_PROBE_ADDRESS=0
 # CONFIG_MTD_NAND_DISKONCHIP_BBTWRITE is not set
 # CONFIG_MTD_NAND_SHARPSL is not set
-# CONFIG_MTD_NAND_NANDSIM is not set
 
 #
 # OneNAND Flash Device Drivers
@@ -585,7 +538,8 @@
 # Block devices
 #
 # CONFIG_BLK_DEV_COW_COMMON is not set
-# CONFIG_BLK_DEV_LOOP is not set
+CONFIG_BLK_DEV_LOOP=m
+# CONFIG_BLK_DEV_CRYPTOLOOP is not set
 # CONFIG_BLK_DEV_NBD is not set
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_COUNT=4
@@ -668,6 +622,7 @@
 # CONFIG_KEYBOARD_NEWTON is not set
 # CONFIG_KEYBOARD_STOWAWAY is not set
 # CONFIG_GPIODEV_KEYS is not set
+# CONFIG_GPIODEV_KEYS2 is not set
 # CONFIG_GPIODEV_DIAGONAL is not set
 CONFIG_KEYBOARD_GPIO=y
 CONFIG_INPUT_MOUSE=y
@@ -782,12 +737,24 @@
 # CONFIG_ADC_AD7877 is not set
 
 #
+# Compaq/iPAQ Drivers
+#
+
+#
+# Compaq/HP iPAQ Drivers
+#
+# CONFIG_IPAQ_SLEEVE is not set
+# CONFIG_SLEEVE_DEBUG is not set
+
+#
 # Multifunction device drivers
 #
 # CONFIG_MFD_SM501 is not set
 # CONFIG_HTC_ASIC2 is not set
 # CONFIG_HTC_ASIC3 is not set
+# CONFIG_HTC_PASIC3 is not set
 # CONFIG_HTC_EGPIO is not set
+# CONFIG_HTC_BBKEYS is not set
 # CONFIG_HTC_ASIC3_DS1WM is not set
 # CONFIG_SOC_SAMCOP is not set
 # CONFIG_SOC_HAMCOP is not set
@@ -807,6 +774,7 @@
 #
 # LED drivers
 #
+# CONFIG_LEDS_GPIO is not set
 
 #
 # LED Triggers
@@ -814,6 +782,7 @@
 CONFIG_LEDS_TRIGGERS=y
 CONFIG_LEDS_TRIGGER_TIMER=y
 # CONFIG_LEDS_TRIGGER_HWTIMER is not set
+# CONFIG_LEDS_TRIGGER_BACKLIGHT is not set
 # CONFIG_LEDS_TRIGGER_HEARTBEAT is not set
 CONFIG_LEDS_TRIGGER_SHARED=y
 
@@ -899,7 +868,7 @@
 #
 # HID Devices
 #
-CONFIG_HID=m
+CONFIG_HID=y
 # CONFIG_HID_DEBUG is not set
 
 #
@@ -1106,8 +1075,8 @@
 # CONFIG_NLS_CODEPAGE_949 is not set
 # CONFIG_NLS_CODEPAGE_874 is not set
 # CONFIG_NLS_ISO8859_8 is not set
-CONFIG_NLS_CODEPAGE_1250=y
-CONFIG_NLS_CODEPAGE_1251=y
+# CONFIG_NLS_CODEPAGE_1250 is not set
+CONFIG_NLS_CODEPAGE_1251=m
 # CONFIG_NLS_ASCII is not set
 CONFIG_NLS_ISO8859_1=y
 # CONFIG_NLS_ISO8859_2 is not set
@@ -1190,7 +1159,7 @@
 # CONFIG_CRC16 is not set
 CONFIG_CRC32=y
 # CONFIG_LIBCRC32C is not set
-CONFIG_REED_SOLOMON=y
+CONFIG_REED_SOLOMON=m
 CONFIG_REED_SOLOMON_DEC16=y
 CONFIG_PLIST=y
 CONFIG_HAS_IOMEM=y
diff -ruN -X X hnd-linux-trunk/arch/arm/configs/asus730_static_defconfig hnd-cleanup/arch/arm/configs/asus730_static_defconfig
--- hnd-linux-trunk/arch/arm/configs/asus730_static_defconfig	2007-09-17 22:44:27.000000000 +0400
+++ hnd-cleanup/arch/arm/configs/asus730_static_defconfig	2007-09-17 23:22:49.000000000 +0400
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.21-hh12
-# Tue Jul 17 20:51:07 2007
+# Linux kernel version: 2.6.21-hh15
+# Tue Sep 11 04:54:55 2007
 #
 CONFIG_ARM=y
 CONFIG_SYS_SUPPORTS_APM_EMULATION=y
@@ -167,6 +167,10 @@
 # CONFIG_MACH_MAGICIAN is not set
 # CONFIG_MACH_HTCAPACHE is not set
 # CONFIG_MACH_BLUEANGEL is not set
+
+#
+# HTC_HW6X00
+#
 # CONFIG_MACH_HTCBEETLES is not set
 # CONFIG_MACH_HW6900 is not set
 # CONFIG_MACH_HTCATHENA is not set
@@ -408,68 +412,8 @@
 #
 # CONFIG_NET_PKTGEN is not set
 # CONFIG_HAMRADIO is not set
-CONFIG_IRDA=y
-
-#
-# IrDA protocols
-#
-CONFIG_IRLAN=y
-CONFIG_IRCOMM=y
-CONFIG_IRDA_ULTRA=y
-
-#
-# IrDA options
-#
-CONFIG_IRDA_CACHE_LAST_LSAP=y
-CONFIG_IRDA_FAST_RR=y
-CONFIG_IRDA_DEBUG=y
-
-#
-# Infrared-port device drivers
-#
-
-#
-# SIR device drivers
-#
-CONFIG_IRTTY_SIR=y
-
-#
-# Dongle support
-#
-# CONFIG_DONGLE is not set
-
-#
-# Old SIR device drivers
-#
-# CONFIG_IRPORT_SIR is not set
-
-#
-# Old Serial dongle support
-#
-
-#
-# FIR device drivers
-#
-CONFIG_PXA_FICP=y
-CONFIG_BT=y
-CONFIG_BT_L2CAP=m
-CONFIG_BT_SCO=m
-CONFIG_BT_RFCOMM=m
-CONFIG_BT_RFCOMM_TTY=y
-CONFIG_BT_BNEP=m
-CONFIG_BT_BNEP_MC_FILTER=y
-CONFIG_BT_BNEP_PROTO_FILTER=y
-CONFIG_BT_HIDP=m
-
-#
-# Bluetooth device drivers
-#
-# CONFIG_BT_HCIUART is not set
-# CONFIG_BT_HCIDTL1 is not set
-# CONFIG_BT_HCIBT3C is not set
-# CONFIG_BT_HCIBLUECARD is not set
-# CONFIG_BT_HCIBTUART is not set
-# CONFIG_BT_HCIVHCI is not set
+# CONFIG_IRDA is not set
+# CONFIG_BT is not set
 # CONFIG_IEEE80211 is not set
 
 #
@@ -518,8 +462,14 @@
 #
 # RAM/ROM/Flash chip drivers
 #
-# CONFIG_MTD_CFI is not set
+CONFIG_MTD_CFI=y
 # CONFIG_MTD_JEDECPROBE is not set
+CONFIG_MTD_GEN_PROBE=y
+CONFIG_MTD_CFI_ADV_OPTIONS=y
+CONFIG_MTD_CFI_NOSWAP=y
+# CONFIG_MTD_CFI_BE_BYTE_SWAP is not set
+# CONFIG_MTD_CFI_LE_BYTE_SWAP is not set
+CONFIG_MTD_CFI_GEOMETRY=y
 CONFIG_MTD_MAP_BANK_WIDTH_1=y
 CONFIG_MTD_MAP_BANK_WIDTH_2=y
 CONFIG_MTD_MAP_BANK_WIDTH_4=y
@@ -530,15 +480,24 @@
 CONFIG_MTD_CFI_I2=y
 # CONFIG_MTD_CFI_I4 is not set
 # CONFIG_MTD_CFI_I8 is not set
+# CONFIG_MTD_OTP is not set
+CONFIG_MTD_CFI_INTELEXT=y
+# CONFIG_MTD_CFI_AMDSTD is not set
+# CONFIG_MTD_CFI_STAA is not set
+CONFIG_MTD_CFI_UTIL=y
 # CONFIG_MTD_RAM is not set
 # CONFIG_MTD_ROM is not set
 # CONFIG_MTD_ABSENT is not set
 # CONFIG_MTD_OBSOLETE_CHIPS is not set
+# CONFIG_MTD_XIP is not set
 
 #
 # Mapping drivers for chip access
 #
 # CONFIG_MTD_COMPLEX_MAPPINGS is not set
+# CONFIG_MTD_PHYSMAP is not set
+# CONFIG_MTD_ARM_INTEGRATOR is not set
+# CONFIG_MTD_IPAQ is not set
 # CONFIG_MTD_SHARP_SL is not set
 # CONFIG_MTD_PLATRAM is not set
 
@@ -562,14 +521,7 @@
 #
 # NAND Flash Device Drivers
 #
-CONFIG_MTD_NAND=y
-# CONFIG_MTD_NAND_VERIFY_WRITE is not set
-# CONFIG_MTD_NAND_ECC_SMC is not set
-# CONFIG_MTD_NAND_H1900 is not set
-CONFIG_MTD_NAND_IDS=y
-# CONFIG_MTD_NAND_DISKONCHIP is not set
-# CONFIG_MTD_NAND_SHARPSL is not set
-# CONFIG_MTD_NAND_NANDSIM is not set
+# CONFIG_MTD_NAND is not set
 
 #
 # OneNAND Flash Device Drivers
@@ -590,7 +542,8 @@
 # Block devices
 #
 # CONFIG_BLK_DEV_COW_COMMON is not set
-# CONFIG_BLK_DEV_LOOP is not set
+CONFIG_BLK_DEV_LOOP=m
+# CONFIG_BLK_DEV_CRYPTOLOOP is not set
 # CONFIG_BLK_DEV_NBD is not set
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_COUNT=4
@@ -695,6 +648,7 @@
 # CONFIG_KEYBOARD_NEWTON is not set
 # CONFIG_KEYBOARD_STOWAWAY is not set
 # CONFIG_GPIODEV_KEYS is not set
+# CONFIG_GPIODEV_KEYS2 is not set
 # CONFIG_GPIODEV_DIAGONAL is not set
 # CONFIG_KEYBOARD_PXA27x is not set
 # CONFIG_KEYBOARD_GPIO is not set
@@ -847,12 +801,24 @@
 # CONFIG_ADC_AD7877 is not set
 
 #
+# Compaq/iPAQ Drivers
+#
+
+#
+# Compaq/HP iPAQ Drivers
+#
+# CONFIG_IPAQ_SLEEVE is not set
+# CONFIG_SLEEVE_DEBUG is not set
+
+#
 # Multifunction device drivers
 #
 # CONFIG_MFD_SM501 is not set
 # CONFIG_HTC_ASIC2 is not set
 # CONFIG_HTC_ASIC3 is not set
+# CONFIG_HTC_PASIC3 is not set
 # CONFIG_HTC_EGPIO is not set
+# CONFIG_HTC_BBKEYS is not set
 # CONFIG_HTC_ASIC3_DS1WM is not set
 # CONFIG_SOC_SAMCOP is not set
 # CONFIG_SOC_HAMCOP is not set
@@ -872,6 +838,7 @@
 #
 # LED drivers
 #
+# CONFIG_LEDS_GPIO is not set
 
 #
 # LED Triggers
@@ -880,6 +847,7 @@
 CONFIG_LEDS_TRIGGER_TIMER=y
 # CONFIG_LEDS_TRIGGER_HWTIMER is not set
 # CONFIG_LEDS_TRIGGER_IDE_DISK is not set
+# CONFIG_LEDS_TRIGGER_BACKLIGHT is not set
 # CONFIG_LEDS_TRIGGER_HEARTBEAT is not set
 CONFIG_LEDS_TRIGGER_SHARED=y
 
@@ -1005,8 +973,7 @@
 #
 # HID Devices
 #
-CONFIG_HID=m
-# CONFIG_HID_DEBUG is not set
+# CONFIG_HID is not set
 
 #
 # USB support
@@ -1155,7 +1122,18 @@
 # CONFIG_BEFS_FS is not set
 # CONFIG_BFS_FS is not set
 # CONFIG_EFS_FS is not set
-# CONFIG_JFFS2_FS is not set
+CONFIG_JFFS2_FS=y
+CONFIG_JFFS2_FS_DEBUG=0
+CONFIG_JFFS2_FS_WRITEBUFFER=y
+# CONFIG_JFFS2_SUMMARY is not set
+# CONFIG_JFFS2_FS_XATTR is not set
+CONFIG_JFFS2_COMPRESSION_OPTIONS=y
+CONFIG_JFFS2_ZLIB=y
+CONFIG_JFFS2_RTIME=y
+# CONFIG_JFFS2_RUBIN is not set
+# CONFIG_JFFS2_CMODE_NONE is not set
+CONFIG_JFFS2_CMODE_PRIORITY=y
+# CONFIG_JFFS2_CMODE_SIZE is not set
 # CONFIG_CRAMFS is not set
 # CONFIG_VXFS_FS is not set
 # CONFIG_HPFS_FS is not set
@@ -1218,8 +1196,8 @@
 # CONFIG_NLS_CODEPAGE_949 is not set
 # CONFIG_NLS_CODEPAGE_874 is not set
 # CONFIG_NLS_ISO8859_8 is not set
-CONFIG_NLS_CODEPAGE_1250=y
-CONFIG_NLS_CODEPAGE_1251=y
+# CONFIG_NLS_CODEPAGE_1250 is not set
+CONFIG_NLS_CODEPAGE_1251=m
 # CONFIG_NLS_ASCII is not set
 CONFIG_NLS_ISO8859_1=y
 # CONFIG_NLS_ISO8859_2 is not set
@@ -1302,6 +1280,8 @@
 # CONFIG_CRC16 is not set
 CONFIG_CRC32=y
 # CONFIG_LIBCRC32C is not set
+CONFIG_ZLIB_INFLATE=y
+CONFIG_ZLIB_DEFLATE=y
 CONFIG_PLIST=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT=y
diff -ruN -X X hnd-linux-trunk/arch/arm/configs/aximx50_static_defconfig hnd-cleanup/arch/arm/configs/aximx50_static_defconfig
--- hnd-linux-trunk/arch/arm/configs/aximx50_static_defconfig	2007-09-17 22:44:27.000000000 +0400
+++ hnd-cleanup/arch/arm/configs/aximx50_static_defconfig	2007-09-17 23:22:48.000000000 +0400
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.21-hh12
-# Tue Jul 17 20:51:07 2007
+# Linux kernel version: 2.6.21-hh15
+# Mon Sep 10 20:36:41 2007
 #
 CONFIG_ARM=y
 CONFIG_SYS_SUPPORTS_APM_EMULATION=y
@@ -166,8 +166,7 @@
 # CONFIG_MACH_MAGICIAN is not set
 # CONFIG_MACH_HTCAPACHE is not set
 # CONFIG_MACH_BLUEANGEL is not set
-# CONFIG_MACH_HTCBEETLES is not set
-# CONFIG_MACH_HW6900 is not set
+# CONFIG_HTC_HW6X00 is not set
 # CONFIG_MACH_HTCATHENA is not set
 # CONFIG_ARCH_AXIMX3 is not set
 # CONFIG_ARCH_AXIMX5 is not set
@@ -402,64 +401,8 @@
 #
 # CONFIG_NET_PKTGEN is not set
 # CONFIG_HAMRADIO is not set
-CONFIG_IRDA=y
-
-#
-# IrDA protocols
-#
-CONFIG_IRLAN=y
-CONFIG_IRCOMM=y
-CONFIG_IRDA_ULTRA=y
-
-#
-# IrDA options
-#
-CONFIG_IRDA_CACHE_LAST_LSAP=y
-CONFIG_IRDA_FAST_RR=y
-CONFIG_IRDA_DEBUG=y
-
-#
-# Infrared-port device drivers
-#
-
-#
-# SIR device drivers
-#
-CONFIG_IRTTY_SIR=y
-
-#
-# Dongle support
-#
-# CONFIG_DONGLE is not set
-
-#
-# Old SIR device drivers
-#
-# CONFIG_IRPORT_SIR is not set
-
-#
-# Old Serial dongle support
-#
-
-#
-# FIR device drivers
-#
-CONFIG_PXA_FICP=y
-CONFIG_BT=y
-CONFIG_BT_L2CAP=m
-CONFIG_BT_SCO=m
-CONFIG_BT_RFCOMM=m
-CONFIG_BT_RFCOMM_TTY=y
-CONFIG_BT_BNEP=m
-CONFIG_BT_BNEP_MC_FILTER=y
-CONFIG_BT_BNEP_PROTO_FILTER=y
-CONFIG_BT_HIDP=m
-
-#
-# Bluetooth device drivers
-#
-# CONFIG_BT_HCIUART is not set
-# CONFIG_BT_HCIVHCI is not set
+# CONFIG_IRDA is not set
+# CONFIG_BT is not set
 # CONFIG_IEEE80211 is not set
 
 #
@@ -484,21 +427,19 @@
 #
 # Memory Technology Devices (MTD)
 #
-CONFIG_MTD=y
+CONFIG_MTD=m
 CONFIG_MTD_DEBUG=y
 CONFIG_MTD_DEBUG_VERBOSE=0
-CONFIG_MTD_CONCAT=y
-CONFIG_MTD_PARTITIONS=y
-# CONFIG_MTD_REDBOOT_PARTS is not set
-# CONFIG_MTD_CMDLINE_PARTS is not set
-# CONFIG_MTD_AFS_PARTS is not set
+# CONFIG_MTD_CONCAT is not set
+# CONFIG_MTD_PARTITIONS is not set
 
 #
 # User Modules And Translation Layers
 #
-CONFIG_MTD_CHAR=y
-CONFIG_MTD_BLKDEVS=y
-CONFIG_MTD_BLOCK=y
+CONFIG_MTD_CHAR=m
+# CONFIG_MTD_BLKDEVS is not set
+# CONFIG_MTD_BLOCK is not set
+# CONFIG_MTD_BLOCK_RO is not set
 # CONFIG_FTL is not set
 # CONFIG_NFTL is not set
 # CONFIG_INFTL is not set
@@ -573,7 +514,8 @@
 # Block devices
 #
 # CONFIG_BLK_DEV_COW_COMMON is not set
-# CONFIG_BLK_DEV_LOOP is not set
+CONFIG_BLK_DEV_LOOP=m
+# CONFIG_BLK_DEV_CRYPTOLOOP is not set
 # CONFIG_BLK_DEV_NBD is not set
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_COUNT=4
@@ -656,6 +598,7 @@
 # CONFIG_KEYBOARD_NEWTON is not set
 # CONFIG_KEYBOARD_STOWAWAY is not set
 # CONFIG_GPIODEV_KEYS is not set
+# CONFIG_GPIODEV_KEYS2 is not set
 # CONFIG_GPIODEV_DIAGONAL is not set
 CONFIG_KEYBOARD_PXA27x=y
 CONFIG_KEYBOARD_GPIO=y
@@ -780,12 +723,24 @@
 # CONFIG_ADC_AD7877 is not set
 
 #
+# Compaq/iPAQ Drivers
+#
+
+#
+# Compaq/HP iPAQ Drivers
+#
+# CONFIG_IPAQ_SLEEVE is not set
+# CONFIG_SLEEVE_DEBUG is not set
+
+#
 # Multifunction device drivers
 #
 # CONFIG_MFD_SM501 is not set
 # CONFIG_HTC_ASIC2 is not set
 # CONFIG_HTC_ASIC3 is not set
+# CONFIG_HTC_PASIC3 is not set
 # CONFIG_HTC_EGPIO is not set
+# CONFIG_HTC_BBKEYS is not set
 # CONFIG_HTC_ASIC3_DS1WM is not set
 # CONFIG_SOC_SAMCOP is not set
 # CONFIG_SOC_HAMCOP is not set
@@ -805,6 +760,7 @@
 #
 # LED drivers
 #
+# CONFIG_LEDS_GPIO is not set
 
 #
 # LED Triggers
@@ -812,6 +768,7 @@
 CONFIG_LEDS_TRIGGERS=y
 CONFIG_LEDS_TRIGGER_TIMER=y
 CONFIG_LEDS_TRIGGER_HWTIMER=y
+# CONFIG_LEDS_TRIGGER_BACKLIGHT is not set
 # CONFIG_LEDS_TRIGGER_HEARTBEAT is not set
 CONFIG_LEDS_TRIGGER_SHARED=y
 
@@ -897,8 +854,7 @@
 #
 # HID Devices
 #
-CONFIG_HID=m
-# CONFIG_HID_DEBUG is not set
+# CONFIG_HID is not set
 
 #
 # USB support
@@ -1104,8 +1060,8 @@
 # CONFIG_NLS_CODEPAGE_949 is not set
 # CONFIG_NLS_CODEPAGE_874 is not set
 # CONFIG_NLS_ISO8859_8 is not set
-CONFIG_NLS_CODEPAGE_1250=y
-CONFIG_NLS_CODEPAGE_1251=y
+# CONFIG_NLS_CODEPAGE_1250 is not set
+CONFIG_NLS_CODEPAGE_1251=m
 # CONFIG_NLS_ASCII is not set
 CONFIG_NLS_ISO8859_1=y
 # CONFIG_NLS_ISO8859_2 is not set
diff -ruN -X X hnd-linux-trunk/arch/arm/configs/eteng500_static_defconfig hnd-cleanup/arch/arm/configs/eteng500_static_defconfig
--- hnd-linux-trunk/arch/arm/configs/eteng500_static_defconfig	2007-09-17 22:44:27.000000000 +0400
+++ hnd-cleanup/arch/arm/configs/eteng500_static_defconfig	2007-09-17 23:22:48.000000000 +0400
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.21-hh12
-# Tue Jul 17 20:51:08 2007
+# Linux kernel version: 2.6.21-hh15
+# Mon Sep 10 20:36:41 2007
 #
 CONFIG_ARM=y
 CONFIG_SYS_SUPPORTS_APM_EMULATION=y
@@ -395,63 +395,8 @@
 #
 # CONFIG_NET_PKTGEN is not set
 # CONFIG_HAMRADIO is not set
-CONFIG_IRDA=y
-
-#
-# IrDA protocols
-#
-CONFIG_IRLAN=y
-CONFIG_IRCOMM=y
-CONFIG_IRDA_ULTRA=y
-
-#
-# IrDA options
-#
-CONFIG_IRDA_CACHE_LAST_LSAP=y
-CONFIG_IRDA_FAST_RR=y
-CONFIG_IRDA_DEBUG=y
-
-#
-# Infrared-port device drivers
-#
-
-#
-# SIR device drivers
-#
-CONFIG_IRTTY_SIR=y
-
-#
-# Dongle support
-#
-# CONFIG_DONGLE is not set
-
-#
-# Old SIR device drivers
-#
-# CONFIG_IRPORT_SIR is not set
-
-#
-# Old Serial dongle support
-#
-
-#
-# FIR device drivers
-#
-CONFIG_BT=y
-CONFIG_BT_L2CAP=m
-CONFIG_BT_SCO=m
-CONFIG_BT_RFCOMM=m
-CONFIG_BT_RFCOMM_TTY=y
-CONFIG_BT_BNEP=m
-CONFIG_BT_BNEP_MC_FILTER=y
-CONFIG_BT_BNEP_PROTO_FILTER=y
-CONFIG_BT_HIDP=m
-
-#
-# Bluetooth device drivers
-#
-# CONFIG_BT_HCIUART is not set
-# CONFIG_BT_HCIVHCI is not set
+# CONFIG_IRDA is not set
+# CONFIG_BT is not set
 # CONFIG_IEEE80211 is not set
 
 #
@@ -476,21 +421,19 @@
 #
 # Memory Technology Devices (MTD)
 #
-CONFIG_MTD=y
+CONFIG_MTD=m
 CONFIG_MTD_DEBUG=y
 CONFIG_MTD_DEBUG_VERBOSE=0
-CONFIG_MTD_CONCAT=y
-CONFIG_MTD_PARTITIONS=y
-# CONFIG_MTD_REDBOOT_PARTS is not set
-# CONFIG_MTD_CMDLINE_PARTS is not set
-# CONFIG_MTD_AFS_PARTS is not set
+# CONFIG_MTD_CONCAT is not set
+# CONFIG_MTD_PARTITIONS is not set
 
 #
 # User Modules And Translation Layers
 #
-CONFIG_MTD_CHAR=y
-CONFIG_MTD_BLKDEVS=y
-CONFIG_MTD_BLOCK=y
+CONFIG_MTD_CHAR=m
+# CONFIG_MTD_BLKDEVS is not set
+# CONFIG_MTD_BLOCK is not set
+# CONFIG_MTD_BLOCK_RO is not set
 # CONFIG_FTL is not set
 # CONFIG_NFTL is not set
 # CONFIG_INFTL is not set
@@ -543,16 +486,15 @@
 #
 # NAND Flash Device Drivers
 #
-CONFIG_MTD_NAND=y
+CONFIG_MTD_NAND=m
 # CONFIG_MTD_NAND_VERIFY_WRITE is not set
 # CONFIG_MTD_NAND_ECC_SMC is not set
-CONFIG_MTD_NAND_IDS=y
-CONFIG_MTD_NAND_S3C2410=y
+CONFIG_MTD_NAND_IDS=m
+CONFIG_MTD_NAND_S3C2410=m
 # CONFIG_MTD_NAND_S3C2410_DEBUG is not set
 CONFIG_MTD_NAND_S3C2410_HWECC=y
 CONFIG_MTD_NAND_S3C2410_CLKSTOP=y
 # CONFIG_MTD_NAND_DISKONCHIP is not set
-# CONFIG_MTD_NAND_NANDSIM is not set
 
 #
 # OneNAND Flash Device Drivers
@@ -573,7 +515,8 @@
 # Block devices
 #
 # CONFIG_BLK_DEV_COW_COMMON is not set
-# CONFIG_BLK_DEV_LOOP is not set
+CONFIG_BLK_DEV_LOOP=m
+# CONFIG_BLK_DEV_CRYPTOLOOP is not set
 # CONFIG_BLK_DEV_NBD is not set
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_COUNT=4
@@ -656,6 +599,7 @@
 # CONFIG_KEYBOARD_NEWTON is not set
 # CONFIG_KEYBOARD_STOWAWAY is not set
 # CONFIG_GPIODEV_KEYS is not set
+# CONFIG_GPIODEV_KEYS2 is not set
 # CONFIG_GPIODEV_DIAGONAL is not set
 CONFIG_KEYBOARD_GPIO=y
 CONFIG_INPUT_MOUSE=y
@@ -776,12 +720,24 @@
 # CONFIG_ADC_AD7877 is not set
 
 #
+# Compaq/iPAQ Drivers
+#
+
+#
+# Compaq/HP iPAQ Drivers
+#
+# CONFIG_IPAQ_SLEEVE is not set
+# CONFIG_SLEEVE_DEBUG is not set
+
+#
 # Multifunction device drivers
 #
 # CONFIG_MFD_SM501 is not set
 # CONFIG_HTC_ASIC2 is not set
 # CONFIG_HTC_ASIC3 is not set
+# CONFIG_HTC_PASIC3 is not set
 # CONFIG_HTC_EGPIO is not set
+# CONFIG_HTC_BBKEYS is not set
 # CONFIG_HTC_ASIC3_DS1WM is not set
 # CONFIG_SOC_SAMCOP is not set
 # CONFIG_SOC_HAMCOP is not set
@@ -800,6 +756,7 @@
 # LED drivers
 #
 CONFIG_LEDS_S3C24XX=y
+# CONFIG_LEDS_GPIO is not set
 
 #
 # LED Triggers
@@ -807,6 +764,7 @@
 CONFIG_LEDS_TRIGGERS=y
 CONFIG_LEDS_TRIGGER_TIMER=y
 # CONFIG_LEDS_TRIGGER_HWTIMER is not set
+# CONFIG_LEDS_TRIGGER_BACKLIGHT is not set
 # CONFIG_LEDS_TRIGGER_HEARTBEAT is not set
 CONFIG_LEDS_TRIGGER_SHARED=y
 
@@ -892,8 +850,7 @@
 #
 # HID Devices
 #
-CONFIG_HID=m
-# CONFIG_HID_DEBUG is not set
+# CONFIG_HID is not set
 
 #
 # USB support
@@ -1098,8 +1055,8 @@
 # CONFIG_NLS_CODEPAGE_949 is not set
 # CONFIG_NLS_CODEPAGE_874 is not set
 # CONFIG_NLS_ISO8859_8 is not set
-CONFIG_NLS_CODEPAGE_1250=y
-CONFIG_NLS_CODEPAGE_1251=y
+# CONFIG_NLS_CODEPAGE_1250 is not set
+CONFIG_NLS_CODEPAGE_1251=m
 # CONFIG_NLS_ASCII is not set
 CONFIG_NLS_ISO8859_1=y
 # CONFIG_NLS_ISO8859_2 is not set
diff -ruN -X X hnd-linux-trunk/arch/arm/configs/h1910_static_defconfig hnd-cleanup/arch/arm/configs/h1910_static_defconfig
--- hnd-linux-trunk/arch/arm/configs/h1910_static_defconfig	2007-09-17 22:44:27.000000000 +0400
+++ hnd-cleanup/arch/arm/configs/h1910_static_defconfig	2007-09-17 23:22:49.000000000 +0400
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.21-hh12
-# Tue Jul 17 20:51:08 2007
+# Linux kernel version: 2.6.21-hh15
+# Mon Sep 10 20:36:42 2007
 #
 CONFIG_ARM=y
 CONFIG_SYS_SUPPORTS_APM_EMULATION=y
@@ -168,8 +168,7 @@
 # CONFIG_MACH_MAGICIAN is not set
 # CONFIG_MACH_HTCAPACHE is not set
 # CONFIG_MACH_BLUEANGEL is not set
-# CONFIG_MACH_HTCBEETLES is not set
-# CONFIG_MACH_HW6900 is not set
+# CONFIG_HTC_HW6X00 is not set
 # CONFIG_MACH_HTCATHENA is not set
 # CONFIG_ARCH_AXIMX3 is not set
 # CONFIG_ARCH_AXIMX5 is not set
@@ -400,64 +399,8 @@
 #
 # CONFIG_NET_PKTGEN is not set
 # CONFIG_HAMRADIO is not set
-CONFIG_IRDA=y
-
-#
-# IrDA protocols
-#
-CONFIG_IRLAN=y
-CONFIG_IRCOMM=y
-CONFIG_IRDA_ULTRA=y
-
-#
-# IrDA options
-#
-CONFIG_IRDA_CACHE_LAST_LSAP=y
-CONFIG_IRDA_FAST_RR=y
-CONFIG_IRDA_DEBUG=y
-
-#
-# Infrared-port device drivers
-#
-
-#
-# SIR device drivers
-#
-CONFIG_IRTTY_SIR=y
-
-#
-# Dongle support
-#
-# CONFIG_DONGLE is not set
-
-#
-# Old SIR device drivers
-#
-# CONFIG_IRPORT_SIR is not set
-
-#
-# Old Serial dongle support
-#
-
-#
-# FIR device drivers
-#
-CONFIG_PXA_FICP=y
-CONFIG_BT=y
-CONFIG_BT_L2CAP=m
-CONFIG_BT_SCO=m
-CONFIG_BT_RFCOMM=m
-CONFIG_BT_RFCOMM_TTY=y
-CONFIG_BT_BNEP=m
-CONFIG_BT_BNEP_MC_FILTER=y
-CONFIG_BT_BNEP_PROTO_FILTER=y
-CONFIG_BT_HIDP=m
-
-#
-# Bluetooth device drivers
-#
-# CONFIG_BT_HCIUART is not set
-# CONFIG_BT_HCIVHCI is not set
+# CONFIG_IRDA is not set
+# CONFIG_BT is not set
 # CONFIG_IEEE80211 is not set
 
 #
@@ -482,21 +425,19 @@
 #
 # Memory Technology Devices (MTD)
 #
-CONFIG_MTD=y
+CONFIG_MTD=m
 CONFIG_MTD_DEBUG=y
 CONFIG_MTD_DEBUG_VERBOSE=0
-CONFIG_MTD_CONCAT=y
-CONFIG_MTD_PARTITIONS=y
-# CONFIG_MTD_REDBOOT_PARTS is not set
-# CONFIG_MTD_CMDLINE_PARTS is not set
-# CONFIG_MTD_AFS_PARTS is not set
+# CONFIG_MTD_CONCAT is not set
+# CONFIG_MTD_PARTITIONS is not set
 
 #
 # User Modules And Translation Layers
 #
-CONFIG_MTD_CHAR=y
-CONFIG_MTD_BLKDEVS=y
-CONFIG_MTD_BLOCK=y
+CONFIG_MTD_CHAR=m
+# CONFIG_MTD_BLKDEVS is not set
+# CONFIG_MTD_BLOCK is not set
+# CONFIG_MTD_BLOCK_RO is not set
 # CONFIG_FTL is not set
 # CONFIG_NFTL is not set
 # CONFIG_INFTL is not set
@@ -571,7 +512,8 @@
 # Block devices
 #
 # CONFIG_BLK_DEV_COW_COMMON is not set
-# CONFIG_BLK_DEV_LOOP is not set
+CONFIG_BLK_DEV_LOOP=m
+# CONFIG_BLK_DEV_CRYPTOLOOP is not set
 # CONFIG_BLK_DEV_NBD is not set
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_COUNT=4
@@ -654,6 +596,7 @@
 # CONFIG_KEYBOARD_NEWTON is not set
 # CONFIG_KEYBOARD_STOWAWAY is not set
 # CONFIG_GPIODEV_KEYS is not set
+# CONFIG_GPIODEV_KEYS2 is not set
 # CONFIG_GPIODEV_DIAGONAL is not set
 # CONFIG_KEYBOARD_ASIC3 is not set
 # CONFIG_KEYBOARD_GPIO is not set
@@ -808,12 +751,24 @@
 # CONFIG_ADC_AD7877 is not set
 
 #
+# Compaq/iPAQ Drivers
+#
+
+#
+# Compaq/HP iPAQ Drivers
+#
+# CONFIG_IPAQ_SLEEVE is not set
+# CONFIG_SLEEVE_DEBUG is not set
+
+#
 # Multifunction device drivers
 #
 # CONFIG_MFD_SM501 is not set
 # CONFIG_HTC_ASIC2 is not set
 CONFIG_HTC_ASIC3=y
+# CONFIG_HTC_PASIC3 is not set
 # CONFIG_HTC_EGPIO is not set
+# CONFIG_HTC_BBKEYS is not set
 # CONFIG_HTC_ASIC3_DS1WM is not set
 # CONFIG_SOC_SAMCOP is not set
 # CONFIG_SOC_HAMCOP is not set
@@ -834,6 +789,7 @@
 # LED drivers
 #
 # CONFIG_LEDS_ASIC3 is not set
+# CONFIG_LEDS_GPIO is not set
 
 #
 # LED Triggers
@@ -841,6 +797,7 @@
 CONFIG_LEDS_TRIGGERS=y
 CONFIG_LEDS_TRIGGER_TIMER=y
 # CONFIG_LEDS_TRIGGER_HWTIMER is not set
+# CONFIG_LEDS_TRIGGER_BACKLIGHT is not set
 # CONFIG_LEDS_TRIGGER_HEARTBEAT is not set
 CONFIG_LEDS_TRIGGER_SHARED=y
 
@@ -960,8 +917,7 @@
 #
 # HID Devices
 #
-CONFIG_HID=m
-# CONFIG_HID_DEBUG is not set
+# CONFIG_HID is not set
 
 #
 # USB support
@@ -1174,8 +1130,8 @@
 # CONFIG_NLS_CODEPAGE_949 is not set
 # CONFIG_NLS_CODEPAGE_874 is not set
 # CONFIG_NLS_ISO8859_8 is not set
-CONFIG_NLS_CODEPAGE_1250=y
-CONFIG_NLS_CODEPAGE_1251=y
+# CONFIG_NLS_CODEPAGE_1250 is not set
+CONFIG_NLS_CODEPAGE_1251=m
 # CONFIG_NLS_ASCII is not set
 CONFIG_NLS_ISO8859_1=y
 # CONFIG_NLS_ISO8859_2 is not set
diff -ruN -X X hnd-linux-trunk/arch/arm/configs/h2200_static_defconfig hnd-cleanup/arch/arm/configs/h2200_static_defconfig
--- hnd-linux-trunk/arch/arm/configs/h2200_static_defconfig	2007-09-17 22:44:27.000000000 +0400
+++ hnd-cleanup/arch/arm/configs/h2200_static_defconfig	2007-09-17 23:22:48.000000000 +0400
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.21-hh12
-# Tue Jul 17 20:51:08 2007
+# Linux kernel version: 2.6.21-hh15
+# Mon Sep 10 20:36:43 2007
 #
 CONFIG_ARM=y
 CONFIG_SYS_SUPPORTS_APM_EMULATION=y
@@ -167,8 +167,7 @@
 # CONFIG_MACH_MAGICIAN is not set
 # CONFIG_MACH_HTCAPACHE is not set
 # CONFIG_MACH_BLUEANGEL is not set
-# CONFIG_MACH_HTCBEETLES is not set
-# CONFIG_MACH_HW6900 is not set
+# CONFIG_HTC_HW6X00 is not set
 # CONFIG_MACH_HTCATHENA is not set
 # CONFIG_ARCH_AXIMX3 is not set
 # CONFIG_ARCH_AXIMX5 is not set
@@ -408,13 +407,13 @@
 #
 # CONFIG_NET_PKTGEN is not set
 # CONFIG_HAMRADIO is not set
-CONFIG_IRDA=y
+CONFIG_IRDA=m
 
 #
 # IrDA protocols
 #
-CONFIG_IRLAN=y
-CONFIG_IRCOMM=y
+CONFIG_IRLAN=m
+CONFIG_IRCOMM=m
 CONFIG_IRDA_ULTRA=y
 
 #
@@ -431,7 +430,7 @@
 #
 # SIR device drivers
 #
-CONFIG_IRTTY_SIR=y
+CONFIG_IRTTY_SIR=m
 
 #
 # Dongle support
@@ -452,17 +451,17 @@
 #
 # CONFIG_USB_IRDA is not set
 # CONFIG_SIGMATEL_FIR is not set
-CONFIG_PXA_FICP=y
+CONFIG_PXA_FICP=m
 # CONFIG_MCS_FIR is not set
 CONFIG_BT=y
-CONFIG_BT_L2CAP=m
-CONFIG_BT_SCO=m
-CONFIG_BT_RFCOMM=m
+CONFIG_BT_L2CAP=y
+CONFIG_BT_SCO=y
+CONFIG_BT_RFCOMM=y
 CONFIG_BT_RFCOMM_TTY=y
-CONFIG_BT_BNEP=m
+CONFIG_BT_BNEP=y
 CONFIG_BT_BNEP_MC_FILTER=y
 CONFIG_BT_BNEP_PROTO_FILTER=y
-CONFIG_BT_HIDP=m
+CONFIG_BT_HIDP=y
 
 #
 # Bluetooth device drivers
@@ -600,7 +599,8 @@
 # Block devices
 #
 # CONFIG_BLK_DEV_COW_COMMON is not set
-# CONFIG_BLK_DEV_LOOP is not set
+CONFIG_BLK_DEV_LOOP=m
+# CONFIG_BLK_DEV_CRYPTOLOOP is not set
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_UB is not set
 CONFIG_BLK_DEV_RAM=y
@@ -706,6 +706,7 @@
 # CONFIG_KEYBOARD_NEWTON is not set
 # CONFIG_KEYBOARD_STOWAWAY is not set
 # CONFIG_GPIODEV_KEYS is not set
+# CONFIG_GPIODEV_KEYS2 is not set
 # CONFIG_GPIODEV_DIAGONAL is not set
 CONFIG_KEYBOARD_H2200=y
 CONFIG_KEYBOARD_GPIO=y
@@ -888,12 +889,24 @@
 CONFIG_ADC_SAMCOP=y
 
 #
+# Compaq/iPAQ Drivers
+#
+
+#
+# Compaq/HP iPAQ Drivers
+#
+# CONFIG_IPAQ_SLEEVE is not set
+# CONFIG_SLEEVE_DEBUG is not set
+
+#
 # Multifunction device drivers
 #
 # CONFIG_MFD_SM501 is not set
 # CONFIG_HTC_ASIC2 is not set
 # CONFIG_HTC_ASIC3 is not set
+# CONFIG_HTC_PASIC3 is not set
 # CONFIG_HTC_EGPIO is not set
+# CONFIG_HTC_BBKEYS is not set
 # CONFIG_HTC_ASIC3_DS1WM is not set
 # CONFIG_SOC_SAMCOP is not set
 CONFIG_SOC_HAMCOP=y
@@ -916,6 +929,7 @@
 # LED drivers
 #
 CONFIG_LEDS_HAMCOP=y
+# CONFIG_LEDS_GPIO is not set
 
 #
 # LED Triggers
@@ -924,6 +938,7 @@
 CONFIG_LEDS_TRIGGER_TIMER=y
 CONFIG_LEDS_TRIGGER_HWTIMER=y
 # CONFIG_LEDS_TRIGGER_IDE_DISK is not set
+# CONFIG_LEDS_TRIGGER_BACKLIGHT is not set
 # CONFIG_LEDS_TRIGGER_HEARTBEAT is not set
 CONFIG_LEDS_TRIGGER_SHARED=y
 
@@ -1057,7 +1072,7 @@
 #
 # HID Devices
 #
-CONFIG_HID=m
+CONFIG_HID=y
 # CONFIG_HID_DEBUG is not set
 
 #
@@ -1386,8 +1401,8 @@
 # CONFIG_NLS_CODEPAGE_949 is not set
 # CONFIG_NLS_CODEPAGE_874 is not set
 # CONFIG_NLS_ISO8859_8 is not set
-CONFIG_NLS_CODEPAGE_1250=y
-CONFIG_NLS_CODEPAGE_1251=y
+# CONFIG_NLS_CODEPAGE_1250 is not set
+CONFIG_NLS_CODEPAGE_1251=m
 # CONFIG_NLS_ASCII is not set
 CONFIG_NLS_ISO8859_1=y
 # CONFIG_NLS_ISO8859_2 is not set
diff -ruN -X X hnd-linux-trunk/arch/arm/configs/h3600_static_defconfig hnd-cleanup/arch/arm/configs/h3600_static_defconfig
--- hnd-linux-trunk/arch/arm/configs/h3600_static_defconfig	2007-09-17 22:44:27.000000000 +0400
+++ hnd-cleanup/arch/arm/configs/h3600_static_defconfig	2007-09-17 23:22:48.000000000 +0400
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.21-hh12
-# Tue Jul 17 20:51:09 2007
+# Linux kernel version: 2.6.21-hh15
+# Mon Sep 10 20:36:43 2007
 #
 CONFIG_ARM=y
 CONFIG_SYS_SUPPORTS_APM_EMULATION=y
@@ -383,64 +383,8 @@
 #
 # CONFIG_NET_PKTGEN is not set
 # CONFIG_HAMRADIO is not set
-CONFIG_IRDA=y
-
-#
-# IrDA protocols
-#
-CONFIG_IRLAN=y
-CONFIG_IRCOMM=y
-CONFIG_IRDA_ULTRA=y
-
-#
-# IrDA options
-#
-CONFIG_IRDA_CACHE_LAST_LSAP=y
-CONFIG_IRDA_FAST_RR=y
-CONFIG_IRDA_DEBUG=y
-
-#
-# Infrared-port device drivers
-#
-
-#
-# SIR device drivers
-#
-CONFIG_IRTTY_SIR=y
-
-#
-# Dongle support
-#
-# CONFIG_DONGLE is not set
-
-#
-# Old SIR device drivers
-#
-# CONFIG_IRPORT_SIR is not set
-
-#
-# Old Serial dongle support
-#
-
-#
-# FIR device drivers
-#
-# CONFIG_SA1100_FIR is not set
-CONFIG_BT=y
-CONFIG_BT_L2CAP=m
-CONFIG_BT_SCO=m
-CONFIG_BT_RFCOMM=m
-CONFIG_BT_RFCOMM_TTY=y
-CONFIG_BT_BNEP=m
-CONFIG_BT_BNEP_MC_FILTER=y
-CONFIG_BT_BNEP_PROTO_FILTER=y
-CONFIG_BT_HIDP=m
-
-#
-# Bluetooth device drivers
-#
-# CONFIG_BT_HCIUART is not set
-# CONFIG_BT_HCIVHCI is not set
+# CONFIG_IRDA is not set
+# CONFIG_BT is not set
 # CONFIG_IEEE80211 is not set
 
 #
@@ -554,7 +498,8 @@
 # Block devices
 #
 # CONFIG_BLK_DEV_COW_COMMON is not set
-# CONFIG_BLK_DEV_LOOP is not set
+CONFIG_BLK_DEV_LOOP=m
+# CONFIG_BLK_DEV_CRYPTOLOOP is not set
 # CONFIG_BLK_DEV_NBD is not set
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_COUNT=4
@@ -637,6 +582,7 @@
 # CONFIG_KEYBOARD_NEWTON is not set
 # CONFIG_KEYBOARD_STOWAWAY is not set
 # CONFIG_GPIODEV_KEYS is not set
+# CONFIG_GPIODEV_KEYS2 is not set
 # CONFIG_GPIODEV_DIAGONAL is not set
 CONFIG_KEYBOARD_MICRO=y
 CONFIG_KEYBOARD_GPIO=y
@@ -764,13 +710,25 @@
 # CONFIG_ADC_AD7877 is not set
 
 #
+# Compaq/iPAQ Drivers
+#
+
+#
+# Compaq/HP iPAQ Drivers
+#
+# CONFIG_IPAQ_SLEEVE is not set
+# CONFIG_SLEEVE_DEBUG is not set
+
+#
 # Multifunction device drivers
 #
 # CONFIG_MFD_SM501 is not set
 CONFIG_IPAQ_MICRO=y
 # CONFIG_HTC_ASIC2 is not set
 # CONFIG_HTC_ASIC3 is not set
+# CONFIG_HTC_PASIC3 is not set
 # CONFIG_HTC_EGPIO is not set
+# CONFIG_HTC_BBKEYS is not set
 # CONFIG_HTC_ASIC3_DS1WM is not set
 # CONFIG_SOC_SAMCOP is not set
 # CONFIG_SOC_HAMCOP is not set
@@ -793,6 +751,7 @@
 #
 # LED drivers
 #
+# CONFIG_LEDS_GPIO is not set
 
 #
 # LED Triggers
@@ -800,6 +759,7 @@
 CONFIG_LEDS_TRIGGERS=y
 CONFIG_LEDS_TRIGGER_TIMER=y
 CONFIG_LEDS_TRIGGER_HWTIMER=y
+# CONFIG_LEDS_TRIGGER_BACKLIGHT is not set
 # CONFIG_LEDS_TRIGGER_HEARTBEAT is not set
 CONFIG_LEDS_TRIGGER_SHARED=y
 
@@ -884,8 +844,7 @@
 #
 # HID Devices
 #
-CONFIG_HID=m
-# CONFIG_HID_DEBUG is not set
+# CONFIG_HID is not set
 
 #
 # USB support
@@ -1089,8 +1048,8 @@
 # CONFIG_NLS_CODEPAGE_949 is not set
 # CONFIG_NLS_CODEPAGE_874 is not set
 # CONFIG_NLS_ISO8859_8 is not set
-CONFIG_NLS_CODEPAGE_1250=y
-CONFIG_NLS_CODEPAGE_1251=y
+# CONFIG_NLS_CODEPAGE_1250 is not set
+CONFIG_NLS_CODEPAGE_1251=m
 # CONFIG_NLS_ASCII is not set
 CONFIG_NLS_ISO8859_1=y
 # CONFIG_NLS_ISO8859_2 is not set
diff -ruN -X X hnd-linux-trunk/arch/arm/configs/h3800_static_defconfig hnd-cleanup/arch/arm/configs/h3800_static_defconfig
--- hnd-linux-trunk/arch/arm/configs/h3800_static_defconfig	2007-09-17 22:44:27.000000000 +0400
+++ hnd-cleanup/arch/arm/configs/h3800_static_defconfig	2007-09-17 23:22:49.000000000 +0400
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.21-hh12
-# Tue Jul 17 20:51:09 2007
+# Linux kernel version: 2.6.21-hh15
+# Mon Sep 10 20:36:44 2007
 #
 CONFIG_ARM=y
 CONFIG_SYS_SUPPORTS_APM_EMULATION=y
@@ -381,64 +381,8 @@
 #
 # CONFIG_NET_PKTGEN is not set
 # CONFIG_HAMRADIO is not set
-CONFIG_IRDA=y
-
-#
-# IrDA protocols
-#
-CONFIG_IRLAN=y
-CONFIG_IRCOMM=y
-CONFIG_IRDA_ULTRA=y
-
-#
-# IrDA options
-#
-CONFIG_IRDA_CACHE_LAST_LSAP=y
-CONFIG_IRDA_FAST_RR=y
-CONFIG_IRDA_DEBUG=y
-
-#
-# Infrared-port device drivers
-#
-
-#
-# SIR device drivers
-#
-CONFIG_IRTTY_SIR=y
-
-#
-# Dongle support
-#
-# CONFIG_DONGLE is not set
-
-#
-# Old SIR device drivers
-#
-# CONFIG_IRPORT_SIR is not set
-
-#
-# Old Serial dongle support
-#
-
-#
-# FIR device drivers
-#
-# CONFIG_SA1100_FIR is not set
-CONFIG_BT=y
-CONFIG_BT_L2CAP=m
-CONFIG_BT_SCO=m
-CONFIG_BT_RFCOMM=m
-CONFIG_BT_RFCOMM_TTY=y
-CONFIG_BT_BNEP=m
-CONFIG_BT_BNEP_MC_FILTER=y
-CONFIG_BT_BNEP_PROTO_FILTER=y
-CONFIG_BT_HIDP=m
-
-#
-# Bluetooth device drivers
-#
-# CONFIG_BT_HCIUART is not set
-# CONFIG_BT_HCIVHCI is not set
+# CONFIG_IRDA is not set
+# CONFIG_BT is not set
 # CONFIG_IEEE80211 is not set
 
 #
@@ -552,7 +496,8 @@
 # Block devices
 #
 # CONFIG_BLK_DEV_COW_COMMON is not set
-# CONFIG_BLK_DEV_LOOP is not set
+CONFIG_BLK_DEV_LOOP=m
+# CONFIG_BLK_DEV_CRYPTOLOOP is not set
 # CONFIG_BLK_DEV_NBD is not set
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_COUNT=4
@@ -635,6 +580,7 @@
 # CONFIG_KEYBOARD_NEWTON is not set
 # CONFIG_KEYBOARD_STOWAWAY is not set
 # CONFIG_GPIODEV_KEYS is not set
+# CONFIG_GPIODEV_KEYS2 is not set
 # CONFIG_GPIODEV_DIAGONAL is not set
 CONFIG_KEYBOARD_ASIC2=y
 CONFIG_KEYBOARD_GPIO=y
@@ -762,12 +708,24 @@
 CONFIG_ADC_ASIC2=y
 
 #
+# Compaq/iPAQ Drivers
+#
+
+#
+# Compaq/HP iPAQ Drivers
+#
+# CONFIG_IPAQ_SLEEVE is not set
+# CONFIG_SLEEVE_DEBUG is not set
+
+#
 # Multifunction device drivers
 #
 # CONFIG_MFD_SM501 is not set
 CONFIG_HTC_ASIC2=y
 # CONFIG_HTC_ASIC3 is not set
+# CONFIG_HTC_PASIC3 is not set
 # CONFIG_HTC_EGPIO is not set
+# CONFIG_HTC_BBKEYS is not set
 # CONFIG_HTC_ASIC3_DS1WM is not set
 # CONFIG_SOC_SAMCOP is not set
 # CONFIG_SOC_HAMCOP is not set
@@ -790,6 +748,7 @@
 #
 # LED drivers
 #
+# CONFIG_LEDS_GPIO is not set
 
 #
 # LED Triggers
@@ -797,6 +756,7 @@
 CONFIG_LEDS_TRIGGERS=y
 CONFIG_LEDS_TRIGGER_TIMER=y
 CONFIG_LEDS_TRIGGER_HWTIMER=y
+# CONFIG_LEDS_TRIGGER_BACKLIGHT is not set
 # CONFIG_LEDS_TRIGGER_HEARTBEAT is not set
 CONFIG_LEDS_TRIGGER_SHARED=y
 
@@ -881,8 +841,7 @@
 #
 # HID Devices
 #
-CONFIG_HID=m
-# CONFIG_HID_DEBUG is not set
+# CONFIG_HID is not set
 
 #
 # USB support
@@ -1086,8 +1045,8 @@
 # CONFIG_NLS_CODEPAGE_949 is not set
 # CONFIG_NLS_CODEPAGE_874 is not set
 # CONFIG_NLS_ISO8859_8 is not set
-CONFIG_NLS_CODEPAGE_1250=y
-CONFIG_NLS_CODEPAGE_1251=y
+# CONFIG_NLS_CODEPAGE_1250 is not set
+CONFIG_NLS_CODEPAGE_1251=m
 # CONFIG_NLS_ASCII is not set
 CONFIG_NLS_ISO8859_1=y
 # CONFIG_NLS_ISO8859_2 is not set
diff -ruN -X X hnd-linux-trunk/arch/arm/configs/h3900_static_defconfig hnd-cleanup/arch/arm/configs/h3900_static_defconfig
--- hnd-linux-trunk/arch/arm/configs/h3900_static_defconfig	2007-09-17 22:44:27.000000000 +0400
+++ hnd-cleanup/arch/arm/configs/h3900_static_defconfig	2007-09-17 23:22:48.000000000 +0400
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.21-hh12
-# Tue Jul 17 20:51:10 2007
+# Linux kernel version: 2.6.21-hh15
+# Mon Sep 10 20:36:44 2007
 #
 CONFIG_ARM=y
 CONFIG_SYS_SUPPORTS_APM_EMULATION=y
@@ -169,8 +169,7 @@
 # CONFIG_MACH_MAGICIAN is not set
 # CONFIG_MACH_HTCAPACHE is not set
 # CONFIG_MACH_BLUEANGEL is not set
-# CONFIG_MACH_HTCBEETLES is not set
-# CONFIG_MACH_HW6900 is not set
+# CONFIG_HTC_HW6X00 is not set
 # CONFIG_MACH_HTCATHENA is not set
 # CONFIG_ARCH_AXIMX3 is not set
 # CONFIG_ARCH_AXIMX5 is not set
@@ -401,58 +400,16 @@
 #
 # CONFIG_NET_PKTGEN is not set
 # CONFIG_HAMRADIO is not set
-CONFIG_IRDA=y
-
-#
-# IrDA protocols
-#
-CONFIG_IRLAN=y
-CONFIG_IRCOMM=y
-CONFIG_IRDA_ULTRA=y
-
-#
-# IrDA options
-#
-CONFIG_IRDA_CACHE_LAST_LSAP=y
-CONFIG_IRDA_FAST_RR=y
-CONFIG_IRDA_DEBUG=y
-
-#
-# Infrared-port device drivers
-#
-
-#
-# SIR device drivers
-#
-CONFIG_IRTTY_SIR=y
-
-#
-# Dongle support
-#
-# CONFIG_DONGLE is not set
-
-#
-# Old SIR device drivers
-#
-# CONFIG_IRPORT_SIR is not set
-
-#
-# Old Serial dongle support
-#
-
-#
-# FIR device drivers
-#
-CONFIG_PXA_FICP=y
+# CONFIG_IRDA is not set
 CONFIG_BT=y
-CONFIG_BT_L2CAP=m
-CONFIG_BT_SCO=m
-CONFIG_BT_RFCOMM=m
+CONFIG_BT_L2CAP=y
+CONFIG_BT_SCO=y
+CONFIG_BT_RFCOMM=y
 CONFIG_BT_RFCOMM_TTY=y
-CONFIG_BT_BNEP=m
+CONFIG_BT_BNEP=y
 CONFIG_BT_BNEP_MC_FILTER=y
 CONFIG_BT_BNEP_PROTO_FILTER=y
-CONFIG_BT_HIDP=m
+CONFIG_BT_HIDP=y
 
 #
 # Bluetooth device drivers
@@ -572,7 +529,8 @@
 # Block devices
 #
 # CONFIG_BLK_DEV_COW_COMMON is not set
-# CONFIG_BLK_DEV_LOOP is not set
+CONFIG_BLK_DEV_LOOP=m
+# CONFIG_BLK_DEV_CRYPTOLOOP is not set
 # CONFIG_BLK_DEV_NBD is not set
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_COUNT=4
@@ -655,6 +613,7 @@
 # CONFIG_KEYBOARD_NEWTON is not set
 # CONFIG_KEYBOARD_STOWAWAY is not set
 # CONFIG_GPIODEV_KEYS is not set
+# CONFIG_GPIODEV_KEYS2 is not set
 # CONFIG_GPIODEV_DIAGONAL is not set
 CONFIG_KEYBOARD_ASIC2=y
 # CONFIG_KEYBOARD_ASIC3 is not set
@@ -817,12 +776,24 @@
 CONFIG_ADC_ASIC2=y
 
 #
+# Compaq/iPAQ Drivers
+#
+
+#
+# Compaq/HP iPAQ Drivers
+#
+# CONFIG_IPAQ_SLEEVE is not set
+# CONFIG_SLEEVE_DEBUG is not set
+
+#
 # Multifunction device drivers
 #
 # CONFIG_MFD_SM501 is not set
 CONFIG_HTC_ASIC2=y
 CONFIG_HTC_ASIC3=y
+# CONFIG_HTC_PASIC3 is not set
 # CONFIG_HTC_EGPIO is not set
+# CONFIG_HTC_BBKEYS is not set
 # CONFIG_HTC_ASIC3_DS1WM is not set
 # CONFIG_SOC_SAMCOP is not set
 # CONFIG_SOC_HAMCOP is not set
@@ -843,6 +814,7 @@
 # LED drivers
 #
 # CONFIG_LEDS_ASIC3 is not set
+# CONFIG_LEDS_GPIO is not set
 
 #
 # LED Triggers
@@ -850,6 +822,7 @@
 CONFIG_LEDS_TRIGGERS=y
 CONFIG_LEDS_TRIGGER_TIMER=y
 CONFIG_LEDS_TRIGGER_HWTIMER=y
+# CONFIG_LEDS_TRIGGER_BACKLIGHT is not set
 # CONFIG_LEDS_TRIGGER_HEARTBEAT is not set
 CONFIG_LEDS_TRIGGER_SHARED=y
 
@@ -966,7 +939,7 @@
 #
 # HID Devices
 #
-CONFIG_HID=m
+CONFIG_HID=y
 # CONFIG_HID_DEBUG is not set
 
 #
@@ -1191,8 +1164,8 @@
 # CONFIG_NLS_CODEPAGE_949 is not set
 # CONFIG_NLS_CODEPAGE_874 is not set
 # CONFIG_NLS_ISO8859_8 is not set
-CONFIG_NLS_CODEPAGE_1250=y
-CONFIG_NLS_CODEPAGE_1251=y
+# CONFIG_NLS_CODEPAGE_1250 is not set
+CONFIG_NLS_CODEPAGE_1251=m
 # CONFIG_NLS_ASCII is not set
 CONFIG_NLS_ISO8859_1=y
 # CONFIG_NLS_ISO8859_2 is not set
diff -ruN -X X hnd-linux-trunk/arch/arm/configs/h4000_static_defconfig hnd-cleanup/arch/arm/configs/h4000_static_defconfig
--- hnd-linux-trunk/arch/arm/configs/h4000_static_defconfig	2007-09-17 22:44:27.000000000 +0400
+++ hnd-cleanup/arch/arm/configs/h4000_static_defconfig	2007-09-17 23:22:48.000000000 +0400
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.21-hh13
-# Thu Jul 26 04:01:26 2007
+# Linux kernel version: 2.6.21-hh15
+# Mon Sep 10 20:36:45 2007
 #
 CONFIG_ARM=y
 CONFIG_SYS_SUPPORTS_APM_EMULATION=y
@@ -175,8 +175,7 @@
 # CONFIG_MACH_MAGICIAN is not set
 # CONFIG_MACH_HTCAPACHE is not set
 # CONFIG_MACH_BLUEANGEL is not set
-# CONFIG_MACH_HTCBEETLES is not set
-# CONFIG_MACH_HW6900 is not set
+# CONFIG_HTC_HW6X00 is not set
 # CONFIG_MACH_HTCATHENA is not set
 # CONFIG_ARCH_AXIMX3 is not set
 # CONFIG_ARCH_AXIMX5 is not set
@@ -763,6 +762,7 @@
 # CONFIG_KEYBOARD_NEWTON is not set
 # CONFIG_KEYBOARD_STOWAWAY is not set
 # CONFIG_GPIODEV_KEYS is not set
+# CONFIG_GPIODEV_KEYS2 is not set
 # CONFIG_GPIODEV_DIAGONAL is not set
 # CONFIG_KEYBOARD_ASIC3 is not set
 CONFIG_KEYBOARD_GPIO=y
@@ -929,6 +929,16 @@
 # CONFIG_ADC_AD7877 is not set
 
 #
+# Compaq/iPAQ Drivers
+#
+
+#
+# Compaq/HP iPAQ Drivers
+#
+# CONFIG_IPAQ_SLEEVE is not set
+# CONFIG_SLEEVE_DEBUG is not set
+
+#
 # Multifunction device drivers
 #
 # CONFIG_MFD_SM501 is not set
@@ -936,6 +946,7 @@
 CONFIG_HTC_ASIC3=y
 # CONFIG_HTC_PASIC3 is not set
 # CONFIG_HTC_EGPIO is not set
+# CONFIG_HTC_BBKEYS is not set
 # CONFIG_HTC_ASIC3_DS1WM is not set
 # CONFIG_SOC_SAMCOP is not set
 # CONFIG_SOC_HAMCOP is not set
@@ -956,6 +967,7 @@
 # LED drivers
 #
 CONFIG_LEDS_ASIC3=y
+# CONFIG_LEDS_GPIO is not set
 
 #
 # LED Triggers
diff -ruN -X X hnd-linux-trunk/arch/arm/configs/h5000_static_defconfig hnd-cleanup/arch/arm/configs/h5000_static_defconfig
--- hnd-linux-trunk/arch/arm/configs/h5000_static_defconfig	2007-09-17 22:44:27.000000000 +0400
+++ hnd-cleanup/arch/arm/configs/h5000_static_defconfig	2007-09-17 23:22:49.000000000 +0400
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.21-hh12
-# Tue Jul 17 20:51:11 2007
+# Linux kernel version: 2.6.21-hh15
+# Mon Sep 10 20:36:45 2007
 #
 CONFIG_ARM=y
 CONFIG_SYS_SUPPORTS_APM_EMULATION=y
@@ -164,16 +164,13 @@
 CONFIG_IPAQ_H5400_BT=y
 CONFIG_IPAQ_H5400_LCD=y
 CONFIG_IPAQ_H5400_BL=y
-CONFIG_IPAQ_H5400_POWER=y
-CONFIG_IPAQ_H5400_LEDS=y
 # CONFIG_MACH_HIMALAYA is not set
 # CONFIG_MACH_HTCUNIVERSAL is not set
 # CONFIG_MACH_HTCALPINE is not set
 # CONFIG_MACH_MAGICIAN is not set
 # CONFIG_MACH_HTCAPACHE is not set
 # CONFIG_MACH_BLUEANGEL is not set
-# CONFIG_MACH_HTCBEETLES is not set
-# CONFIG_MACH_HW6900 is not set
+# CONFIG_HTC_HW6X00 is not set
 # CONFIG_MACH_HTCATHENA is not set
 # CONFIG_ARCH_AXIMX3 is not set
 # CONFIG_ARCH_AXIMX5 is not set
@@ -403,13 +400,13 @@
 #
 # CONFIG_NET_PKTGEN is not set
 # CONFIG_HAMRADIO is not set
-CONFIG_IRDA=y
+CONFIG_IRDA=m
 
 #
 # IrDA protocols
 #
-CONFIG_IRLAN=y
-CONFIG_IRCOMM=y
+CONFIG_IRLAN=m
+CONFIG_IRCOMM=m
 CONFIG_IRDA_ULTRA=y
 
 #
@@ -426,7 +423,7 @@
 #
 # SIR device drivers
 #
-CONFIG_IRTTY_SIR=y
+CONFIG_IRTTY_SIR=m
 
 #
 # Dongle support
@@ -445,16 +442,16 @@
 #
 # FIR device drivers
 #
-CONFIG_PXA_FICP=y
+CONFIG_PXA_FICP=m
 CONFIG_BT=y
-CONFIG_BT_L2CAP=m
-CONFIG_BT_SCO=m
-CONFIG_BT_RFCOMM=m
+CONFIG_BT_L2CAP=y
+CONFIG_BT_SCO=y
+CONFIG_BT_RFCOMM=y
 CONFIG_BT_RFCOMM_TTY=y
-CONFIG_BT_BNEP=m
+CONFIG_BT_BNEP=y
 CONFIG_BT_BNEP_MC_FILTER=y
 CONFIG_BT_BNEP_PROTO_FILTER=y
-CONFIG_BT_HIDP=m
+CONFIG_BT_HIDP=y
 
 #
 # Bluetooth device drivers
@@ -592,7 +589,8 @@
 # Block devices
 #
 # CONFIG_BLK_DEV_COW_COMMON is not set
-# CONFIG_BLK_DEV_LOOP is not set
+CONFIG_BLK_DEV_LOOP=m
+# CONFIG_BLK_DEV_CRYPTOLOOP is not set
 # CONFIG_BLK_DEV_NBD is not set
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_COUNT=4
@@ -675,6 +673,7 @@
 # CONFIG_KEYBOARD_NEWTON is not set
 # CONFIG_KEYBOARD_STOWAWAY is not set
 CONFIG_GPIODEV_KEYS=y
+# CONFIG_GPIODEV_KEYS2 is not set
 CONFIG_GPIODEV_DIAGONAL=y
 # CONFIG_KEYBOARD_GPIO is not set
 CONFIG_INPUT_MOUSE=y
@@ -813,12 +812,25 @@
 CONFIG_ADC_SAMCOP=y
 
 #
+# Compaq/iPAQ Drivers
+#
+
+#
+# Compaq/HP iPAQ Drivers
+#
+# CONFIG_IPAQ_SLEEVE is not set
+# CONFIG_SLEEVE_DEBUG is not set
+# CONFIG_IPAQ_SAMCOP_FSI is not set
+
+#
 # Multifunction device drivers
 #
 # CONFIG_MFD_SM501 is not set
 # CONFIG_HTC_ASIC2 is not set
 # CONFIG_HTC_ASIC3 is not set
+# CONFIG_HTC_PASIC3 is not set
 # CONFIG_HTC_EGPIO is not set
+# CONFIG_HTC_BBKEYS is not set
 # CONFIG_HTC_ASIC3_DS1WM is not set
 CONFIG_SOC_SAMCOP=y
 # CONFIG_SOC_HAMCOP is not set
@@ -841,6 +853,7 @@
 # LED drivers
 #
 CONFIG_LEDS_SAMCOP=y
+# CONFIG_LEDS_GPIO is not set
 
 #
 # LED Triggers
@@ -848,6 +861,7 @@
 CONFIG_LEDS_TRIGGERS=y
 CONFIG_LEDS_TRIGGER_TIMER=y
 CONFIG_LEDS_TRIGGER_HWTIMER=y
+# CONFIG_LEDS_TRIGGER_BACKLIGHT is not set
 # CONFIG_LEDS_TRIGGER_HEARTBEAT is not set
 CONFIG_LEDS_TRIGGER_SHARED=y
 
@@ -933,7 +947,7 @@
 #
 # HID Devices
 #
-CONFIG_HID=m
+CONFIG_HID=y
 # CONFIG_HID_DEBUG is not set
 
 #
@@ -1151,8 +1165,8 @@
 # CONFIG_NLS_CODEPAGE_949 is not set
 # CONFIG_NLS_CODEPAGE_874 is not set
 # CONFIG_NLS_ISO8859_8 is not set
-CONFIG_NLS_CODEPAGE_1250=y
-CONFIG_NLS_CODEPAGE_1251=y
+# CONFIG_NLS_CODEPAGE_1250 is not set
+CONFIG_NLS_CODEPAGE_1251=m
 # CONFIG_NLS_ASCII is not set
 CONFIG_NLS_ISO8859_1=y
 # CONFIG_NLS_ISO8859_2 is not set
diff -ruN -X X hnd-linux-trunk/arch/arm/configs/htcalpine_static_defconfig hnd-cleanup/arch/arm/configs/htcalpine_static_defconfig
--- hnd-linux-trunk/arch/arm/configs/htcalpine_static_defconfig	2007-09-17 22:44:27.000000000 +0400
+++ hnd-cleanup/arch/arm/configs/htcalpine_static_defconfig	2007-09-17 23:22:48.000000000 +0400
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.21-hh12
-# Tue Jul 17 20:51:12 2007
+# Linux kernel version: 2.6.21-hh15
+# Mon Sep 10 20:36:47 2007
 #
 CONFIG_ARM=y
 CONFIG_SYS_SUPPORTS_APM_EMULATION=y
@@ -168,8 +168,7 @@
 # CONFIG_MACH_MAGICIAN is not set
 # CONFIG_MACH_HTCAPACHE is not set
 # CONFIG_MACH_BLUEANGEL is not set
-# CONFIG_MACH_HTCBEETLES is not set
-# CONFIG_MACH_HW6900 is not set
+# CONFIG_HTC_HW6X00 is not set
 # CONFIG_MACH_HTCATHENA is not set
 # CONFIG_ARCH_AXIMX3 is not set
 # CONFIG_ARCH_AXIMX5 is not set
@@ -400,58 +399,16 @@
 #
 # CONFIG_NET_PKTGEN is not set
 # CONFIG_HAMRADIO is not set
-CONFIG_IRDA=y
-
-#
-# IrDA protocols
-#
-CONFIG_IRLAN=y
-CONFIG_IRCOMM=y
-CONFIG_IRDA_ULTRA=y
-
-#
-# IrDA options
-#
-CONFIG_IRDA_CACHE_LAST_LSAP=y
-CONFIG_IRDA_FAST_RR=y
-CONFIG_IRDA_DEBUG=y
-
-#
-# Infrared-port device drivers
-#
-
-#
-# SIR device drivers
-#
-CONFIG_IRTTY_SIR=y
-
-#
-# Dongle support
-#
-# CONFIG_DONGLE is not set
-
-#
-# Old SIR device drivers
-#
-# CONFIG_IRPORT_SIR is not set
-
-#
-# Old Serial dongle support
-#
-
-#
-# FIR device drivers
-#
-CONFIG_PXA_FICP=y
+# CONFIG_IRDA is not set
 CONFIG_BT=y
-CONFIG_BT_L2CAP=m
-CONFIG_BT_SCO=m
-CONFIG_BT_RFCOMM=m
+CONFIG_BT_L2CAP=y
+CONFIG_BT_SCO=y
+CONFIG_BT_RFCOMM=y
 CONFIG_BT_RFCOMM_TTY=y
-CONFIG_BT_BNEP=m
+CONFIG_BT_BNEP=y
 CONFIG_BT_BNEP_MC_FILTER=y
 CONFIG_BT_BNEP_PROTO_FILTER=y
-CONFIG_BT_HIDP=m
+CONFIG_BT_HIDP=y
 
 #
 # Bluetooth device drivers
@@ -484,21 +441,19 @@
 #
 # Memory Technology Devices (MTD)
 #
-CONFIG_MTD=y
+CONFIG_MTD=m
 CONFIG_MTD_DEBUG=y
 CONFIG_MTD_DEBUG_VERBOSE=0
-CONFIG_MTD_CONCAT=y
-CONFIG_MTD_PARTITIONS=y
-# CONFIG_MTD_REDBOOT_PARTS is not set
-# CONFIG_MTD_CMDLINE_PARTS is not set
-# CONFIG_MTD_AFS_PARTS is not set
+# CONFIG_MTD_CONCAT is not set
+# CONFIG_MTD_PARTITIONS is not set
 
 #
 # User Modules And Translation Layers
 #
-CONFIG_MTD_CHAR=y
-CONFIG_MTD_BLKDEVS=y
-CONFIG_MTD_BLOCK=y
+CONFIG_MTD_CHAR=m
+# CONFIG_MTD_BLKDEVS is not set
+# CONFIG_MTD_BLOCK is not set
+# CONFIG_MTD_BLOCK_RO is not set
 # CONFIG_FTL is not set
 # CONFIG_NFTL is not set
 # CONFIG_INFTL is not set
@@ -573,7 +528,8 @@
 # Block devices
 #
 # CONFIG_BLK_DEV_COW_COMMON is not set
-# CONFIG_BLK_DEV_LOOP is not set
+CONFIG_BLK_DEV_LOOP=m
+# CONFIG_BLK_DEV_CRYPTOLOOP is not set
 # CONFIG_BLK_DEV_NBD is not set
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_COUNT=4
@@ -656,6 +612,7 @@
 # CONFIG_KEYBOARD_NEWTON is not set
 # CONFIG_KEYBOARD_STOWAWAY is not set
 # CONFIG_GPIODEV_KEYS is not set
+# CONFIG_GPIODEV_KEYS2 is not set
 # CONFIG_GPIODEV_DIAGONAL is not set
 # CONFIG_KEYBOARD_PXA27x is not set
 CONFIG_KEYBOARD_GPIO=y
@@ -775,12 +732,24 @@
 # CONFIG_ADC_AD7877 is not set
 
 #
+# Compaq/iPAQ Drivers
+#
+
+#
+# Compaq/HP iPAQ Drivers
+#
+# CONFIG_IPAQ_SLEEVE is not set
+# CONFIG_SLEEVE_DEBUG is not set
+
+#
 # Multifunction device drivers
 #
 # CONFIG_MFD_SM501 is not set
 # CONFIG_HTC_ASIC2 is not set
 # CONFIG_HTC_ASIC3 is not set
+# CONFIG_HTC_PASIC3 is not set
 # CONFIG_HTC_EGPIO is not set
+# CONFIG_HTC_BBKEYS is not set
 # CONFIG_HTC_ASIC3_DS1WM is not set
 # CONFIG_SOC_SAMCOP is not set
 # CONFIG_SOC_HAMCOP is not set
@@ -800,6 +769,7 @@
 #
 # LED drivers
 #
+# CONFIG_LEDS_GPIO is not set
 
 #
 # LED Triggers
@@ -807,6 +777,7 @@
 CONFIG_LEDS_TRIGGERS=y
 CONFIG_LEDS_TRIGGER_TIMER=y
 # CONFIG_LEDS_TRIGGER_HWTIMER is not set
+# CONFIG_LEDS_TRIGGER_BACKLIGHT is not set
 # CONFIG_LEDS_TRIGGER_HEARTBEAT is not set
 CONFIG_LEDS_TRIGGER_SHARED=y
 
@@ -892,7 +863,7 @@
 #
 # HID Devices
 #
-CONFIG_HID=m
+CONFIG_HID=y
 # CONFIG_HID_DEBUG is not set
 
 #
@@ -1099,8 +1070,8 @@
 # CONFIG_NLS_CODEPAGE_949 is not set
 # CONFIG_NLS_CODEPAGE_874 is not set
 # CONFIG_NLS_ISO8859_8 is not set
-CONFIG_NLS_CODEPAGE_1250=y
-CONFIG_NLS_CODEPAGE_1251=y
+# CONFIG_NLS_CODEPAGE_1250 is not set
+CONFIG_NLS_CODEPAGE_1251=m
 # CONFIG_NLS_ASCII is not set
 CONFIG_NLS_ISO8859_1=y
 # CONFIG_NLS_ISO8859_2 is not set
diff -ruN -X X hnd-linux-trunk/arch/arm/configs/htcapache_static_defconfig hnd-cleanup/arch/arm/configs/htcapache_static_defconfig
--- hnd-linux-trunk/arch/arm/configs/htcapache_static_defconfig	2007-09-17 22:44:27.000000000 +0400
+++ hnd-cleanup/arch/arm/configs/htcapache_static_defconfig	2007-09-17 23:22:48.000000000 +0400
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.21-hh12
-# Tue Jul 17 20:51:12 2007
+# Linux kernel version: 2.6.21-hh15
+# Mon Sep 10 20:36:48 2007
 #
 CONFIG_ARM=y
 CONFIG_SYS_SUPPORTS_APM_EMULATION=y
@@ -166,8 +166,7 @@
 # CONFIG_MACH_MAGICIAN is not set
 CONFIG_MACH_HTCAPACHE=y
 # CONFIG_MACH_BLUEANGEL is not set
-# CONFIG_MACH_HTCBEETLES is not set
-# CONFIG_MACH_HW6900 is not set
+# CONFIG_HTC_HW6X00 is not set
 # CONFIG_MACH_HTCATHENA is not set
 # CONFIG_ARCH_AXIMX3 is not set
 # CONFIG_ARCH_AXIMX5 is not set
@@ -400,58 +399,16 @@
 #
 # CONFIG_NET_PKTGEN is not set
 # CONFIG_HAMRADIO is not set
-CONFIG_IRDA=y
-
-#
-# IrDA protocols
-#
-CONFIG_IRLAN=y
-CONFIG_IRCOMM=y
-CONFIG_IRDA_ULTRA=y
-
-#
-# IrDA options
-#
-CONFIG_IRDA_CACHE_LAST_LSAP=y
-CONFIG_IRDA_FAST_RR=y
-CONFIG_IRDA_DEBUG=y
-
-#
-# Infrared-port device drivers
-#
-
-#
-# SIR device drivers
-#
-CONFIG_IRTTY_SIR=y
-
-#
-# Dongle support
-#
-# CONFIG_DONGLE is not set
-
-#
-# Old SIR device drivers
-#
-# CONFIG_IRPORT_SIR is not set
-
-#
-# Old Serial dongle support
-#
-
-#
-# FIR device drivers
-#
-CONFIG_PXA_FICP=y
+# CONFIG_IRDA is not set
 CONFIG_BT=y
-CONFIG_BT_L2CAP=m
-CONFIG_BT_SCO=m
-CONFIG_BT_RFCOMM=m
+CONFIG_BT_L2CAP=y
+CONFIG_BT_SCO=y
+CONFIG_BT_RFCOMM=y
 CONFIG_BT_RFCOMM_TTY=y
-CONFIG_BT_BNEP=m
+CONFIG_BT_BNEP=y
 CONFIG_BT_BNEP_MC_FILTER=y
 CONFIG_BT_BNEP_PROTO_FILTER=y
-CONFIG_BT_HIDP=m
+CONFIG_BT_HIDP=y
 
 #
 # Bluetooth device drivers
@@ -485,21 +442,19 @@
 #
 # Memory Technology Devices (MTD)
 #
-CONFIG_MTD=y
+CONFIG_MTD=m
 CONFIG_MTD_DEBUG=y
 CONFIG_MTD_DEBUG_VERBOSE=0
-CONFIG_MTD_CONCAT=y
-CONFIG_MTD_PARTITIONS=y
-# CONFIG_MTD_REDBOOT_PARTS is not set
-# CONFIG_MTD_CMDLINE_PARTS is not set
-# CONFIG_MTD_AFS_PARTS is not set
+# CONFIG_MTD_CONCAT is not set
+# CONFIG_MTD_PARTITIONS is not set
 
 #
 # User Modules And Translation Layers
 #
-CONFIG_MTD_CHAR=y
-CONFIG_MTD_BLKDEVS=y
-CONFIG_MTD_BLOCK=y
+CONFIG_MTD_CHAR=m
+# CONFIG_MTD_BLKDEVS is not set
+# CONFIG_MTD_BLOCK is not set
+# CONFIG_MTD_BLOCK_RO is not set
 # CONFIG_FTL is not set
 # CONFIG_NFTL is not set
 # CONFIG_INFTL is not set
@@ -574,7 +529,8 @@
 # Block devices
 #
 # CONFIG_BLK_DEV_COW_COMMON is not set
-# CONFIG_BLK_DEV_LOOP is not set
+CONFIG_BLK_DEV_LOOP=m
+# CONFIG_BLK_DEV_CRYPTOLOOP is not set
 # CONFIG_BLK_DEV_NBD is not set
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_COUNT=4
@@ -706,6 +662,7 @@
 # CONFIG_KEYBOARD_NEWTON is not set
 # CONFIG_KEYBOARD_STOWAWAY is not set
 CONFIG_GPIODEV_KEYS=y
+# CONFIG_GPIODEV_KEYS2 is not set
 # CONFIG_GPIODEV_DIAGONAL is not set
 CONFIG_KEYBOARD_PXA27x=y
 CONFIG_KEYBOARD_GPIO=y
@@ -860,12 +817,24 @@
 CONFIG_ADC_AD7877=y
 
 #
+# Compaq/iPAQ Drivers
+#
+
+#
+# Compaq/HP iPAQ Drivers
+#
+# CONFIG_IPAQ_SLEEVE is not set
+# CONFIG_SLEEVE_DEBUG is not set
+
+#
 # Multifunction device drivers
 #
 # CONFIG_MFD_SM501 is not set
 # CONFIG_HTC_ASIC2 is not set
 # CONFIG_HTC_ASIC3 is not set
+# CONFIG_HTC_PASIC3 is not set
 CONFIG_HTC_EGPIO=y
+CONFIG_HTC_BBKEYS=y
 # CONFIG_HTC_ASIC3_DS1WM is not set
 # CONFIG_SOC_SAMCOP is not set
 # CONFIG_SOC_HAMCOP is not set
@@ -885,6 +854,7 @@
 #
 # LED drivers
 #
+CONFIG_LEDS_GPIO=y
 
 #
 # LED Triggers
@@ -892,6 +862,7 @@
 CONFIG_LEDS_TRIGGERS=y
 CONFIG_LEDS_TRIGGER_TIMER=y
 # CONFIG_LEDS_TRIGGER_HWTIMER is not set
+# CONFIG_LEDS_TRIGGER_BACKLIGHT is not set
 # CONFIG_LEDS_TRIGGER_HEARTBEAT is not set
 CONFIG_LEDS_TRIGGER_SHARED=y
 
@@ -1011,7 +982,7 @@
 #
 # HID Devices
 #
-CONFIG_HID=m
+CONFIG_HID=y
 # CONFIG_HID_DEBUG is not set
 
 #
@@ -1224,8 +1195,8 @@
 # CONFIG_NLS_CODEPAGE_949 is not set
 # CONFIG_NLS_CODEPAGE_874 is not set
 # CONFIG_NLS_ISO8859_8 is not set
-CONFIG_NLS_CODEPAGE_1250=y
-CONFIG_NLS_CODEPAGE_1251=y
+# CONFIG_NLS_CODEPAGE_1250 is not set
+CONFIG_NLS_CODEPAGE_1251=m
 # CONFIG_NLS_ASCII is not set
 CONFIG_NLS_ISO8859_1=y
 # CONFIG_NLS_ISO8859_2 is not set
diff -ruN -X X hnd-linux-trunk/arch/arm/configs/htcbeetles_static_defconfig hnd-cleanup/arch/arm/configs/htcbeetles_static_defconfig
--- hnd-linux-trunk/arch/arm/configs/htcbeetles_static_defconfig	2007-09-17 22:44:27.000000000 +0400
+++ hnd-cleanup/arch/arm/configs/htcbeetles_static_defconfig	2007-09-17 23:22:49.000000000 +0400
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.21-hh13
-# Thu Jul 26 03:30:38 2007
+# Linux kernel version: 2.6.21-hh15
+# Tue Sep 11 04:23:34 2007
 #
 CONFIG_ARM=y
 CONFIG_SYS_SUPPORTS_APM_EMULATION=y
@@ -166,9 +166,17 @@
 # CONFIG_MACH_MAGICIAN is not set
 # CONFIG_MACH_HTCAPACHE is not set
 # CONFIG_MACH_BLUEANGEL is not set
+
+#
+# HTC_HW6X00
+#
 CONFIG_MACH_HTCBEETLES=y
-# CONFIG_HTCBEETLES_TS is not set
 # CONFIG_MACH_HW6900 is not set
+# CONFIG_HTCSABLE_LCD is not set
+# CONFIG_HTCSABLE_BACKLIGHT is not set
+# CONFIG_HTCSABLE_ROM is not set
+# CONFIG_HTCSABLE_BT is not set
+# CONFIG_HTCSABLE_PHONE is not set
 # CONFIG_MACH_HTCATHENA is not set
 # CONFIG_ARCH_AXIMX3 is not set
 # CONFIG_ARCH_AXIMX5 is not set
@@ -613,9 +621,10 @@
 # CONFIG_KEYBOARD_NEWTON is not set
 # CONFIG_KEYBOARD_STOWAWAY is not set
 # CONFIG_GPIODEV_KEYS is not set
+# CONFIG_GPIODEV_KEYS2 is not set
 # CONFIG_GPIODEV_DIAGONAL is not set
 # CONFIG_KEYBOARD_ASIC3 is not set
-# CONFIG_KEYBOARD_PXA27x is not set
+CONFIG_KEYBOARD_PXA27x=y
 CONFIG_KEYBOARD_GPIO=y
 CONFIG_INPUT_MOUSE=y
 # CONFIG_MOUSE_PS2 is not set
@@ -733,6 +742,16 @@
 # CONFIG_ADC_AD7877 is not set
 
 #
+# Compaq/iPAQ Drivers
+#
+
+#
+# Compaq/HP iPAQ Drivers
+#
+# CONFIG_IPAQ_SLEEVE is not set
+# CONFIG_SLEEVE_DEBUG is not set
+
+#
 # Multifunction device drivers
 #
 # CONFIG_MFD_SM501 is not set
@@ -740,6 +759,7 @@
 CONFIG_HTC_ASIC3=y
 # CONFIG_HTC_PASIC3 is not set
 # CONFIG_HTC_EGPIO is not set
+# CONFIG_HTC_BBKEYS is not set
 # CONFIG_HTC_ASIC3_DS1WM is not set
 # CONFIG_SOC_SAMCOP is not set
 # CONFIG_SOC_HAMCOP is not set
@@ -760,6 +780,7 @@
 # LED drivers
 #
 # CONFIG_LEDS_ASIC3 is not set
+# CONFIG_LEDS_GPIO is not set
 
 #
 # LED Triggers
diff -ruN -X X hnd-linux-trunk/arch/arm/configs/htcblueangel_static_defconfig hnd-cleanup/arch/arm/configs/htcblueangel_static_defconfig
--- hnd-linux-trunk/arch/arm/configs/htcblueangel_static_defconfig	2007-09-17 22:44:27.000000000 +0400
+++ hnd-cleanup/arch/arm/configs/htcblueangel_static_defconfig	2007-09-17 23:22:49.000000000 +0400
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.21-hh12
-# Tue Jul 17 20:51:13 2007
+# Linux kernel version: 2.6.21-hh15
+# Mon Sep 10 20:36:49 2007
 #
 CONFIG_ARM=y
 CONFIG_SYS_SUPPORTS_APM_EMULATION=y
@@ -178,8 +178,7 @@
 CONFIG_MACH_BLUEANGEL_ROM=y
 CONFIG_MACH_BLUEANGEL_DPRAM=y
 CONFIG_MACH_BLUEANGEL_PHONE=m
-# CONFIG_MACH_HTCBEETLES is not set
-# CONFIG_MACH_HW6900 is not set
+# CONFIG_HTC_HW6X00 is not set
 # CONFIG_MACH_HTCATHENA is not set
 # CONFIG_ARCH_AXIMX3 is not set
 # CONFIG_ARCH_AXIMX5 is not set
@@ -421,58 +420,16 @@
 #
 # CONFIG_NET_PKTGEN is not set
 # CONFIG_HAMRADIO is not set
-CONFIG_IRDA=y
-
-#
-# IrDA protocols
-#
-CONFIG_IRLAN=y
-CONFIG_IRCOMM=y
-CONFIG_IRDA_ULTRA=y
-
-#
-# IrDA options
-#
-CONFIG_IRDA_CACHE_LAST_LSAP=y
-CONFIG_IRDA_FAST_RR=y
-CONFIG_IRDA_DEBUG=y
-
-#
-# Infrared-port device drivers
-#
-
-#
-# SIR device drivers
-#
-CONFIG_IRTTY_SIR=y
-
-#
-# Dongle support
-#
-# CONFIG_DONGLE is not set
-
-#
-# Old SIR device drivers
-#
-# CONFIG_IRPORT_SIR is not set
-
-#
-# Old Serial dongle support
-#
-
-#
-# FIR device drivers
-#
-CONFIG_PXA_FICP=y
+# CONFIG_IRDA is not set
 CONFIG_BT=y
-CONFIG_BT_L2CAP=m
-CONFIG_BT_SCO=m
-CONFIG_BT_RFCOMM=m
+CONFIG_BT_L2CAP=y
+CONFIG_BT_SCO=y
+CONFIG_BT_RFCOMM=y
 CONFIG_BT_RFCOMM_TTY=y
-CONFIG_BT_BNEP=m
+CONFIG_BT_BNEP=y
 CONFIG_BT_BNEP_MC_FILTER=y
 CONFIG_BT_BNEP_PROTO_FILTER=y
-CONFIG_BT_HIDP=m
+CONFIG_BT_HIDP=y
 
 #
 # Bluetooth device drivers
@@ -609,7 +566,8 @@
 # Block devices
 #
 # CONFIG_BLK_DEV_COW_COMMON is not set
-# CONFIG_BLK_DEV_LOOP is not set
+CONFIG_BLK_DEV_LOOP=m
+# CONFIG_BLK_DEV_CRYPTOLOOP is not set
 # CONFIG_BLK_DEV_NBD is not set
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_COUNT=4
@@ -766,6 +724,7 @@
 # CONFIG_KEYBOARD_NEWTON is not set
 # CONFIG_KEYBOARD_STOWAWAY is not set
 # CONFIG_GPIODEV_KEYS is not set
+# CONFIG_GPIODEV_KEYS2 is not set
 # CONFIG_GPIODEV_DIAGONAL is not set
 CONFIG_KEYBOARD_ASIC3=y
 CONFIG_KEYBOARD_TSC2200=y
@@ -948,12 +907,24 @@
 # CONFIG_ADC_AD7877 is not set
 
 #
+# Compaq/iPAQ Drivers
+#
+
+#
+# Compaq/HP iPAQ Drivers
+#
+# CONFIG_IPAQ_SLEEVE is not set
+# CONFIG_SLEEVE_DEBUG is not set
+
+#
 # Multifunction device drivers
 #
 # CONFIG_MFD_SM501 is not set
 # CONFIG_HTC_ASIC2 is not set
 CONFIG_HTC_ASIC3=y
+# CONFIG_HTC_PASIC3 is not set
 # CONFIG_HTC_EGPIO is not set
+# CONFIG_HTC_BBKEYS is not set
 # CONFIG_HTC_ASIC3_DS1WM is not set
 # CONFIG_SOC_SAMCOP is not set
 # CONFIG_SOC_HAMCOP is not set
@@ -974,6 +945,7 @@
 # LED drivers
 #
 CONFIG_LEDS_ASIC3=y
+# CONFIG_LEDS_GPIO is not set
 
 #
 # LED Triggers
@@ -981,6 +953,7 @@
 CONFIG_LEDS_TRIGGERS=y
 CONFIG_LEDS_TRIGGER_TIMER=y
 CONFIG_LEDS_TRIGGER_HWTIMER=y
+# CONFIG_LEDS_TRIGGER_BACKLIGHT is not set
 # CONFIG_LEDS_TRIGGER_HEARTBEAT is not set
 CONFIG_LEDS_TRIGGER_SHARED=y
 
@@ -1146,7 +1119,7 @@
 #
 # HID Devices
 #
-CONFIG_HID=m
+CONFIG_HID=y
 # CONFIG_HID_DEBUG is not set
 
 #
@@ -1377,8 +1350,8 @@
 # CONFIG_NLS_CODEPAGE_949 is not set
 # CONFIG_NLS_CODEPAGE_874 is not set
 # CONFIG_NLS_ISO8859_8 is not set
-CONFIG_NLS_CODEPAGE_1250=y
-CONFIG_NLS_CODEPAGE_1251=y
+# CONFIG_NLS_CODEPAGE_1250 is not set
+CONFIG_NLS_CODEPAGE_1251=m
 # CONFIG_NLS_ASCII is not set
 CONFIG_NLS_ISO8859_1=y
 # CONFIG_NLS_ISO8859_2 is not set
diff -ruN -X X hnd-linux-trunk/arch/arm/configs/htchimalaya_static_defconfig hnd-cleanup/arch/arm/configs/htchimalaya_static_defconfig
--- hnd-linux-trunk/arch/arm/configs/htchimalaya_static_defconfig	2007-09-17 22:44:27.000000000 +0400
+++ hnd-cleanup/arch/arm/configs/htchimalaya_static_defconfig	2007-09-17 23:22:48.000000000 +0400
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.21-hh13
-# Thu Jul 26 00:45:12 2007
+# Linux kernel version: 2.6.21-hh15
+# Mon Sep 10 20:36:49 2007
 #
 CONFIG_ARM=y
 CONFIG_SYS_SUPPORTS_APM_EMULATION=y
@@ -169,8 +169,7 @@
 # CONFIG_MACH_MAGICIAN is not set
 # CONFIG_MACH_HTCAPACHE is not set
 # CONFIG_MACH_BLUEANGEL is not set
-# CONFIG_MACH_HTCBEETLES is not set
-# CONFIG_MACH_HW6900 is not set
+# CONFIG_HTC_HW6X00 is not set
 # CONFIG_MACH_HTCATHENA is not set
 # CONFIG_ARCH_AXIMX3 is not set
 # CONFIG_ARCH_AXIMX5 is not set
@@ -615,6 +614,7 @@
 # CONFIG_KEYBOARD_NEWTON is not set
 # CONFIG_KEYBOARD_STOWAWAY is not set
 # CONFIG_GPIODEV_KEYS is not set
+# CONFIG_GPIODEV_KEYS2 is not set
 # CONFIG_GPIODEV_DIAGONAL is not set
 # CONFIG_KEYBOARD_ASIC3 is not set
 CONFIG_KEYBOARD_GPIO=y
@@ -734,6 +734,16 @@
 # CONFIG_ADC_AD7877 is not set
 
 #
+# Compaq/iPAQ Drivers
+#
+
+#
+# Compaq/HP iPAQ Drivers
+#
+# CONFIG_IPAQ_SLEEVE is not set
+# CONFIG_SLEEVE_DEBUG is not set
+
+#
 # Multifunction device drivers
 #
 # CONFIG_MFD_SM501 is not set
@@ -741,6 +751,7 @@
 CONFIG_HTC_ASIC3=y
 # CONFIG_HTC_PASIC3 is not set
 # CONFIG_HTC_EGPIO is not set
+# CONFIG_HTC_BBKEYS is not set
 # CONFIG_HTC_ASIC3_DS1WM is not set
 # CONFIG_SOC_SAMCOP is not set
 # CONFIG_SOC_HAMCOP is not set
@@ -761,6 +772,7 @@
 # LED drivers
 #
 # CONFIG_LEDS_ASIC3 is not set
+# CONFIG_LEDS_GPIO is not set
 
 #
 # LED Triggers
diff -ruN -X X hnd-linux-trunk/arch/arm/configs/htcsable_static_defconfig hnd-cleanup/arch/arm/configs/htcsable_static_defconfig
--- hnd-linux-trunk/arch/arm/configs/htcsable_static_defconfig	2007-09-17 22:44:27.000000000 +0400
+++ hnd-cleanup/arch/arm/configs/htcsable_static_defconfig	2007-09-17 23:22:48.000000000 +0400
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.21-hh12
-# Tue Jul 17 20:51:13 2007
+# Linux kernel version: 2.6.21-hh15
+# Tue Sep 11 04:23:35 2007
 #
 CONFIG_ARM=y
 CONFIG_SYS_SUPPORTS_APM_EMULATION=y
@@ -166,10 +166,17 @@
 # CONFIG_MACH_MAGICIAN is not set
 # CONFIG_MACH_HTCAPACHE is not set
 # CONFIG_MACH_BLUEANGEL is not set
+
+#
+# HTC_HW6X00
+#
 # CONFIG_MACH_HTCBEETLES is not set
 CONFIG_MACH_HW6900=y
 CONFIG_HTCSABLE_LCD=y
 CONFIG_HTCSABLE_BACKLIGHT=y
+# CONFIG_HTCSABLE_ROM is not set
+# CONFIG_HTCSABLE_BT is not set
+# CONFIG_HTCSABLE_PHONE is not set
 # CONFIG_MACH_HTCATHENA is not set
 # CONFIG_ARCH_AXIMX3 is not set
 # CONFIG_ARCH_AXIMX5 is not set
@@ -401,58 +408,16 @@
 #
 # CONFIG_NET_PKTGEN is not set
 # CONFIG_HAMRADIO is not set
-CONFIG_IRDA=y
-
-#
-# IrDA protocols
-#
-CONFIG_IRLAN=y
-CONFIG_IRCOMM=y
-CONFIG_IRDA_ULTRA=y
-
-#
-# IrDA options
-#
-CONFIG_IRDA_CACHE_LAST_LSAP=y
-CONFIG_IRDA_FAST_RR=y
-CONFIG_IRDA_DEBUG=y
-
-#
-# Infrared-port device drivers
-#
-
-#
-# SIR device drivers
-#
-CONFIG_IRTTY_SIR=y
-
-#
-# Dongle support
-#
-# CONFIG_DONGLE is not set
-
-#
-# Old SIR device drivers
-#
-# CONFIG_IRPORT_SIR is not set
-
-#
-# Old Serial dongle support
-#
-
-#
-# FIR device drivers
-#
-CONFIG_PXA_FICP=y
+# CONFIG_IRDA is not set
 CONFIG_BT=y
-CONFIG_BT_L2CAP=m
-CONFIG_BT_SCO=m
-CONFIG_BT_RFCOMM=m
+CONFIG_BT_L2CAP=y
+CONFIG_BT_SCO=y
+CONFIG_BT_RFCOMM=y
 CONFIG_BT_RFCOMM_TTY=y
-CONFIG_BT_BNEP=m
+CONFIG_BT_BNEP=y
 CONFIG_BT_BNEP_MC_FILTER=y
 CONFIG_BT_BNEP_PROTO_FILTER=y
-CONFIG_BT_HIDP=m
+CONFIG_BT_HIDP=y
 
 #
 # Bluetooth device drivers
@@ -486,21 +451,19 @@
 #
 # Memory Technology Devices (MTD)
 #
-CONFIG_MTD=y
+CONFIG_MTD=m
 CONFIG_MTD_DEBUG=y
 CONFIG_MTD_DEBUG_VERBOSE=0
-CONFIG_MTD_CONCAT=y
-CONFIG_MTD_PARTITIONS=y
-# CONFIG_MTD_REDBOOT_PARTS is not set
-# CONFIG_MTD_CMDLINE_PARTS is not set
-# CONFIG_MTD_AFS_PARTS is not set
+# CONFIG_MTD_CONCAT is not set
+# CONFIG_MTD_PARTITIONS is not set
 
 #
 # User Modules And Translation Layers
 #
-CONFIG_MTD_CHAR=y
-CONFIG_MTD_BLKDEVS=y
-CONFIG_MTD_BLOCK=y
+CONFIG_MTD_CHAR=m
+# CONFIG_MTD_BLKDEVS is not set
+# CONFIG_MTD_BLOCK is not set
+# CONFIG_MTD_BLOCK_RO is not set
 # CONFIG_FTL is not set
 # CONFIG_NFTL is not set
 # CONFIG_INFTL is not set
@@ -510,9 +473,9 @@
 #
 # RAM/ROM/Flash chip drivers
 #
-CONFIG_MTD_CFI=y
+CONFIG_MTD_CFI=m
 # CONFIG_MTD_JEDECPROBE is not set
-CONFIG_MTD_GEN_PROBE=y
+CONFIG_MTD_GEN_PROBE=m
 # CONFIG_MTD_CFI_ADV_OPTIONS is not set
 CONFIG_MTD_MAP_BANK_WIDTH_1=y
 CONFIG_MTD_MAP_BANK_WIDTH_2=y
@@ -583,7 +546,8 @@
 # Block devices
 #
 # CONFIG_BLK_DEV_COW_COMMON is not set
-# CONFIG_BLK_DEV_LOOP is not set
+CONFIG_BLK_DEV_LOOP=m
+# CONFIG_BLK_DEV_CRYPTOLOOP is not set
 # CONFIG_BLK_DEV_NBD is not set
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_COUNT=4
@@ -716,6 +680,7 @@
 # CONFIG_KEYBOARD_NEWTON is not set
 # CONFIG_KEYBOARD_STOWAWAY is not set
 # CONFIG_GPIODEV_KEYS is not set
+# CONFIG_GPIODEV_KEYS2 is not set
 # CONFIG_GPIODEV_DIAGONAL is not set
 # CONFIG_KEYBOARD_ASIC3 is not set
 CONFIG_KEYBOARD_PXA27x=y
@@ -871,12 +836,24 @@
 # CONFIG_ADC_AD7877 is not set
 
 #
+# Compaq/iPAQ Drivers
+#
+
+#
+# Compaq/HP iPAQ Drivers
+#
+# CONFIG_IPAQ_SLEEVE is not set
+# CONFIG_SLEEVE_DEBUG is not set
+
+#
 # Multifunction device drivers
 #
 # CONFIG_MFD_SM501 is not set
 # CONFIG_HTC_ASIC2 is not set
 CONFIG_HTC_ASIC3=y
+# CONFIG_HTC_PASIC3 is not set
 # CONFIG_HTC_EGPIO is not set
+# CONFIG_HTC_BBKEYS is not set
 # CONFIG_HTC_ASIC3_DS1WM is not set
 # CONFIG_SOC_SAMCOP is not set
 # CONFIG_SOC_HAMCOP is not set
@@ -897,6 +874,7 @@
 # LED drivers
 #
 # CONFIG_LEDS_ASIC3 is not set
+# CONFIG_LEDS_GPIO is not set
 
 #
 # LED Triggers
@@ -904,6 +882,7 @@
 CONFIG_LEDS_TRIGGERS=y
 CONFIG_LEDS_TRIGGER_TIMER=y
 # CONFIG_LEDS_TRIGGER_HWTIMER is not set
+# CONFIG_LEDS_TRIGGER_BACKLIGHT is not set
 # CONFIG_LEDS_TRIGGER_HEARTBEAT is not set
 CONFIG_LEDS_TRIGGER_SHARED=y
 
@@ -1023,7 +1002,7 @@
 #
 # HID Devices
 #
-CONFIG_HID=m
+CONFIG_HID=y
 # CONFIG_HID_DEBUG is not set
 
 #
@@ -1174,7 +1153,7 @@
 # CONFIG_BEFS_FS is not set
 # CONFIG_BFS_FS is not set
 # CONFIG_EFS_FS is not set
-CONFIG_JFFS2_FS=y
+CONFIG_JFFS2_FS=m
 CONFIG_JFFS2_FS_DEBUG=0
 CONFIG_JFFS2_FS_WRITEBUFFER=y
 # CONFIG_JFFS2_SUMMARY is not set
@@ -1248,8 +1227,8 @@
 # CONFIG_NLS_CODEPAGE_949 is not set
 # CONFIG_NLS_CODEPAGE_874 is not set
 # CONFIG_NLS_ISO8859_8 is not set
-CONFIG_NLS_CODEPAGE_1250=y
-CONFIG_NLS_CODEPAGE_1251=y
+# CONFIG_NLS_CODEPAGE_1250 is not set
+CONFIG_NLS_CODEPAGE_1251=m
 # CONFIG_NLS_ASCII is not set
 CONFIG_NLS_ISO8859_1=y
 # CONFIG_NLS_ISO8859_2 is not set
@@ -1332,8 +1311,8 @@
 # CONFIG_CRC16 is not set
 CONFIG_CRC32=y
 # CONFIG_LIBCRC32C is not set
-CONFIG_ZLIB_INFLATE=y
-CONFIG_ZLIB_DEFLATE=y
+CONFIG_ZLIB_INFLATE=m
+CONFIG_ZLIB_DEFLATE=m
 CONFIG_PLIST=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT=y
diff -ruN -X X hnd-linux-trunk/arch/arm/configs/htcuniversal_static_defconfig hnd-cleanup/arch/arm/configs/htcuniversal_static_defconfig
--- hnd-linux-trunk/arch/arm/configs/htcuniversal_static_defconfig	2007-09-17 22:44:27.000000000 +0400
+++ hnd-cleanup/arch/arm/configs/htcuniversal_static_defconfig	2007-09-17 23:22:49.000000000 +0400
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.21-hh12
-# Tue Jul 17 20:51:14 2007
+# Linux kernel version: 2.6.21-hh15
+# Mon Sep 10 20:36:51 2007
 #
 CONFIG_ARM=y
 CONFIG_SYS_SUPPORTS_APM_EMULATION=y
@@ -177,8 +177,7 @@
 # CONFIG_MACH_MAGICIAN is not set
 # CONFIG_MACH_HTCAPACHE is not set
 # CONFIG_MACH_BLUEANGEL is not set
-# CONFIG_MACH_HTCBEETLES is not set
-# CONFIG_MACH_HW6900 is not set
+# CONFIG_HTC_HW6X00 is not set
 # CONFIG_MACH_HTCATHENA is not set
 # CONFIG_ARCH_AXIMX3 is not set
 # CONFIG_ARCH_AXIMX5 is not set
@@ -410,58 +409,16 @@
 #
 # CONFIG_NET_PKTGEN is not set
 # CONFIG_HAMRADIO is not set
-CONFIG_IRDA=y
-
-#
-# IrDA protocols
-#
-CONFIG_IRLAN=y
-CONFIG_IRCOMM=y
-CONFIG_IRDA_ULTRA=y
-
-#
-# IrDA options
-#
-CONFIG_IRDA_CACHE_LAST_LSAP=y
-CONFIG_IRDA_FAST_RR=y
-CONFIG_IRDA_DEBUG=y
-
-#
-# Infrared-port device drivers
-#
-
-#
-# SIR device drivers
-#
-CONFIG_IRTTY_SIR=y
-
-#
-# Dongle support
-#
-# CONFIG_DONGLE is not set
-
-#
-# Old SIR device drivers
-#
-# CONFIG_IRPORT_SIR is not set
-
-#
-# Old Serial dongle support
-#
-
-#
-# FIR device drivers
-#
-CONFIG_PXA_FICP=y
+# CONFIG_IRDA is not set
 CONFIG_BT=y
-CONFIG_BT_L2CAP=m
-CONFIG_BT_SCO=m
-CONFIG_BT_RFCOMM=m
+CONFIG_BT_L2CAP=y
+CONFIG_BT_SCO=y
+CONFIG_BT_RFCOMM=y
 CONFIG_BT_RFCOMM_TTY=y
-CONFIG_BT_BNEP=m
+CONFIG_BT_BNEP=y
 CONFIG_BT_BNEP_MC_FILTER=y
 CONFIG_BT_BNEP_PROTO_FILTER=y
-CONFIG_BT_HIDP=m
+CONFIG_BT_HIDP=y
 
 #
 # Bluetooth device drivers
@@ -495,21 +452,19 @@
 #
 # Memory Technology Devices (MTD)
 #
-CONFIG_MTD=y
+CONFIG_MTD=m
 CONFIG_MTD_DEBUG=y
 CONFIG_MTD_DEBUG_VERBOSE=0
-CONFIG_MTD_CONCAT=y
-CONFIG_MTD_PARTITIONS=y
-# CONFIG_MTD_REDBOOT_PARTS is not set
-# CONFIG_MTD_CMDLINE_PARTS is not set
-# CONFIG_MTD_AFS_PARTS is not set
+# CONFIG_MTD_CONCAT is not set
+# CONFIG_MTD_PARTITIONS is not set
 
 #
 # User Modules And Translation Layers
 #
-CONFIG_MTD_CHAR=y
-CONFIG_MTD_BLKDEVS=y
-CONFIG_MTD_BLOCK=y
+CONFIG_MTD_CHAR=m
+# CONFIG_MTD_BLKDEVS is not set
+# CONFIG_MTD_BLOCK is not set
+# CONFIG_MTD_BLOCK_RO is not set
 # CONFIG_FTL is not set
 # CONFIG_NFTL is not set
 # CONFIG_INFTL is not set
@@ -584,7 +539,8 @@
 # Block devices
 #
 # CONFIG_BLK_DEV_COW_COMMON is not set
-# CONFIG_BLK_DEV_LOOP is not set
+CONFIG_BLK_DEV_LOOP=m
+# CONFIG_BLK_DEV_CRYPTOLOOP is not set
 # CONFIG_BLK_DEV_NBD is not set
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_COUNT=4
@@ -717,6 +673,7 @@
 # CONFIG_KEYBOARD_NEWTON is not set
 # CONFIG_KEYBOARD_STOWAWAY is not set
 # CONFIG_GPIODEV_KEYS is not set
+# CONFIG_GPIODEV_KEYS2 is not set
 # CONFIG_GPIODEV_DIAGONAL is not set
 CONFIG_KEYBOARD_ASIC3=y
 CONFIG_KEYBOARD_PXA27x=y
@@ -891,12 +848,24 @@
 # CONFIG_ADC_AD7877 is not set
 
 #
+# Compaq/iPAQ Drivers
+#
+
+#
+# Compaq/HP iPAQ Drivers
+#
+# CONFIG_IPAQ_SLEEVE is not set
+# CONFIG_SLEEVE_DEBUG is not set
+
+#
 # Multifunction device drivers
 #
 # CONFIG_MFD_SM501 is not set
 # CONFIG_HTC_ASIC2 is not set
 CONFIG_HTC_ASIC3=y
+# CONFIG_HTC_PASIC3 is not set
 # CONFIG_HTC_EGPIO is not set
+# CONFIG_HTC_BBKEYS is not set
 CONFIG_HTC_ASIC3_DS1WM=y
 # CONFIG_SOC_SAMCOP is not set
 # CONFIG_SOC_HAMCOP is not set
@@ -917,6 +886,7 @@
 # LED drivers
 #
 CONFIG_LEDS_ASIC3=y
+# CONFIG_LEDS_GPIO is not set
 
 #
 # LED Triggers
@@ -924,6 +894,7 @@
 CONFIG_LEDS_TRIGGERS=y
 CONFIG_LEDS_TRIGGER_TIMER=y
 CONFIG_LEDS_TRIGGER_HWTIMER=y
+# CONFIG_LEDS_TRIGGER_BACKLIGHT is not set
 # CONFIG_LEDS_TRIGGER_HEARTBEAT is not set
 CONFIG_LEDS_TRIGGER_SHARED=y
 
@@ -1042,7 +1013,7 @@
 #
 # HID Devices
 #
-CONFIG_HID=m
+CONFIG_HID=y
 # CONFIG_HID_DEBUG is not set
 
 #
@@ -1259,8 +1230,8 @@
 # CONFIG_NLS_CODEPAGE_949 is not set
 # CONFIG_NLS_CODEPAGE_874 is not set
 # CONFIG_NLS_ISO8859_8 is not set
-CONFIG_NLS_CODEPAGE_1250=y
-CONFIG_NLS_CODEPAGE_1251=y
+# CONFIG_NLS_CODEPAGE_1250 is not set
+CONFIG_NLS_CODEPAGE_1251=m
 # CONFIG_NLS_ASCII is not set
 CONFIG_NLS_ISO8859_1=y
 # CONFIG_NLS_ISO8859_2 is not set
diff -ruN -X X hnd-linux-trunk/arch/arm/configs/htcwallaby_static_defconfig hnd-cleanup/arch/arm/configs/htcwallaby_static_defconfig
--- hnd-linux-trunk/arch/arm/configs/htcwallaby_static_defconfig	2007-09-17 22:44:27.000000000 +0400
+++ hnd-cleanup/arch/arm/configs/htcwallaby_static_defconfig	2007-09-17 23:22:48.000000000 +0400
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.21-hh12
-# Tue Jul 17 20:51:14 2007
+# Linux kernel version: 2.6.21-hh15
+# Mon Sep 10 20:36:51 2007
 #
 CONFIG_ARM=y
 CONFIG_SYS_SUPPORTS_APM_EMULATION=y
@@ -380,64 +380,8 @@
 #
 # CONFIG_NET_PKTGEN is not set
 # CONFIG_HAMRADIO is not set
-CONFIG_IRDA=y
-
-#
-# IrDA protocols
-#
-CONFIG_IRLAN=y
-CONFIG_IRCOMM=y
-CONFIG_IRDA_ULTRA=y
-
-#
-# IrDA options
-#
-CONFIG_IRDA_CACHE_LAST_LSAP=y
-CONFIG_IRDA_FAST_RR=y
-CONFIG_IRDA_DEBUG=y
-
-#
-# Infrared-port device drivers
-#
-
-#
-# SIR device drivers
-#
-CONFIG_IRTTY_SIR=y
-
-#
-# Dongle support
-#
-# CONFIG_DONGLE is not set
-
-#
-# Old SIR device drivers
-#
-# CONFIG_IRPORT_SIR is not set
-
-#
-# Old Serial dongle support
-#
-
-#
-# FIR device drivers
-#
-# CONFIG_SA1100_FIR is not set
-CONFIG_BT=y
-CONFIG_BT_L2CAP=m
-CONFIG_BT_SCO=m
-CONFIG_BT_RFCOMM=m
-CONFIG_BT_RFCOMM_TTY=y
-CONFIG_BT_BNEP=m
-CONFIG_BT_BNEP_MC_FILTER=y
-CONFIG_BT_BNEP_PROTO_FILTER=y
-CONFIG_BT_HIDP=m
-
-#
-# Bluetooth device drivers
-#
-# CONFIG_BT_HCIUART is not set
-# CONFIG_BT_HCIVHCI is not set
+# CONFIG_IRDA is not set
+# CONFIG_BT is not set
 # CONFIG_IEEE80211 is not set
 
 #
@@ -462,21 +406,19 @@
 #
 # Memory Technology Devices (MTD)
 #
-CONFIG_MTD=y
+CONFIG_MTD=m
 CONFIG_MTD_DEBUG=y
 CONFIG_MTD_DEBUG_VERBOSE=0
-CONFIG_MTD_CONCAT=y
-CONFIG_MTD_PARTITIONS=y
-# CONFIG_MTD_REDBOOT_PARTS is not set
-# CONFIG_MTD_CMDLINE_PARTS is not set
-# CONFIG_MTD_AFS_PARTS is not set
+# CONFIG_MTD_CONCAT is not set
+# CONFIG_MTD_PARTITIONS is not set
 
 #
 # User Modules And Translation Layers
 #
-CONFIG_MTD_CHAR=y
-CONFIG_MTD_BLKDEVS=y
-CONFIG_MTD_BLOCK=y
+CONFIG_MTD_CHAR=m
+# CONFIG_MTD_BLKDEVS is not set
+# CONFIG_MTD_BLOCK is not set
+# CONFIG_MTD_BLOCK_RO is not set
 # CONFIG_FTL is not set
 # CONFIG_NFTL is not set
 # CONFIG_INFTL is not set
@@ -486,9 +428,9 @@
 #
 # RAM/ROM/Flash chip drivers
 #
-CONFIG_MTD_CFI=y
+CONFIG_MTD_CFI=m
 # CONFIG_MTD_JEDECPROBE is not set
-CONFIG_MTD_GEN_PROBE=y
+CONFIG_MTD_GEN_PROBE=m
 # CONFIG_MTD_CFI_ADV_OPTIONS is not set
 CONFIG_MTD_MAP_BANK_WIDTH_1=y
 CONFIG_MTD_MAP_BANK_WIDTH_2=y
@@ -514,7 +456,6 @@
 # CONFIG_MTD_COMPLEX_MAPPINGS is not set
 # CONFIG_MTD_PHYSMAP is not set
 # CONFIG_MTD_ARM_INTEGRATOR is not set
-CONFIG_MTD_SA1100=y
 # CONFIG_MTD_IPAQ is not set
 # CONFIG_MTD_PLATRAM is not set
 
@@ -560,7 +501,8 @@
 # Block devices
 #
 # CONFIG_BLK_DEV_COW_COMMON is not set
-# CONFIG_BLK_DEV_LOOP is not set
+CONFIG_BLK_DEV_LOOP=m
+# CONFIG_BLK_DEV_CRYPTOLOOP is not set
 # CONFIG_BLK_DEV_NBD is not set
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_COUNT=4
@@ -643,6 +585,7 @@
 # CONFIG_KEYBOARD_NEWTON is not set
 # CONFIG_KEYBOARD_STOWAWAY is not set
 # CONFIG_GPIODEV_KEYS is not set
+# CONFIG_GPIODEV_KEYS2 is not set
 # CONFIG_GPIODEV_DIAGONAL is not set
 CONFIG_KEYBOARD_GPIO=y
 CONFIG_INPUT_MOUSE=y
@@ -767,12 +710,24 @@
 # CONFIG_ADC_AD7877 is not set
 
 #
+# Compaq/iPAQ Drivers
+#
+
+#
+# Compaq/HP iPAQ Drivers
+#
+# CONFIG_IPAQ_SLEEVE is not set
+# CONFIG_SLEEVE_DEBUG is not set
+
+#
 # Multifunction device drivers
 #
 # CONFIG_MFD_SM501 is not set
 # CONFIG_HTC_ASIC2 is not set
 # CONFIG_HTC_ASIC3 is not set
+# CONFIG_HTC_PASIC3 is not set
 # CONFIG_HTC_EGPIO is not set
+# CONFIG_HTC_BBKEYS is not set
 # CONFIG_HTC_ASIC3_DS1WM is not set
 # CONFIG_SOC_SAMCOP is not set
 # CONFIG_SOC_HAMCOP is not set
@@ -795,6 +750,7 @@
 #
 # LED drivers
 #
+# CONFIG_LEDS_GPIO is not set
 
 #
 # LED Triggers
@@ -802,6 +758,7 @@
 CONFIG_LEDS_TRIGGERS=y
 CONFIG_LEDS_TRIGGER_TIMER=y
 CONFIG_LEDS_TRIGGER_HWTIMER=y
+# CONFIG_LEDS_TRIGGER_BACKLIGHT is not set
 # CONFIG_LEDS_TRIGGER_HEARTBEAT is not set
 CONFIG_LEDS_TRIGGER_SHARED=y
 
@@ -886,8 +843,7 @@
 #
 # HID Devices
 #
-CONFIG_HID=m
-# CONFIG_HID_DEBUG is not set
+# CONFIG_HID is not set
 
 #
 # USB support
@@ -1017,7 +973,7 @@
 # CONFIG_BEFS_FS is not set
 # CONFIG_BFS_FS is not set
 # CONFIG_EFS_FS is not set
-CONFIG_JFFS2_FS=y
+CONFIG_JFFS2_FS=m
 CONFIG_JFFS2_FS_DEBUG=0
 CONFIG_JFFS2_FS_WRITEBUFFER=y
 # CONFIG_JFFS2_SUMMARY is not set
@@ -1091,8 +1047,8 @@
 # CONFIG_NLS_CODEPAGE_949 is not set
 # CONFIG_NLS_CODEPAGE_874 is not set
 # CONFIG_NLS_ISO8859_8 is not set
-CONFIG_NLS_CODEPAGE_1250=y
-CONFIG_NLS_CODEPAGE_1251=y
+# CONFIG_NLS_CODEPAGE_1250 is not set
+CONFIG_NLS_CODEPAGE_1251=m
 # CONFIG_NLS_ASCII is not set
 CONFIG_NLS_ISO8859_1=y
 # CONFIG_NLS_ISO8859_2 is not set
@@ -1175,8 +1131,8 @@
 # CONFIG_CRC16 is not set
 CONFIG_CRC32=y
 # CONFIG_LIBCRC32C is not set
-CONFIG_ZLIB_INFLATE=y
-CONFIG_ZLIB_DEFLATE=y
+CONFIG_ZLIB_INFLATE=m
+CONFIG_ZLIB_DEFLATE=m
 CONFIG_PLIST=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_IOPORT=y
diff -ruN -X X hnd-linux-trunk/arch/arm/configs/hx4700_static_defconfig hnd-cleanup/arch/arm/configs/hx4700_static_defconfig
--- hnd-linux-trunk/arch/arm/configs/hx4700_static_defconfig	2007-09-17 22:44:27.000000000 +0400
+++ hnd-cleanup/arch/arm/configs/hx4700_static_defconfig	2007-09-17 23:22:48.000000000 +0400
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.21-hh13
-# Thu Jul 26 04:01:27 2007
+# Linux kernel version: 2.6.21-hh15
+# Mon Sep 10 20:36:46 2007
 #
 CONFIG_ARM=y
 CONFIG_SYS_SUPPORTS_APM_EMULATION=y
@@ -173,8 +173,7 @@
 # CONFIG_MACH_MAGICIAN is not set
 # CONFIG_MACH_HTCAPACHE is not set
 # CONFIG_MACH_BLUEANGEL is not set
-# CONFIG_MACH_HTCBEETLES is not set
-# CONFIG_MACH_HW6900 is not set
+# CONFIG_HTC_HW6X00 is not set
 # CONFIG_MACH_HTCATHENA is not set
 # CONFIG_ARCH_AXIMX3 is not set
 # CONFIG_ARCH_AXIMX5 is not set
@@ -800,6 +799,7 @@
 # CONFIG_KEYBOARD_NEWTON is not set
 # CONFIG_KEYBOARD_STOWAWAY is not set
 # CONFIG_GPIODEV_KEYS is not set
+# CONFIG_GPIODEV_KEYS2 is not set
 # CONFIG_GPIODEV_DIAGONAL is not set
 # CONFIG_KEYBOARD_ASIC3 is not set
 # CONFIG_KEYBOARD_PXA27x is not set
@@ -982,6 +982,16 @@
 # CONFIG_ADC_AD7877 is not set
 
 #
+# Compaq/iPAQ Drivers
+#
+
+#
+# Compaq/HP iPAQ Drivers
+#
+# CONFIG_IPAQ_SLEEVE is not set
+# CONFIG_SLEEVE_DEBUG is not set
+
+#
 # Multifunction device drivers
 #
 # CONFIG_MFD_SM501 is not set
@@ -989,6 +999,7 @@
 CONFIG_HTC_ASIC3=y
 # CONFIG_HTC_PASIC3 is not set
 # CONFIG_HTC_EGPIO is not set
+# CONFIG_HTC_BBKEYS is not set
 CONFIG_HTC_ASIC3_DS1WM=y
 # CONFIG_SOC_SAMCOP is not set
 # CONFIG_SOC_HAMCOP is not set
@@ -1009,6 +1020,7 @@
 # LED drivers
 #
 CONFIG_LEDS_ASIC3=y
+# CONFIG_LEDS_GPIO is not set
 
 #
 # LED Triggers
diff -ruN -X X hnd-linux-trunk/arch/arm/configs/looxc550_static_defconfig hnd-cleanup/arch/arm/configs/looxc550_static_defconfig
--- hnd-linux-trunk/arch/arm/configs/looxc550_static_defconfig	2007-09-17 22:44:27.000000000 +0400
+++ hnd-cleanup/arch/arm/configs/looxc550_static_defconfig	2007-09-17 23:22:48.000000000 +0400
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.21-hh12
-# Tue Jul 17 20:51:15 2007
+# Linux kernel version: 2.6.21-hh15
+# Mon Sep 10 20:36:52 2007
 #
 CONFIG_ARM=y
 CONFIG_SYS_SUPPORTS_APM_EMULATION=y
@@ -166,8 +166,7 @@
 # CONFIG_MACH_MAGICIAN is not set
 # CONFIG_MACH_HTCAPACHE is not set
 # CONFIG_MACH_BLUEANGEL is not set
-# CONFIG_MACH_HTCBEETLES is not set
-# CONFIG_MACH_HW6900 is not set
+# CONFIG_HTC_HW6X00 is not set
 # CONFIG_MACH_HTCATHENA is not set
 # CONFIG_ARCH_AXIMX3 is not set
 # CONFIG_ARCH_AXIMX5 is not set
@@ -398,58 +397,16 @@
 #
 # CONFIG_NET_PKTGEN is not set
 # CONFIG_HAMRADIO is not set
-CONFIG_IRDA=y
-
-#
-# IrDA protocols
-#
-CONFIG_IRLAN=y
-CONFIG_IRCOMM=y
-CONFIG_IRDA_ULTRA=y
-
-#
-# IrDA options
-#
-CONFIG_IRDA_CACHE_LAST_LSAP=y
-CONFIG_IRDA_FAST_RR=y
-CONFIG_IRDA_DEBUG=y
-
-#
-# Infrared-port device drivers
-#
-
-#
-# SIR device drivers
-#
-CONFIG_IRTTY_SIR=y
-
-#
-# Dongle support
-#
-# CONFIG_DONGLE is not set
-
-#
-# Old SIR device drivers
-#
-# CONFIG_IRPORT_SIR is not set
-
-#
-# Old Serial dongle support
-#
-
-#
-# FIR device drivers
-#
-CONFIG_PXA_FICP=y
+# CONFIG_IRDA is not set
 CONFIG_BT=y
-CONFIG_BT_L2CAP=m
-CONFIG_BT_SCO=m
-CONFIG_BT_RFCOMM=m
+CONFIG_BT_L2CAP=y
+CONFIG_BT_SCO=y
+CONFIG_BT_RFCOMM=y
 CONFIG_BT_RFCOMM_TTY=y
-CONFIG_BT_BNEP=m
+CONFIG_BT_BNEP=y
 CONFIG_BT_BNEP_MC_FILTER=y
 CONFIG_BT_BNEP_PROTO_FILTER=y
-CONFIG_BT_HIDP=m
+CONFIG_BT_HIDP=y
 
 #
 # Bluetooth device drivers
@@ -482,21 +439,19 @@
 #
 # Memory Technology Devices (MTD)
 #
-CONFIG_MTD=y
+CONFIG_MTD=m
 CONFIG_MTD_DEBUG=y
 CONFIG_MTD_DEBUG_VERBOSE=0
-CONFIG_MTD_CONCAT=y
-CONFIG_MTD_PARTITIONS=y
-# CONFIG_MTD_REDBOOT_PARTS is not set
-# CONFIG_MTD_CMDLINE_PARTS is not set
-# CONFIG_MTD_AFS_PARTS is not set
+# CONFIG_MTD_CONCAT is not set
+# CONFIG_MTD_PARTITIONS is not set
 
 #
 # User Modules And Translation Layers
 #
-CONFIG_MTD_CHAR=y
-CONFIG_MTD_BLKDEVS=y
-CONFIG_MTD_BLOCK=y
+CONFIG_MTD_CHAR=m
+# CONFIG_MTD_BLKDEVS is not set
+# CONFIG_MTD_BLOCK is not set
+# CONFIG_MTD_BLOCK_RO is not set
 # CONFIG_FTL is not set
 # CONFIG_NFTL is not set
 # CONFIG_INFTL is not set
@@ -571,7 +526,8 @@
 # Block devices
 #
 # CONFIG_BLK_DEV_COW_COMMON is not set
-# CONFIG_BLK_DEV_LOOP is not set
+CONFIG_BLK_DEV_LOOP=m
+# CONFIG_BLK_DEV_CRYPTOLOOP is not set
 # CONFIG_BLK_DEV_NBD is not set
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_COUNT=4
@@ -654,6 +610,7 @@
 # CONFIG_KEYBOARD_NEWTON is not set
 # CONFIG_KEYBOARD_STOWAWAY is not set
 # CONFIG_GPIODEV_KEYS is not set
+# CONFIG_GPIODEV_KEYS2 is not set
 # CONFIG_GPIODEV_DIAGONAL is not set
 # CONFIG_KEYBOARD_PXA27x is not set
 CONFIG_KEYBOARD_GPIO=y
@@ -778,12 +735,24 @@
 # CONFIG_ADC_AD7877 is not set
 
 #
+# Compaq/iPAQ Drivers
+#
+
+#
+# Compaq/HP iPAQ Drivers
+#
+# CONFIG_IPAQ_SLEEVE is not set
+# CONFIG_SLEEVE_DEBUG is not set
+
+#
 # Multifunction device drivers
 #
 # CONFIG_MFD_SM501 is not set
 # CONFIG_HTC_ASIC2 is not set
 # CONFIG_HTC_ASIC3 is not set
+# CONFIG_HTC_PASIC3 is not set
 # CONFIG_HTC_EGPIO is not set
+# CONFIG_HTC_BBKEYS is not set
 # CONFIG_HTC_ASIC3_DS1WM is not set
 # CONFIG_SOC_SAMCOP is not set
 # CONFIG_SOC_HAMCOP is not set
@@ -803,6 +772,7 @@
 #
 # LED drivers
 #
+# CONFIG_LEDS_GPIO is not set
 
 #
 # LED Triggers
@@ -810,6 +780,7 @@
 CONFIG_LEDS_TRIGGERS=y
 CONFIG_LEDS_TRIGGER_TIMER=y
 # CONFIG_LEDS_TRIGGER_HWTIMER is not set
+# CONFIG_LEDS_TRIGGER_BACKLIGHT is not set
 # CONFIG_LEDS_TRIGGER_HEARTBEAT is not set
 CONFIG_LEDS_TRIGGER_SHARED=y
 
@@ -895,7 +866,7 @@
 #
 # HID Devices
 #
-CONFIG_HID=m
+CONFIG_HID=y
 # CONFIG_HID_DEBUG is not set
 
 #
@@ -1102,8 +1073,8 @@
 # CONFIG_NLS_CODEPAGE_949 is not set
 # CONFIG_NLS_CODEPAGE_874 is not set
 # CONFIG_NLS_ISO8859_8 is not set
-CONFIG_NLS_CODEPAGE_1250=y
-CONFIG_NLS_CODEPAGE_1251=y
+# CONFIG_NLS_CODEPAGE_1250 is not set
+CONFIG_NLS_CODEPAGE_1251=m
 # CONFIG_NLS_ASCII is not set
 CONFIG_NLS_ISO8859_1=y
 # CONFIG_NLS_ISO8859_2 is not set
diff -ruN -X X hnd-linux-trunk/arch/arm/configs/magician_static_defconfig hnd-cleanup/arch/arm/configs/magician_static_defconfig
--- hnd-linux-trunk/arch/arm/configs/magician_static_defconfig	2007-09-17 22:44:27.000000000 +0400
+++ hnd-cleanup/arch/arm/configs/magician_static_defconfig	2007-09-17 23:22:48.000000000 +0400
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.21-hh12
-# Tue Jul 17 20:51:11 2007
+# Linux kernel version: 2.6.21-hh15
+# Mon Sep 10 20:36:47 2007
 #
 CONFIG_ARM=y
 CONFIG_SYS_SUPPORTS_APM_EMULATION=y
@@ -170,8 +170,7 @@
 CONFIG_MAGICIAN_PHONE=m
 # CONFIG_MACH_HTCAPACHE is not set
 # CONFIG_MACH_BLUEANGEL is not set
-# CONFIG_MACH_HTCBEETLES is not set
-# CONFIG_MACH_HW6900 is not set
+# CONFIG_HTC_HW6X00 is not set
 # CONFIG_MACH_HTCATHENA is not set
 # CONFIG_ARCH_AXIMX3 is not set
 # CONFIG_ARCH_AXIMX5 is not set
@@ -405,61 +404,16 @@
 #
 # CONFIG_NET_PKTGEN is not set
 # CONFIG_HAMRADIO is not set
-CONFIG_IRDA=y
-
-#
-# IrDA protocols
-#
-CONFIG_IRLAN=y
-CONFIG_IRCOMM=y
-CONFIG_IRDA_ULTRA=y
-
-#
-# IrDA options
-#
-CONFIG_IRDA_CACHE_LAST_LSAP=y
-CONFIG_IRDA_FAST_RR=y
-CONFIG_IRDA_DEBUG=y
-
-#
-# Infrared-port device drivers
-#
-
-#
-# SIR device drivers
-#
-CONFIG_IRTTY_SIR=y
-
-#
-# Dongle support
-#
-# CONFIG_DONGLE is not set
-
-#
-# Old SIR device drivers
-#
-# CONFIG_IRPORT_SIR is not set
-
-#
-# Old Serial dongle support
-#
-
-#
-# FIR device drivers
-#
-# CONFIG_USB_IRDA is not set
-# CONFIG_SIGMATEL_FIR is not set
-CONFIG_PXA_FICP=y
-# CONFIG_MCS_FIR is not set
+# CONFIG_IRDA is not set
 CONFIG_BT=y
-CONFIG_BT_L2CAP=m
-CONFIG_BT_SCO=m
-CONFIG_BT_RFCOMM=m
+CONFIG_BT_L2CAP=y
+CONFIG_BT_SCO=y
+CONFIG_BT_RFCOMM=y
 CONFIG_BT_RFCOMM_TTY=y
-CONFIG_BT_BNEP=m
+CONFIG_BT_BNEP=y
 CONFIG_BT_BNEP_MC_FILTER=y
 CONFIG_BT_BNEP_PROTO_FILTER=y
-CONFIG_BT_HIDP=m
+CONFIG_BT_HIDP=y
 
 #
 # Bluetooth device drivers
@@ -598,7 +552,8 @@
 # Block devices
 #
 # CONFIG_BLK_DEV_COW_COMMON is not set
-# CONFIG_BLK_DEV_LOOP is not set
+CONFIG_BLK_DEV_LOOP=m
+# CONFIG_BLK_DEV_CRYPTOLOOP is not set
 # CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_UB is not set
 CONFIG_BLK_DEV_RAM=y
@@ -682,6 +637,7 @@
 # CONFIG_KEYBOARD_NEWTON is not set
 # CONFIG_KEYBOARD_STOWAWAY is not set
 CONFIG_GPIODEV_KEYS=y
+# CONFIG_GPIODEV_KEYS2 is not set
 # CONFIG_GPIODEV_DIAGONAL is not set
 # CONFIG_KEYBOARD_PXA27x is not set
 CONFIG_KEYBOARD_GPIO=y
@@ -855,6 +811,16 @@
 # CONFIG_ADC_AD7877 is not set
 
 #
+# Compaq/iPAQ Drivers
+#
+
+#
+# Compaq/HP iPAQ Drivers
+#
+# CONFIG_IPAQ_SLEEVE is not set
+# CONFIG_SLEEVE_DEBUG is not set
+
+#
 # Multifunction device drivers
 #
 # CONFIG_MFD_SM501 is not set
@@ -862,6 +828,7 @@
 # CONFIG_HTC_ASIC3 is not set
 CONFIG_HTC_PASIC3=y
 CONFIG_HTC_EGPIO=y
+# CONFIG_HTC_BBKEYS is not set
 # CONFIG_HTC_ASIC3_DS1WM is not set
 # CONFIG_SOC_SAMCOP is not set
 # CONFIG_SOC_HAMCOP is not set
@@ -883,6 +850,7 @@
 #
 CONFIG_LEDS_MAGICIAN=y
 CONFIG_LEDS_PASIC3=y
+# CONFIG_LEDS_GPIO is not set
 
 #
 # LED Triggers
@@ -890,6 +858,7 @@
 CONFIG_LEDS_TRIGGERS=y
 CONFIG_LEDS_TRIGGER_TIMER=y
 CONFIG_LEDS_TRIGGER_HWTIMER=y
+# CONFIG_LEDS_TRIGGER_BACKLIGHT is not set
 # CONFIG_LEDS_TRIGGER_HEARTBEAT is not set
 CONFIG_LEDS_TRIGGER_SHARED=y
 
@@ -1381,8 +1350,8 @@
 # CONFIG_NLS_CODEPAGE_949 is not set
 # CONFIG_NLS_CODEPAGE_874 is not set
 # CONFIG_NLS_ISO8859_8 is not set
-CONFIG_NLS_CODEPAGE_1250=y
-CONFIG_NLS_CODEPAGE_1251=y
+# CONFIG_NLS_CODEPAGE_1250 is not set
+CONFIG_NLS_CODEPAGE_1251=m
 # CONFIG_NLS_ASCII is not set
 CONFIG_NLS_ISO8859_1=y
 # CONFIG_NLS_ISO8859_2 is not set
diff -ruN -X X hnd-linux-trunk/arch/arm/configs/rx1950_static_defconfig hnd-cleanup/arch/arm/configs/rx1950_static_defconfig
--- hnd-linux-trunk/arch/arm/configs/rx1950_static_defconfig	2007-09-17 22:44:27.000000000 +0400
+++ hnd-cleanup/arch/arm/configs/rx1950_static_defconfig	2007-09-17 23:22:49.000000000 +0400
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.21-hh12
-# Tue Jul 17 20:51:15 2007
+# Linux kernel version: 2.6.21-hh15
+# Mon Sep 10 20:36:52 2007
 #
 CONFIG_ARM=y
 CONFIG_SYS_SUPPORTS_APM_EMULATION=y
@@ -397,57 +397,16 @@
 #
 # CONFIG_NET_PKTGEN is not set
 # CONFIG_HAMRADIO is not set
-CONFIG_IRDA=y
-
-#
-# IrDA protocols
-#
-CONFIG_IRLAN=y
-CONFIG_IRCOMM=y
-CONFIG_IRDA_ULTRA=y
-
-#
-# IrDA options
-#
-CONFIG_IRDA_CACHE_LAST_LSAP=y
-CONFIG_IRDA_FAST_RR=y
-CONFIG_IRDA_DEBUG=y
-
-#
-# Infrared-port device drivers
-#
-
-#
-# SIR device drivers
-#
-CONFIG_IRTTY_SIR=y
-
-#
-# Dongle support
-#
-# CONFIG_DONGLE is not set
-
-#
-# Old SIR device drivers
-#
-# CONFIG_IRPORT_SIR is not set
-
-#
-# Old Serial dongle support
-#
-
-#
-# FIR device drivers
-#
+# CONFIG_IRDA is not set
 CONFIG_BT=y
-CONFIG_BT_L2CAP=m
-CONFIG_BT_SCO=m
-CONFIG_BT_RFCOMM=m
+CONFIG_BT_L2CAP=y
+CONFIG_BT_SCO=y
+CONFIG_BT_RFCOMM=y
 CONFIG_BT_RFCOMM_TTY=y
-CONFIG_BT_BNEP=m
+CONFIG_BT_BNEP=y
 CONFIG_BT_BNEP_MC_FILTER=y
 CONFIG_BT_BNEP_PROTO_FILTER=y
-CONFIG_BT_HIDP=m
+CONFIG_BT_HIDP=y
 
 #
 # Bluetooth device drivers
@@ -480,21 +439,19 @@
 #
 # Memory Technology Devices (MTD)
 #
-CONFIG_MTD=y
+CONFIG_MTD=m
 CONFIG_MTD_DEBUG=y
 CONFIG_MTD_DEBUG_VERBOSE=0
-CONFIG_MTD_CONCAT=y
-CONFIG_MTD_PARTITIONS=y
-# CONFIG_MTD_REDBOOT_PARTS is not set
-# CONFIG_MTD_CMDLINE_PARTS is not set
-# CONFIG_MTD_AFS_PARTS is not set
+# CONFIG_MTD_CONCAT is not set
+# CONFIG_MTD_PARTITIONS is not set
 
 #
 # User Modules And Translation Layers
 #
-CONFIG_MTD_CHAR=y
-CONFIG_MTD_BLKDEVS=y
-CONFIG_MTD_BLOCK=y
+CONFIG_MTD_CHAR=m
+# CONFIG_MTD_BLKDEVS is not set
+# CONFIG_MTD_BLOCK is not set
+# CONFIG_MTD_BLOCK_RO is not set
 # CONFIG_FTL is not set
 # CONFIG_NFTL is not set
 # CONFIG_INFTL is not set
@@ -547,16 +504,15 @@
 #
 # NAND Flash Device Drivers
 #
-CONFIG_MTD_NAND=y
+CONFIG_MTD_NAND=m
 # CONFIG_MTD_NAND_VERIFY_WRITE is not set
 # CONFIG_MTD_NAND_ECC_SMC is not set
-CONFIG_MTD_NAND_IDS=y
-CONFIG_MTD_NAND_S3C2410=y
+CONFIG_MTD_NAND_IDS=m
+CONFIG_MTD_NAND_S3C2410=m
 # CONFIG_MTD_NAND_S3C2410_DEBUG is not set
 # CONFIG_MTD_NAND_S3C2410_HWECC is not set
 # CONFIG_MTD_NAND_S3C2410_CLKSTOP is not set
 # CONFIG_MTD_NAND_DISKONCHIP is not set
-# CONFIG_MTD_NAND_NANDSIM is not set
 
 #
 # OneNAND Flash Device Drivers
@@ -577,7 +533,8 @@
 # Block devices
 #
 # CONFIG_BLK_DEV_COW_COMMON is not set
-# CONFIG_BLK_DEV_LOOP is not set
+CONFIG_BLK_DEV_LOOP=m
+# CONFIG_BLK_DEV_CRYPTOLOOP is not set
 # CONFIG_BLK_DEV_NBD is not set
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_COUNT=4
@@ -662,6 +619,7 @@
 # CONFIG_KEYBOARD_NEWTON is not set
 # CONFIG_KEYBOARD_STOWAWAY is not set
 # CONFIG_GPIODEV_KEYS is not set
+# CONFIG_GPIODEV_KEYS2 is not set
 # CONFIG_GPIODEV_DIAGONAL is not set
 CONFIG_KEYBOARD_GPIO=y
 CONFIG_INPUT_MOUSE=y
@@ -788,12 +746,24 @@
 # CONFIG_ADC_AD7877 is not set
 
 #
+# Compaq/iPAQ Drivers
+#
+
+#
+# Compaq/HP iPAQ Drivers
+#
+# CONFIG_IPAQ_SLEEVE is not set
+# CONFIG_SLEEVE_DEBUG is not set
+
+#
 # Multifunction device drivers
 #
 # CONFIG_MFD_SM501 is not set
 # CONFIG_HTC_ASIC2 is not set
 # CONFIG_HTC_ASIC3 is not set
+# CONFIG_HTC_PASIC3 is not set
 # CONFIG_HTC_EGPIO is not set
+# CONFIG_HTC_BBKEYS is not set
 # CONFIG_HTC_ASIC3_DS1WM is not set
 # CONFIG_SOC_SAMCOP is not set
 # CONFIG_SOC_HAMCOP is not set
@@ -812,6 +782,7 @@
 # LED drivers
 #
 CONFIG_LEDS_S3C24XX=y
+# CONFIG_LEDS_GPIO is not set
 
 #
 # LED Triggers
@@ -819,6 +790,7 @@
 CONFIG_LEDS_TRIGGERS=y
 CONFIG_LEDS_TRIGGER_TIMER=y
 # CONFIG_LEDS_TRIGGER_HWTIMER is not set
+# CONFIG_LEDS_TRIGGER_BACKLIGHT is not set
 # CONFIG_LEDS_TRIGGER_HEARTBEAT is not set
 CONFIG_LEDS_TRIGGER_SHARED=y
 
@@ -934,7 +906,7 @@
 #
 # HID Devices
 #
-CONFIG_HID=m
+CONFIG_HID=y
 # CONFIG_HID_DEBUG is not set
 
 #
@@ -1140,8 +1112,8 @@
 # CONFIG_NLS_CODEPAGE_949 is not set
 # CONFIG_NLS_CODEPAGE_874 is not set
 # CONFIG_NLS_ISO8859_8 is not set
-CONFIG_NLS_CODEPAGE_1250=y
-CONFIG_NLS_CODEPAGE_1251=y
+# CONFIG_NLS_CODEPAGE_1250 is not set
+CONFIG_NLS_CODEPAGE_1251=m
 # CONFIG_NLS_ASCII is not set
 CONFIG_NLS_ISO8859_1=y
 # CONFIG_NLS_ISO8859_2 is not set
diff -ruN -X X hnd-linux-trunk/arch/arm/configs/rx3000_static_defconfig hnd-cleanup/arch/arm/configs/rx3000_static_defconfig
--- hnd-linux-trunk/arch/arm/configs/rx3000_static_defconfig	2007-09-17 22:44:27.000000000 +0400
+++ hnd-cleanup/arch/arm/configs/rx3000_static_defconfig	2007-09-17 23:22:49.000000000 +0400
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.21-hh12
-# Tue Jul 17 20:51:16 2007
+# Linux kernel version: 2.6.21-hh15
+# Mon Sep 10 20:36:53 2007
 #
 CONFIG_ARM=y
 CONFIG_SYS_SUPPORTS_APM_EMULATION=y
@@ -404,57 +404,16 @@
 #
 # CONFIG_NET_PKTGEN is not set
 # CONFIG_HAMRADIO is not set
-CONFIG_IRDA=y
-
-#
-# IrDA protocols
-#
-CONFIG_IRLAN=y
-CONFIG_IRCOMM=y
-CONFIG_IRDA_ULTRA=y
-
-#
-# IrDA options
-#
-CONFIG_IRDA_CACHE_LAST_LSAP=y
-CONFIG_IRDA_FAST_RR=y
-CONFIG_IRDA_DEBUG=y
-
-#
-# Infrared-port device drivers
-#
-
-#
-# SIR device drivers
-#
-CONFIG_IRTTY_SIR=y
-
-#
-# Dongle support
-#
-# CONFIG_DONGLE is not set
-
-#
-# Old SIR device drivers
-#
-# CONFIG_IRPORT_SIR is not set
-
-#
-# Old Serial dongle support
-#
-
-#
-# FIR device drivers
-#
+# CONFIG_IRDA is not set
 CONFIG_BT=y
-CONFIG_BT_L2CAP=m
-CONFIG_BT_SCO=m
-CONFIG_BT_RFCOMM=m
+CONFIG_BT_L2CAP=y
+CONFIG_BT_SCO=y
+CONFIG_BT_RFCOMM=y
 CONFIG_BT_RFCOMM_TTY=y
-CONFIG_BT_BNEP=m
+CONFIG_BT_BNEP=y
 CONFIG_BT_BNEP_MC_FILTER=y
 CONFIG_BT_BNEP_PROTO_FILTER=y
-CONFIG_BT_HIDP=m
+CONFIG_BT_HIDP=y
 
 #
 # Bluetooth device drivers
@@ -585,7 +544,8 @@
 # Block devices
 #
 # CONFIG_BLK_DEV_COW_COMMON is not set
-# CONFIG_BLK_DEV_LOOP is not set
+CONFIG_BLK_DEV_LOOP=m
+# CONFIG_BLK_DEV_CRYPTOLOOP is not set
 # CONFIG_BLK_DEV_NBD is not set
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_COUNT=4
@@ -718,6 +678,7 @@
 # CONFIG_KEYBOARD_NEWTON is not set
 # CONFIG_KEYBOARD_STOWAWAY is not set
 # CONFIG_GPIODEV_KEYS is not set
+# CONFIG_GPIODEV_KEYS2 is not set
 # CONFIG_GPIODEV_DIAGONAL is not set
 CONFIG_KEYBOARD_ASIC3=y
 CONFIG_KEYBOARD_GPIO=y
@@ -893,12 +854,24 @@
 # CONFIG_ADC_AD7877 is not set
 
 #
+# Compaq/iPAQ Drivers
+#
+
+#
+# Compaq/HP iPAQ Drivers
+#
+# CONFIG_IPAQ_SLEEVE is not set
+# CONFIG_SLEEVE_DEBUG is not set
+
+#
 # Multifunction device drivers
 #
 # CONFIG_MFD_SM501 is not set
 # CONFIG_HTC_ASIC2 is not set
 CONFIG_HTC_ASIC3=y
+# CONFIG_HTC_PASIC3 is not set
 # CONFIG_HTC_EGPIO is not set
+# CONFIG_HTC_BBKEYS is not set
 CONFIG_HTC_ASIC3_DS1WM=y
 # CONFIG_SOC_SAMCOP is not set
 # CONFIG_SOC_HAMCOP is not set
@@ -918,6 +891,7 @@
 #
 # CONFIG_LEDS_S3C24XX is not set
 CONFIG_LEDS_ASIC3=y
+# CONFIG_LEDS_GPIO is not set
 
 #
 # LED Triggers
@@ -925,6 +899,7 @@
 CONFIG_LEDS_TRIGGERS=y
 CONFIG_LEDS_TRIGGER_TIMER=y
 # CONFIG_LEDS_TRIGGER_HWTIMER is not set
+# CONFIG_LEDS_TRIGGER_BACKLIGHT is not set
 # CONFIG_LEDS_TRIGGER_HEARTBEAT is not set
 CONFIG_LEDS_TRIGGER_SHARED=y
 
@@ -1080,7 +1055,7 @@
 #
 # HID Devices
 #
-CONFIG_HID=m
+CONFIG_HID=y
 # CONFIG_HID_DEBUG is not set
 
 #
@@ -1293,8 +1268,8 @@
 # CONFIG_NLS_CODEPAGE_949 is not set
 # CONFIG_NLS_CODEPAGE_874 is not set
 # CONFIG_NLS_ISO8859_8 is not set
-CONFIG_NLS_CODEPAGE_1250=y
-CONFIG_NLS_CODEPAGE_1251=y
+# CONFIG_NLS_CODEPAGE_1250 is not set
+CONFIG_NLS_CODEPAGE_1251=m
 # CONFIG_NLS_ASCII is not set
 CONFIG_NLS_ISO8859_1=y
 # CONFIG_NLS_ISO8859_2 is not set
diff -ruN -X X hnd-linux-trunk/arch/arm/Kconfig hnd-cleanup/arch/arm/Kconfig
--- hnd-linux-trunk/arch/arm/Kconfig	2007-09-17 22:44:34.000000000 +0400
+++ hnd-cleanup/arch/arm/Kconfig	2007-09-17 23:22:57.000000000 +0400
@@ -460,8 +460,6 @@
 	  Enable support for iWMMXt context switching at run time if
 	  running on a CPU that supports it.
 
-source arch/arm/armboot/Kconfig
-
 #  bool 'Use XScale PMU as timer source' CONFIG_XSCALE_PMU_TIMER
 config XSCALE_PMU
 	bool
diff -ruN -X X hnd-linux-trunk/arch/arm/mach-pxa/asus730/a730_flash.c hnd-cleanup/arch/arm/mach-pxa/asus730/a730_flash.c
--- hnd-linux-trunk/arch/arm/mach-pxa/asus730/a730_flash.c	2007-09-17 22:44:29.000000000 +0400
+++ hnd-cleanup/arch/arm/mach-pxa/asus730/a730_flash.c	2007-09-17 23:22:51.000000000 +0400
@@ -117,9 +117,8 @@
 static struct mtd_info *mtds_concat = NULL;
 static int mtds_found = 0;
 
-#ifdef CONFIG_MTD_PARTITIONS
 static const char *part_probes[] = {"cmdlinepart", "RedBoot", NULL};
-#endif
+
 static int mphysmap_map_device(struct map_info *map)
 {
         static const char *rom_probe_types[] = {"cfi_probe", "jedec_probe", "map_rom", NULL};
@@ -184,10 +183,9 @@
 static int a730_physmap_flash_probe(struct device *dev)
 {
 	int i;
-#ifdef CONFIG_MTD_PARTITIONS
 	struct mtd_partition* mtd_parts;
 	int mtd_parts_nb;
-#endif
+
 	for (i = 0; i < ARRAY_SIZE(mphysmap_static_maps); i++)
 	{
 		if (strcmp(mphysmap_static_maps[i].name, "") != 0 && mphysmap_static_maps[i].size != 0 && mphysmap_static_maps[i].bankwidth != 0)
diff -ruN -X X hnd-linux-trunk/arch/arm/mach-pxa/generic.c hnd-cleanup/arch/arm/mach-pxa/generic.c
--- hnd-linux-trunk/arch/arm/mach-pxa/generic.c	2007-09-17 22:44:32.000000000 +0400
+++ hnd-cleanup/arch/arm/mach-pxa/generic.c	2007-09-17 23:22:54.000000000 +0400
@@ -233,6 +233,21 @@
 
 #include <linux/gpiodev2.h>
 struct gpio_ops gpio_desc[16];
+
+int gpio_direction_input(unsigned gpio)
+{
+	if (gpio < GPIO_BASE_INCREMENT)
+		return pxa_gpio_mode(gpio | GPIO_IN);
+	return -EINVAL;
+}
+
+int gpio_direction_output(unsigned gpio)
+{
+	if (gpio < GPIO_BASE_INCREMENT)
+		return pxa_gpio_mode(gpio | GPIO_OUT);
+	return -EINVAL;
+}
+
 /*
  * Return GPIO level
  */
@@ -252,7 +267,8 @@
 {
 	if (gpio < GPIO_BASE_INCREMENT)
 		__gpio_set_value(gpio, value);
-	gpiodev2_set_value(gpio, value);
+	else
+		gpiodev2_set_value(gpio, value);
 }
 
 EXPORT_SYMBOL(pxa_gpio_set_value);
diff -ruN -X X hnd-linux-trunk/arch/arm/mach-pxa/h5400/h5400.c hnd-cleanup/arch/arm/mach-pxa/h5400/h5400.c
--- hnd-linux-trunk/arch/arm/mach-pxa/h5400/h5400.c	2007-09-17 22:44:28.000000000 +0400
+++ hnd-cleanup/arch/arm/mach-pxa/h5400/h5400.c	2007-09-17 23:22:49.000000000 +0400
@@ -38,8 +38,7 @@
 #include <linux/input_pda.h>
 #include <linux/adc.h>
 #include <linux/mfd/samcop_adc.h>
-#include <linux/gpiodev_keys.h>
-#include <linux/gpiodev_diagonal.h>
+#include <linux/gpiodev_keys2.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
 #include <linux/mtd/physmap.h>
@@ -508,7 +507,7 @@
 	GPIO_NR_H5400_IRDA_SD | GPIO_OUT,			/* GPIO58 */
 	59 | GPIO_OUT,						/* GPIO59 XXX docs say "usb charge on" input */
 	GPIO_NR_H5400_POWER_SD_N | GPIO_OUT,			/* GPIO60 XXX not really active low? */
-	GPIO_NR_H5400_POWER_RS232_N | GPIO_OUT | GPIO_DFLT_HIGH,
+	GPIO_NR_H5400_POWER_RS232_N_OR_FS | GPIO_OUT | GPIO_DFLT_HIGH,
 	GPIO_NR_H5400_POWER_ACCEL_N | GPIO_OUT | GPIO_DFLT_HIGH,
 	63 | GPIO_OUT,						/* GPIO63 NC */
 	GPIO_NR_H5400_OPT_NVRAM | GPIO_OUT ,
@@ -649,8 +648,8 @@
 		.gpacon2 = 0x5a,
 		.gpadat = 0x0,
 		.gpaup = 0x0,
-		.gpioint = { 0x66666666, 0x60006, 0x0, },
-		.gpioflt = { 0x3fff0000, 0x3fff3fff, 0x3fff, 0, 0, 0x3fff3fff, 0, },
+		.gpioint = { 0xeeeeeeee, 0x6766eeee, 0x0444444f, },
+		.gpioflt = { 0x3fff0001, 0x3fff3fff, 0x3fff3fff, 0x3fff3fff, 0x3fff3fff, 0x3fff3fff, 0x000f3fff, },
 		.gpioenint = { 0x3f, 0x7f, },
 	},
 	.child_devs = samcop_child_devs,
@@ -669,52 +668,68 @@
 };
 EXPORT_SYMBOL(h5400_samcop);
 
-static struct gpiodev_keys_button h5400_button_table[] = {
-	{ KEY_POWER,      { &pxagpio_device.dev, GPIO_NR_H5400_POWER_BUTTON }, 1, "Power button" },
-	{ _KEY_RECORD,    { &h5400_samcop.dev, SAMCOP_GPA_RECORD },	1, "Record button" },
-	{ _KEY_CALENDAR,  { &h5400_samcop.dev, SAMCOP_GPA_APPBTN1 },	1, "Calendar button" },
-	{ _KEY_CONTACTS,  { &h5400_samcop.dev, SAMCOP_GPA_APPBTN2 },	1, "Contacts button" },
-	{ _KEY_MAIL,      { &h5400_samcop.dev, SAMCOP_GPA_APPBTN3 },	1, "Mail button" },
-	{ _KEY_HOMEPAGE,  { &h5400_samcop.dev, SAMCOP_GPA_APPBTN4 },	1, "Homepage button" },
-	{ KEY_VOLUMEUP,	  { &h5400_samcop.dev, SAMCOP_GPA_TOGGLEUP },		1, "Volume up" },
-	{ KEY_VOLUMEDOWN, { &h5400_samcop.dev, SAMCOP_GPA_TOGGLEDOWN },		1, "Volume down" },
+static struct gpiodev_keys2_gpio h5000_gpiodev_keys2_gpios[] = {
+	{ "Power button",   	{ &pxagpio_device.dev, GPIO_NR_H5400_POWER_BUTTON }, 0, },
+	{ "Record button",  	{ &h5400_samcop.dev, SAMCOP_GPA_RECORD },	1, },
+	{ "Calendar button",	{ &h5400_samcop.dev, SAMCOP_GPA_APPBTN1 },	1, },
+	{ "Contacts button",	{ &h5400_samcop.dev, SAMCOP_GPA_APPBTN2 },	1, },
+	{ "Mail button",    	{ &h5400_samcop.dev, SAMCOP_GPA_APPBTN3 },	1, },
+	{ "Homepage button",	{ &h5400_samcop.dev, SAMCOP_GPA_APPBTN4 },	1, },
+	{ "Volume up",	    	{ &h5400_samcop.dev, SAMCOP_GPA_TOGGLEUP },	1, },
+	{ "Volume down",    	{ &h5400_samcop.dev, SAMCOP_GPA_TOGGLEDOWN },	1, },
+	{ "Joypad NW",      	{ &h5400_samcop.dev, SAMCOP_GPA_JOYSTICK1 }, 1, },
+	{ "Joypad NE",      	{ &h5400_samcop.dev, SAMCOP_GPA_JOYSTICK2 }, 1, },
+	{ "Joypad SE",      	{ &h5400_samcop.dev, SAMCOP_GPA_JOYSTICK3 }, 1, },
+	{ "Joypad SW",      	{ &h5400_samcop.dev, SAMCOP_GPA_JOYSTICK4 }, 1, },
+	{ "Joypad action", 	{ &h5400_samcop.dev, SAMCOP_GPA_JOYSTICK5 }, 1, },
+};
+
+static struct gpiodev_keys2_button h5000_gpiodev_keys2_buttons[] = {
+	{ KEY_POWER,      	{ "Power button", NULL }, 0, 0, },
+	{ _KEY_CALENDAR,	{ "Calendar button", NULL }, 0, 0, },
+	{ _KEY_CONTACTS,	{ "Contacts button", NULL }, 0, 0, },
+	{ _KEY_MAIL,    	{ "Mail button", NULL }, 0, 0, },
+	{ _KEY_HOMEPAGE,	{ "Homepage button", NULL }, 0, 0, },
+	/* Side buttons */
+	{ _KEY_RECORD,  	{ "Record button", "Volume up", "Volume down", NULL }, 75, 1, },
+	{ KEY_VOLUMEUP, 	{ "Volume up", NULL }, 75, 0, },
+	{ KEY_VOLUMEDOWN,	{ "Volume down", "Record button", NULL }, 75, 0, },
+	/* Diagonal joypad */
+	{ KEY_ENTER,     	{ "Joypad action", NULL }, 0, 0},
+	/* One diagonal pressed */
+	/* NE */
+	{ KEY_UP,       	{ "Joypad NE", "Joypad action", NULL}, 0, 1},
+	{ KEY_RIGHT,       	{ "Joypad NE", "Joypad action", NULL}, 0, 1},
+	/* NW */
+	{ KEY_UP,       	{ "Joypad NW", "Joypad action", NULL}, 0, 1},
+	{ KEY_LEFT,       	{ "Joypad NW", "Joypad action", NULL}, 0, 1},
+	/* SE */
+	{ KEY_DOWN,       	{ "Joypad SE", "Joypad action", NULL}, 0, 1},
+	{ KEY_RIGHT,       	{ "Joypad SE", "Joypad action", NULL}, 0, 1},
+	/* SW */
+	{ KEY_DOWN,       	{ "Joypad SW", "Joypad action", NULL}, 0, 1},
+	{ KEY_LEFT,       	{ "Joypad SW", "Joypad action", NULL}, 0, 1},
+	/* Two diagonals pressed */
+	{ KEY_UP,        	{ "Joypad NE", "Joypad NW", "Joypad action", NULL }, 0, 2},
+	{ KEY_LEFT,        	{ "Joypad NW", "Joypad SW", "Joypad action", NULL }, 0, 2},
+	{ KEY_DOWN,        	{ "Joypad SW", "Joypad SE", "Joypad action", NULL }, 0, 2},
+	{ KEY_RIGHT,        	{ "Joypad SE", "Joypad NE", "Joypad action", NULL }, 0, 2},
+};
+
+static struct gpiodev_keys2_platform_data h5000_gpiodev_keys2_platform_data = {
+	.gpios  =  	h5000_gpiodev_keys2_gpios,
+	.ngpios =  	ARRAY_SIZE(h5000_gpiodev_keys2_gpios),
+	.buttons = 	h5000_gpiodev_keys2_buttons,
+	.nbuttons = 	ARRAY_SIZE(h5000_gpiodev_keys2_buttons),
 };
 
-
-static struct gpiodev_keys_platform_data h5400_pxa_keys_data = {
-	.buttons = h5400_button_table,
-	.nbuttons = ARRAY_SIZE(h5400_button_table),
-};
-
-static struct platform_device h5400_pxa_keys = {
-	.name = "gpiodev-keys",
-	.dev = {
-		.platform_data = &h5400_pxa_keys_data,
-	},
-};
-
-static struct gpiodev_diagonal_button h5400_joypad_table[] = {
-	{ { &h5400_samcop.dev, SAMCOP_GPA_JOYSTICK1 }, 1, GPIODEV_DIAG_LEFT | GPIODEV_DIAG_UP, "Joypad left-up" },
-	{ { &h5400_samcop.dev, SAMCOP_GPA_JOYSTICK2 }, 1, GPIODEV_DIAG_RIGHT | GPIODEV_DIAG_UP, "Joypad right-up" },
-	{ { &h5400_samcop.dev, SAMCOP_GPA_JOYSTICK3 }, 1, GPIODEV_DIAG_RIGHT | GPIODEV_DIAG_DOWN, "Joypad right-down" },
-	{ { &h5400_samcop.dev, SAMCOP_GPA_JOYSTICK4 }, 1, GPIODEV_DIAG_LEFT | GPIODEV_DIAG_DOWN, "Joypad left-down" },
-	{ { &h5400_samcop.dev, SAMCOP_GPA_JOYSTICK5 }, 1, GPIODEV_DIAG_ACTION, "Joypad action" },
-};
-
-static struct gpiodev_diagonal_platform_data h5400_pxa_joypad_data = {
-	.buttons = h5400_joypad_table,
-	.nbuttons = ARRAY_SIZE(h5400_joypad_table),
-	.dir_disables_enter = 1,
-};
-
-static struct platform_device h5400_pxa_joypad = {
-	.name = "gpiodev-diagonal",
+static struct platform_device h5000_gpiodev_keys2 = {
+	.name = "gpiodev-keys2",
 	.dev = {
-		.platform_data = &h5400_pxa_joypad_data,
+		.platform_data = &h5000_gpiodev_keys2_platform_data,
 	},
 };
 
-
 static void __init
 h5400_init (void)
 {
@@ -723,8 +738,7 @@
 	platform_device_register (&h5000_flash[0]);
 	platform_device_register (&h5000_flash[1]);
 	platform_device_register (&h5400_samcop);
-	platform_device_register (&h5400_pxa_keys);
-	platform_device_register (&h5400_pxa_joypad);
+	platform_device_register (&h5000_gpiodev_keys2);
 	pxa_set_udc_info (&h5400_udc_mach_info);
 	pxa_set_dma_needs_bounce (h5400_dma_needs_bounce);
 }
diff -ruN -X X hnd-linux-trunk/arch/arm/mach-pxa/htcapache/htcapache.c hnd-cleanup/arch/arm/mach-pxa/htcapache/htcapache.c
--- hnd-linux-trunk/arch/arm/mach-pxa/htcapache/htcapache.c	2007-09-17 22:44:28.000000000 +0400
+++ hnd-cleanup/arch/arm/mach-pxa/htcapache/htcapache.c	2007-09-17 23:22:50.000000000 +0400
@@ -8,34 +8,32 @@
  */
 
 #include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/device.h>
-#include <linux/fb.h>
-#include <linux/platform_device.h>
 #include <linux/delay.h> // mdelay
-#include <linux/input.h>
-#include <linux/ad7877.h>
-#include <linux/touchscreen-adc.h>
-#include <linux/gpio_keys.h>
-#include <linux/adc_battery.h>
-#include <linux/pda_power.h>
-#include <linux/mfd/htc-egpio.h>
-
-#include <asm/mach-types.h>
-#include <asm/mach/arch.h>
-
-#include <asm/arch/hardware.h>
-#include <asm/arch/pxafb.h>
-#include <asm/arch/pxa-regs.h>
-#include <asm/arch/udc.h>
-#include <asm/arch/htcapache-gpio.h>
-#include <asm/arch/mmc.h>
-#include <asm/arch/serial.h>
-#include <asm/arch/pxa27x_keyboard.h>
+#include <linux/input.h> // KEY_*
+#include <linux/ad7877.h> // struct ad7877_data
+#include <linux/touchscreen-adc.h> // struct tsadc
+#include <linux/gpio_keys.h> // struct gpio_keys_button
+#include <linux/adc_battery.h> // struct battery_info
+#include <linux/pda_power.h> // struct pda_power_pdata
+#include <linux/mfd/htc-egpio.h> // struct htc_egpio_platform_data
+#include <linux/mfd/htc-bbkeys.h> // struct htc_bbkeys_platform_data
+#include <linux/leds.h> // struct gpio_led
+#include <linux/platform_device.h> // struct platform_device
+
+#include <asm/gpio.h> // gpio_set_value
+#include <asm/mach-types.h> // MACH_TYPE_HTCAPACHE
+#include <asm/mach/arch.h> // MACHINE_START
+
+#include <asm/arch/pxafb.h> // struct pxafb_mach_info
+#include <asm/arch/udc.h> // PXA2XX_UDC_CMD_DISCONNECT
+#include <asm/arch/htcapache-gpio.h> // GPIO_NR_HTCAPACHE_*
+#include <asm/arch/mmc.h> // MMC_VDD_32_33
+#include <asm/arch/serial.h> // PXA_UART_CFG_POST_STARTUP
+#include <asm/arch/pxa27x_keyboard.h> // struct pxa27x_keyboard_platform_data
 #include <asm/arch/irda.h> // struct pxaficp_platform_data
 
-#include "../generic.h"
-#include "../../../../drivers/net/wireless/acx/acx_hw.h"
+#include "../generic.h" // pxa_map_io
+#include "../../../../drivers/net/wireless/acx/acx_hw.h" // acx_hardware_data
 
 
 /****************************************************************
@@ -60,20 +58,20 @@
 
 struct htc_egpio_pinInfo pins[] = {
 	// Input pins with IRQs
-	{.pin_nr = EGPIO_NR_HTCAPACHE_PWR_IN_PWR
+	{.gpio = EGPIO_NR_HTCAPACHE_PWR_IN_PWR
 	 , .type = HTC_EGPIO_TYPE_INPUT
 	 , .input_irq = EGPIO_NR_HTCAPACHE_PWR_IN_PWR+8},
-	{.pin_nr = EGPIO_NR_HTCAPACHE_PWR_IN_HIGHPWR
+	{.gpio = EGPIO_NR_HTCAPACHE_PWR_IN_HIGHPWR
 	 , .type = HTC_EGPIO_TYPE_INPUT
 	 , .input_irq = EGPIO_NR_HTCAPACHE_PWR_IN_HIGHPWR+8},
-	{.pin_nr = EGPIO_NR_HTCAPACHE_SND_IN_JACK
+	{.gpio = EGPIO_NR_HTCAPACHE_SND_IN_JACK
 	 , .type = HTC_EGPIO_TYPE_INPUT
 	 , .input_irq = EGPIO_NR_HTCAPACHE_SND_IN_JACK+8},
-	{.pin_nr = EGPIO_NR_HTCAPACHE_WIFI_IN_IRQ
+	{.gpio = EGPIO_NR_HTCAPACHE_WIFI_IN_IRQ
 	 , .type = HTC_EGPIO_TYPE_INPUT
 	 , .input_irq = EGPIO_NR_HTCAPACHE_WIFI_IN_IRQ+8},
 	// Output pins that default on
-	{.pin_nr = EGPIO_NR_HTCAPACHE_PWR_CHARGE
+	{.gpio = EGPIO_NR_HTCAPACHE_PWR_CHARGE
 	 , .type = HTC_EGPIO_TYPE_OUTPUT
 	 , .output_initial = 1},  // Disable charger
 };
@@ -81,7 +79,7 @@
 struct htc_egpio_platform_data egpio_data = {
 	.invertAcks = 1,
 	.irq_base = IRQ_BOARD_START,
-	.gpio_base = GPIO_BASE_INCREMENT,
+	.gpio_base = HTCAPACHE_EGPIO_BASE,
 	.nrRegs = 3,
 	.pins = pins,
 	.nr_pins = ARRAY_SIZE(pins),
@@ -98,53 +96,87 @@
 };
 
 // Compatibility wrappers
-#define IRQ_EGPIO(x)   (IRQ_BOARD_START + (x) + 8)
-int htcapache_egpio_get(int bit) {
-	return egpio_data.ops.get(&egpio.dev, bit);
-}
-EXPORT_SYMBOL(htcapache_egpio_get);
-void htcapache_egpio_set(int bit, int value) {
-	egpio_data.ops.set(&egpio.dev, bit, value);
-}
-EXPORT_SYMBOL(htcapache_egpio_set);
-int htcapache_egpio_to_irq(int bit) {
-	return egpio_data.ops.to_irq(&egpio.dev, bit);
-}
-EXPORT_SYMBOL(htcapache_egpio_to_irq);
+#define IRQ_EGPIO(x)   (IRQ_BOARD_START + (x) - HTCAPACHE_EGPIO_BASE + 8)
 
 
 /****************************************************************
- * LCD power
+ * Front keypad
+ ****************************************************************/
+
+#define HTCAPACHE_BBKEYS_BASE (HTCAPACHE_EGPIO_BASE + GPIO_BASE_INCREMENT)
+#define BBKEYS_GPIO(reg,bit) (HTCAPACHE_BBKEYS_BASE + 8*(reg) + (bit))
+
+static struct resource bbkeys_resources[] = {
+	[0] = {
+		.start  = IRQ_GPIO(GPIO_NR_HTCAPACHE_MC_IRQ),
+		.end    = IRQ_GPIO(GPIO_NR_HTCAPACHE_MC_IRQ),
+		.flags  = IORESOURCE_IRQ,
+	},
+};
+
+static struct htc_bbkeys_platform_data bbkeys_data = {
+	.sda_gpio = GPIO_NR_HTCAPACHE_MC_SDA,
+	.scl_gpio = GPIO_NR_HTCAPACHE_MC_SCL,
+	.gpio_base = HTCAPACHE_BBKEYS_BASE,
+
+	.ackreg = 3,
+	.key1reg = 4,
+	.key2reg = 5,
+	.buttons = {
+		-1, -1, -1,
+		KEY_ENTER,     // Joystick press
+		KEY_DOWN,      // Joystick down
+		KEY_LEFT,      // Joystick left
+		KEY_UP,        // Joystick up
+		KEY_RIGHT,     // Joystick right
+		-1, -1,
+		KEY_LEFTMETA,  // Windows key
+		KEY_OK,        // Ok
+		KEY_RIGHTCTRL, // Right menu
+		KEY_ESC,       // Hangup
+		KEY_LEFTCTRL,  // Left menu
+		KEY_PHONE,     // Call button
+	}
+};
+
+static struct platform_device bbkeys = {
+	.name   = "htc-bbkeys",
+	.id     = -1,
+	.resource = bbkeys_resources,
+	.num_resources = ARRAY_SIZE(bbkeys_resources),
+	.dev	=  {
+		.platform_data	= &bbkeys_data,
+	},
+};
+
+
+/****************************************************************
+ * LCD
  ****************************************************************/
 
 static void lcd_power(int on, struct fb_var_screeninfo *si)
 {
 	if (on) {
 		printk(KERN_DEBUG "lcd power on\n");
-		htcapache_write_mc_reg(0, 0x40);
+		gpio_set_value(BBKEYS_GPIO(0, 6), 1);
 		udelay(2000);
-		htcapache_write_mc_reg(0, 0xc0);
+		gpio_set_value(BBKEYS_GPIO(0, 7), 1);
 		udelay(2000);
-		htcapache_write_mc_reg(0, 0xd0);
+		gpio_set_value(BBKEYS_GPIO(0, 4), 1);
 		udelay(2000);
-		htcapache_write_mc_reg(0, 0xf0);
+		gpio_set_value(BBKEYS_GPIO(0, 5), 1);
 	} else {
 		printk(KERN_DEBUG "lcd power off\n");
-		htcapache_write_mc_reg(0, 0xd0);
+		gpio_set_value(BBKEYS_GPIO(0, 5), 0);
 		udelay(2000);
-		htcapache_write_mc_reg(0, 0xc0);
+		gpio_set_value(BBKEYS_GPIO(0, 4), 0);
 		udelay(2000);
-		htcapache_write_mc_reg(0, 0x40);
+		gpio_set_value(BBKEYS_GPIO(0, 7), 0);
 		udelay(2000);
-		htcapache_write_mc_reg(0, 0x00);
+		gpio_set_value(BBKEYS_GPIO(0, 6), 0);
 	}
 }
 
-
-/****************************************************************
- * Frame buffer
- ****************************************************************/
-
 static struct pxafb_mode_info lcd_mode = {
 	.pixclock		= 192307,
 	.xres			= 240,
@@ -220,8 +252,8 @@
 
 static void set_charge(int flags)
 {
-	htcapache_egpio_set(EGPIO_NR_HTCAPACHE_USB_PWR
-			    , flags == PDA_POWER_CHARGE_USB);
+	gpio_set_value(EGPIO_NR_HTCAPACHE_USB_PWR
+		       , flags == PDA_POWER_CHARGE_USB);
 
 	// XXX - enable/disable battery charger once charge complete
 	// detection available.
@@ -229,15 +261,15 @@
 
 static int ac_on(void)
 {
-	int haspower = !htcapache_egpio_get(EGPIO_NR_HTCAPACHE_PWR_IN_PWR);
-	int hashigh = !htcapache_egpio_get(EGPIO_NR_HTCAPACHE_PWR_IN_HIGHPWR);
+	int haspower = !gpio_get_value(EGPIO_NR_HTCAPACHE_PWR_IN_PWR);
+	int hashigh = !gpio_get_value(EGPIO_NR_HTCAPACHE_PWR_IN_HIGHPWR);
 	return haspower && hashigh;
 }
 
 static int usb_on(void)
 {
-	int haspower = !htcapache_egpio_get(EGPIO_NR_HTCAPACHE_PWR_IN_PWR);
-	int hashigh = !htcapache_egpio_get(EGPIO_NR_HTCAPACHE_PWR_IN_HIGHPWR);
+	int haspower = !gpio_get_value(EGPIO_NR_HTCAPACHE_PWR_IN_PWR);
+	int hashigh = !gpio_get_value(EGPIO_NR_HTCAPACHE_PWR_IN_HIGHPWR);
 	return haspower && !hashigh;
 }
 
@@ -301,8 +333,33 @@
  * LEDS
  ****************************************************************/
 
+struct gpio_led apache_leds[] = {
+	{ .name = "apache:vibra", .gpio = EGPIO_NR_HTCAPACHE_LED_VIBRA },
+	{ .name = "apache:kbd_bl",
+	  .gpio = EGPIO_NR_HTCAPACHE_LED_KBD_BACKLIGHT },
+	{ .name = "apache:flashlight",
+	  .gpio = GPIO_NR_HTCAPACHE_LED_FLASHLIGHT },
+	{ .name = "apache:phone_bl", .gpio = BBKEYS_GPIO(1, 5) },
+
+	{ .name = "apacheLeft:green", .gpio = BBKEYS_GPIO(2, 2) },
+	{ .name = "apacheLeft:blue", .gpio = BBKEYS_GPIO(2, 3) },
+	{ .name = "apacheLeft:alter", .gpio = BBKEYS_GPIO(2, 4) },
+	{ .name = "apacheRight:green", .gpio = BBKEYS_GPIO(2, 5) },
+	{ .name = "apacheRight:red", .gpio = BBKEYS_GPIO(2, 6) },
+	{ .name = "apacheRight:alter", .gpio = BBKEYS_GPIO(2, 7) },
+};
+
+static struct gpio_led_platform_data apache_led_info = {
+	.leds = apache_leds,
+	.num_leds = ARRAY_SIZE(apache_leds),
+};
+
 static struct platform_device leds = {
-	.name = "htcapache-leds",
+	.name = "leds-gpio",
+	.id = -1,
+	.dev = {
+		.platform_data = &apache_led_info,
+	}
 };
 
 
@@ -320,9 +377,9 @@
 		pxa_gpio_mode(GPIO44_BTCTS_MD);
 		pxa_gpio_mode(GPIO45_BTRTS_MD);
 
-		htcapache_egpio_set(EGPIO_NR_HTCAPACHE_BT_POWER, 1);
+		gpio_set_value(EGPIO_NR_HTCAPACHE_BT_POWER, 1);
 		mdelay(5);
-		htcapache_egpio_set(EGPIO_NR_HTCAPACHE_BT_RESET, 1);
+		gpio_set_value(EGPIO_NR_HTCAPACHE_BT_RESET, 1);
 		/*
 		 * BRF6150's RTS goes low when firmware is ready
 		 * so check for CTS=1 (nCTS=0 -> CTS=1). Typical 150ms
@@ -334,8 +391,8 @@
 		printk("btuart: post_startup (%d)\n", tries);
 		break;
 	case PXA_UART_CFG_PRE_SHUTDOWN:
-		htcapache_egpio_set(EGPIO_NR_HTCAPACHE_BT_POWER, 0);
-		htcapache_egpio_set(EGPIO_NR_HTCAPACHE_BT_RESET, 0);
+		gpio_set_value(EGPIO_NR_HTCAPACHE_BT_POWER, 0);
+		gpio_set_value(EGPIO_NR_HTCAPACHE_BT_RESET, 0);
 		printk("btuart: pre_shutdown\n");
 		break;
 	}
@@ -370,23 +427,23 @@
 static int
 wlan_start(void)
 {
-	htcapache_egpio_set(EGPIO_NR_HTCAPACHE_WIFI_POWER1, 1);
-	htcapache_egpio_set(EGPIO_NR_HTCAPACHE_WIFI_POWER2, 1);
-	htcapache_egpio_set(EGPIO_NR_HTCAPACHE_WIFI_POWER3, 1);
+	gpio_set_value(EGPIO_NR_HTCAPACHE_WIFI_POWER1, 1);
+	gpio_set_value(EGPIO_NR_HTCAPACHE_WIFI_POWER2, 1);
+	gpio_set_value(EGPIO_NR_HTCAPACHE_WIFI_POWER3, 1);
 	mdelay(250);
-	htcapache_egpio_set(EGPIO_NR_HTCAPACHE_WIFI_RESET, 1);
-        mdelay(100);
-        return 0;
+	gpio_set_value(EGPIO_NR_HTCAPACHE_WIFI_RESET, 1);
+	mdelay(100);
+	return 0;
 }
 
 static int
 wlan_stop(void)
 {
-	htcapache_egpio_set(EGPIO_NR_HTCAPACHE_WIFI_POWER1, 0);
-	htcapache_egpio_set(EGPIO_NR_HTCAPACHE_WIFI_POWER2, 0);
-	htcapache_egpio_set(EGPIO_NR_HTCAPACHE_WIFI_POWER3, 0);
-	htcapache_egpio_set(EGPIO_NR_HTCAPACHE_WIFI_RESET, 0);
-        return 0;
+	gpio_set_value(EGPIO_NR_HTCAPACHE_WIFI_POWER1, 0);
+	gpio_set_value(EGPIO_NR_HTCAPACHE_WIFI_POWER2, 0);
+	gpio_set_value(EGPIO_NR_HTCAPACHE_WIFI_POWER3, 0);
+	gpio_set_value(EGPIO_NR_HTCAPACHE_WIFI_RESET, 0);
+	return 0;
 }
 
 enum {
@@ -546,38 +603,6 @@
 
 
 /****************************************************************
- * Buttons on front
- ****************************************************************/
-
-static struct gpio_keys_button front_button_list[] = {
-	{ .gpio = 15, .keycode = KEY_PHONE},     // Call button
-	{ .gpio = 14, .keycode = KEY_LEFTCTRL},  // Left menu
-	{ .gpio = 13, .keycode = KEY_ESC},       // Hangup
-	{ .gpio = 12, .keycode = KEY_RIGHTCTRL}, // Right menu
-	{ .gpio = 11, .keycode = KEY_OK},        // Ok
-	{ .gpio = 10, .keycode = KEY_LEFTMETA},  // Windows key
-	{ .gpio = 7,  .keycode = KEY_RIGHT},     // Joystick right
-	{ .gpio = 6,  .keycode = KEY_UP},        // Joystick up
-	{ .gpio = 5,  .keycode = KEY_LEFT},      // Joystick left
-	{ .gpio = 4,  .keycode = KEY_DOWN},      // Joystick down
-	{ .gpio = 3,  .keycode = KEY_ENTER},     // Joystick press
-};
-
-static struct gpio_keys_platform_data front_buttons_data = {
-	.buttons = front_button_list,
-	.nbuttons = ARRAY_SIZE(front_button_list),
-};
-
-static struct platform_device front_buttons = {
-	.name   = "htcapache-frontkeys",
-	.id     = -1,
-	.dev	=  {
-		.platform_data	= &front_buttons_data,
-	},
-};
-
-
-/****************************************************************
  * USB client controller
  ****************************************************************/
 
@@ -660,6 +685,7 @@
 
 static struct platform_device *devices[] __initdata = {
 	&egpio,
+	&bbkeys,
 	&htcapache_keyboard,
 	&htcapache_buttons,
 	&ad7877,
@@ -669,15 +695,14 @@
 	&htcapache_bl,
 	&leds,
 	&acx_device,
-	&front_buttons,
 };
 
 void htcapache_ll_pm_init(void);
 
 static void __init htcapache_init(void)
 {
-	set_pxa_fb_info(&lcd);
 	platform_add_devices(devices, ARRAY_SIZE(devices));
+	set_pxa_fb_info(&lcd);
 	pxa_set_btuart_info(&btuart_funcs);
 	pxa_set_udc_info(&htcapache_udc_mach_info);
 	pxa_set_mci_info(&htcapache_mci_platform_data);
diff -ruN -X X hnd-linux-trunk/arch/arm/mach-pxa/htcapache/Kconfig hnd-cleanup/arch/arm/mach-pxa/htcapache/Kconfig
--- hnd-linux-trunk/arch/arm/mach-pxa/htcapache/Kconfig	2007-09-17 22:44:28.000000000 +0400
+++ hnd-cleanup/arch/arm/mach-pxa/htcapache/Kconfig	2007-09-17 23:22:50.000000000 +0400
@@ -9,6 +9,8 @@
         select LEDS_CLASS
         select ADC
         select HTC_EGPIO
+        select HTC_BBKEYS
+        select LEDS_GPIO
 	help
 		Say Y here if you intend to run this kernel on a
 		HTC Apache. Currently there is only basic support
diff -ruN -X X hnd-linux-trunk/arch/arm/mach-pxa/htcapache/Makefile hnd-cleanup/arch/arm/mach-pxa/htcapache/Makefile
--- hnd-linux-trunk/arch/arm/mach-pxa/htcapache/Makefile	2007-09-17 22:44:28.000000000 +0400
+++ hnd-cleanup/arch/arm/mach-pxa/htcapache/Makefile	2007-09-17 23:22:50.000000000 +0400
@@ -4,7 +4,4 @@
 
 obj-$(CONFIG_MACH_HTCAPACHE)        += htcapache.o
 obj-$(CONFIG_MACH_HTCAPACHE)        += htcapache-bl.o
-obj-$(CONFIG_MACH_HTCAPACHE)        += htcapache-mc.o
-obj-$(CONFIG_MACH_HTCAPACHE)        += htcapache-leds.o
-obj-$(CONFIG_MACH_HTCAPACHE)        += htcapache-frontkeys.o
 obj-$(CONFIG_MACH_HTCAPACHE)        += htcapache-pm.o
diff -ruN -X X hnd-linux-trunk/arch/arm/mach-pxa/Kconfig hnd-cleanup/arch/arm/mach-pxa/Kconfig
--- hnd-linux-trunk/arch/arm/mach-pxa/Kconfig	2007-09-17 22:44:32.000000000 +0400
+++ hnd-cleanup/arch/arm/mach-pxa/Kconfig	2007-09-17 23:22:54.000000000 +0400
@@ -54,6 +54,7 @@
 source "arch/arm/mach-pxa/palmt650/Kconfig"
 source "arch/arm/mach-pxa/palmt680/Kconfig"
 source "arch/arm/mach-pxa/palmt700wx/Kconfig"
+source "arch/arm/mach-pxa/plat-recon/Kconfig"
 
 config MACH_GHI270HG
 	bool "Grayhill Duramax HG"
diff -ruN -X X hnd-linux-trunk/arch/arm/mach-pxa/magician/magician.c hnd-cleanup/arch/arm/mach-pxa/magician/magician.c
--- hnd-linux-trunk/arch/arm/mach-pxa/magician/magician.c	2007-09-17 22:44:29.000000000 +0400
+++ hnd-cleanup/arch/arm/mach-pxa/magician/magician.c	2007-09-17 23:22:51.000000000 +0400
@@ -186,20 +186,21 @@
 struct htc_egpio_pinInfo egpio_pins[] = {
 	/* Output pins that default on */
 	{
-		.pin_nr         = EGPIO_MAGICIAN_GSM_RESET - MAGICIAN_EGPIO_BASE,
+		.gpio           = EGPIO_MAGICIAN_GSM_RESET,
 		.type           = HTC_EGPIO_TYPE_OUTPUT,
 		.output_initial = 1,
 	},
 	{
-		.pin_nr         = EGPIO_MAGICIAN_IN_SEL1 - MAGICIAN_EGPIO_BASE,
+		.gpio           = EGPIO_MAGICIAN_IN_SEL1,
 		.type           = HTC_EGPIO_TYPE_OUTPUT,
 		.output_initial = 1,
 	},
 	/* Input pins with associated IRQ */
 	{
-		.pin_nr         = EGPIO_MAGICIAN_EP_INSERT - MAGICIAN_EGPIO_BASE,
+		.gpio           = EGPIO_MAGICIAN_EP_INSERT,
 		.type           = HTC_EGPIO_TYPE_INPUT,
-		.input_irq      = 1 /* IRQ_MAGICIAN_EP_IRQ - IRQ_BOARD_START */,
+		.input_irq      = MAGICIAN_EGPIO(3, 1),
+			/* 'pin' corresponding to IRQ_MAGICIAN_EP_IRQ */
 	},
 };
 
@@ -573,9 +574,30 @@
 	},
 };
 
-static struct platform_device magician_led = {
-	.name = "magician-led",
+struct gpio_led gpio_leds[] = {
+        {
+		.name = "magician:vibra",
+		.default_trigger = "none",
+		.gpio = GPIO22_MAGICIAN_VIBRA_EN,
+	},
+        {
+		.name = "magician:phone_bl",
+		.default_trigger = "backlight",
+		.gpio = GPIO103_MAGICIAN_LED_KP,
+	},
+};
+
+static struct gpio_led_platform_data gpio_led_info = {
+	.leds = gpio_leds,
+	.num_leds = ARRAY_SIZE(gpio_leds),
+};
+
+static struct platform_device leds_gpio = {
+	.name = "leds-gpio",
 	.id   = -1,
+	.dev  = {
+		.platform_data = &gpio_led_info,
+	},
 };
 
 /*
@@ -788,7 +810,7 @@
 	&magician_phone,
 	&magician_flash,
 	&pasic3,
-	&magician_led,
+	&leds_gpio,
 #if 0
 	&pxa_spi_ssp2,
 #endif
diff -ruN -X X hnd-linux-trunk/arch/arm/mach-pxa/Makefile hnd-cleanup/arch/arm/mach-pxa/Makefile
--- hnd-linux-trunk/arch/arm/mach-pxa/Makefile	2007-09-17 22:44:32.000000000 +0400
+++ hnd-cleanup/arch/arm/mach-pxa/Makefile	2007-09-17 23:22:54.000000000 +0400
@@ -44,8 +44,6 @@
 obj-y                           += aximx5/
 obj-y				+= aximx30/
 obj-y                           += rover/
-obj-$(CONFIG_MACH_RECON)	+= plat-recon/
-obj-$(CONFIG_MACH_LOOXC550)	+= looxc550/
 obj-$(CONFIG_MACH_X50)			+= aximx50/
 obj-$(CONFIG_MACH_TUNGE2)		+= palmte2/
 obj-$(CONFIG_MACH_OMAP_PALMTC)		+= ssp.o palmtc/
@@ -58,6 +56,8 @@
 obj-$(CONFIG_MACH_XSCALE_PALMTREO650)	+= palmt650/
 obj-$(CONFIG_MACH_XSCALE_TREO680)	+= palmt680/
 obj-$(CONFIG_MACH_T700WX)		+= palmt700wx/
+obj-$(CONFIG_MACH_RECON)        += plat-recon/
+obj-$(CONFIG_MACH_LOOXC550)	+= looxc550/
 
 # Support for blinky lights
 led-y := leds.o
diff -ruN -X X hnd-linux-trunk/arch/arm/mach-pxa/palmtt5/palmtt5.c hnd-cleanup/arch/arm/mach-pxa/palmtt5/palmtt5.c
--- hnd-linux-trunk/arch/arm/mach-pxa/palmtt5/palmtt5.c	2007-09-17 22:44:30.000000000 +0400
+++ hnd-cleanup/arch/arm/mach-pxa/palmtt5/palmtt5.c	2007-09-17 23:22:52.000000000 +0400
@@ -151,12 +151,10 @@
 
 static void palmtt5_bl_power(int on)
 {
-	if(GET_PALMTT5_GPIO(BL_POWER)!=on) {
-		SET_PALMTT5_GPIO(LCD_POWER, on);
-		SET_PALMTT5_GPIO(BL_POWER, on);
-		pxa_set_cken(CKEN0_PWM0, on);
-		pxa_set_cken(CKEN1_PWM1, on);
-    	}
+    SET_PALMTT5_GPIO(BL_POWER, on);
+    pxa_set_cken(CKEN0_PWM0, on);
+    pxa_set_cken(CKEN1_PWM1, on);
+    mdelay(50);
 }
 
 static void palmtt5_set_bl_intensity(int intensity)
diff -ruN -X X hnd-linux-trunk/arch/arm/mach-pxa/palmtt5/palmtt5_pm.c hnd-cleanup/arch/arm/mach-pxa/palmtt5/palmtt5_pm.c
--- hnd-linux-trunk/arch/arm/mach-pxa/palmtt5/palmtt5_pm.c	2007-09-17 22:44:30.000000000 +0400
+++ hnd-cleanup/arch/arm/mach-pxa/palmtt5/palmtt5_pm.c	2007-09-17 23:22:52.000000000 +0400
@@ -41,6 +41,10 @@
 	while(!(OSCC & OSCC_OOK)) 
 	    {}
 
+	/* Turn off LCD power */
+	SET_PALMTT5_GPIO(LCD_POWER,0);
+	/* Turn screen off */
+	SET_PALMTT5_GPIO(BL_POWER,0);
 	/* Turn off USB power */
 	SET_PALMTT5_GPIO(USB_POWER,0);
 
@@ -63,6 +67,10 @@
 
 	/* Here are all of special to resume Palm T5  */
 
+	/* Turn on LCD power */
+	SET_PALMTT5_GPIO(LCD_POWER,1);
+	/* Turn screen on */
+	SET_PALMTT5_GPIO(BL_POWER,1);
 	/* Turn on USB power */
 	SET_PALMTT5_GPIO(USB_POWER,1);
 	
diff -ruN -X X hnd-linux-trunk/arch/arm/mach-pxa/palmz31/gpioed.c hnd-cleanup/arch/arm/mach-pxa/palmz31/gpioed.c
--- hnd-linux-trunk/arch/arm/mach-pxa/palmz31/gpioed.c	2007-09-17 22:44:31.000000000 +0400
+++ hnd-cleanup/arch/arm/mach-pxa/palmz31/gpioed.c	1970-01-01 03:00:00.000000000 +0300
@@ -1,279 +0,0 @@
-/*** Basic includes ***/
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/proc_fs.h>
-
-#include <linux/irq.h>
-#include <linux/interrupt.h>
-#include <asm/irq.h>
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-#include <asm/mach-types.h>
-#include <asm/hardware.h>
-#include <linux/sched.h>
-#include <linux/workqueue.h>
-#include <asm/arch/pxa-regs.h>
-#include <asm/arch/irqs.h>
-#include <asm/uaccess.h>
-
-/*** GPIO macros ***/
-#define GET_PALMT3_GPIO(gpio) \
-	(GPLR(GPIO_NR_PALMT3_ ## gpio) & GPIO_bit(GPIO_NR_PALMT3_ ## gpio))
-
-#define SET_PALMT3_GPIO(gpio, setp) \
-	do { \
-		if (setp) \
-			GPSR(GPIO_NR_PALMT3_ ## gpio) = GPIO_bit(GPIO_NR_PALMT3_ ## gpio); \
-		else \
-			GPCR(GPIO_NR_PALMT3_ ## gpio) = GPIO_bit(GPIO_NR_PALMT3_ ## gpio); \
-	} while (0)
-
-#define SET_PALMT3_GPIO_N(gpio, setp) \
-	do { \
-		if (setp) \
-			GPCR(GPIO_NR_PALMT3_ ## gpio) = GPIO_bit(GPIO_NR_PALMT3_ ## gpio); \
-		else \
-			GPSR(GPIO_NR_PALMT3_ ## gpio) = GPIO_bit(GPIO_NR_PALMT3_ ## gpio); \
-	} while (0)
-
-#define GET_GPIO_REG(reg,gpio) (GP##reg(gpio) & GPIO_bit(gpio))
-#define GET_GPIO(gpio) (GPLR(gpio) & GPIO_bit(gpio))
-#define GET_GPIOD(gpio) (GPDR(gpio) & GPIO_bit(gpio))
-
-/*** /proc interface ***/
-static struct proc_dir_entry *proc_intf;
-#define procfs_name			"gpioed"
-#define PROCFS_MAX_SIZE		20
-
-static char procfs_buffer[PROCFS_MAX_SIZE];
-static unsigned long procfs_buffer_size = 0;
-
-int gpio_info(char *buffer);
-
-int procfile_read(char *buffer, char **buffer_location, off_t offset, int buffer_length, int *eof, void *data)
-{
-	int ret;
-
-	if (offset > 0) {
-		/* we have finished to read, return 0 */
-		ret  = 0;
-	} else {
-		/* fill the buffer, return the buffer size */
-		ret = gpio_info(buffer);
-		//ret = sprintf(buffer, "HelloWorld!\n");
-	}
-	return ret;
-}
-
-int gpio_info(char *buffer) 
-// output all knowen infomation about the gpios to /proc/gpioed
-{
-	int i;
-	int ret;
-	sprintf(buffer, "Infomation about gpios:\n| Gpio | Direction | State |\n");
-	for(i=0; i<85; i++)
-	{
-		sprintf(buffer, "%s|  %2i  ", buffer, i);
-		if(GET_GPIOD(i) == 0) //In
-			sprintf(buffer, "%s|    In     ",buffer);
-		else //Out
-			sprintf(buffer, "%s|    Out    ",buffer);
-		if(GET_GPIO(i) == 0) //Low
-			sprintf(buffer, "%s| Low  |\n", buffer);
-		else //high
-			sprintf(buffer, "%s| High |\n", buffer);
-	}
-	ret = sprintf(buffer, "%s---------------------------\n Alternate Functions:\n 0L: %X 0U: %X 1L: %X 1U: %X 2L: %X 2U: %X\n", buffer, GAFR0_L, GAFR0_U, GAFR1_L, GAFR1_U, GAFR2_L, GAFR2_U);
-
-	return ret;
-}
-
-void handle_request(void);
-
-int procfile_write(struct file *file, const char *buffer, unsigned long count, void *data)
-{
-	procfs_buffer_size = count;
-	if (procfs_buffer_size > PROCFS_MAX_SIZE ) {
-		procfs_buffer_size = PROCFS_MAX_SIZE;
-	}
-	
-	/* write data to the buffer */
-	if ( copy_from_user(procfs_buffer, buffer, procfs_buffer_size) ) {
-		return -EFAULT;
-	}
-	
-	handle_request();
-	
-	return procfs_buffer_size;
-}
-
-/*** IRQ (GPIO) handling ***/
-static struct workqueue_struct *my_workqueue;
-#define MY_WORK_QUEUE_NAME "GPIOed"
-
-static void handle_gpio(void* irq)
-{
-	int gpn = (int)irq;
-	printk(KERN_ERR "*** GPIO *** %d *** is *** %s ***\n", gpn, GET_GPIO(gpn) ? "high" : "low ");
-}
-
-irqreturn_t gpio_irq(int irq, void *dev_id, struct pt_regs *regs)
-{
-	static int initialised = 0;
-	static struct work_struct task;
-	
-	if (initialised == 0) {
-		INIT_WORK(&task, handle_gpio, dev_id);
-		initialised = 1;
-	} else {
-		PREPARE_WORK(&task, handle_gpio, dev_id);
-	}
-
-	queue_work(my_workqueue, &task);
-
-	return IRQ_HANDLED;
-}
-
-/*** GPIO R/W ***/
-static int gpio_get(int id)
-{
-	return GET_GPIO(id);
-}
-
-static void gpio_set(int id, int on)
-{
-	do {
-		if (on)
-			GPSR(id) = GPIO_bit(id);
-		else
-			GPCR(id) = GPIO_bit(id);
-	} while (0);
-}
-
-static int gpio_watch(int x)
-{
-	int ret;
-	ret = request_irq (IRQ_GPIO(x), gpio_irq, SA_SAMPLE_RANDOM, "test_handler", (void*)x);
-	set_irq_type (IRQ_GPIO(x), IRQT_BOTHEDGE);
-	if(ret!=0) {
-		printk(KERN_ERR "GPIOed: failed to register for GPIO %d\n", x);
-		return 1;
-	} else {
-		printk(KERN_ERR "GPIOed: Registered GPIO %d\n", x);
-		return 0;
-	}
-}
-
-void set_afn(int gpio, int fn)
-{
-	int gafr;
-	gafr = GAFR(gpio) & ~(0x3 << (((gpio) & 0xf)*2));
-	GAFR(gpio) = gafr |  (fn  << (((gpio) & 0xf)*2));
-}
-
-
-/*** Request handler ***/
-void handle_request()
-{
-	char *p = NULL;
-	unsigned long base = 10;
-	unsigned long id;
-	
-	if((procfs_buffer[0] == 'P') || (procfs_buffer[0] == 'V'))
-		base = 16;
-	id = simple_strtoul(procfs_buffer+2, &p, base);
-	switch(procfs_buffer[0]) {
-		case 'r':
-			printk(KERN_ERR "GPIOed: GPIO %lu is %s\n", id, gpio_get(id)?"high":"low ");
-			break;
-		case 's':
-			gpio_watch(id);
-			break;
-		case 'h':
-			gpio_set(id, 1);
-			printk(KERN_ERR "GPIOed: GPIO %lu set high\n", id);
-			break;
-		case 'l':
-			gpio_set(id, 0);
-			printk(KERN_ERR "GPIOed: GPIO %lu set low\n", id);
-			break;
-		case 'd':
-			printk(KERN_ERR "GPIOed: GPIO %lu is %s\n", id, GET_GPIO_REG(DR,id)?"output":"input");
-			break;
-
-		case 'P':
-			printk(KERN_ERR "GPIOed: P-V for 0x%x is 0x%x\n", id, (unsigned int)phys_to_virt(id));
-			break;
-		case 'V':
-			printk(KERN_ERR "GPIOed: V-P for 0x%x is 0x%x\n", id, (unsigned int)virt_to_phys(id));
-			break;
-		case 'D':
-			base = *((unsigned int*)id);
-			printk(KERN_ERR "GPIOed: 0x%x = 0x%x\n", id, base);
-			break;
-		case 'o':
-			GPDR(id) &= ~(GPIO_bit(id));
-			break;
-		case 'i':
-			GPDR(id) |= GPIO_bit(id);
-			break;
-
-		case '0':
-			set_afn(id, 0);
-			break;
-		case '1':
-			set_afn(id, 1);
-			break;
-		case '2':
-			set_afn(id, 2);
-			break;
-
-		default:
-			printk(KERN_ERR "GPIOed: Unknown request\n");
-			break;
-	}
-}
-
-/*** init&exit ***/
-static int __init gpioed_init(void)
-{
-	my_workqueue = create_workqueue(MY_WORK_QUEUE_NAME);
-	
-	proc_intf = create_proc_entry(procfs_name, 0644, NULL);
-	if (proc_intf == NULL) {
-		remove_proc_entry(procfs_name, &proc_root);
-		printk(KERN_ALERT "Error: Could not initialize /proc/%s\n",
-				procfs_name);
-		return -ENOMEM;
-	}
-	
-	proc_intf->read_proc = procfile_read;
-	proc_intf->write_proc = procfile_write;
-	proc_intf->owner     = THIS_MODULE;
-	proc_intf->mode      = S_IFREG | S_IRUGO;
-	proc_intf->uid       = 0;
-	proc_intf->gid       = 0;
-	proc_intf->size      = 37;
-
-	printk(KERN_INFO "/proc/%s created\n", procfs_name);
-	
-        return 0;
-}
-
-static void __exit gpioed_exit(void)
-{
-	destroy_workqueue(my_workqueue);
-	remove_proc_entry(procfs_name, &proc_root);
-	printk(KERN_INFO "/proc/%s removed\n", procfs_name);
-}
-
-
-/*** Some more stuff ***/
-module_init(gpioed_init);
-module_exit(gpioed_exit);
-
-MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Vladimir \"Farcaller\" Pouzanov <farcaller@gmail.com>");
-MODULE_DESCRIPTION("GPIO editor for PXA26x");
-
diff -ruN -X X hnd-linux-trunk/arch/arm/mach-pxa/palmz31/gpioed-ng.c hnd-cleanup/arch/arm/mach-pxa/palmz31/gpioed-ng.c
--- hnd-linux-trunk/arch/arm/mach-pxa/palmz31/gpioed-ng.c	2007-09-17 22:44:31.000000000 +0400
+++ hnd-cleanup/arch/arm/mach-pxa/palmz31/gpioed-ng.c	1970-01-01 03:00:00.000000000 +0300
@@ -1,175 +0,0 @@
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/proc_fs.h>
-
-#include <linux/interrupt.h>
-#include <asm/irq.h>
-#include <asm/mach/arch.h>
-#include <asm/mach/map.h>
-#include <asm/mach-types.h>
-#include <asm/hardware.h>
-#include <linux/sched.h>
-#include <linux/workqueue.h>
-#include <asm/arch/pxa-regs.h>
-#include <asm/arch/irqs.h>
-#include <asm/uaccess.h>
-
-#include <linux/debugfs.h>
-#include <linux/seq_file.h>
-
-#define PROCFS_NAME	"gpio"
-#define DEBUGFS_NAME	"gpio"
-
-static struct proc_dir_entry *proc_intf;
-static struct dentry	     *debugfs_intf;
-
-#define PROCFS_MAX_SIZE		20
-
-static char procfs_buffer[PROCFS_MAX_SIZE];
-static unsigned long procfs_buffer_size = 0;
-
-#define GPIO_TEST(reg, gp) (reg(gp) & GPIO_bit(gp))
-static int dfs_show(struct seq_file *s, void *_)
-{
-	int i,afn;
-	seq_printf(s, "GPIO lines status:\n");
-
-	for(i=0;i<121;i++) {
-		afn = (GAFR(i) & (0x3 << (((i) & 0xf)*2))) >> (((i) & 0xf)*2);
-		seq_printf(s, "%s%d: %s %s %s %s %lx\n",
-				i<10?"0":"",
-				i,
-				GPIO_TEST(GPLR, i)?"*":" ",
-				GPIO_TEST(GPDR, i)?"->":"<-",
-				GPIO_TEST(GRER, i)?"_/":"  ",
-				GPIO_TEST(GFER, i)?"\\_":"  ",
-				afn);
-
-	}
-	
-	return 0;
-}
-
-static int dfs_open(struct inode *inode, struct file *file)
-{
-	return single_open(file, dfs_show, inode->u.generic_ip);
-}
-
-static struct file_operations debug_fops = {
-	.open		= dfs_open,
-	.read		= seq_read,
-	.llseek		= seq_lseek,
-	.release	= single_release,
-};
-
-static void gpio_set(int id, int on)
-{
-	do {
-		if (on)
-			GPSR(id) = GPIO_bit(id);
-		else
-			GPCR(id) = GPIO_bit(id);
-	} while (0);
-}
-
-void set_afn(int gpio, int fn)
-{
-	int gafr;
-	gafr = GAFR(gpio) & ~(0x3 << (((gpio) & 0xf)*2));
-	GAFR(gpio) = gafr |  (fn  << (((gpio) & 0xf)*2));
-}
-
-void handle_request()
-{
-	char *p = NULL;
-	unsigned long id = simple_strtoul(procfs_buffer+2, &p, 10);
-	switch(procfs_buffer[0]) {
-		case 'L':
-			gpio_set(id, 1);
-			printk(KERN_ERR "GPIOed: GPIO %lu set high\n", id);
-			break;
-		case 'l':
-			gpio_set(id, 0);
-			printk(KERN_ERR "GPIOed: GPIO %lu set low\n", id);
-			break;
-		case 'd':
-			GPDR(id) &= ~(GPIO_bit(id));
-			break;
-		case 'D':
-			GPDR(id) |= GPIO_bit(id);
-			break;
-		case '0':
-			set_afn(id, 0);
-			break;
-		case '1':
-			set_afn(id, 1);
-			break;
-		case '2':
-			set_afn(id, 2);
-			break;
-		default:
-			printk(KERN_ERR "GPIOed: Unknown request\n");
-			break;
-	}
-}
-
-
-int procfile_write(struct file *file, const char *buffer, unsigned long count, void *data)
-{
-	procfs_buffer_size = count;
-	if (procfs_buffer_size > PROCFS_MAX_SIZE ) {
-		procfs_buffer_size = PROCFS_MAX_SIZE;
-	}
-	
-	/* write data to the buffer */
-	if ( copy_from_user(procfs_buffer, buffer, procfs_buffer_size) ) {
-		return -EFAULT;
-	}
-	
-	handle_request();
-	
-	return procfs_buffer_size;
-}
-
-
-static int __init gpioed_init(void)
-{
-	proc_intf = create_proc_entry(PROCFS_NAME, 0644, NULL);
-	if (proc_intf == NULL) {
-		remove_proc_entry(PROCFS_NAME, &proc_root);
-		printk(KERN_ALERT "Error: Could not initialize /proc/%s\n", PROCFS_NAME);
-		return -ENOMEM;
-	}
-	
-	/*proc_intf->read_proc = procfile_read;*/
-	proc_intf->write_proc = procfile_write;
-	proc_intf->owner     = THIS_MODULE;
-	proc_intf->mode      = S_IFREG | S_IRUGO;
-	proc_intf->uid       = 0;
-	proc_intf->gid       = 0;
-	proc_intf->size      = 37;
-	
-	debugfs_intf = debugfs_create_file(DEBUGFS_NAME, S_IRUGO, NULL, NULL, &debug_fops);
-
-	printk(KERN_INFO "/proc/%s created\n", PROCFS_NAME);
-	
-        return 0;
-}
-
-static void __exit gpioed_exit(void)
-{
-	debugfs_remove(debugfs_intf);
-	remove_proc_entry(PROCFS_NAME, &proc_root);
-	printk(KERN_INFO "/proc/%s removed\n", PROCFS_NAME);
-}
-
-
-/*** Some more stuff ***/
-module_init(gpioed_init);
-module_exit(gpioed_exit);
-
-MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Vladimir \"Farcaller\" Pouzanov <farcaller@gmail.com>");
-MODULE_DESCRIPTION("GPIO editor for PXA26x, second edition");
-
diff -ruN -X X hnd-linux-trunk/arch/arm/mach-pxa/palmz31/Kconfig hnd-cleanup/arch/arm/mach-pxa/palmz31/Kconfig
--- hnd-linux-trunk/arch/arm/mach-pxa/palmz31/Kconfig	2007-09-17 22:44:31.000000000 +0400
+++ hnd-cleanup/arch/arm/mach-pxa/palmz31/Kconfig	2007-09-17 23:22:53.000000000 +0400
@@ -11,20 +11,3 @@
 	help
 		This driver translates button presses on a Palm 
 		Tungsten E2 to Linux input subsystem events.
-
-
-config GPIOED
-       tristate "GPIOED"
-       depends on MACH_ZIRE31
-       default n
-       help
-    	    Gpioed: only for debuging and testing!
-
-
-config GPIOEDNG
-       tristate "GPIOEDNG"
-       depends on MACH_ZIRE31
-       default n
-       help
-    	    Gpioed-ng: only for debuging and testing!
-
diff -ruN -X X hnd-linux-trunk/arch/arm/mach-pxa/palmz31/Makefile hnd-cleanup/arch/arm/mach-pxa/palmz31/Makefile
--- hnd-linux-trunk/arch/arm/mach-pxa/palmz31/Makefile	2007-09-17 22:44:31.000000000 +0400
+++ hnd-cleanup/arch/arm/mach-pxa/palmz31/Makefile	2007-09-17 23:22:53.000000000 +0400
@@ -4,5 +4,3 @@
 
 obj-$(CONFIG_MACH_ZIRE31) 	+= palmz31.o
 obj-$(CONFIG_PALMZ31_BUTTONS)	+= palmz31_buttons.o 
-obj-$(CONFIG_GPIOED)		+= gpioed.o
-obj-$(CONFIG_GPIOEDNG)		+= gpioed-ng.o
diff -ruN -X X hnd-linux-trunk/arch/arm/mach-pxa/palmz72/camera.txt hnd-cleanup/arch/arm/mach-pxa/palmz72/camera.txt
--- hnd-linux-trunk/arch/arm/mach-pxa/palmz72/camera.txt	2007-09-17 22:44:32.000000000 +0400
+++ hnd-cleanup/arch/arm/mach-pxa/palmz72/camera.txt	1970-01-01 03:00:00.000000000 +0300
@@ -1,60 +0,0 @@
-GPLR0      GPLR1      GPLR2      GPLR3
-
-No camera
-0xFF511B05 0x3C7EDDFD 0xFF3F7328 0X8D1B6600
-0xFF511B15 0X3C7EDDFD 0XFF2F7328 0X8D1B6600
-0xff511b05 0x3c7efdfd 0xff2f7328 0x8d1b6600
-0xff511a85 0x3c7efda9 0x4a2d7328 0x8d1b6600
-0xff511a15 0x3c7efd19 0x8c3e7328 0x8d1b6600
-0xff511af5 0x3c7efdb9 0x8c2d7328 0x8d1b6600
-
-Camera on
-0XFF511B15 0X3C7ECB04 0X063C632A 0XBD0B6600
-0xff511b15 0x3cfe7328 0x002c630a 0x8d0b6600
-0xff511b85 0x3cfe1700 0x002c6308 0x8d0b6600
-0xff511b05 0x3cfe6288 0x633c612a 0x8d1b6600
-0xff511a15 0x3cfed304 0x443c410a 0x8d0b6600
-0xff511a05 0x3cfe8ee8 0xf72e4108 0x8d1b6600
-
-  XXXXXXXX   XXXXX      X XX XXX   XXXXXXXX
-
-
-GPLR1
-Camera off
-dfd  1101 1111 1101
-da9  1101 1010 1001
-d19  1101 0001 1001
-db9  1101 1011 1001
-
-Camera on
-b04  1011 0000 0100
-328  0011 0010 1000
-700  0111 0000 0000
-288  0010 1000 1000
-304  0011 0000 0100
-ee8  1110 1110 1000
-
-     XX X XXXX XXX 
-Camera: off   on
-GPIO32  1     0
-GPIO41  0     1 # FF_RTS, strange...
-
-GPLR2
-Camera off
-XFXX7XXX 1111 XXXX XXXX 0111 XXXX XXXX XXXX
-XAXX7XXX 1010 XXXX XXXX 0111 XXXX XXXX XXXX
-XCXX7XXX 1100 XXXX XXXX 0111 XXXX XXXX XXXX
-
-Camera on
-X6XX6XXX 0110 XXXX XXXX 0110 XXXX XXXX XXXX
-X0XX6XXX 0000 XXXX XXXX 0110 XXXX XXXX XXXX
-X3XX6XXX 0011 XXXX XXXX 0110 XXXX XXXX XXXX
-X4XX4XXX 0100 XXXX XXXX 0100 XXXX XXXX XXXX
-X7XX4XXX 0111 XXXX XXXX 0100 XXXX XXXX XXXX
-
-          XXX XXXX XXXX XXX  XXXX XXXX XXXX
-
-Camera: off  on
-GPIO76  1    0   # L_PCLK_WR, seems just accidentally
-GPIO91  1    0
-
diff -ruN -X X hnd-linux-trunk/arch/arm/mach-pxa/palmz72/gpio_map_ext.txt hnd-cleanup/arch/arm/mach-pxa/palmz72/gpio_map_ext.txt
--- hnd-linux-trunk/arch/arm/mach-pxa/palmz72/gpio_map_ext.txt	2007-09-17 22:44:32.000000000 +0400
+++ hnd-cleanup/arch/arm/mach-pxa/palmz72/gpio_map_ext.txt	1970-01-01 03:00:00.000000000 +0300
@@ -1,62 +0,0 @@
-GPIO pin 	Level 	Dir 	Function
-GPIO 0 		0 	I 	00
-GPIO 1 		1 	I 	00
-GPIO 2 		1 	O 	00
-GPIO 3 		1 	O 	00
-GPIO 4 		1 	O 	00
-GPIO 5 		1 	I 	00
-GPIO 6 		1 	I 	00
-GPIO 7 		1 	I 	00
-GPIO 8 		1 	I 	00
-GPIO 9 		0 	I 	00
-GPIO 10 	1 	I 	00
-GPIO 11 	0 	I 	00
-GPIO 12 	1 	I 	00
-GPIO 14 	0 	I 	00
-GPIO 15 	0 	I 	00
-GPIO 17 	1 	O 	00
-GPIO 18 	0 	O 	00
-GPIO 19 	1 	O 	00
-GPIO 20 	1 	O 	00
-GPIO 21 	0 	O 	00
-GPIO 22 	0 	O 	00
-GPIO 27 	0 	I 	00
-GPIO 32 	0 	O 	00
-GPIO 33 	0 	O 	00
-GPIO 34 	1 	I 	00
-GPIO 36 	1 	O 	00
-GPIO 37 	1 	I 	00
-GPIO 38 	0 	O 	00
-GPIO 39 	0 	O 	00
-GPIO 40 	0 	O 	00
-GPIO 49 	0 	O 	00
-GPIO 56 	1 	O 	00
-GPIO 57 	0 	O 	00
-GPIO 78 	0 	O 	00
-GPIO 79 	0 	O 	00
-GPIO 80 	1 	I 	00
-GPIO 82 	0 	O 	00
-GPIO 83 	0 	O 	00
-GPIO 86 	1 	I 	00
-GPIO 87 	0 	I 	00
-GPIO 88 	0 	O 	00
-GPIO 90 	0 	O 	00
-GPIO 91 	1 	O 	00
-GPIO 92 	0 	O 	00
-GPIO 94 	0 	I 	00
-GPIO 95 	0 	O 	00
-GPIO 96 	1 	O 	00
-GPIO 98 	1 	O 	00
-GPIO 99 	1 	I 	00
-GPIO106 	0 	O 	00
-GPIO107 	1 	I 	00
-GPIO109 	0 	O 	00
-GPIO110 	0 	O 	00
-GPIO111 	0 	O 	00
-GPIO112 	0 	O 	00
-GPIO113 	1 	O 	00
-GPIO114 	1 	O 	00
-GPIO115 	0 	I 	00
-GPIO116 	0 	O 	00
-GPIO119 	0 	O 	00
-GPIO120 	0 	O 	00
diff -ruN -X X hnd-linux-trunk/arch/arm/mach-pxa/palmz72/gpio_map.txt hnd-cleanup/arch/arm/mach-pxa/palmz72/gpio_map.txt
--- hnd-linux-trunk/arch/arm/mach-pxa/palmz72/gpio_map.txt	2007-09-17 22:44:32.000000000 +0400
+++ hnd-cleanup/arch/arm/mach-pxa/palmz72/gpio_map.txt	1970-01-01 03:00:00.000000000 +0300
@@ -1,122 +0,0 @@
-GPIO pin 	Level 	Dir 	Function
-GPIO_0	 	0 	I 	00 Low POWER detect? 
-GPIO_1	 	1 	I 	00
-GPIO_2	 	1 	O 	00 SYS_EN
-GPIO_3	 	1 	O 	00
-GPIO_4	 	1 	O 	00
-GPIO_5	 	1 	I 	00 PWR_CAP<0>
-GPIO_6	 	1 	I 	00 PWR_CAP<1>
-GPIO_7	 	1 	I 	00 PWR_CAP<2>
-GPIO_8	 	1 	I 	00 PWR_CAP<3>
-GPIO_9 		0 	I 	00
-GPIO_10 	1 	I 	00
-GPIO_11 	0 	I 	00
-GPIO_12 	1 	I 	00 USB_PULLUP
-GPIO_13 	0 	I 	02 KP_DKIN7  // Voice Memo button
-GPIO_14 	0 	I 	00 SD card inserted
-GPIO_15 	0 	I 	00 USB_DETECT
-GPIO_16 	1 	O 	02 PWM_OUT0
-GPIO_17 	1 	O 	00 Bluetooth: 1 when enabled in POS
-GPIO_18 	0 	O 	00
-GPIO_19 	1 	O 	00 Screen goes white when 0
-GPIO_20 	1 	O 	00 BL_POWER // Backlight goes off when 0
-GPIO_21 	0 	O 	00 LCD border switch
-GPIO_22 	0 	O 	00 LCD border select
-GPIO_23 	0 	O 	02 SSPSCLK
-GPIO_24 	1 	O 	02 SSPSFRM
-GPIO_25 	0 	O 	02 SSPSTXD
-GPIO_26 	1 	I 	01 SSPRXD
-GPIO_27 	0 	I 	00 WM9712_IRQ
-GPIO_28 	0 	I 	01 AC97_BITCLK    // AC97
-GPIO_29 	0 	I 	01 AC97_SDATA_IN0 // AC97
-GPIO_30 	0 	O 	02 AC97_SDATA_OUT // AC97
-GPIO_31 	0 	O 	02 AC97_SYNC      // AC97
-GPIO_32 	0 	O 	00
-GPIO_33 	0 	O 	00
-GPIO_34 	1 	I 	00
-GPIO_35 	1 	I 	01 FFCTS
-GPIO_36 	1 	O 	00
-GPIO_37 	1 	I 	00
-GPIO_38 	0 	O 	00
-GPIO_39 	0 	O 	00
-GPIO_40 	0 	O 	00
-GPIO_41 	1 	O 	02 FF_RTS
-GPIO_42 	1 	I 	01 BTRXD
-GPIO_43 	1 	O 	02 BTTXD
-GPIO_44 	1 	I 	01 BTCTS
-GPIO_45 	1 	O 	02 BTRTS
-GPIO_46 	1 	I 	02 STD_RXD
-GPIO_47 	0 	O 	01 STD_TXD
-GPIO_48 	1 	I 	01 CIF_DD5
-GPIO_49 	0 	O 	00 IR_SD
-GPIO_50 	1 	I 	01 CIF_DD3
-GPIO_51 	1 	I 	01 CIF_DD2
-GPIO_52 	1 	I 	01 CIF_DD4
-GPIO_53 	0 	O 	02 CIF_MCLK
-GPIO_54 	1 	I 	03 CIF_PCLK
-GPIO_55 	0 	I 	01 CIF_DD1
-GPIO_56 	1 	O 	00
-GPIO_57 	0 	O 	00
-GPIO_58 	1 	O 	02 LDD0
-GPIO_59 	1 	O 	02 LDD1
-GPIO_60 	1 	O 	02 LDD2
-GPIO_61 	1 	O 	02 LDD3
-GPIO_62 	1 	O 	02 LDD4
-GPIO_63 	1 	O 	02 LDD5
-GPIO_64 	1 	O 	02 LDD6
-GPIO_65 	1 	O 	02 LDD7
-GPIO_66 	1 	O 	02 LDD8
-GPIO_67 	1 	O 	02 LDD9
-GPIO_68 	1 	O 	02 LDD10
-GPIO_69 	1 	O 	02 LDD11
-GPIO_70 	1 	O 	02 LDD12
-GPIO_71 	1 	O 	02 LDD13
-GPIO_72 	1 	O 	02 LDD14
-GPIO_73 	1 	O 	02 LDD15
-GPIO_74 	1 	O 	02 L_LCLK_RD
-GPIO_75 	1 	O 	02 L_LCLK_A0
-GPIO_76 	1 	O 	02 L_PCLK_WR
-GPIO_77 	1 	O 	02 L_BIAS
-GPIO_78 	0 	O 	00
-GPIO_79 	0 	O 	00
-GPIO_80 	1 	I 	00
-GPIO_81 	1 	I 	02 CIF_DD0
-GPIO_82 	0 	O 	00
-GPIO_83 	0 	O 	00 Bluetooth: 1 when enabled in POS
-GPIO_84 	1 	I 	03 CIF_FV
-GPIO_85 	1 	I 	03 CIF_LV
-GPIO_86 	1 	I 	00
-GPIO_87 	0 	I 	00 
-GPIO_88 	0 	O 	00 LED
-GPIO_89 	0 	O 	01 AC97_SYSCLK
-GPIO_90 	0 	O 	00
-GPIO_91 	1 	O 	00 1->0 disables I2C0?
-GPIO_92 	0 	O 	00
-GPIO_93 	1 	I 	02 CIF_DD6
-GPIO_94 	0 	I 	00
-GPIO_95 	0 	O 	00 USB_POWER
-GPIO_96 	1 	O 	00 LCD_POWER (LCD OFF when 0)
-GPIO_97 	0 	I 	03 KP_MKIN3
-GPIO_98 	1 	O 	00
-GPIO_99 	1 	I 	00
-GPIO100 	0 	I 	01 KP_MKIN0
-GPIO101 	0 	I 	01 KP_MKIN1
-GPIO102 	0 	I 	01 KP_MKIN2
-GPIO103 	1 	O 	02 KP_MKOUT0
-GPIO104 	1 	O 	02 KP_MKOUT1
-GPIO105 	1 	O 	02 KP_MKOUT2
-GPIO106 	0 	O 	00
-GPIO107 	1 	I 	00
-GPIO108 	1 	I 	01 CIF_DD7
-GPIO109 	0 	O 	00
-GPIO110 	0 	O 	00
-GPIO111 	0 	O 	00
-GPIO112 	0 	O 	00 CAMERA?
-GPIO113 	1 	O 	00
-GPIO114 	1 	O 	00
-GPIO115 	0 	I 	00
-GPIO116 	0 	O 	00
-GPIO117 	1 	O 	01 SCL
-GPIO118 	1 	O 	01 SDA
-GPIO119 	0 	O 	00
-GPIO120 	0 	O 	00 CAMERA?
diff -ruN -X X hnd-linux-trunk/arch/arm/mach-pxa/palmz72/i2c.txt hnd-cleanup/arch/arm/mach-pxa/palmz72/i2c.txt
--- hnd-linux-trunk/arch/arm/mach-pxa/palmz72/i2c.txt	2007-09-17 22:44:32.000000000 +0400
+++ hnd-cleanup/arch/arm/mach-pxa/palmz72/i2c.txt	1970-01-01 03:00:00.000000000 +0300
@@ -1,28 +0,0 @@
-root@palmz72:/$ i2cdetect 1
-WARNING! This program can confuse your I2C bus, cause data loss and worse!
-I will probe file /dev/i2c-1.
-I will probe address range 0x03-0x77.
-Continue? [Y/n] y
-     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
-00:          XX XX XX XX XX XX XX XX XX XX XX XX XX
-10: XX XX XX XX 14 XX XX XX XX XX XX XX XX XX XX XX
-20: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX
-30: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX
-40: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX
-50: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX
-60: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX
-70: XX XX XX XX XX XX XX XX
-root@palmz72:/$ i2cdetect 0
-WARNING! This program can confuse your I2C bus, cause data loss and worse!
-I will probe file /dev/i2c-0.
-I will probe address range 0x03-0x77.
-Continue? [Y/n] y
-     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
-00:          XX XX XX XX XX XX XX XX XX XX XX XX XX
-10: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX
-20: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX
-30: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX
-40: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX
-50: 50 51 52 53 54 55 56 57 XX XX XX XX XX XX XX XX
-60: XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX
-70: XX XX XX XX XX XX XX XX
diff -ruN -X X hnd-linux-trunk/arch/arm/mach-pxa/palmz72/pxaci.c hnd-cleanup/arch/arm/mach-pxa/palmz72/pxaci.c
--- hnd-linux-trunk/arch/arm/mach-pxa/palmz72/pxaci.c	2007-09-17 22:44:32.000000000 +0400
+++ hnd-cleanup/arch/arm/mach-pxa/palmz72/pxaci.c	1970-01-01 03:00:00.000000000 +0300
@@ -1,134 +0,0 @@
-#include <linux/module.h>
-#include <linux/platform_device.h>
-#include <asm/arch/pxa-regs.h>
-#include <asm/arch/hardware.h>
-
-static int pxaci_enabled = 0;
-static DEFINE_MUTEX(enable_mutex);
-
-static void show_ci_regs(void)
-{
-	printk(KERN_INFO "CI regs:\nCICR0=%08x CICR1=%08x\nCICR2=%08x CICR3=%08x\nCICR4=%08x\n", CICR0, CICR1, CICR2, CICR3, CICR4);
-	printk(KERN_INFO "CISR=%08x\n", CISR);
-}
-
-static ssize_t pxaci_enable_show(struct device *dev,
-				   struct device_attribute *attr, char *buf)
-{
-	printk(KERN_INFO "PXACIF: read\n");
-	show_ci_regs();
-	return sprintf(buf, "%u\n", pxaci_enabled);
-}
-/*
-CICR0 = 0x800003f7 DMA_EN|~PAR_EN|~SL_CAP_EN|~ENB|~DIS|SIM=000 (master-parallel)|TOM|RDAVM|FEM|EOLM|PERRM|QDM|CDM|~SOFM|~EOFM
-CICR1 = 0x009f8412 ~TBIT|RGBT_CONV=00 (No) |
-CICR2 = 0
-CICR3 = 0x000000ef
-CICR4 = 0x00880001
-
-*/
-
-
-static ssize_t pxaci_enable_store(struct device *dev, struct device_attribute *attr,
-				    const char *buf, size_t count)
-{
-	int state;
-
-	printk(KERN_INFO "PXACIF: write\n");
-	show_ci_regs();
-	if (sscanf(buf, "%u", &state) != 1)
-		return -EINVAL;
-
-	if ((state != 1) && (state != 0))
-		return -EINVAL;
-
-	mutex_lock(&enable_mutex);
-	if (state != pxaci_enabled) {
-		pxaci_enabled = state;
-		pxa_set_cken(CKEN24_CAMERA, state);
-		if(pxaci_enabled) {
-			CICR0 = 0x3ff;
-			CICR1 = 0x009f8412;
-			CICR2 = 0x0;
-			CICR3 = 0xef;
-			CICR4 = 0x00880001;
-			CICR0 = CICR0_ENB|0x3ff;
-		} else {
-			CICR0 = 0x3ff;
-			CICR1 = 0x009f8412;
-			CICR2 = 0x0;
-			CICR3 = 0xef;
-			CICR4 = 0x00880001;
-		}
-	}
-	mutex_unlock(&enable_mutex);
-
-	return strnlen(buf, count);
-}
-
-static DEVICE_ATTR(enable, S_IRUGO | S_IWUSR, pxaci_enable_show, pxaci_enable_store);
-
-
-#ifdef CONFIG_PM
-static int pxaci_suspend(struct platform_device *pdev, pm_message_t state)
-{
-	pxa_set_cken(CKEN24_CAMERA, 0);
-	return 0;
-}
-
-static int pxaci_resume(struct platform_device *pdev)
-{
-	pxa_set_cken(CKEN24_CAMERA, pxaci_enabled);
-	return 0;
-}
-#else
-#define pxaci_suspend NULL
-#define pxaci_resume	NULL
-#endif
-
-
-static int pxaci_probe(struct platform_device *pdev)
-{
-	int ret;
-	pxa_set_cken(CKEN24_CAMERA, 0);
-	show_ci_regs();
-	ret = device_create_file(&pdev->dev, &dev_attr_enable);
-	printk(KERN_INFO "Initialized device PXACI\n");
-	return 0;
-}
-
-static int pxaci_remove(struct platform_device *pdev)
-{
-	pxa_set_cken(CKEN24_CAMERA, 0);
-	printk(KERN_INFO "Denitialized device PXACI\n");
-	return 0;
-}
-
-static struct platform_driver pxaci_driver = {
-	.probe		= pxaci_probe,
-	.remove		= pxaci_remove,
-	.suspend	= pxaci_suspend,
-	.resume		= pxaci_resume,
-	.driver		= {
-		.name	= "pxacif",
-	},
-};
-
-static int __init pxacif_init(void)
-{
-	int pdreg = platform_driver_register(&pxaci_driver);
-
-	return pdreg;
-}
-
-static void __exit pxacif_exit(void)
-{
-	platform_driver_unregister(&pxaci_driver);
-}
-
-module_init(pxacif_init);
-module_exit(pxacif_exit);
-
-MODULE_AUTHOR("Sergey Lapin <slapin@hackndev.com>");
-MODULE_DESCRIPTION("XScale Camera Interface Experiments Driver");
-MODULE_LICENSE("GPL");
diff -ruN -X X hnd-linux-trunk/arch/arm/mach-pxa/pxa27x.c hnd-cleanup/arch/arm/mach-pxa/pxa27x.c
--- hnd-linux-trunk/arch/arm/mach-pxa/pxa27x.c	2007-09-17 22:44:32.000000000 +0400
+++ hnd-cleanup/arch/arm/mach-pxa/pxa27x.c	2007-09-17 23:22:54.000000000 +0400
@@ -198,32 +198,6 @@
 	.resource       = pxa27x_ohci_resources,
 };
 
-static struct resource pxacamera_resources[] = {
-        [0] = {
-                .start  = 0x50000000,
-                .end    = 0x50000fff,
-                .flags  = IORESOURCE_MEM,
-        },
-        [1] = {
-                .start  = IRQ_CAMERA,
-                .end    = IRQ_CAMERA,
-                .flags  = IORESOURCE_IRQ,
-        },
-};
-
-static u64 pxa_camera_dmamask = 0xffffffffUL;
-
-static struct platform_device pxacamera_device = {
-        .name           = "pxa-camera",
-        .id             = -1, //check this
-        .dev            = {
-                .dma_mask = &pxa_camera_dmamask,
-                .coherent_dma_mask = 0xffffffff,
-	},
-	.num_resources  = ARRAY_SIZE(pxacamera_resources),
-        .resource       = pxacamera_resources,
-};
-
 void __init pxa_set_ohci_info(struct pxaohci_platform_data *info)
 {
 	ohci_device.dev.platform_data = info;
@@ -231,7 +205,6 @@
 
 static struct platform_device *devices[] __initdata = {
 	&ohci_device,
-	&pxacamera_device,
 };
 
 static int __init pxa27x_init(void)
diff -ruN -X X hnd-linux-trunk/arch/arm/Makefile hnd-cleanup/arch/arm/Makefile
--- hnd-linux-trunk/arch/arm/Makefile	2007-09-17 22:44:34.000000000 +0400
+++ hnd-cleanup/arch/arm/Makefile	2007-09-17 23:22:57.000000000 +0400
@@ -166,7 +166,7 @@
 endif
 
 # If we have a machine-specific directory, then include it in the build.
-core-y				+= arch/arm/kernel/ arch/arm/mm/ arch/arm/common/ arch/arm/armboot/
+core-y				+= arch/arm/kernel/ arch/arm/mm/ arch/arm/common/
 core-y				+= $(MACHINE)
 core-$(CONFIG_ARCH_S3C2410)	+= arch/arm/mach-s3c2400/
 core-$(CONFIG_ARCH_S3C2410)	+= arch/arm/mach-s3c2412/
diff -ruN -X X hnd-linux-trunk/arch/sh/kernel/process.c hnd-cleanup/arch/sh/kernel/process.c
--- hnd-linux-trunk/arch/sh/kernel/process.c	2007-09-17 22:45:30.000000000 +0400
+++ hnd-cleanup/arch/sh/kernel/process.c	2007-09-17 23:23:51.000000000 +0400
@@ -9,26 +9,22 @@
  *		     Copyright (C) 2006 Lineo Solutions Inc. support SH4A UBC
  *		     Copyright (C) 2002 - 2006  Paul Mundt
  */
-
 #include <linux/module.h>
 #include <linux/mm.h>
 #include <linux/elfcore.h>
 #include <linux/pm.h>
 #include <linux/kallsyms.h>
 #include <linux/kexec.h>
-
 #include <asm/uaccess.h>
 #include <asm/mmu_context.h>
 #include <asm/ubc.h>
 
 static int hlt_counter;
-
 int ubc_usercnt = 0;
 
 #define HARD_IDLE_TIMEOUT (HZ / 3)
 
 void (*pm_idle)(void);
-
 void (*pm_power_off)(void);
 EXPORT_SYMBOL(pm_power_off);
 
diff -ruN -X X hnd-linux-trunk/Documentation/filesystems/00-INDEX hnd-cleanup/Documentation/filesystems/00-INDEX
--- hnd-linux-trunk/Documentation/filesystems/00-INDEX	2007-09-17 22:44:03.000000000 +0400
+++ hnd-cleanup/Documentation/filesystems/00-INDEX	2007-09-17 23:22:25.000000000 +0400
@@ -84,8 +84,6 @@
 	- info and mount options for the UDF filesystem.
 ufs.txt
 	- info on the ufs filesystem.
-unionfs/
-	- info on the unionfs filesystem
 vfat.txt
 	- info on using the VFAT filesystem used in Windows NT and Windows 95
 vfs.txt
diff -ruN -X X hnd-linux-trunk/drivers/i2c/algos/i2c-algo-pxa.c hnd-cleanup/drivers/i2c/algos/i2c-algo-pxa.c
--- hnd-linux-trunk/drivers/i2c/algos/i2c-algo-pxa.c	2007-09-17 22:47:07.000000000 +0400
+++ hnd-cleanup/drivers/i2c/algos/i2c-algo-pxa.c	1970-01-01 03:00:00.000000000 +0300
@@ -1,360 +0,0 @@
-/*
- *  i2c-algo-pxa.c
- *
- *  I2C algorithm for the PXA I2C bus access.
- *  Byte driven algorithm similar to pcf.
- *
- *  Copyright (C) 2002 Intrinsyc Software Inc.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License version 2 as
- *  published by the Free Software Foundation.
- *
- *  History:
- *  Apr 2002: Initial version [CS]
- *  Jun 2002: Properly seperated algo/adap [FB]
- *  Jan 2003: added limited signal handling [Kai-Uwe Bloem]
- *  Jan 2003: allow SMBUS_QUICK as valid msg [FB]
- *  Jun 2003: updated for 2.5 [Dustin McIntire]
- *  ...: more updates for 2.6 [Holger Schurig]
- *
- */
-#include <linux/kernel.h>
-#include <linux/module.h>
-
-#include <linux/init.h>
-#include <linux/delay.h>
-#include <linux/errno.h>
-#include <linux/i2c.h>		/* struct i2c_msg and others */
-#include <linux/i2c-id.h>
-
-#include <asm/arch/i2c-pxa.h>
-
-/*
- * Set this to zero to remove all the debug statements via dead code elimination.
- */
-//#define DEBUG	999	
-
-static int pxa_scan = 1;
-
-static int i2c_pxa_readbytes(struct i2c_adapter *i2c_adap, char *buf,
-			int count, int last)
-{
-
-	int i, timeout=0;
-	struct i2c_algo_pxa_data *adap = i2c_adap->algo_data;
-	
-	/* increment number of bytes to read by one -- read dummy byte */
-	for (i = 0; i <= count; i++) {
-		if (i!=0) {
-			/* set ACK to NAK for last received byte ICR[ACKNAK] = 1
-			   only if not a repeated start */
-
-			if ((i == count) && last) {
-				adap->transfer( last, I2C_RECEIVE, 0);
-			} else {
-				adap->transfer( 0, I2C_RECEIVE, 1);
-			}
-
-			timeout = adap->wait_for_interrupt(I2C_RECEIVE);
-
-#ifdef DEBUG
-			if (timeout==BUS_ERROR) {
-				dev_dbg(&i2c_adap->dev, "read bus error, forcing reset\n");
-				adap->reset();
-				return I2C_RETRY;
-			} else
-#endif
-			if (timeout == -ERESTARTSYS) {
-				adap->abort();
-				return timeout;
-			} else
-			if (timeout) {
-				dev_dbg(&i2c_adap->dev, "read timeout, forcing reset\n");
-				adap->reset();
-				return I2C_RETRY;
-			}
-
-		}
-
-		if (i) {
-			buf[i - 1] = adap->read_byte();
-		} else {
-			adap->read_byte(); /* dummy read */
-		}
-	}
-	return (i - 1);
-}
-
-static int i2c_pxa_sendbytes(struct i2c_adapter *i2c_adap, const char *buf,
-			 int count, int last)
-{
-
-	struct i2c_algo_pxa_data *adap = i2c_adap->algo_data;
-	int wrcount, timeout;
-	
-	for (wrcount=0; wrcount<count; ++wrcount) {
-
-		adap->write_byte(buf[wrcount]);
-		if ((wrcount==(count-1)) && last) {
-			adap->transfer( last, I2C_TRANSMIT, 0);
-		} else {
-			adap->transfer( 0, I2C_TRANSMIT, 1);
-		}
-
-		timeout = adap->wait_for_interrupt(I2C_TRANSMIT);
-
-#ifdef DEBUG
-		if (timeout==BUS_ERROR) {
-			dev_dbg(&i2c_adap->dev, "send bus error, forcing reset\n");
-			adap->reset();
-			return I2C_RETRY;
-		} else
-#endif
-		if (timeout == -ERESTARTSYS) {
-			adap->abort();
-			return timeout;
-		} else
-		if (timeout) {
-			dev_dbg(&i2c_adap->dev, "send timeout, forcing reset\n");
-			adap->reset();
-			return I2C_RETRY;
-		}
-	}
-	return (wrcount);
-}
-
-
-static inline int i2c_pxa_set_ctrl_byte(struct i2c_algo_pxa_data * adap, struct i2c_msg *msg)
-{
-	u16 flags = msg->flags;
-	u8 addr;
-		
-	addr = (u8) ( (0x7f & msg->addr) << 1 );
-	if (flags & I2C_M_RD )
-		addr |= 1;
-	if (flags & I2C_M_REV_DIR_ADDR )
-		addr ^= 1;
-	adap->write_byte(addr);
-	return 0;
-}
-
-static int i2c_pxa_do_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg msgs[], int num)
-{
-	struct i2c_algo_pxa_data * adap;
-	struct i2c_msg *pmsg=NULL;
-	int i;
-	int ret=0, timeout;
-	
-	adap = i2c_adap->algo_data;
-
-	timeout = adap->wait_bus_not_busy();
-
-	if (timeout) {
-		return I2C_RETRY;
-	}
-
-	for (i = 0;ret >= 0 && i < num; i++) {
-		int last = i + 1 == num;
-		pmsg = &msgs[i];
-
-		ret = i2c_pxa_set_ctrl_byte(adap,pmsg);
-
-		/* Send START */
-		if (i == 0) {
-			adap->start();
-		} else {
-			adap->repeat_start();
-		}
-
-		adap->transfer(0, I2C_TRANSMIT, 0);
-
-		/* Wait for ITE (transmit empty) */
-		timeout = adap->wait_for_interrupt(I2C_TRANSMIT);
-
-#ifdef DEBUG
-		/* Check for ACK (bus error) */
-		if (timeout==BUS_ERROR) {
-			dev_dbg(&i2c_adap->dev, "xfer bus error, forcing reset\n");
-			adap->reset();
-			return I2C_RETRY;
-		} else
-#endif
-		if (timeout == -ERESTARTSYS) {
-			adap->abort();
-			return timeout;
-		} else
-		if (timeout) {
-			dev_dbg(&i2c_adap->dev, "xfer timeout, forcing reset\n");
-			adap->reset();
-			return I2C_RETRY;
-		}
-/* FIXME: handle arbitration... */
-#if 0
-		/* Check for bus arbitration loss */
-		if (adap->arbitration_loss()) {
-			printk("Arbitration loss detected \n");
-			adap->reset();
-			return I2C_RETRY;
-		}
-#endif
-
-		/* Read */
-		if (pmsg->flags & I2C_M_RD) {
-			/* read bytes into buffer*/
-			ret = i2c_pxa_readbytes(i2c_adap, pmsg->buf, pmsg->len, last);
-#if defined(DEBUG) && (DEBUG > 2)
-			if (ret != pmsg->len) {
-				int i=0;
-				dev_dbg(&i2c_adap->dev, "i2c_pxa_do_xfer read %d/%d bytes:",
-					ret, pmsg->len);
-                                for (i=0; i < pmsg->len; i++)
-                                        printk("0x%x ", pmsg->buf[i]);
-                                printk("\n");
-			} else {
-				int i=0;
-				dev_dbg(&i2c_adap->dev, "i2c_pxa_do_xfer: read %d bytes:",ret);
-                                for (i=0; i < pmsg->len; i++)
-		                        printk("0x%x ", pmsg->buf[i]);
-                                printk("\n");
-			}
-#endif
-		} else { /* Write */
-			ret = i2c_pxa_sendbytes(i2c_adap, pmsg->buf, pmsg->len, last);
-#if defined(DEBUG) && (DEBUG > 2)
-			if (ret != pmsg->len) {
-				int i=0;
-				dev_dbg(&i2c_adap->dev, "i2c_pxa_do_xfer wrote %d/%d bytes\n",
-					ret, pmsg->len);
-                                for (i=0; i < pmsg->len; i++)
-                                        printk("0x%x ", pmsg->buf[i]);
-                                printk("\n");
-			} else {
-				int i=0;
-				dev_info(&i2c_adap->dev, "i2c_pxa_do_xfer wrote %d bytes\n",ret);
-                                for (i=0; i < pmsg->len; i++)
-                                        printk("0x%x ", pmsg->buf[i]);
-                                printk("\n");
-
-			}
-#endif
-		}
-	}
-
-	if (ret<0) {
-		return ret;
-	} else {
-		return i;
-	}
-}
-
-static int i2c_pxa_valid_messages( struct device *dev, struct i2c_msg msgs[], int num)
-{
-	int i;
-	if (num < 1 || num > MAX_MESSAGES) {
-		dev_dbg(dev, "%d messages of max %d\n", num, MAX_MESSAGES);
-		return -EINVAL;
-	}
-
-	/* check consistency of our messages */
-	for (i=0; i<num; i++) {
-		if (&msgs[i]==NULL) {
-			dev_dbg(dev, "msgs is NULL\n");
-			return -EINVAL;
-		} else {
-			if (msgs[i].buf == NULL) {
-				dev_dbg(dev, "length less than zero");
-				return -EINVAL;
-			}
-		}
-	}
-
-	return 1;
-}
-
-static int i2c_pxa_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg msgs[], int num)
-{
-	int retval = i2c_pxa_valid_messages(&i2c_adap->dev, msgs, num);
-	
-	if (retval > 0)
-	{
-		int i;
-		for (i=i2c_adap->retries; i>=0; i--) {
-			int retval = i2c_pxa_do_xfer(i2c_adap,msgs,num);
-			if (retval != I2C_RETRY) {
-				return retval;
-			}
-			dev_dbg(&i2c_adap->dev, "retrying transmission\n");
-			udelay(100);
-		}
-		dev_dbg(&i2c_adap->dev, "retried %i times\n", i2c_adap->retries);
-		return -EREMOTEIO;
-
-	}
-	return retval;
-}
-
-static u32 i2c_pxa_functionality(struct i2c_adapter *adap)
-{
-	return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL | I2C_FUNC_PROTOCOL_MANGLING; 
-}
-
-
-
-struct i2c_algorithm i2c_pxa_algorithm  = {
-	.master_xfer   = i2c_pxa_xfer,
-	.functionality = i2c_pxa_functionality,
-};
-
-/*
- * registering functions to load algorithms at runtime
- */
-int i2c_pxa_add_bus(struct i2c_adapter *i2c_adap)
-{
-	struct i2c_algo_pxa_data *adap = i2c_adap->algo_data;
-	
-	i2c_adap->algo = &i2c_pxa_algorithm;
-
-	/* register new adapter to i2c module... */
-	i2c_add_adapter(i2c_adap);
-
-	adap->reset();
-
-	/* scan bus */
-	if (pxa_scan) {
-		int i;
-		for (i = 0x02; i < 0xff; i+=2) {
-			if (i==(I2C_PXA_SLAVE_ADDR<<1)) continue;
-
-			if (adap->wait_bus_not_busy()) {
-				dev_err(&i2c_adap->dev, "TIMEOUT while scanning bus\n");
-				return -EIO;
-			}
-			adap->write_byte(i);
-			adap->start();
-			adap->transfer(0, I2C_TRANSMIT, 0);
-
-			if ((adap->wait_for_interrupt(I2C_TRANSMIT) != BUS_ERROR)) {
-				dev_info(&i2c_adap->dev, "found device 0x%02x\n", i>>1);
-				adap->abort();
-			} else {
-				adap->stop();
-			}
-			udelay(adap->udelay);
-		}
-	}
-	return 0;
-}
-
-int i2c_pxa_del_bus(struct i2c_adapter *i2c_adap)
-{
-	return i2c_del_adapter(i2c_adap);
-}
-EXPORT_SYMBOL(i2c_pxa_add_bus);
-EXPORT_SYMBOL(i2c_pxa_del_bus);
-
-module_param(pxa_scan, bool, 0);
-MODULE_PARM_DESC(pxa_scan, "Scan for active chips on the bus");
-
-MODULE_AUTHOR("Intrinsyc Software Inc.");
-MODULE_LICENSE("GPL");
diff -ruN -X X hnd-linux-trunk/drivers/i2c/algos/Kconfig hnd-cleanup/drivers/i2c/algos/Kconfig
--- hnd-linux-trunk/drivers/i2c/algos/Kconfig	2007-09-17 22:47:07.000000000 +0400
+++ hnd-cleanup/drivers/i2c/algos/Kconfig	2007-09-17 23:25:44.000000000 +0400
@@ -42,17 +42,6 @@
 	tristate "MPC8xx CPM I2C interface"
 	depends on 8xx && I2C
 
-config I2C_ALGOPXA
-	tristate "PXA I2C Algorithm"
-	depends on ARCH_PXA && I2C
-	help
-	  This supports the use of the PXA I2C interface found on XScale
-	  processors. Say Y if you have one of these. You should also say Y
-	  for the PXA I2C peripheral driver support below.
-
-	  This support is also available as a module.  If so, the module
-	  will be called i2c-algo-pxa.
-
 config I2C_ALGO_SGI
 	tristate "I2C SGI interfaces"
 	depends on I2C && (SGI_IP22 || SGI_IP32 || X86_VISWS)
diff -ruN -X X hnd-linux-trunk/drivers/i2c/algos/Makefile hnd-cleanup/drivers/i2c/algos/Makefile
--- hnd-linux-trunk/drivers/i2c/algos/Makefile	2007-09-17 22:47:07.000000000 +0400
+++ hnd-cleanup/drivers/i2c/algos/Makefile	2007-09-17 23:25:44.000000000 +0400
@@ -6,7 +6,6 @@
 obj-$(CONFIG_I2C_ALGOPCF)	+= i2c-algo-pcf.o
 obj-$(CONFIG_I2C_ALGOPCA)	+= i2c-algo-pca.o
 obj-$(CONFIG_I2C_ALGO_SGI)	+= i2c-algo-sgi.o
-obj-$(CONFIG_I2C_PXA)		+= i2c-algo-pxa.o
 
 ifeq ($(CONFIG_I2C_DEBUG_ALGO),y)
 EXTRA_CFLAGS += -DDEBUG
diff -ruN -X X hnd-linux-trunk/drivers/i2c/chips/adcm2650-i2c.c hnd-cleanup/drivers/i2c/chips/adcm2650-i2c.c
--- hnd-linux-trunk/drivers/i2c/chips/adcm2650-i2c.c	2007-09-17 22:47:09.000000000 +0400
+++ hnd-cleanup/drivers/i2c/chips/adcm2650-i2c.c	1970-01-01 03:00:00.000000000 +0300
@@ -1,269 +0,0 @@
-/* 
-    i2c-adcm2650 - ADCM 2650 CMOS sensor I2C client driver
-
-    Copyright (C) 2003, Intel Corporation
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/slab.h>
-#include <linux/init.h>
-#include <linux/i2c.h>
-#include <asm/hardware.h>
-#include <asm/types.h>
-//#include <linux/i2c-sensor.h>
-#include "adcm2650-i2c.h"
-
-#define I2C_NAME(s) (s)->name
-
-int i2c_adcm2650_probe(struct i2c_adapter *adapter);
-extern int i2c_adapter_id(struct i2c_adapter *adap);
-int i2c_adcm2650_attach_client(struct i2c_adapter *adapter, int address, int kind);
-void i2c_adcm2650_cleanup(void);
-int i2c_adcm2650_detach(struct i2c_client *client);
-
-static struct i2c_driver adcm2650_driver  = 
-{
-	.owner          		= THIS_MODULE,
-	.name =				"adcm2650 driver",		/* name           */
-	.id =				I2C_DRIVERID_ADCM2650, 		/* id             */
-	.flags =			I2C_DF_NOTIFY,        		/* flags          */
-	.attach_adapter =		&i2c_adcm2650_probe,   /* attach_adapter */
-	.detach_client =		&i2c_adcm2650_detach,    /* detach_client  */
-	.command =			NULL,
-};
-
-extern  struct i2c_adapter *i2cdev_adaps[];
-/* Unique ID allocation */
-static int adcm2650_id = 0;
-static struct i2c_client *g_client;
-static unsigned short normal_i2c[] = { 0x52,I2C_CLIENT_END };
-static unsigned short normal_i2c_range[] = { I2C_CLIENT_END }; 
-static unsigned short probe[2] = { I2C_CLIENT_END , I2C_CLIENT_END };
-static unsigned short probe_range[2] = { I2C_CLIENT_END , I2C_CLIENT_END };
-static unsigned short ignore[2] = { I2C_CLIENT_END , I2C_CLIENT_END };
-static unsigned short ignore_range[2] = { I2C_CLIENT_END, I2C_CLIENT_END };
-static unsigned short force[2] = { I2C_CLIENT_END , I2C_CLIENT_END };
-
-//I2C_CLIENT_INSMOD;
-static struct i2c_client_address_data addr_data = {
-        .normal_i2c             = normal_i2c,
-        .probe                  = probe,
-        .ignore                 = ignore,
-};
-
-static int ChgBlockAddr(u8 block)
-{
-	struct adcm2650_data *p;
-	int	res;
-	p = i2c_get_clientdata(g_client);
-	
-	down(&p->update_lock);
-	/*	FIXME:	Shall we change the g_client->addr?	*/
-	g_client->addr = PIPE_SLAVE_ADDR;	
-	res = i2c_smbus_write_byte_data(g_client, BLOCK_SWITCH_CMD, block);
-	p->blockaddr = block;
-	up( &p->update_lock);
-	return res;
-}
-
-int adcm2650_read(u16 addr, u16 *pvalue)
-{
-	int	res=0;
-	struct 	adcm2650_data *p;
-	u8	blockaddr = BLOCK(addr);
-	u8	offset;
-	
-	if( g_client == NULL )	/*	No global client pointer?	*/
-		return -1;
-
-	p = i2c_get_clientdata(g_client);
-
-	//if( p->blockaddr != blockaddr )
-	res = ChgBlockAddr( blockaddr);
-	
-	if( res !=0 )  {
-		printk("Change block address failed. block = %2x \n", blockaddr);
-		return -1;
-	}
-	offset = (addr << 1) & 0xff;
-	res = i2c_smbus_read_word_data(g_client, offset);
-	printk("adcm2650_read: read 0x%x at offset 0x%x\n", res, offset);
-	*pvalue = (u16)res;
-	return res;
-}	
-
-int adcm2650_write(u16 addr, u16 value)
-{
-	int	res=0;
-	struct adcm2650_data *p;
-	u8	blockaddr = BLOCK(addr);
-	u8 	offset;
-	
-	if( g_client == NULL )	/*	No global client pointer?	*/
-		return -1;
-
-	p = i2c_get_clientdata(g_client);
-	//if( p->blockaddr != blockaddr )
-	res = ChgBlockAddr( blockaddr );
-	
-	if( res !=0 )  {
-		printk("Change block address failed. block = %2x \n", blockaddr);
-		return -1;
-	}
-	offset = (addr << 1) & 0xff;
-	printk("adcm2650_write: writing 0x%x at offset 0x%x\n", value, offset);
-	return i2c_smbus_write_word_data(g_client, offset, value );
-}	
-
-
-int i2c_adcm2650_read(struct i2c_client *client, u8 reg)
-{
-	return i2c_smbus_read_word_data(client,reg);
-	//  return i2c_smbus_read_byte_data(client,reg);
-}
-
-int i2c_adcm2650_write(struct i2c_client *client, u8 reg, u16 value)
-{
-	return i2c_smbus_write_word_data(client,reg,value);
-}
-
-
-int i2c_adcm2650_detect_client(struct i2c_adapter *adapter, int address, int kind)
-{
-	struct i2c_client *new_client;
-	int err = 0;
-	struct adcm2650_data *data;
-	printk("detected ADCM2650 at addr 0x%x i2c-bus %s\n",
-			                address, adapter->name);
-	/* Let's see whether this adapter can support what we need.
-          Please substitute the things you need here!  */
-	if ( !i2c_check_functionality(adapter,I2C_FUNC_SMBUS_WORD_DATA) ) {
-		printk(KERN_INFO "Word op is not permited.\n");
-		goto ERROR0;
-	}
-
-	/* OK. For now, we presume we have a valid client. We now create the
-          client structure, even though we cannot fill it completely yet.
-          But it allows us to access several i2c functions safely */
-    
-	/* Note that we reserve some space for adcm2650_data too. If you don't
-          need it, remove it. We do it here to help to lessen memory
-          fragmentation. */
-
-	new_client=kmalloc(sizeof(struct i2c_client), GFP_KERNEL );
-
-	if ( !new_client )  {
-       	err = -ENOMEM;
-	        goto ERROR0;
-       }
-	memset(new_client, 0, sizeof(struct i2c_client));
-	data = kmalloc(sizeof(struct adcm2650_data), GFP_KERNEL);
-	if (data == NULL) {
-		kfree(new_client);
-		return -ENOMEM;
-	}
-	memset(data, 0, sizeof(struct adcm2650_data));
-	new_client->addr = address;	
-	i2c_set_clientdata(new_client, data);
-        new_client->adapter = adapter;
-        new_client->driver = &adcm2650_driver;
-        new_client->flags = I2C_CLIENT_ALLOW_USE; //new_client->flags = 0;
-
-    	g_client = new_client;
-
-    	/* Now, we do the remaining detection. If no `force' parameter is used. */
-
-	data->valid = 0; /* Only if you use this field */
-	
-	init_MUTEX(&data->update_lock); /* Only if you use this field */
-
-    	/* Tell the i2c layer a new client has arrived */
-    	if ((err = i2c_attach_client(new_client)))
-      		goto ERROR3;
-    	
-	return 0;
-
-    	/* OK, this is not exactly good programming practice, usually. But it is
-          very code-efficient in this case. */
-
-ERROR3:
-//ERROR1:
-      	kfree(new_client);
-ERROR0:
-	return err;
-}
-
-
-int i2c_adcm2650_probe(struct i2c_adapter *adap)
-{
-//        printk(KERN_INFO "In function %s.\n", __FUNCTION__);
-        return i2c_probe(adap, &addr_data, i2c_adcm2650_detect_client);
-}
-
-
-int i2c_adcm2650_detach(struct i2c_client *client)
-{
-	int err;
-    	
-	/* Try to detach the client from i2c space */
-    	if ((err = i2c_detach_client(client))) {
-      		printk("adcm2650.o: Client deregistration failed, client not detached.\n");
-	      	return err;
-    	}
-
-    	kfree(client); /* Frees client data too, if allocated at the same time */
-    	g_client = NULL;
-    	return 0;
-}
-
-/* 	Keep track of how far we got in the initialization process. If several
-	things have to initialized, and we fail halfway, only those things
-	have to be cleaned up! */
-static int adcm2650_initialized = 0;
-
-int i2c_adcm2650_init(void)
-{
-	int res;
-	
-	if (!adcm2650_initialized ){
-		if ( (res = i2c_add_driver(&adcm2650_driver)) ) {
-			printk("adcm2650: Driver registration failed, module not inserted.\n");
-			i2c_adcm2650_cleanup();
-			return res;
-		}
-	}
-	adcm2650_initialized ++;
-	return 0;
-}
-
-void i2c_adcm2650_cleanup(void)
-{
-	if (adcm2650_initialized == 1) {
-		if ((i2c_del_driver(&adcm2650_driver))) {
-			printk("adcm2650: Driver registration failed, module not removed.\n");
-		}
-	}
-	adcm2650_initialized --;
-}
-
-MODULE_LICENSE("GPL");
-
-EXPORT_SYMBOL(i2c_adcm2650_init);
-EXPORT_SYMBOL(adcm2650_write);
-EXPORT_SYMBOL(adcm2650_read);
-EXPORT_SYMBOL(i2c_adcm2650_cleanup);
diff -ruN -X X hnd-linux-trunk/drivers/i2c/chips/adcm2650-i2c.h hnd-cleanup/drivers/i2c/chips/adcm2650-i2c.h
--- hnd-linux-trunk/drivers/i2c/chips/adcm2650-i2c.h	2007-09-17 22:47:09.000000000 +0400
+++ hnd-cleanup/drivers/i2c/chips/adcm2650-i2c.h	1970-01-01 03:00:00.000000000 +0300
@@ -1,53 +0,0 @@
-/* 
-    i2c-adcm2650 - ADCM 2650 CMOS sensor I2C client driver
-
-    Copyright (C) 2003, Intel Corporation
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-
-#ifndef  _I2C_ADCM2650_H_
-#define  _I2C_ADCM2650_H_
-/* Calculating the Module Block Number */
-#define BLOCK(a)    (u8)((a) >> 7)      /* register's module block address. */
-#define OFFSET(a)   (u8)((a) & 0x7F )   /* register's offset to this block. */
-
-/*  Update the block address.*/
-#define BLOCK_SWITCH_CMD    0xFE
-#define PIPE_SLAVE_ADDR     0x0052
-#define SENSOR_SLAVE_ADDR   0x0055
-
-//#define DEBUG
-#define I2C_DRIVERID_ADCM2650   I2C_DRIVERID_EXP1
-/* Register definitions in ADCM2650's chip. */
-#define REV     0x0
-
-struct adcm2650_data {
-    /*
-     *  Because the i2c bus is slow, it is often useful to cache the read
-     *  information of a chip for some time (for example, 1 or 2 seconds).
-     *  It depends of course on the device whether this is really worthwhile
-     *  or even sensible.
-     */
-    struct semaphore update_lock; /* When we are reading lots of information,
-                                     another process should not update the
-                                     below information */
-    char valid;                   /* != 0 if the following fields are valid. */
-    int  blockaddr;                  /*  current using block address.    */
-    unsigned long last_updated;   /* In jiffies */
-};
-
-#endif
diff -ruN -X X hnd-linux-trunk/drivers/i2c/chips/i2c-ov9640.c hnd-cleanup/drivers/i2c/chips/i2c-ov9640.c
--- hnd-linux-trunk/drivers/i2c/chips/i2c-ov9640.c	2007-09-17 22:47:09.000000000 +0400
+++ hnd-cleanup/drivers/i2c/chips/i2c-ov9640.c	1970-01-01 03:00:00.000000000 +0300
@@ -1,396 +0,0 @@
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/slab.h>
-#include <linux/init.h>
-#include <linux/i2c.h>
-#include <asm/hardware.h>
-#include <asm/types.h>
-#include <linux/delay.h>
-#include <asm/arch/palmz72-gpio.h>
-
-#include "i2c-ov9640.h"
-#include "ov9640_hw.h"
-
-#define DEBUG 1
-#define DPRINTK(fmt,args...)	do { if (DEBUG) printk("in function %s "fmt,__FUNCTION__,##args);} while(0)
-extern int i2c_adapter_id(struct i2c_adapter *adap);
-
-void i2c_ov9640_cleanup(void);
-static int  i2c_ov9640_attach_adapter(struct i2c_adapter *adapter);
-static int  i2c_ov9640_detect_client(struct i2c_adapter *, int, int);
-static int  i2c_ov9640_detach_client(struct i2c_client *client);
-
-struct i2c_driver ov9640_driver  = 
-{
-	.driver = {
-		    .name = "i2c-ov9640",	            /* name           */
-	},
-	.attach_adapter = 	&i2c_ov9640_attach_adapter,       /* attach_adapter */
-	.detach_client = 	&i2c_ov9640_detach_client,        /* detach_client  */
-};
-
-extern  struct i2c_adapter *i2cdev_adaps[];
-struct i2c_client *g_client = NULL;
-static unsigned short normal_i2c[] = {OV9640_SLAVE_ADDR ,I2C_CLIENT_END };
-/* static unsigned short normal_i2c_range[] = { I2C_CLIENT_END }; */
-I2C_CLIENT_INSMOD;
-
-char ov9640_read(u8 addr, u8 *pvalue)
-{
-	int	res = 0;
-	char 	buf = 0;
-	struct i2c_msg msgs[2];
-	struct ov9640_data * p;
-	
-	if( g_client == NULL )	
-		return -1;
-	p = i2c_get_clientdata(g_client);
-
-	msgs[0].addr = g_client->addr;
-	msgs[0].flags = 0;
-	msgs[0].len = 1;
-	msgs[0].buf = &addr;
-
-	msgs[1].addr = g_client->addr;
-	msgs[1].flags = I2C_M_RD;
-	msgs[1].len = 1;
-	msgs[1].buf = &buf;
-	
-	down(&p->update_lock);
-	res=i2c_transfer(g_client->adapter,&msgs[0],1);
-	if (res<=0) 
-		goto out;
-	res=i2c_transfer(g_client->adapter,&msgs[1],1);
-	if (res<=0) 
-		goto out;
-	*pvalue = buf;
-	up(&p->update_lock);
-out:
-	DPRINTK(KERN_INFO "In funtion %s addr:%x,value=%x\n", __FUNCTION__, addr,*pvalue);
-	if (res<=0) DPRINTK("res = %d \n",res);
-	return res;
-}	
-
-int ov9640_write(u8 addr, u8 value)
-{
-	int res = 0;
-	char buf[2] = {addr, value};
-
-	struct ov9640_data * p;
-	if( g_client == NULL )
-		return -1;
-	p = i2c_get_clientdata(g_client);
-	if(!p)
-	    return -1;
-	down(&p->update_lock);
-	res = i2c_master_send(g_client, buf, 2);
-	up(&p->update_lock);
-	if (res >0) res =0;
-	else res =-1;
-	DPRINTK(KERN_INFO "In funtion %s addr:%x value:%xreturn %d \n", __FUNCTION__, addr,value,res);
-	return res;
-}	
-
-
-int i2c_ov9640_read(struct i2c_client *client, u8 reg)
-{
-	unsigned char msgbuf=0;
-	DPRINTK("in function %s\n",__FUNCTION__);
-	i2c_master_recv(client,&msgbuf,1);
-	return msgbuf;
-}
-
-int i2c_ov9640_write(struct i2c_client *client, u8 reg, u16 value)
-{
-    return i2c_smbus_write_word_data(client,reg,value);
-}
-
-
-int i2c_ov9640_attach_adapter(struct i2c_adapter *adap)
-{
-	DPRINTK("In function %s.\n", __FUNCTION__);
-	return i2c_probe(adap,&addr_data,i2c_ov9640_detect_client);
-}
-
-#if 0
-static int a780_camera_adapter_attach(struct i2c_adapter *adap)
-{
-	if(! (a780_camera_client = kmalloc(sizeof(struct i2c_client),GFP_KERNEL)))
-		return -ENOMEM;
-	memcpy(a780_camera_client,&client_template,sizeof(struct i2c_client));
-	a780_camera_client->adapter = adap;
-        
-	a780_camera_client->addr = 0x5D;
-	
-	i2c_attach_client(a780_camera_client);
-	return 0;
-}	
-
-#endif
-
-static int i2c_ov9640_detect_client(struct i2c_adapter *adapter, int address,  int kind)
-{
-    struct i2c_client *new_client;
-    int err = 0;
-    char res = -1;
-    struct ov9640_data *data;
-    
-    /*check if */
-    if(g_client != NULL) {
-      err = -ENXIO;
-      goto ERROR0;
-    }
- 
-
-	DPRINTK(KERN_INFO "In funtion %s. address=0X%X\n", __FUNCTION__, address);
-    /* Let's see whether this adapter can support what we need.
-       Please substitute the things you need here!  */
-	if ( !i2c_check_functionality(adapter,I2C_FUNC_SMBUS_WORD_DATA) ) {
-		DPRINTK(KERN_INFO "Word op is not permited.\n");
-		goto ERROR0;
-	}
-
-    /* OK. For now, we presume we have a valid client. We now create the
-       client structure, even though we cannot fill it completely yet.
-       But it allows us to access several i2c functions safely */
-    
-    /* Note that we reserve some space for ov9640_data too. If you don't
-       need it, remove it. We do it here to help to lessen memory
-       fragmentation. */
-
-    new_client=kzalloc(sizeof(struct i2c_client), GFP_KERNEL);
-
-    if ( !new_client )  {
-      err = -ENOMEM;
-      goto ERROR0;
-    }
-    data=kzalloc(sizeof(struct ov9640_data), GFP_KERNEL );
-
-    if ( !new_client )  {
-      err = -ENOMEM;
-      goto ERROR0;
-    }
-
-	new_client->addr = address;	
-	new_client->adapter = adapter;
-	new_client->driver = &ov9640_driver;
-	new_client->flags = 0;
-	init_MUTEX(&data->update_lock); 
-	i2c_set_clientdata(new_client, data);
-
-	g_client = new_client;
-	ov9640_power_down(0);
-	mdelay(1);
-
-    /* Now, we do the remaining detection. If no `force' parameter is used. */
-
-    /* First, the generic detection (if any), that is skipped if any force
-       parameter was used. */
-	mdelay(2000);
-	ov9640_read(REV,&res);
-	/* The below is of course bogus */
-	DPRINTK("I2C: Probe ov9640 chip..addr=0x%x, REV=%d, res=0x%x\n", address, REV, res);
-
-	if (kind <= 0) {
-                 char res = -1;
-		mdelay(2000);
-		 ov9640_read(REV,&res);
-		/* The below is of course bogus */
-		DPRINTK("I2C: Probe ov9640 chip..addr=0x%x, REV=%d, res=0x%x\n", address, REV, res);
-                /*ov9640 chip id is 0x9648
-                 if(res != OV9640_CHIP_ID) {
-			DPRINTK(KERN_WARNING "Failed.product id =%d \n",res);
-			goto ERROR1;
-		 }		 
-		else {
-                       DPRINTK("OV9640 chip id is 0X%04X\n", OV9640_CHIP_ID);
-			if ( ov9640_id == 0 )
-				DPRINTK(" detected.\n");
-		}*/
-	}
-
-	strcpy(new_client->name, "i2c-ov9640");
-
-    /* Only if you use this field */
-	data->valid = 0; 
-
-
-    /* Tell the i2c layer a new client has arrived */
-    if ((err = i2c_attach_client(new_client)))
-      goto ERROR3;
-
-    /* This function can write default values to the client registers, if
-       needed. */
-	/*	ov9640_init_client(new_client);	*/
-    return 0;
-
-    /* OK, this is not exactly good programming practice, usually. But it is
-       very code-efficient in this case. */
-
-ERROR3:
-      kfree(new_client);
-      g_client = NULL;
-ERROR0:
-      return err;
-}
-
-int i2c_ov9640_detach_client(struct i2c_client *client)
-{
-	int err;
-
-    /* Try to detach the client from i2c space */
-    if ((err = i2c_detach_client(client))) {
-      DPRINTK("i2c-ov9640.o: Client deregistration failed, client not detached.\n");
-      return err;
-    }
-
-    kfree(client); /* Frees client data too, if allocated at the same time */
-    g_client = NULL;
-    return 0;
-}
-
-/* 	Keep track of how far we got in the initialization process. If several
-	things have to initialized, and we fail halfway, only those things
-	have to be cleaned up! */
-static int ov9640_initialized = 0;
-
-
-
-/***********************************************************************
-*  Power & Reset
-***********************************************************************/
-
-
-
-#if 0
-static struct i2c_driver driver = {
-	.name		= "a780 camera driver",
-	.id		= I2C_A780_CAMERA,
-	//flags:           I2C_DF_DUMMY,
-	.attach_adapter	= a780_camera_adapter_attach,        
-	.detach_client	= a780_camera_detach,
-	.owner		= THIS_MODULE,
-};
-
-static struct i2c_adapter a780_camera_adapter = {
-        name:                   "a780 camera adapter",
-        id:                     I2C_A780_CAMERA,
-        client_register:        a780_camera_client_register,
-        client_unregister:      a780_camera_client_unregister,
-};
-static struct i2c_client client_template =
-{
-    name:   "(unset)",        
-    adapter:&a780_camera_adapter,
-};
-struct i2c_client *a780_camera_client;
-
-int ov9640_write(u8 addr, u8 value)
-{
-    char    tmp[2]={addr, value};
-    int     ret;
-    unsigned int flags;
-		
-    ret = a780_camera_write(tmp, 2);
-    local_irq_save(flags)
-    enable_irq(IRQ_I2C);
-	ret = i2c_master_send(a780_camera_client, buf, count);
-    local_irq_restore(flags);
-    if(ret < 0)
-    {
-        err_print("i2c write error code =%d", ret);
-        return -EIO;
-    }
-
-    ddbg_print("addr = 0x%02x, value = 0x%02x", addr,value);
-    return 0;
-}
-#endif
-
-
-void ov9640_soft_reset(void)
-{
-	u8 regValue;
-	regValue = 0x80;
-	ov9640_write(OV9640_COM7, regValue);
-	mdelay(10);
-	return;
-}
-
-void ov9640_power_down(int powerDown)
-{
-	// OV9640 PWRDWN, 0 = NORMAL, 1=POWER DOWN
-	//GPDR1 |= GPIO_bit(50);
-	//OV9640 reset CIF_RST, 0 = NORMAL, 1=RESET
-	//GPDR0 |= GPIO_bit(19);
-	if (powerDown == 1) {
-		mdelay(200);
-		ov9640_soft_reset();
-		ov9640_write(0x39, 0xf4);
-		ov9640_write(0x1e, 0x80);
-		ov9640_write(0x6b, 0x3f);
-		ov9640_write(0x36, 0x49);
-		ov9640_write(0x12, 0x05);
-		mdelay(800);
-		ov9640_set_powerdown_gpio();
-	}
-	else {
-		ov9640_write(0x39, 0xf0);
-		ov9640_write(0x1e, 0x00);
-		ov9640_write(0x6b, 0x3f);
-		ov9640_write(0x36, 0x49);
-		ov9640_write(0x12, 0x10);
-		ov9640_clear_powerdown_gpio();
-		//GPSR0 = GPIO_bit(19);
-		mdelay(20);
-		//GPCR0 = GPIO_bit(19);
-	}
-	mdelay(100);
-}
-
-int i2c_ov9640_init(void)
-{
-	int res;
-
-	if (ov9640_initialized) 
-		return 0;
-//	SET_GPIO(112, 1);
-	DPRINTK("I2C: driver for device ov9640.\n");
-
-	ov9640_gpio_init();
-
-	if ( (res = i2c_add_driver(&ov9640_driver)) ) {
-		DPRINTK("i2c-ov9640: Driver registration failed, module not inserted.\n");
-		i2c_ov9640_cleanup();
-		return res;
-	}
-	ov9640_initialized ++;
-        if(g_client != NULL) {
-   	   DPRINTK("I2C: driver for device %s registed!.\n", g_client->name);
-	} else {
-           DPRINTK("I2C: driver for device unregisted!.\n");
-	}
-	return 0;
-}
-
-void i2c_ov9640_cleanup(void)
-{
-//	SET_GPIO(112, 0);
-	if (ov9640_initialized == 1) {
-		if (i2c_del_driver(&ov9640_driver)) {
-			DPRINTK("i2c-ov9640: Driver registration failed, module not removed.\n");
-			return;
-		}
-		ov9640_initialized --;
-	}
-}
-
-
-//EXPORT_SYMBOL(i2c_ov9640_init);
-EXPORT_SYMBOL(ov9640_write);
-EXPORT_SYMBOL(ov9640_read);
-//EXPORT_SYMBOL(i2c_ov9640_cleanup);
-module_init(i2c_ov9640_init);
-module_exit(i2c_ov9640_cleanup);
-MODULE_LICENSE("GPL");
-
diff -ruN -X X hnd-linux-trunk/drivers/i2c/chips/i2c-ov9640.h hnd-cleanup/drivers/i2c/chips/i2c-ov9640.h
--- hnd-linux-trunk/drivers/i2c/chips/i2c-ov9640.h	2007-09-17 22:47:09.000000000 +0400
+++ hnd-cleanup/drivers/i2c/chips/i2c-ov9640.h	1970-01-01 03:00:00.000000000 +0300
@@ -1,47 +0,0 @@
-#ifndef  __I2C_OV9640_H__
-#define  __I2C_OV9640_H__
-
-#ifndef DEBUG
-#define DEBUG
-#endif
-
-/* Calculating the Module Block Number */
-#define BLOCK(a)    (u8)((a) >> 7)      /* register's module block address. */
-#define OFFSET(a)   (u8)((a) & 0x7F )   /* register's offset to this block. */
-
-/*  Update the block address.*/
-#define BLOCK_SWITCH_CMD    0xFE
-
-#define OV9640_SLAVE_ADDR (0x60>>1)	/* 60 for write , 61 for read */
-// #define SENSOR_SLAVE_ADDR   0x0055      /* tbd: */
-
-
-#define I2C_DRIVERID_OV9640   I2C_DRIVERID_EXP2
-
-/*ov9640 chip id*/
-#define OV9640_CHIP_ID  0x9648
-
-/* Register definitions in OV9640's chip. */
-#define PID	0xA
-#define REV     0xA
-
-struct ov9640_data {
-    /*
-     *  Because the i2c bus is slow, it is often useful to cache the read
-     *  information of a chip for some time (for example, 1 or 2 seconds).
-     *  It depends of course on the device whether this is really worthwhile
-     *  or even sensible.
-     */
-    struct semaphore update_lock; /* When we are reading lots of information,
-                                     another process should not update the
-                                     below information */
-
-    char valid;                   /* != 0 if the following fields are valid. */
-    int  blockaddr;               /* current using block address.    */
-    unsigned long last_updated;   /* In jiffies */
-};
-void ov9640_gpio_init(void);
-void ov9640_set_powerdown_gpio();
-void ov9640_clear_powerdown_gpio();
-#endif
-
diff -ruN -X X hnd-linux-trunk/drivers/i2c/chips/i2c-ov96xx.c hnd-cleanup/drivers/i2c/chips/i2c-ov96xx.c
--- hnd-linux-trunk/drivers/i2c/chips/i2c-ov96xx.c	2007-09-17 22:47:09.000000000 +0400
+++ hnd-cleanup/drivers/i2c/chips/i2c-ov96xx.c	1970-01-01 03:00:00.000000000 +0300
@@ -1,254 +0,0 @@
-/*
- *  i2c-ov96xx.c - Omnivision 9640, 9650 CMOS sensor I2C adapter
- *
- *  Copyright (C) 2003 Intel Corporation
- *  Copyright (C) 2004 Motorola Inc.
- *  Copyright (C) 2007 Philipp Zabel <philipp.zabel@gmail.com>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-#include <linux/delay.h>
-#include <linux/i2c.h>
-#include <linux/kernel.h>
-#include <linux/module.h>
-
-#include <asm/hardware.h>
-#include <asm/types.h>
-
-#include "i2c-ov96xx.h"
-
-#define DEBUG 1
-#define DPRINTK(fmt,args...) \
-	do { if (DEBUG) printk("in function %s "fmt,__FUNCTION__,##args);} while(0)
-
-extern struct i2c_adapter *i2cdev_adaps[];
-struct i2c_client *g_client = NULL;
-static unsigned short normal_i2c[] = { OV96xx_SLAVE_ADDR, I2C_CLIENT_END };
-I2C_CLIENT_INSMOD;
-
-int i2c_ov96xx_read(u8 addr, u8 *pvalue)
-{
-	int	res = 0;
-	char 	buf = 0;
-	struct i2c_msg msgs[2];
-	struct ov96xx_data * p;
-	
-	if( g_client == NULL )	
-		return -1;
-	p = i2c_get_clientdata(g_client);
-
-	msgs[0].addr = g_client->addr;
-	msgs[0].flags = 0;
-	msgs[0].len = 1;
-	msgs[0].buf = &addr;
-
-	msgs[1].addr = g_client->addr;
-	msgs[1].flags = I2C_M_RD;
-	msgs[1].len = 1;
-	msgs[1].buf = &buf;
-	
-	down(&p->update_lock);
-	res=i2c_transfer(g_client->adapter,&msgs[0],1);
-	if (res<=0) 
-		goto out;
-	res=i2c_transfer(g_client->adapter,&msgs[1],1);
-	if (res<=0) 
-		goto out;
-	*pvalue = buf;
-	up(&p->update_lock);
-out:
-//	DPRINTK(KERN_INFO "In funtion %s addr:%x,value=%x\n", __FUNCTION__, addr,*pvalue);
-//	if (res<=0) DPRINTK("res = %d \n",res);
-	return res;
-}	
-
-int i2c_ov96xx_write(u8 addr, u8 value)
-{
-	int res = 0;
-	char buf[2] = {addr, value};
-
-	struct ov96xx_data * p;
-	if( g_client == NULL )
-		return -1;
-	p = i2c_get_clientdata(g_client);
-	if(!p)
-	    return -1;
-	down(&p->update_lock);
-	res = i2c_master_send(g_client, buf, 2);
-	up(&p->update_lock);
-	if (res >0) res =0;
-	else res =-1;
-	DPRINTK("addr:%x value:%xreturn %d \n", addr,value,res);
-	return res;
-}	
-
-static struct i2c_driver ov96xx_i2c_driver;
-
-static int i2c_ov96xx_detect_client(struct i2c_adapter *adapter, int address,  int kind)
-{
-	struct i2c_client *new_client;
-	int err = 0;
-	char res = -1;
-	struct ov96xx_data *data;
-    
-	if (g_client != NULL) {
-		err = -ENXIO;
-		goto ERROR0;
-	}
-
-	DPRINTK("address=0X%X\n", address);
-    /* Let's see whether this adapter can support what we need.
-       Please substitute the things you need here!  */
-	if ( !i2c_check_functionality(adapter,I2C_FUNC_SMBUS_WORD_DATA) ) {
-		DPRINTK("Word op is not permited.\n");
-		goto ERROR0;
-	}
-
-    /* OK. For now, we presume we have a valid client. We now create the
-       client structure, even though we cannot fill it completely yet.
-       But it allows us to access several i2c functions safely */
-    
-    /* Note that we reserve some space for ov9640_data too. If you don't
-       need it, remove it. We do it here to help to lessen memory
-       fragmentation. */
-
-	new_client=kzalloc(sizeof(struct i2c_client), GFP_KERNEL);
-
-	if (!new_client) {
-		err = -ENOMEM;
-		goto ERROR0;
-	}
-	data = kzalloc(sizeof(struct ov96xx_data), GFP_KERNEL);
-
-	if (!new_client) {
-		err = -ENOMEM;
-		goto ERROR0;
-	}
-
-	new_client->addr = address;	
-	new_client->adapter = adapter;
-	new_client->driver = &ov96xx_i2c_driver;
-	new_client->flags = 0;
-	init_MUTEX(&data->update_lock); 
-	i2c_set_clientdata(new_client, data);
-
-	g_client = new_client;
-
-	/* no probing */
-	/* no detection here */
-
-	strcpy(new_client->name, "i2c-ov96xx");
-
-    /* Only if you use this field */
-	data->valid = 0; 
-
-	printk("trying to attach the client\n");
-	/* Tell the i2c layer a new client has arrived */
-	if (err = i2c_attach_client(new_client))
-		goto ERROR3;
-
-    /* This function can write default values to the client registers, if
-       needed. */
-
-	/* no initialization of default registers here */
-	return 0;
-
-ERROR3:
-      kfree(new_client);
-      g_client = NULL;
-ERROR0:
-      return err;
-}
-
-/* 	Keep track of how far we got in the initialization process. If several
-	things have to initialized, and we fail halfway, only those things
-	have to be cleaned up! */
-static int ov96xx_initialized = 0;
-
-int i2c_ov96xx_detach_client(struct i2c_client *client)
-{
-	int err;
-
-	/* Try to detach the client from i2c space */
-	if (err = i2c_detach_client(client)) {
-		DPRINTK("i2c-ov96xx.o: Client deregistration failed, client not detached.\n");
-		return err;
-	}
-
-	kfree(client); /* Frees client data too, if allocated at the same time */
-	g_client = NULL;
-	return 0;
-}
-
-int i2c_ov96xx_attach_adapter(struct i2c_adapter *adap)
-{
-	printk("i2c_ov96xx_attach_adapter\n");
-	return i2c_probe(adap, &addr_data, i2c_ov96xx_detect_client);
-}
-
-static struct i2c_driver ov96xx_i2c_driver  = 
-{
-	.driver = {
-		.name   = "i2c-ov96xx",
-		.owner = THIS_MODULE,
-	},
-	.id		= I2C_DRIVERID_OV96xx,
-	.attach_adapter = &i2c_ov96xx_attach_adapter,
-	.detach_client  = &i2c_ov96xx_detach_client,
-};
-
-int i2c_ov96xx_init(void)
-{
-	int res;
-
-	if (ov96xx_initialized) 
-		return 0;
-
-	DPRINTK("I2C: driver for device ov96xx.\n");
-
-	if (res = i2c_add_driver(&ov96xx_i2c_driver)) {
-		DPRINTK("i2c-ov96xx: Driver registration failed, module not inserted.\n");
-		i2c_ov96xx_cleanup();
-		return res;
-	}
-	ov96xx_initialized++;
-        if(g_client != NULL) {
-   	   DPRINTK("I2C: driver for device %s registed!.\n", g_client->name);
-	} else {
-           DPRINTK("I2C: driver for device unregisted!.\n");
-	}
-	return 0;
-}
-
-void i2c_ov96xx_cleanup(void)
-{
-	if (ov96xx_initialized == 1) {
-		if (i2c_del_driver(&ov96xx_i2c_driver)) {
-			DPRINTK("i2c-ov96xx: Driver registration failed, module not removed.\n");
-			return;
-		}
-		ov96xx_initialized --;
-	}
-}
-
-EXPORT_SYMBOL(i2c_ov96xx_read);
-EXPORT_SYMBOL(i2c_ov96xx_write);
-EXPORT_SYMBOL(i2c_ov96xx_init);
-EXPORT_SYMBOL(i2c_ov96xx_cleanup);
-
-MODULE_LICENSE("GPL");
-
diff -ruN -X X hnd-linux-trunk/drivers/i2c/chips/i2c-ov96xx.h hnd-cleanup/drivers/i2c/chips/i2c-ov96xx.h
--- hnd-linux-trunk/drivers/i2c/chips/i2c-ov96xx.h	2007-09-17 22:47:09.000000000 +0400
+++ hnd-cleanup/drivers/i2c/chips/i2c-ov96xx.h	1970-01-01 03:00:00.000000000 +0300
@@ -1,28 +0,0 @@
-#ifndef  __I2C_OV96xx_H__
-#define  __I2C_OV96xx_H__
-
-#ifndef DEBUG
-#define DEBUG
-#endif
-
-#define OV96xx_SLAVE_ADDR (0x60>>1)	/* 60 for write , 61 for read */
-// #define SENSOR_SLAVE_ADDR   0x0055      /* tbd: */
-
-struct ov96xx_data {
-    /*
-     *  Because the i2c bus is slow, it is often useful to cache the read
-     *  information of a chip for some time (for example, 1 or 2 seconds).
-     *  It depends of course on the device whether this is really worthwhile
-     *  or even sensible.
-     */
-    struct semaphore update_lock; /* When we are reading lots of information,
-                                     another process should not update the
-                                     below information */
-
-    char valid;                   /* != 0 if the following fields are valid. */
-    int  blockaddr;               /* current using block address.    */
-    unsigned long last_updated;   /* In jiffies */
-};
-
-#endif
-
diff -ruN -X X hnd-linux-trunk/drivers/i2c/chips/Kconfig hnd-cleanup/drivers/i2c/chips/Kconfig
--- hnd-linux-trunk/drivers/i2c/chips/Kconfig	2007-09-17 22:47:09.000000000 +0400
+++ hnd-cleanup/drivers/i2c/chips/Kconfig	2007-09-17 23:25:44.000000000 +0400
@@ -36,12 +36,6 @@
 	  This driver can also be built as a module.  If so, the module
 	  will be called eeprom.
 
-config I2C_ADCM2650
-        tristate "ADCM2650 device"
-        depends on I2C && EXPERIMENTAL
-	help
-	  If you say yes here you get support for the ADCM 2650 chip.
-
 config SENSORS_PCF8574
 	tristate "Philips PCF8574 and PCF8574A"
 	depends on I2C && EXPERIMENTAL
@@ -115,7 +109,7 @@
 # and having mostly OMAP-specific board support
 config TPS65010
 	tristate "TPS6501x Power Management chips"
-	depends on I2C && (ARCH_OMAP || MACH_T3XSCALE)
+	depends on I2C && ARCH_OMAP
 	default y if MACH_OMAP_H2 || MACH_OMAP_H3 || MACH_OMAP_OSK
 	help
 	  If you say yes here you get support for the TPS6501x series of
@@ -158,17 +152,4 @@
 	  This driver can also be built as a module.  If so, the module
 	  will be called max6875.
 
-config I2C_OV9640
-	tristate "Support for OmniVision 9640 camera sensor"
-	depends on I2C
-	help
-	  Say yes here to enable OV9640 sensor which is found in some
-	  handhelds and phones
-
-config I2C_OV96XX
-	tristate "Support for OmniVision 96XX camera sensor"
-	depends on I2C
-	help
-	  Say yes here to enable OV96XX sensor which is found in some
-	  handhelds and phones
 endmenu
diff -ruN -X X hnd-linux-trunk/drivers/i2c/chips/Makefile hnd-cleanup/drivers/i2c/chips/Makefile
--- hnd-linux-trunk/drivers/i2c/chips/Makefile	2007-09-17 22:47:09.000000000 +0400
+++ hnd-cleanup/drivers/i2c/chips/Makefile	2007-09-17 23:25:44.000000000 +0400
@@ -15,12 +15,6 @@
 obj-$(CONFIG_ISP1301_OMAP)	+= isp1301_omap.o
 obj-$(CONFIG_TPS65010)		+= tps65010.o
 
-obj-$(CONFIG_I2C_ADCM2650) 	+= adcm2650-i2c.o
-
-obj-$(CONFIG_I2C_OV9640)	+= i2c-ov9640.o
-
-obj-$(CONFIG_I2C_OV96XX)	+= i2c-ov96xx.o
-
 ifeq ($(CONFIG_I2C_DEBUG_CHIP),y)
 EXTRA_CFLAGS += -DDEBUG
 endif
diff -ruN -X X hnd-linux-trunk/drivers/i2c/chips/ov9640_hw.h hnd-cleanup/drivers/i2c/chips/ov9640_hw.h
--- hnd-linux-trunk/drivers/i2c/chips/ov9640_hw.h	2007-09-17 22:47:09.000000000 +0400
+++ hnd-cleanup/drivers/i2c/chips/ov9640_hw.h	1970-01-01 03:00:00.000000000 +0300
@@ -1,222 +0,0 @@
-/* 
-    ov9640_hw - Omnivision 9640 CMOS sensor driver 
-
-    Copyright (C) 2003, Intel Corporation
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#ifndef _OV_9640_HW_H_
-#define _OV_9640_HW_H_
-
-/***********************************************************************
- *
- * Constants & Structures
- *
- ***********************************************************************/
-// Revision constants
-#define PID_OV			0x96
-#define PID_9640		0x48
-
-#define PID_OV_v3		0x96
-#define PID_9640_v3		0x49
-
-// Return codes
-#define OV_ERR_NONE       	0x00
-#define OV_ERR_TIMEOUT    	-1
-#define OV_ERR_PARAMETER  	-2  
-#define OV_COMM_ERR		-3
-
-#define CIBR0_PHY	(0x50000000 + 0x28)
-#define CIBR1_PHY	(0x50000000 + 0x30)
-#define CIBR2_PHY	(0x50000000 + 0x38)
-#define DPRINTK(fmt,args...)	do { if (DEBUG) printk("in function %s "fmt,__FUNCTION__,##args);} while(0)
-
-// Output Size & Format
-/*
-#define OV_SIZE_NONE		0
-#define OV_SIZE_QQVGA		0x01
-#define OV_SIZE_QVGA		( OV_SIZE_QQVGA << 1 )
-#define OV_SIZE_VGA		( OV_SIZE_QQVGA << 2 )
-#define OV_SIZE_SXGA		( OV_SIZE_QQVGA << 3 )
-#define OV_SIZE_QQCIF		0x10
-#define OV_SIZE_QCIF		( OV_SIZE_QQCIF << 1 )			
-#define OV_SIZE_CIF		( OV_SIZE_QQCIF << 2 )			
-#define OV_FORMAT_NONE		0
-#define OV_FORMAT_YUV_422	1
-#define OV_FORMAT_RGB_565	2
-*/
-enum OV_SIZE {
-	OV_SIZE_NONE=0	,
-	OV_SIZE_QQVGA	,
-	OV_SIZE_QVGA	,
-	OV_SIZE_VGA	,
-	OV_SIZE_SXGA	,
-	OV_SIZE_QQCIF	,
-	OV_SIZE_QCIF	,
-	OV_SIZE_CIF	
-};
-enum OV_FORMAT {
-	OV_FORMAT_NONE=0 ,
-	OV_FORMAT_YUV_422,
-	OV_FORMAT_RGB_565,
-};
-
-// Camera Mode
-#define VIEWFINDER_MODE     0x10
-#define STILLFRAME_MODE     0x20
-
-// Others
-#define OV9640_TIMEOUT    1000    // ms to timeout.
-
-// OV9640 Register Definitions
-#define OV9640_GAIN		0x0000
-#define OV9640_BLUE		0x0001
-#define OV9640_RED		0x0002
-#define OV9640_VREF		0x0003
-#define OV9640_COM1		0x0004
-#define OV9640_BAVE		0x0005				// U/B Average Level
-#define OV9640_GEAVE		0x0006				// Y/Ge Average Level
-#define OV9640_GOAVE		0x0007				// Y/Go Average Level
-#define OV9640_RAVE		0x0008				// V/R Average level
-#define OV9640_COM2		0x0009				// Common control 2
-#define OV9640_PID		0x000A				// Product ID
-#define OV9640_VER		0x000B				// Version
-#define OV9640_COM3		0x000C
-#define OV9640_COM4		0x000D
-#define OV9640_COM5		0x000E
-#define OV9640_COM6		0x000F
-#define OV9640_AECH		0x0010
-#define OV9640_CLKRC		0x0011
-#define OV9640_COM7		0x0012
-#define OV9640_COM8		0x0013
-#define OV9640_COM9		0x0014
-#define OV9640_COM10		0x0015
-#define OV9640_WS		0x0016
-#define OV9640_HSTART		0x0017
-#define OV9640_HSTOP		0x0018
-#define OV9640_VSTRT		0x0019
-#define OV9640_VSTOP		0x001A
-#define OV9640_PSHFT		0x001B
-#define OV9640_MIDH		0x001C
-#define OV9640_MIDL		0x001D
-#define OV9640_DLY		0x001E
-#define OV9640_LAEC		0x001F
-#define OV9640_BOS		0x0020
-#define OV9640_GBOS		0x0021
-#define OV9640_GROS		0x0022
-#define OV9640_ROS		0x0023
-#define OV9640_AEW		0x0024
-#define OV9640_AEB		0x0025
-#define OV9640_VPT		0x0026
-#define OV9640_BBIAS		0x0027
-#define OV9640_GbBIAS		0x0028
-#define OV9640_GrBIAS		0x0029
-#define OV9640_EXHCH		0x002A
-#define OV9640_EXHCL		0x002B
-#define OV9640_RBIAS		0x002C
-#define OV9640_ADVFL		0x002D
-#define OV9640_ADVFH		0x002E
-#define OV9640_YAVE		0x002F
-#define OV9640_HSYST		0x0030
-#define OV9640_HSYEN		0x0031
-#define OV9640_HREF		0x0032
-#define OV9640_CHLF		0x0033
-#define OV9640_ARBLM		0x0034
-#define OV9640_VRHL		0x0035
-#define OV9640_VIDO		0x0036
-#define OV9640_ADC		0x0037
-#define OV9640_ACOM		0x0038
-#define OV9640_OFON		0x0039
-#define OV9640_TSLB		0x003A
-#define OV9640_COM11		0x003B
-#define OV9640_COM12		0x003C
-#define OV9640_COM13		0x003D
-#define OV9640_COM14		0x003E
-#define OV9640_EDGE		0x003F
-#define OV9640_COM15		0x0040
-#define OV9640_COM16		0x0041
-#define OV9640_COM17		0x0042
-#define OV9640_AWBTH1		0x0043
-#define OV9640_AWBTH2		0x0044
-#define OV9640_AWBTH3		0x0045
-#define OV9640_AWBTH4		0x0046
-#define OV9640_AWBTH5		0x0047
-#define OV9640_AWBTH6		0x0048
-#define OV9640_MTX1		0x004F
-#define OV9640_MTX2		0x0050
-#define OV9640_MTX3		0x0051
-#define OV9640_MTX4		0x0052
-#define OV9640_MTX5		0x0053
-#define OV9640_MTX6		0x0054
-#define OV9640_MTX7		0x0055
-#define OV9640_MTX8		0x0056
-#define OV9640_MTX9		0x0057
-#define OV9640_MTXS		0x0058
-#define OV9640_AWBC1		0x0059
-#define OV9640_AWBC2		0x005A
-#define OV9640_AWBC3		0x005B
-#define OV9640_AWBC4		0x005C
-#define OV9640_AWBC5		0x005D
-#define OV9640_AWBC6		0x005E
-#define OV9640_AWBC7		0x005F
-#define OV9640_AWBC8		0x0060
-#define OV9640_AWBC9		0x0061
-#define OV9640_LCC1		0x0062
-#define OV9640_LCC2		0x0063
-#define OV9640_LCC3		0x0064
-#define OV9640_LCC4		0x0065
-#define OV9640_LCC5		0x0066
-#define OV9640_MANU		0x0067
-#define OV9640_MANV		0x0068
-#define OV9640_HV		0x0069
-#define OV9640_MBD		0x006A
-#define OV9640_DBLV		0x006B
-#define OV9640_GSP0		0x006C
-#define OV9640_GSP1		0x006D
-#define OV9640_GSP2		0x006E
-#define OV9640_GSP3		0x006F
-#define OV9640_GSP4		0x0070
-#define OV9640_GSP5		0x0071
-#define OV9640_GSP6		0x0072
-#define OV9640_GSP7		0x0073
-#define OV9640_GSP8		0x0074
-#define OV9640_GSP9		0x0075
-#define OV9640_GSP10		0x0076
-#define OV9640_GSP11		0x0077
-#define OV9640_GSP12		0x0078
-#define OV9640_GSP13		0x0079
-#define OV9640_GSP14		0x007A
-#define OV9640_GSP15		0x007B
-#define OV9640_GST0		0x007C
-#define OV9640_GST1		0x007D
-#define OV9640_GST2		0x007E
-#define OV9640_GST3		0x007F
-#define OV9640_GST4		0x0080
-#define OV9640_GST5		0x0081
-#define OV9640_GST6		0x0082
-#define OV9640_GST7		0x0083
-#define OV9640_GST8		0x0084
-#define OV9640_GST9		0x0085
-#define OV9640_GST10		0x0086
-#define OV9640_GST11		0x0087
-#define OV9640_GST12		0x0088
-#define OV9640_GST13		0x0089
-#define OV9640_GST14		0x008A
-
-// End of OV9640 register
-#define OV9640_REGEND		( OV9640_GST14 + 1 )
-
-#endif
diff -ruN -X X hnd-linux-trunk/drivers/i2c/i2c-core.c hnd-cleanup/drivers/i2c/i2c-core.c
--- hnd-linux-trunk/drivers/i2c/i2c-core.c	2007-09-17 22:47:09.000000000 +0400
+++ hnd-cleanup/drivers/i2c/i2c-core.c	2007-09-17 23:25:44.000000000 +0400
@@ -34,7 +34,7 @@
 #include <linux/mutex.h>
 #include <linux/completion.h>
 #include <asm/uaccess.h>
-#include <linux/delay.h>
+
 
 static LIST_HEAD(adapters);
 static LIST_HEAD(drivers);
@@ -663,7 +663,7 @@
 	msg.addr = client->addr;
 	msg.flags = client->flags & I2C_M_TEN;
 	msg.len = count;
-	msg.buf = (char *) buf;
+	msg.buf = (char *)buf;
 
 	ret = i2c_transfer(adap, &msg, 1);
 
diff -ruN -X X hnd-linux-trunk/drivers/input/keyboard/gpiodev_keys2.c hnd-cleanup/drivers/input/keyboard/gpiodev_keys2.c
--- hnd-linux-trunk/drivers/input/keyboard/gpiodev_keys2.c	1970-01-01 03:00:00.000000000 +0300
+++ hnd-cleanup/drivers/input/keyboard/gpiodev_keys2.c	2007-09-17 23:24:17.000000000 +0400
@@ -0,0 +1,336 @@
+/*
+ * Driver for diagonal joypads on GPIO lines capable of generating interrupts.
+ *
+ * Copyright 2007 Milan Plzik, based on gpio-keys.c (c) Phil Blundell 2005
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/module.h>
+#include <linux/version.h>
+
+#include <linux/init.h>
+#include <linux/fs.h>
+#include <linux/interrupt.h>
+#include <linux/irq.h>
+#include <linux/sched.h>
+#include <linux/pm.h>
+#include <linux/delay.h>
+#include <linux/platform_device.h>
+#include <linux/input.h>
+#include <linux/irq.h>
+#include <linux/sort.h>
+#include <linux/gpiodev.h>
+#include <linux/gpiodev_keys2.h>
+
+struct gpiodev_keys2_drvdata {
+	struct input_dev *input;
+	struct timer_list debounce_timer;
+	struct gpiodev_keys2_gpio ***button_gpios;
+	int *gpio_delays;
+	struct gpiodev_keys2_button **buttons_by_prio;
+	int *gpio_used_prio;
+};
+
+
+static struct gpiodev_keys2_gpio *lookup_gpio (struct gpiodev_keys2_platform_data *pdata,
+		const char *name)
+{
+	int i;
+	
+	for (i = 0; i < pdata->ngpios; i++) {
+		if (!strcmp (name, pdata->gpios[i].name)) 
+			return &pdata->gpios[i];
+	}
+
+	return NULL;
+}
+
+static int count_gpios (struct gpiodev_keys2_button *btn)
+{
+	int i = 0;
+	const char **gpio = btn->gpio_names;
+	
+	while (gpio[i]) i++;
+
+	return i;
+}
+
+
+static irqreturn_t gpiodev_keys2_isr(int irq, void *data)
+{
+	int i;
+	struct platform_device *pdev = data;
+	struct gpiodev_keys2_platform_data *pdata = pdev->dev.platform_data;
+	struct gpiodev_keys2_drvdata *drvdata = platform_get_drvdata(pdev);
+
+	/* Find out which GPIO has been asserted and the corresponding delay for
+	 * debouncing. */
+	for (i = 0; i < pdata->ngpios; i++)
+		if (irq == gpiodev_to_irq(&pdata->gpios[i].gpio)) {
+			break;
+		};
+	
+	/* Prepare delayed call of debounce handler */
+	if (time_before(drvdata->debounce_timer.expires, jiffies + 
+			msecs_to_jiffies(drvdata->gpio_delays[i])) ||
+	    !timer_pending(&drvdata->debounce_timer))
+		mod_timer(&drvdata->debounce_timer, 
+				jiffies + msecs_to_jiffies(drvdata->gpio_delays[i]));
+
+	return IRQ_HANDLED;
+}
+
+static void debounce_handler(unsigned long data)
+{
+	struct platform_device *pdev = (void*)data;
+	struct gpiodev_keys2_platform_data *pdata = pdev->dev.platform_data;
+	struct gpiodev_keys2_drvdata *drvdata = platform_get_drvdata(pdev);
+	struct gpiodev_keys2_button *button;
+	struct gpiodev_keys2_gpio **gpio;
+	int i;
+
+	memset(drvdata->gpio_used_prio, 0, sizeof(drvdata->gpio_used_prio[0])*pdata->ngpios);
+
+	/* Clear reported buttons */
+	for (i = 0; i < pdata->nbuttons; i++)
+		input_report_key(drvdata->input, pdata->buttons[i].keycode, 0);
+
+	for (i = 0; i < pdata->nbuttons; i++) {
+		int button_idx = drvdata->buttons_by_prio[i] - &pdata->buttons[0];
+		button = drvdata->buttons_by_prio[i];
+		gpio = drvdata->button_gpios[button_idx];
+
+		/* are all required GPIOs asserted? */
+		do {
+			int gpio_idx = gpio[0] - pdata->gpios; /* index in pdata->gpios */
+			if (((gpiodev_get_value(&gpio[0]->gpio) ? 1 : 0) ^ (gpio[0]->active_low)) &&
+				/* this is only true when gpio prio is 0,
+				 * because the buttons are ordered descending by
+				 * priority */
+				drvdata->gpio_used_prio[gpio_idx]<=button->priority)
+				continue;
+			else 
+				break;
+		} while ((++gpio)[0] != NULL);
+
+		if (gpio[0] == NULL) {
+			/* all gpios are asserted and unused otherwise, so key
+			 * can be pressed and GPIOs will be marked as used. */
+			gpio = drvdata->button_gpios[button_idx];
+			do {
+				int gpio_idx = gpio[0] - pdata->gpios;
+				drvdata->gpio_used_prio[gpio_idx] = button->priority;
+			} while (((++gpio)[0]) != NULL);
+			if (button->keycode != -1)
+				input_report_key(drvdata->input, button->keycode, 1);
+		}
+	};
+	input_sync(drvdata->input);
+}
+
+
+static int btnprio_cmp (const void *a, const void *b)
+{
+	const struct gpiodev_keys2_button *b1, *b2;
+	
+	b1 = *((const struct gpiodev_keys2_button**)a);
+	b2 = *((const struct gpiodev_keys2_button**)b);
+
+	return b2->priority - b1->priority;
+}
+
+/* Builds array, which on i-th position contains pointers to all GPIOs used by
+ * i-th button in pdata->buttons, and also finds maximal debounce time for each
+ * gpio.
+ */
+
+static int gpiodev_keys2_init_drvdata(struct platform_device *pdev)
+{
+	struct gpiodev_keys2_platform_data *pdata = pdev->dev.platform_data;
+	struct gpiodev_keys2_drvdata *drvdata = platform_get_drvdata(pdev);
+	struct gpiodev_keys2_gpio *gpio;
+	int i, j;
+	int button_gpios;
+
+	if (drvdata->button_gpios) {
+		printk (KERN_ERR "gpiodev-keys2: Attempting to re-create drvdata\n");
+		return -EBUSY;
+	};
+	
+	drvdata->button_gpios = kzalloc(
+			pdata->nbuttons*sizeof(*drvdata->button_gpios), 
+			GFP_KERNEL);
+	drvdata->gpio_delays = kzalloc(pdata->ngpios*sizeof(*drvdata->gpio_delays), GFP_KERNEL);
+	drvdata->buttons_by_prio = kzalloc(pdata->nbuttons*sizeof(*drvdata->buttons_by_prio), GFP_KERNEL);
+	drvdata->gpio_used_prio = kzalloc(pdata->ngpios*sizeof(*drvdata->gpio_used_prio), GFP_KERNEL);
+
+	for (i = 0; i < pdata->nbuttons; i++) {
+		button_gpios = count_gpios(&pdata->buttons[i]);
+		drvdata->button_gpios[i] = kzalloc((button_gpios+1)*sizeof(drvdata->button_gpios[i]), GFP_KERNEL);
+
+		/* Put all GPIOs used by i-th button into button_gpios[i] */
+		for (j = 0; j < button_gpios; j++) {
+			gpio = lookup_gpio(pdata, pdata->buttons[i].gpio_names[j]);
+			if (!gpio) {
+				printk(KERN_WARNING "gpiodev-keys2: Unknown gpio '%s'\n", pdata->buttons[i].gpio_names[j]);
+				continue;
+			};
+
+			/* See whether actual button has delay, which is bigger
+			 * than delay GPIO. If so, update GPIOs delay.
+			 */
+			drvdata->gpio_delays[gpio - pdata->gpios] = max(
+				drvdata->gpio_delays[gpio - pdata->gpios],
+				pdata->buttons[i].debounce_ms);
+
+			drvdata->button_gpios[i][j] = gpio;
+		};
+
+
+	};
+
+	/* Create list of buttons sorted descending by priority */
+	for (i = 0; i < pdata->nbuttons; i++)
+		drvdata->buttons_by_prio[i] = &pdata->buttons[i];
+	
+	sort(drvdata->buttons_by_prio, pdata->nbuttons, sizeof(drvdata->buttons_by_prio[0]), btnprio_cmp, NULL);
+	for (i = 0; i <pdata->nbuttons; i++)
+		printk (KERN_INFO "- button '%s', prio %d\n", drvdata->buttons_by_prio[i]->gpio_names[0], drvdata->buttons_by_prio[i]->priority);
+
+	return 0;
+}
+
+static void gpiodev_keys2_free_mapping(struct platform_device *pdev)
+{
+	struct gpiodev_keys2_platform_data *pdata = pdev->dev.platform_data;
+	struct gpiodev_keys2_drvdata *drvdata = platform_get_drvdata(pdev);
+	int i;
+
+	if (!drvdata)
+		return;
+
+	for (i = 0; i < pdata->nbuttons; i++) 
+		kfree(drvdata->button_gpios[i]);
+
+	kfree(drvdata->button_gpios);
+	kfree(drvdata->gpio_delays);
+	kfree(drvdata->buttons_by_prio);
+	kfree(drvdata->gpio_used_prio);
+}
+
+
+static int __devinit gpiodev_keys2_probe(struct platform_device *pdev)
+{
+	struct gpiodev_keys2_drvdata *drvdata;
+	struct gpiodev_keys2_platform_data *pdata = pdev->dev.platform_data;
+	struct input_dev *input;
+	int i, error;
+
+	input = input_allocate_device();
+	if (!input)
+		return -ENOMEM;
+
+	input->evbit[0] = BIT(EV_KEY) | BIT(EV_REP);
+	input->name = pdev->name;
+	input->phys = "gpiodev-keys2/input0";
+	input->cdev.dev = &pdev->dev;
+	// input->private // do we need this?
+	input->id.bustype = BUS_HOST;
+	input->id.vendor = 0x0001;
+	input->id.product = 0x0001;
+	input->id.version = 0x0100;
+
+	drvdata = kzalloc(sizeof(struct gpiodev_keys2_drvdata), GFP_KERNEL);
+	drvdata->input = input;
+	platform_set_drvdata(pdev, drvdata);
+
+	setup_timer(&drvdata->debounce_timer, debounce_handler, (unsigned long) pdev);
+	
+	for (i = 0; i < pdata->nbuttons; i++)
+		set_bit(pdata->buttons[i].keycode, input->keybit);
+	
+	error = input_register_device(input);
+	if (error) {
+		printk(KERN_ERR "Unable to register gpiodev-keys2 input device\n");
+		goto fail;
+	}
+
+	gpiodev_keys2_init_drvdata(pdev);
+
+
+	for (i = 0; i < pdata->ngpios; i++) {
+		int irq = gpiodev_to_irq(&(pdata->gpios[i].gpio));
+
+		set_irq_type(irq, IRQ_TYPE_EDGE_BOTH);
+		error = request_irq(irq, gpiodev_keys2_isr, 
+			IRQF_SAMPLE_RANDOM | IRQF_SHARED,
+			pdata->gpios[i].name ? 
+			pdata->gpios[i].name : "gpiodev_keys2", pdev);
+
+		if (error) {
+			printk(KERN_ERR "gpiodev-keys: unable to claim irq %d; error %d\n", irq, error);
+			goto fail;
+		}
+	}
+
+
+	return 0;
+
+fail:
+	for (i = i - 1; i >= 0; i--) 
+		free_irq(gpiodev_to_irq(&pdata->gpios[i].gpio),pdev);
+
+	input_free_device(input);
+
+	del_timer_sync(&drvdata->debounce_timer);
+
+	return error;
+}
+
+static int __devexit gpiodev_keys2_remove(struct platform_device *pdev)
+{
+	struct gpiodev_keys2_drvdata *drvdata = platform_get_drvdata(pdev);
+	struct gpiodev_keys2_platform_data *pdata = pdev->dev.platform_data;
+	int i;
+
+	del_timer_sync(&drvdata->debounce_timer);
+
+	for (i = 0; i < pdata->ngpios; i++) 
+		free_irq(gpiodev_to_irq(&pdata->gpios[i].gpio), pdev);
+
+	input_unregister_device(drvdata->input);
+	input_free_device(drvdata->input);
+	gpiodev_keys2_free_mapping(pdev);
+	kfree(drvdata);
+
+	return 0;
+}
+
+
+struct platform_driver gpiodev_keys2_device_driver = {
+	.probe 	= gpiodev_keys2_probe,
+	.remove = __devexit_p(gpiodev_keys2_remove),
+	.driver	= {
+		.name = "gpiodev-keys2",
+	}
+};
+
+static int __init gpiodev_keys2_init(void)
+{
+	return platform_driver_register(&gpiodev_keys2_device_driver);
+}
+
+static void __exit gpiodev_keys2_exit(void)
+{
+	platform_driver_unregister(&gpiodev_keys2_device_driver);
+}
+
+module_init(gpiodev_keys2_init);
+module_exit(gpiodev_keys2_exit);
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Milan Plzik <milan.plzik@gmail.com>");
+MODULE_DESCRIPTION("Keyboard driver for GPIO");
diff -ruN -X X hnd-linux-trunk/drivers/input/keyboard/Kconfig hnd-cleanup/drivers/input/keyboard/Kconfig
--- hnd-linux-trunk/drivers/input/keyboard/Kconfig	2007-09-17 22:46:00.000000000 +0400
+++ hnd-cleanup/drivers/input/keyboard/Kconfig	2007-09-17 23:24:17.000000000 +0400
@@ -200,6 +200,12 @@
 	  This is more generic version of gpio_keys driver, supporting 
 	  GPIOs across different chips.
 
+config GPIODEV_KEYS2
+	tristate "Buttons on GPIOs, version 2"
+	help
+	  GPIO keyboard driver supportting multiple GPIOs per button, 
+	  as well as button priorities.
+
 config GPIODEV_DIAGONAL
 	tristate "Diagonal joypad on GPIO"
 	help
diff -ruN -X X hnd-linux-trunk/drivers/input/touchscreen/Makefile hnd-cleanup/drivers/input/touchscreen/Makefile
--- hnd-linux-trunk/drivers/input/touchscreen/Makefile	2007-09-17 22:45:59.000000000 +0400
+++ hnd-cleanup/drivers/input/touchscreen/Makefile	2007-09-17 23:24:16.000000000 +0400
@@ -7,22 +7,18 @@
 wm97xx-ts-objs := wm97xx-core.o
 
 obj-$(CONFIG_TOUCHSCREEN_ADS7846)	+= ads7846.o
-obj-$(CONFIG_TOUCHSCREEN_BITSY)		+= h3600_ts_input.o
-obj-$(CONFIG_TOUCHSCREEN_CORGI)		+= corgi_ts.o
-obj-$(CONFIG_TOUCHSCREEN_GUNZE)		+= gunze.o
+obj-$(CONFIG_TOUCHSCREEN_BITSY)	+= h3600_ts_input.o
+obj-$(CONFIG_TOUCHSCREEN_CORGI)	+= corgi_ts.o
+obj-$(CONFIG_TOUCHSCREEN_GUNZE)	+= gunze.o
 obj-$(CONFIG_TOUCHSCREEN_TSC2101)	+= tsc2101_ts.o
-obj-$(CONFIG_SA1100_JORNADA56X)		+= jornada56x_ts.o
-obj-$(CONFIG_SA1100_JORNADA720)		+= jornada720_ts.o
-obj-$(CONFIG_TOUCHSCREEN_ELO)		+= elo.o
-obj-$(CONFIG_TOUCHSCREEN_MTOUCH)	+= mtouch.o
-obj-$(CONFIG_TOUCHSCREEN_MK712)		+= mk712.o
-obj-$(CONFIG_TOUCHSCREEN_HP600)		+= hp680_ts_input.o
-obj-$(CONFIG_TOUCHSCREEN_WM97XX)	+= wm97xx-ts.o
-
-wm97xx-ts-objs := wm97xx-core.o
-ifeq ($(CONFIG_TOUCHSCREEN_WM97XX_PXA),y)
-wm97xx-ts-objs += pxa-wm97xx.o
-endif
+obj-$(CONFIG_SA1100_JORNADA56X) += jornada56x_ts.o
+obj-$(CONFIG_SA1100_JORNADA720) += jornada720_ts.o
+obj-$(CONFIG_TOUCHSCREEN_ELO)	+= elo.o
+obj-$(CONFIG_TOUCHSCREEN_MTOUCH) += mtouch.o
+obj-$(CONFIG_TOUCHSCREEN_MK712)	+= mk712.o
+obj-$(CONFIG_TOUCHSCREEN_HP600)	+= hp680_ts_input.o
+obj-$(CONFIG_TOUCHSCREEN_WM97XX)    += wm97xx-ts.o
+obj-$(CONFIG_TOUCHSCREEN_WM97XX_PXA)    += pxa-wm97xx.o
 
 ifeq ($(CONFIG_TOUCHSCREEN_WM9713),y)
 wm97xx-ts-objs += wm9713.o
@@ -42,7 +38,6 @@
 obj-$(CONFIG_TOUCHSCREEN_UCB1400)	+= ucb1400_ts.o
 obj-$(CONFIG_TOUCHSCREEN_PALMTC)	+= palmtc_ts.o
 
-
 obj-$(CONFIG_TOUCHSCREEN_S3C2410) += s3c2410_ts.o
 obj-$(CONFIG_TOUCHSCREEN_ASIC2) += asic2_ts.o
 obj-$(CONFIG_TOUCHSCREEN_IPAQ_MICRO)	+= micro_ts.o
diff -ruN -X X hnd-linux-trunk/drivers/leds/led-palmz72.c hnd-cleanup/drivers/leds/led-palmz72.c
--- hnd-linux-trunk/drivers/leds/led-palmz72.c	2007-09-17 22:46:49.000000000 +0400
+++ hnd-cleanup/drivers/leds/led-palmz72.c	2007-09-17 23:25:23.000000000 +0400
@@ -21,13 +21,10 @@
 #include <asm/arch/pxa-regs.h>
 #include <asm/hardware/scoop.h>
 
-
-static void palmz72led_green_set(struct led_classdev *led_cdev, enum led_brightness value)
+static void palmz72led_green_set(struct led_classdev *led_cdev,
+				 enum led_brightness value)
 {
-	if (value)
-		SET_PALMZ72_GPIO(LED,1);
-	else
-		SET_PALMZ72_GPIO(LED,0);
+	SET_PALMZ72_GPIO(LED, value ? 1 : 0);
 }
 
 static struct led_classdev palmz72_green_led = {
diff -ruN -X X hnd-linux-trunk/drivers/media/video/Kconfig hnd-cleanup/drivers/media/video/Kconfig
--- hnd-linux-trunk/drivers/media/video/Kconfig	2007-09-17 22:45:40.000000000 +0400
+++ hnd-cleanup/drivers/media/video/Kconfig	2007-09-17 23:24:01.000000000 +0400
@@ -763,8 +763,4 @@
 
 endmenu # V4L USB devices
 
-config PXACI
-	depends on VIDEO_DEV
-	tristate "Camera Interface for PXA27x"
-
 endmenu
diff -ruN -X X hnd-linux-trunk/drivers/media/video/Makefile hnd-cleanup/drivers/media/video/Makefile
--- hnd-linux-trunk/drivers/media/video/Makefile	2007-09-17 22:45:41.000000000 +0400
+++ hnd-cleanup/drivers/media/video/Makefile	2007-09-17 23:24:01.000000000 +0400
@@ -111,7 +111,5 @@
 obj-$(CONFIG_USB_QUICKCAM_MESSENGER)	+= usbvideo/
 
 obj-$(CONFIG_VIDEO_VIVI) += vivi.o
-# obj-$(CONFIG_PXACI) += pxa_camera.o pxa_ci.o pxa_camera_ioctl.o
-obj-$(CONFIG_PXACI) += ov96xx.o
 
 EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core
diff -ruN -X X hnd-linux-trunk/drivers/media/video/ov96xx.c hnd-cleanup/drivers/media/video/ov96xx.c
--- hnd-linux-trunk/drivers/media/video/ov96xx.c	2007-09-17 22:45:41.000000000 +0400
+++ hnd-cleanup/drivers/media/video/ov96xx.c	1970-01-01 03:00:00.000000000 +0300
@@ -1,268 +0,0 @@
-/*
- *  ov96xx.c - Omnivision 9640, 9650 CMOS sensor driver
- *
- *  Copyright (C) 2003 Intel Corporation
- *  Copyright (C) 2004 Motorola Inc.
- *  Copyright (C) 2007 Philipp Zabel <philipp.zabel@gmail.com>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-#include <linux/clk.h>
-#include <linux/delay.h>
-#include <linux/module.h>
-#include <linux/platform_device.h>
-
-#include <media/ov96xx.h>	/* ov96xx_platform_data */
-#include <media/v4l2-dev.h>
-
-#include <asm/arch/gpio.h>
-
-#include <asm/ioctl.h>
-#include <asm/irq.h>
-#include <asm/hardware.h>
-#include <asm/uaccess.h>
-
-#include "pxa_ci_types.h"
-#include "ov96xx_hw.h"
-
-extern int i2c_ov96xx_init(void);
-extern int i2c_ov96xx_cleanup(void);
-extern int i2c_ov96xx_read(u8 addr, u8 *pvalue);
-extern int i2c_ov96xx_write(u8 addr, u8 value);
-
-#define DEBUG 1
-#define DPRINTK(fmt,args...) \
-	do { if (DEBUG) printk("in function %s "fmt,__FUNCTION__,##args);} while(0)
-
-struct ov96xx_data {
-	int		version;
-	struct clk	*clk;
-};
-
-void ov96xx_soft_reset(struct platform_device *pdev)
-{
-	struct ov96xx_data *ov96xx = platform_get_drvdata(pdev);
-
-	i2c_ov96xx_write(OV96xx_COM7, 0x80);		/* COM7 = 0x12 */
-	mdelay(10);
-
-	/* enable digital BLC */
-	switch (ov96xx->version) {
-	case REV_OV9640:
-	case REV_OV9640_v3:
-		break;
-	case REV_OV9650_0:
-		i2c_ov96xx_write(OV96xx_TSLB, 0x0c);	/* TSLB = 0x3a */
-		i2c_ov96xx_write(OV96xx_COM6, 0x4a);	/* COM6 = 0x0f */
-		break;
-	case REV_OV9650:
-		i2c_ov96xx_write(OV96xx_TSLB, 0x0d);	/* TSLB = 0x3a */
-		i2c_ov96xx_write(OV96xx_COM6, 0x42);	/* COM6 = 0x0f */
-		break;
-	}
-
-	dbg_print("end initial register");
-}
-
-int ov96xx_check_revision(struct platform_device *pdev)
-{
-	struct ov96xx_data *ov96xx = platform_get_drvdata(pdev);
-	u8 val;
-
-	i2c_ov96xx_read(OV96xx_PID, &val);
-	DPRINTK("PID = %x\n", val);
-
-	if (val != PID_OV96xx)
-		return -ENODEV;
-
-	mdelay(2000);
-	i2c_ov96xx_read(OV96xx_REV, &val);
-	DPRINTK("REV = %x\n", val);
-
-	switch (val) {
-	case REV_OV9640:
-		printk("detected OV9640\n");
-		break;
-	case REV_OV9640_v3:
-		printk("detected OV9640 v3\n");
-		break;
-	case REV_OV9650_0:
-		printk("detected OV9650-0\n");
-		break;
-	case REV_OV9650:
-		printk("detected OV9650\n");
-		break;
-	default:
-		printk("couldn't detect OV96xx\n");
-		return -ENODEV;
-	}
-	ov96xx->version = val;
-	return val;
-}
-
-void ov96xx_power(struct platform_device *pdev, int powerup)
-{
-	struct ov96xx_platform_data *pdata = pdev->dev.platform_data;
-
-	if (powerup) {
-		gpio_set_value(pdata->power_gpio, pdata->power_gpio_active_high);
-		if (pdata->reset_gpio) {
-			gpio_set_value(pdata->reset_gpio, 1);
-			mdelay(20);
-			gpio_set_value(pdata->reset_gpio, 0);
-		}
-	} else {
-		gpio_set_value(pdata->power_gpio, !pdata->power_gpio_active_high);
-	}
-	mdelay(100);
-}
-
-static int ov96xx_probe(struct platform_device *pdev)
-{
-	struct ov96xx_data *ov96xx;
-	struct ov96xx_platform_data *pdata;
-	int ret;
-	int rate, i;
-	u8 val;
-
-	if (!pdev)
-		return -ENODEV;
-
-	pdata = pdev->dev.platform_data;
-	if (!pdata->power_gpio)
-		return -EINVAL;
-
-	ov96xx = kzalloc(sizeof (struct ov96xx_data), GFP_KERNEL);
-	if (!ov96xx)
-		return -ENOMEM;
-
-	platform_set_drvdata(pdev, ov96xx);
-
-	ov96xx->clk = clk_get(&pdev->dev, "CI_MCLK");
-	if (IS_ERR(ov96xx->clk)) {
-		DPRINTK("couldn't get CI master clock\n");
-		ret = -ENOENT;
-		goto err;
-	}
-
-	rate = clk_get_rate(ov96xx->clk);
-	printk("clock rate = %d\n", rate);
-
-	/* enable clock, camera */
-	clk_enable(ov96xx->clk);
-	ov96xx_power(pdev, 1);
-
-	/* enable i2c */
-	i2c_ov96xx_init();
-
-	/* check revision */
-	//mdelay(2000);
-	mdelay(100);
-	ov96xx_check_revision(pdev);
-
-	/* dump all registers */
-	for (i=0; i<0xff; i++) {
-		if ((i%16) == 0) {
-			printk("\n%02x: ", i);
-		}
-		i2c_ov96xx_read(i, &val);
-		printk("%02x ", val);
-	}
-	printk("\n");
-
-	ov96xx_power(pdev, 0);
-
-	/* disable clock */
-	clk_disable(ov96xx->clk);
-
-	/* disable i2c */
-	i2c_ov96xx_cleanup();
-
-	return 0;
-err:
-	kfree(ov96xx);
-	return ret;
-}
-
-#ifdef CONFIG_PM
-static int ov96xx_suspend(struct platform_device *pdev, pm_message_t state)
-{
-	/*
-	 * stopping DMA transfers and disabling interrupts / clocks
-	 * is the business of the capture interface driver
-	 */
-
-	return 0;
-}
-
-static int ov96xx_resume(struct platform_device *pdev)
-{
-/*	struct ov96xx_data *ov96xx = platform_get_drvdata(pdev); */
-
-	/*
-	 * enabling interrupts / clocks and resuming DMA transfers
-	 * is the business of the capture interface driver
-	 */
-#if 0
-	camera_init(ov96xx->cam_ctx);
-	//ov96xx_restore_property(cam_ctx, 0);
-	if (resume_dma == 1) {
-		camera_start_video_capture(cam_ctx, 0);
-		resume_dma = 0;
-	}
-#endif
-	return 0;
-}
-#else
-#define ov96xx_suspend NULL
-#define ov96xx_resume NULL
-#endif
-
-static int ov96xx_remove(struct platform_device *pdev)
-{
-	struct ov96xx_data *ov96xx = platform_get_drvdata(pdev);
-
-	kfree(ov96xx);
-	return 0;
-}
-
-static struct platform_driver ov96xx_driver = {
-	.driver   = {
-		.name = "ov96xx",
-	},
-	.probe    = ov96xx_probe,
-	.remove   = ov96xx_remove,
-	.suspend  = ov96xx_suspend,
-	.resume   = ov96xx_resume
-};
-
-static int __init ov96xx_init(void)
-{
-	return platform_driver_register(&ov96xx_driver);
-}
-
-static void __exit ov96xx_exit(void)
-{
-	platform_driver_unregister(&ov96xx_driver);
-}
-
-module_init(ov96xx_init);
-module_exit(ov96xx_exit);
-
-MODULE_DESCRIPTION("OV96xx CMOS sensor driver");
-MODULE_LICENSE("GPL");
-
diff -ruN -X X hnd-linux-trunk/drivers/media/video/ov96xx_hw.h hnd-cleanup/drivers/media/video/ov96xx_hw.h
--- hnd-linux-trunk/drivers/media/video/ov96xx_hw.h	2007-09-17 22:45:41.000000000 +0400
+++ hnd-cleanup/drivers/media/video/ov96xx_hw.h	1970-01-01 03:00:00.000000000 +0300
@@ -1,237 +0,0 @@
-/*
- *  ov96xx_hw.h - Omnivision 9640, 9650 CMOS sensor driver
- *
- *  Copyright (C) 2003, Intel Corporation
- *  Copyright (C) 2004 Motorola Inc.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * Merge of OV9640,OV9650 (C) 2007 Philipp Zabel
- *
- */
-
-#ifndef __OV_96xx_HW_H__
-#define __OV_96xx_HW_H__
-
-/* Revision constants */
-#define PID_OV96xx		0x96
-#define REV_OV9640		0x48
-#define REV_OV9640_v3		0x49
-#define REV_OV9650_0		0x51
-#define REV_OV9650		0x52
-
-/* Return codes */
-#define OV_ERR_NONE       	0x00
-#define OV_ERR_TIMEOUT    	-1
-#define OV_ERR_PARAMETER  	-2
-#define OV_COMM_ERR		-3
-
-/* Output Size & Format */
-/*
-#define OV_SIZE_NONE		0
-#define OV_SIZE_QQVGA		0x01
-#define OV_SIZE_QVGA		( OV_SIZE_QQVGA << 1 )
-#define OV_SIZE_VGA		( OV_SIZE_QQVGA << 2 )
-#define OV_SIZE_SXGA		( OV_SIZE_QQVGA << 3 )
-#define OV_SIZE_QQCIF		0x10
-#define OV_SIZE_QCIF		( OV_SIZE_QQCIF << 1 )
-#define OV_SIZE_CIF		( OV_SIZE_QQCIF << 2 )
-#define OV_FORMAT_NONE		0
-#define OV_FORMAT_YUV_422	1
-#define OV_FORMAT_RGB_565	2
-*/
-enum OV_SIZE {
-	OV_SIZE_NONE=0	,
-	OV_SIZE_QQVGA	,
-	OV_SIZE_QVGA	,
-	OV_SIZE_VGA	,
-	OV_SIZE_SXGA	,
-	OV_SIZE_QQCIF	,
-	OV_SIZE_QCIF	,
-	OV_SIZE_CIF
-};
-enum OV_FORMAT {
-	OV_FORMAT_NONE=0 ,
-	OV_FORMAT_YUV_422,
-	OV_FORMAT_RGB_565,
-};
-
-/* Camera Mode */
-#define VIEWFINDER_MODE     0x10
-#define STILLFRAME_MODE     0x20
-
-/* Others */
-#define OV96xx_TIMEOUT    1000    // ms to timeout.
-
-/* OV96xx Register Definitions */
-#define OV96xx_GAIN		0x00
-#define OV96xx_BLUE		0x01
-#define OV96xx_RED		0x02
-#define OV96xx_VREF		0x03
-#define OV96xx_COM1		0x04
-#define OV96xx_BAVE		0x05				// U/B Average Level
-#define OV96xx_GEAVE		0x06				// Y/Ge Average Level
-#define OV96xx_GOAVE		0x07				// Y/Go Average Level
-#define OV96xx_RAVE		0x08				// V/R Average level
-#define OV96xx_COM2		0x09				// Common control 2
-#define OV96xx_PID		0x0A				// Product ID
-#define OV96xx_REV		0x0B				// Revision
-#define OV96xx_COM3		0x0C
-#define OV96xx_COM4		0x0D
-#define OV96xx_COM5		0x0E
-#define OV96xx_COM6		0x0F
-#define OV96xx_AECH		0x10
-#define OV96xx_CLKRC		0x11
-#define OV96xx_COM7		0x12
-#define OV96xx_COM8		0x13
-#define OV96xx_COM9		0x14
-#define OV96xx_COM10		0x15
-#define OV96xx_WS		0x16
-#define OV96xx_HSTART		0x17
-#define OV96xx_HSTOP		0x18
-#define OV96xx_VSTRT		0x19
-#define OV96xx_VSTOP		0x1A
-#define OV96xx_PSHFT		0x1B
-#define OV96xx_MIDH		0x1C
-#define OV96xx_MIDL		0x1D
-#define OV9640_DLY		0x1E
-#define OV9650_MVLP		0x1E
-#define OV96xx_LAEC		0x1F
-#define OV96xx_BOS		0x20
-#define OV96xx_GBOS		0x21
-#define OV96xx_GROS		0x22
-#define OV96xx_ROS		0x23
-#define OV96xx_AEW		0x24
-#define OV96xx_AEB		0x25
-#define OV96xx_VPT		0x26
-#define OV96xx_BBIAS		0x27
-#define OV96xx_GbBIAS		0x28
-#define OV9640_GrBIAS		0x29
-#define OV9650_GrCOM		0x29
-#define OV96xx_EXHCH		0x2A
-#define OV96xx_EXHCL		0x2B
-#define OV96xx_RBIAS		0x2C
-#define OV96xx_ADVFL		0x2D
-#define OV96xx_ADVFH		0x2E
-#define OV96xx_YAVE		0x2F
-#define OV96xx_HSYST		0x30
-#define OV96xx_HSYEN		0x31
-#define OV96xx_HREF		0x32
-#define OV96xx_CHLF		0x33
-#define OV96xx_ARBLM		0x34
-#define OV96xx_VRHL		0x35
-#define OV96xx_VIDO		0x36
-#define OV96xx_ADC		0x37
-#define OV96xx_ACOM		0x38
-#define OV96xx_OFON		0x39
-#define OV96xx_TSLB		0x3A
-#define OV96xx_COM11		0x3B
-#define OV96xx_COM12		0x3C
-#define OV96xx_COM13		0x3D
-#define OV96xx_COM14		0x3E
-#define OV96xx_EDGE		0x3F
-#define OV96xx_COM15		0x40
-#define OV96xx_COM16		0x41
-#define OV96xx_COM17		0x42
-#define OV96xx_AWBTH1		0x43
-#define OV96xx_AWBTH2		0x44
-#define OV96xx_AWBTH3		0x45
-#define OV96xx_AWBTH4		0x46
-#define OV96xx_AWBTH5		0x47
-#define OV96xx_AWBTH6		0x48
-#define OV96xx_MTX1		0x4F
-#define OV96xx_MTX2		0x50
-#define OV96xx_MTX3		0x51
-#define OV96xx_MTX4		0x52
-#define OV96xx_MTX5		0x53
-#define OV96xx_MTX6		0x54
-#define OV96xx_MTX7		0x55
-#define OV96xx_MTX8		0x56
-#define OV96xx_MTX9		0x57
-#define OV96xx_MTXS		0x58
-#define OV96xx_AWBC1		0x59
-#define OV96xx_AWBC2		0x5A
-#define OV96xx_AWBC3		0x5B
-#define OV96xx_AWBC4		0x5C
-#define OV96xx_AWBC5		0x5D
-#define OV96xx_AWBC6		0x5E
-#define OV96xx_AWBC7		0x5F
-#define OV96xx_AWBC8		0x60
-#define OV96xx_AWBC9		0x61
-#define OV96xx_LCC1		0x62
-#define OV96xx_LCC2		0x63
-#define OV96xx_LCC3		0x64
-#define OV96xx_LCC4		0x65
-#define OV96xx_LCC5		0x66
-#define OV96xx_MANU		0x67
-#define OV96xx_MANV		0x68
-#define OV96xx_HV		0x69
-#define OV96xx_MBD		0x6A
-#define OV96xx_DBLV		0x6B
-#define OV96xx_GSP0		0x6C
-#define OV96xx_GSP1		0x6D
-#define OV96xx_GSP2		0x6E
-#define OV96xx_GSP3		0x6F
-#define OV96xx_GSP4		0x70
-#define OV96xx_GSP5		0x71
-#define OV96xx_GSP6		0x72
-#define OV96xx_GSP7		0x73
-#define OV96xx_GSP8		0x74
-#define OV96xx_GSP9		0x75
-#define OV96xx_GSP10		0x76
-#define OV96xx_GSP11		0x77
-#define OV96xx_GSP12		0x78
-#define OV96xx_GSP13		0x79
-#define OV96xx_GSP14		0x7A
-#define OV96xx_GSP15		0x7B
-#define OV96xx_GST0		0x7C
-#define OV96xx_GST1		0x7D
-#define OV96xx_GST2		0x7E
-#define OV96xx_GST3		0x7F
-#define OV96xx_GST4		0x80
-#define OV96xx_GST5		0x81
-#define OV96xx_GST6		0x82
-#define OV96xx_GST7		0x83
-#define OV96xx_GST8		0x84
-#define OV96xx_GST9		0x85
-#define OV96xx_GST10		0x86
-#define OV96xx_GST11		0x87
-#define OV96xx_GST12		0x88
-#define OV96xx_GST13		0x89
-#define OV96xx_GST14		0x8A
-
-/* End of OV9640 register */
-#define OV9640_REGEND		( OV96xx_GST14 + 1 )
-
-/* OV9650 Register Definitions */
-#define OV9650_COM21		0x8B
-#define OV9650_COM22		0x8C
-#define OV9650_COM23		0x8D
-#define OV9650_COM24		0x8E
-#define OV9650_DBLC1		0x8F
-#define OV9650_DBLCB		0x90
-#define OV9650_DBLCR		0x91
-#define OV9650_DMLNL		0x92
-#define OV9650_DMLNH		0x93
-
-#define OV9650_AECHM		0xA1
-
-/* End of OV9650 register */
-#define OV9650_LASTREG		0xAA
-
-/* End flag of register */
-#define OV9650_REGEND		( 0xff )
-
-#endif
diff -ruN -X X hnd-linux-trunk/drivers/media/video/pxa_camera.c hnd-cleanup/drivers/media/video/pxa_camera.c
--- hnd-linux-trunk/drivers/media/video/pxa_camera.c	2007-09-17 22:45:41.000000000 +0400
+++ hnd-cleanup/drivers/media/video/pxa_camera.c	1970-01-01 03:00:00.000000000 +0300
@@ -1,1401 +0,0 @@
-/*
- *  pxa_camera.c
- *
- *  Bulverde Processor Camera Interface driver.
- *
- *  Copyright (C) 2003, Intel Corporation
- *  Copyright (C) 2003, Montavista Software Inc.
- *  Copyright (C) 2003-2006 Motorola Inc.
- *
- *  Author: Intel Corporation Inc.
- *          MontaVista Software, Inc.
- *           source@mvista.com
- *          Motorola Inc.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- *  V4L2 conversion (C) 2007 Sergey Lapin
- */
-#warning "Not finished yet, don't try to use!!!"
-#include <linux/module.h>
-#include <linux/delay.h>
-#include <linux/errno.h>
-#include <linux/fs.h>
-#include <linux/kernel.h>
-#include <linux/slab.h>
-#include <linux/mm.h>
-#include <linux/ioport.h>
-#include <linux/init.h>
-#include <linux/sched.h>
-#include <linux/pci.h>
-#include <linux/random.h>
-#include <linux/version.h>
-#include <linux/videodev2.h>
-#include <linux/dma-mapping.h>
-
-// #include <linux/config.h>
-#include <linux/module.h>
-#include <linux/version.h>
-#include <linux/init.h>
-#include <linux/fs.h>
-#include <linux/vmalloc.h>
-#include <linux/delay.h>
-#include <linux/slab.h>
-#include <linux/proc_fs.h>
-#include <linux/ctype.h>
-#include <linux/pagemap.h>
-// #include <linux/wrapper.h>
-#include <media/v4l2-dev.h>
-#include <linux/pci.h>
-#include <linux/pm.h>
-#include <linux/poll.h>
-#include <linux/wait.h>
-
-#include <linux/types.h>
-#include <asm/mach-types.h>
-#include <asm/io.h>
-#include <asm/semaphore.h>
-#include <asm/hardware.h>
-#include <asm/dma.h>
-#include <asm/arch/irqs.h>
-#include <asm/irq.h>
-#include <linux/interrupt.h>
-
-#include <asm/arch/pxa-regs.h>
-
-#ifdef CONFIG_VIDEO_V4L1_COMPAT
-/* Include V4L1 specific functions. Should be removed soon */
-#include <linux/videodev.h>
-#endif
-
-#include "pxa_ci_types.h"
-
-wait_queue_head_t  camera_wait_q;	
-camera_context_t  *g_camera_context;
-
-/* /dev/videoX registration number */
-static int    minor     = 0;
-static int    ci_dma_y  = -1;
-static int    ci_dma_cb = -1;
-static int    ci_dma_cr = -1;
-
-static int    task_waiting      = 0;
-static int    still_image_mode  = 0;
-static int    still_image_rdy   = 0;
-static int    first_video_frame = 0;
-
-
-static const CI_IMAGE_FORMAT FORMAT_MAPPINGS[] = 
-{
-        CI_RAW8,                   //RAW
-        CI_RAW9,
-        CI_RAW10,
-
-        CI_RGB444,                 //RGB
-        CI_RGB555,
-        CI_RGB565,
-        CI_RGB666_PACKED,          //RGB Packed 
-        CI_RGB666,
-        CI_RGB888_PACKED,
-        CI_RGB888,
-        CI_RGBT555_0,              //RGB+Transparent bit 0
-        CI_RGBT888_0,
-        CI_RGBT555_1,              //RGB+Transparent bit 1  
-        CI_RGBT888_1,
-    
-        CI_INVALID_FORMAT,
-        CI_YCBCR422,               //YCBCR
-        CI_YCBCR422_PLANAR,        //YCBCR Planaried
-        CI_INVALID_FORMAT,
-        CI_INVALID_FORMAT
-};
-
-/***********************************************************************
- *
- * Interrupt APIs
- *
- ***********************************************************************/
-// set interrupt mask 
-void camera_set_int_mask(p_camera_context_t cam_ctx, unsigned int mask)
-{
-	pxa_dma_desc * end_des_virtual;
-	int dma_interrupt_on, i;
-
-	// set CI interrupt
-	ci_set_int_mask( mask & CI_CICR0_INTERRUPT_MASK );
-
-	// set dma end interrupt
-	if( mask & CAMERA_INTMASK_END_OF_DMA )
-		dma_interrupt_on = 1;
-	else
-		dma_interrupt_on = 0;
-
-	// set fifo0 dma chains' flag
-	end_des_virtual = (pxa_dma_desc*)cam_ctx->fifo0_descriptors_virtual + cam_ctx->fifo0_num_descriptors - 1;
-
-    for(i=0; i<cam_ctx->block_number; i++) 
-    {
-        if(dma_interrupt_on)
-            end_des_virtual->dcmd |= DCMD_ENDIRQEN;
-        else
-            end_des_virtual->dcmd &= ~DCMD_ENDIRQEN;
-
-        end_des_virtual += cam_ctx->fifo0_num_descriptors;
-    }
-}
- 
-// get interrupt mask 
-unsigned int camera_get_int_mask(p_camera_context_t cam_ctx)
-{
-	pxa_dma_desc *end_des_virtual;
-	unsigned int ret;
-
-	// get CI mask
-	ret = ci_get_int_mask();
-	
-	// get dma end mask
-	end_des_virtual = (pxa_dma_desc *)cam_ctx->fifo0_descriptors_virtual + cam_ctx->fifo0_num_descriptors - 1;
-
-	if(end_des_virtual->dcmd & DCMD_ENDIRQEN)
-    {
-		ret |= CAMERA_INTMASK_END_OF_DMA;
-    }
-	return ret;   
-} 
-
-// clear interrupt status
-void camera_clear_int_status( p_camera_context_t camera_context, unsigned int status )
-{
-	ci_clear_int_status( (status & 0xFFFF) );   
-}
-
-static void camera_free_dma_irq()
-{
-     if(ci_dma_y>=0) 
-    {
-        pxa_free_dma(ci_dma_y);
-        ci_dma_y = 0;
-    }
-    if(ci_dma_cb>=0) 
-    {
-        pxa_free_dma(ci_dma_cb);
-        ci_dma_cb = 0;
-    }
-    if(ci_dma_cr>=0) 
-    {
-        pxa_free_dma(ci_dma_cr);
-        ci_dma_cr = 0;
-    }
-	DRCMR68 = 0;
-	DRCMR69 = 0;
-	DRCMR70 = 0;
-}
-
-/***********************************************************************************
- * Application interface 							   *
- ***********************************************************************************/
-
-static struct video_device vd;
-
-int pxa_camera_mem_init(void)
-{
-   g_camera_context = kmalloc(sizeof(struct camera_context_s), GFP_KERNEL);
-
-    if(g_camera_context == NULL)
-    {
-    	dbg_print( "PXA_CAMERA: Cann't allocate buffer for camera control structure \n");
-        return -1;
-    }
-	
-    memset(g_camera_context, 0, sizeof(struct camera_context_s));
-    
-    dbg_print("success!"); 
-    return 0;
-}
-
-int camera_init(p_camera_context_t camera_context)
-{
-#warning camera_init is unimplemented
-    return 0;
-}
-
-static int pxa_dma_buffer_init(p_camera_context_t camera_context)
-{
-	struct page    *page;
-	unsigned int	pages;
-	unsigned int	page_count;
-
-	camera_context->pages_allocated = 0;
-
-	pages = (PAGE_ALIGN(camera_context->buf_size) / PAGE_SIZE);
-
-	camera_context->page_array = (struct page **)
-                                 kmalloc(pages * sizeof(struct page *),
-                                 GFP_KERNEL);
-                               
-	if(camera_context->page_array == NULL)
-	{
-		return -ENOMEM;
-	}
-	memset(camera_context->page_array, 0, pages * sizeof(struct page *));
-
-	for(page_count = 0; page_count < pages; page_count++)
-	{
-		page = alloc_page(GFP_KERNEL);
-		if(page == NULL)
-		{
-			goto error;
-		}
-		camera_context->page_array[page_count] = page;
-		init_page_count(page);
-		SetPageReserved(page);
-	}
-	camera_context->buffer_virtual = vmap(camera_context->page_array,
-						pages, VM_MAP, PAGE_KERNEL);
-	if(camera_context->buffer_virtual == NULL)
-	{
-		goto error;
-	}
-
-	camera_context->pages_allocated = pages;
-
-	return 0;
-
-error:
-	for(page_count = 0; page_count < pages; page_count++)
-	{
-		if((page = camera_context->page_array[page_count]) != NULL)
-		{
-			ClearPageReserved(page);
-			init_page_count(page);
-			put_page(page);
-		}
-	}
-	kfree(camera_context->page_array);
-
-	return -ENOMEM;
-}
-
-static void pxa_dma_buffer_free(p_camera_context_t camera_context)
-{
-	struct page *page;
-	int page_count;
-
-	if(camera_context->buffer_virtual == NULL)
-		return;
-
-	vfree(camera_context->buffer_virtual);
-
-	for(page_count = 0; page_count < camera_context->pages_allocated; page_count++)
-	{
-		if((page = camera_context->page_array[page_count]) != NULL)
-		{
-			ClearPageReserved(page);
-			init_page_count(page);
-			put_page(page);
-		}
-	}
-	kfree(camera_context->page_array);
-}
-
-int pxa_camera_mem_deinit(void)
-{
-    if(g_camera_context)
-    {
-        if(g_camera_context->dma_descriptors_virtual != NULL) 
-        {
-	    dma_free_coherent(NULL,
-		    g_camera_context->dma_descriptors_size *
-		    				sizeof(pxa_dma_desc),
-		    g_camera_context->dma_descriptors_virtual,
-		    g_camera_context->dma_descriptors_physical);
-//            kfree(g_camera_context->dma_descriptors_virtual);
-
-          g_camera_context->dma_descriptors_virtual = NULL;
-
-        }
-       if(g_camera_context->buffer_virtual != NULL)  
-       {
-        pxa_dma_buffer_free(g_camera_context);		     
-        g_camera_context->buffer_virtual = NULL;
-       }
-       kfree(g_camera_context);
-       g_camera_context = NULL;
-    }
-    
-    return 0;
-}
-
-
-static int pxa_camera_open(struct inode *inode, struct file *file)
-{
-    unsigned int minor = iminor(inode);
-    camera_context_t *cam_ctx;
-    dbg_print("start...");
-    /*
-      According to Peter's suggestion, move the code of request camera IRQ and DMQ channel to here
-    */     
-    /* 1. mapping CI registers, so that we can access the CI */
-   	
-    ci_dma_y = pxa_request_dma("CI_Y",DMA_PRIO_HIGH, pxa_ci_dma_irq_y, &vd);
-
-    if(ci_dma_y < 0) 
-    {
-	    camera_free_dma_irq();
-      dbg_print( "PXA_CAMERA: Cann't request DMA for Y\n");
-      return -EIO;
-    }
-    dbg_print( "PXA_CAMERA: Request DMA for Y successfully [%d]\n",ci_dma_y);
-   
-    ci_dma_cb = pxa_request_dma("CI_Cb",DMA_PRIO_HIGH, pxa_ci_dma_irq_cb, &vd);
-    if(ci_dma_cb < 0) 
-    {
-	    camera_free_dma_irq();
-	dbg_print( "PXA_CAMERA: Cann't request DMA for Cb\n");
-	return -EIO;
-    } 
-    dbg_print( "PXA_CAMERA: Request DMA for Cb successfully [%d]\n",ci_dma_cb);
-    
-    ci_dma_cr = pxa_request_dma("CI_Cr",DMA_PRIO_HIGH, pxa_ci_dma_irq_cr, &vd);
-    if(ci_dma_cr < 0) 
-    {
-	    camera_free_dma_irq();
-	dbg_print( "PXA_CAMERA: Cann't request DMA for Cr\n");
-	return -EIO;
-    }
-    
-    dbg_print( "PXA_CAMERA: Request DMA for Cr successfully [%d]\n",ci_dma_cr);
-   
-    DRCMR68 = ci_dma_y | DRCMR_MAPVLD;
-    DRCMR69 = ci_dma_cb | DRCMR_MAPVLD;
-    DRCMR70 = ci_dma_cr | DRCMR_MAPVLD;	
-
-
-    init_waitqueue_head(&camera_wait_q);
-   
-    /* alloc memory for camera context */
-    if(pxa_camera_mem_init())
-    {
-	    camera_free_dma_irq();
-      dbg_print("memory allocate failed!");
-      return -1;
-    }
-
-    cam_ctx = g_camera_context;
-    
-    /*
-     camera_init call init function for E680
-    */
-    if(camera_init(cam_ctx))
-    {
-       dbg_print("camera_init faile!");
-	    camera_free_dma_irq();
-       pxa_camera_mem_deinit();
-       return -1;
-    }
-    
-    /*
-       allocate memory for dma descriptors 
-       init function of each sensor should set proper value for cam_ctx->buf_size 
-    */
-   	cam_ctx->dma_started = 0;
-    cam_ctx->dma_descriptors_virtual = dma_alloc_coherent(NULL, (cam_ctx->dma_descriptors_size) * sizeof(pxa_dma_desc),
-                                                        (void *)&(cam_ctx->dma_descriptors_physical), GFP_KERNEL);
-    if(cam_ctx->dma_descriptors_virtual == NULL)
-    {
-       dbg_print("consistent alloc memory for dma_descriptors_virtual fail!");
-	    camera_free_dma_irq();
-       pxa_camera_mem_deinit();
-       return -1;
-    }
-
-
-    /*
-      alloc memory for picture buffer 
-      init function of each sensor should set proper value for cam_ctx->buf_size 
-    */    
-    if(pxa_dma_buffer_init(cam_ctx) != 0)
-    {
-      dbg_print("alloc memory for buffer_virtual  %d bytes fail!", g_camera_context->buf_size);
-	    camera_free_dma_irq();
-      pxa_camera_mem_deinit();
-      return -1;
-    }
-     
-    /*
-      set default size and capture format
-      init function of each sensor should set proper value 
-      for capture_width, capture_height, etc. of camera context 
-    */    
-	if(camera_set_capture_format(cam_ctx) != 0)
-	{
-		dbg_print("camera function init error! capture format!");
-	    camera_free_dma_irq();
-		pxa_camera_mem_deinit();
-		return -1;
-    }
-    dbg_print("PXA_CAMERA: pxa_camera_open success!");
-    return 0;
-}
-
-
-
-static int pxa_camera_close(struct inode *inode, struct file *file)
-{
-    camera_deinit(g_camera_context);
-    pxa_camera_mem_deinit();
-    camera_free_dma_irq();
-    dbg_print("PXA_CAMERA: pxa_camera_close\n");
-    return 0;
-}
-
-#define PXA_CAMERA_BUFFER_COPY_TO_USER(buf, p_page, size) \
-do { \
-	unsigned int len; \
-	unsigned int remain_size = size; \
-	while (remain_size > 0) { \
-		if(remain_size > PAGE_SIZE) \
-			len = PAGE_SIZE; \
-		else \
-			len = remain_size; \
-		if(copy_to_user(buf, page_address(*p_page), len)) \
-			return -EFAULT; \
-		remain_size -= len; \
-		buf += len; \
-		p_page++; \
-	} \
-} while (0);
-
-static ssize_t pxa_camera_write(struct file *file, const char __user *data,
-				size_t count, loff_t *ppos)
-{
-	return -EINVAL;
-}
-
-static ssize_t pxa_camera_read(struct file *file, char   __user *buf,
-                            size_t count, loff_t *ppos)
-{
-
-	struct page **p_page;
-
-	camera_context_t *cam_ctx = g_camera_context;
-
-	if(still_image_mode == 1 && still_image_rdy == 1) 
-    {
-		p_page = &cam_ctx->page_array[cam_ctx->block_tail * cam_ctx->pages_per_block];
-
-		PXA_CAMERA_BUFFER_COPY_TO_USER(buf, p_page, cam_ctx->fifo0_transfer_size);
-		PXA_CAMERA_BUFFER_COPY_TO_USER(buf, p_page, cam_ctx->fifo1_transfer_size);
-		PXA_CAMERA_BUFFER_COPY_TO_USER(buf, p_page, cam_ctx->fifo2_transfer_size);
-
-		still_image_rdy = 0;
-		return cam_ctx->block_size;
-	}
-
-	if(still_image_mode == 0)
-	{
-		if(first_video_frame == 1)
-			cam_ctx->block_tail = cam_ctx->block_header;
-		else
-			cam_ctx->block_tail = (cam_ctx->block_tail + 1) % cam_ctx->block_number;
-	}
-
-	first_video_frame = 0;
-
-	if(cam_ctx->block_header == cam_ctx->block_tail)  
-    {
-		task_waiting = 1;
-		interruptible_sleep_on (&camera_wait_q);
-	}
-
-	p_page = &cam_ctx->page_array[cam_ctx->block_tail * cam_ctx->pages_per_block];
-
-	PXA_CAMERA_BUFFER_COPY_TO_USER(buf, p_page, cam_ctx->fifo0_transfer_size);
-	PXA_CAMERA_BUFFER_COPY_TO_USER(buf, p_page, cam_ctx->fifo1_transfer_size);
-	PXA_CAMERA_BUFFER_COPY_TO_USER(buf, p_page, cam_ctx->fifo2_transfer_size);
-
-	return cam_ctx->block_size;
-}
-
-static int pxa_camera_mmap(struct file *file, struct vm_area_struct *vma)
-{
-   	unsigned long start = vma->vm_start;
-	unsigned long size = (vma->vm_end - vma->vm_start);
-	unsigned long offset = vma->vm_pgoff << PAGE_SHIFT;
-	camera_context_t *cam_ctx = g_camera_context;
-	struct page **p_page = cam_ctx->page_array;
-
-	size = PAGE_ALIGN(size);
-	if (remap_pfn_range(vma, start, page_to_phys(*p_page), size,
-			    PAGE_SHARED)) {
-			return -EFAULT;
-	}
-	return 0;
- }
-
-static unsigned int pxa_camera_poll(struct file *file, poll_table *wait) 
-{
-    static int waited = 0;
-    camera_context_t *cam_ctx = g_camera_context;
-
-    poll_wait(file, &camera_wait_q, wait);
-    
-    if(still_image_mode == 1 && still_image_rdy == 1) 
-    {
-        still_image_rdy = 0;
-        waited = 0;
-        return POLLIN | POLLRDNORM;
-	}
-    
-    if(first_video_frame == 1)
-    {
-       first_video_frame = 0;
-    }
-    else if(still_image_mode == 0 && waited != 1)
-    {
-       cam_ctx->block_tail = (cam_ctx->block_tail + 1) % cam_ctx->block_number;
-    }
-
-    if(cam_ctx->block_header == cam_ctx->block_tail)  
-    {
-        task_waiting = 1;
-        waited = 1;
-        return 0;
-    }
-    waited = 0;
-    return POLLIN | POLLRDNORM;
-}
-
-int pxa_camera_ioctl(struct inode *inode, struct file *file,
-			    unsigned int cmd, unsigned long arg);
-
-static struct file_operations vd_fops =
-{
-	.owner      = THIS_MODULE,
-	.open       = pxa_camera_open,
-	.release    = pxa_camera_close,
-	.read       = pxa_camera_read,
-	.poll       = pxa_camera_poll,
-	.ioctl      = pxa_camera_ioctl,
-	.mmap       = pxa_camera_mmap,
-	.llseek     = no_llseek,
-	.write      = pxa_camera_write,
-};
-
-static struct video_device vd =
-{
-	.owner      = THIS_MODULE,
-	.name       = "PXA camera",
-	.type       = VID_TYPE_CAPTURE,
-#if 0
-		.hardware	= VID_HARDWARE_PXA_CAMERA,      /* FIXME */
-#endif
-	.hardware   = 0,
-	.fops       = &vd_fops,
-	.minor      = -1,
-};
-
-void pxa_ci_dma_irq_y(int channel, void *data)
-{
-
-    static int dma_repeated = 0;
-    camera_context_t  *cam_ctx = g_camera_context;
-    int        dcsr;
-    
-    dcsr = DCSR(channel);
-    DCSR(channel) = dcsr & ~DCSR_STOPIRQEN;
- 
-    if(still_image_mode == 1) 
-    {
-        if(task_waiting == 1) 
-        {
-            wake_up_interruptible (&camera_wait_q);
-            task_waiting = 0;
-        }
-        still_image_rdy = 1;
-    	stop_dma_transfer(cam_ctx);
-    } 
-    else if(dma_repeated == 0 &&
-           (cam_ctx->block_tail == ((cam_ctx->block_header + 2) % cam_ctx->block_number)))  
-    {
-        dma_repeated = 1;
-        pxa_dma_repeat(cam_ctx);
-        //dbg_print ("DMA repeated.");
-        cam_ctx->block_header = (cam_ctx->block_header + 1) % cam_ctx->block_number;
-    }
-    else if(dma_repeated == 1 && 
-        (cam_ctx->block_tail != ((cam_ctx->block_header + 1) % cam_ctx->block_number)) && 
-        (cam_ctx->block_tail != ((cam_ctx->block_header + 2) % cam_ctx->block_number)))  
-    {
-        pxa_dma_continue(cam_ctx);
-        //dbg_print ("DMA continue.");
-        dma_repeated = 0;
-    }
-    else if(dma_repeated == 0) 
-    {
-        cam_ctx->block_header = (cam_ctx->block_header + 1) % cam_ctx->block_number;
-    }
-    
-    if(task_waiting == 1 && !(cam_ctx->block_header == cam_ctx->block_tail)) 
-    {
-        wake_up_interruptible (&camera_wait_q);
-        task_waiting = 0;
-    }
-
-}
-
-void pxa_ci_dma_irq_cb(int channel, void *data)
-{
-    return;
-}
-
-void pxa_ci_dma_irq_cr(int channel, void *data)
-{
-    return;
-}
-
-
-static irqreturn_t pxa_camera_irq(int irq, void *dev_id)
-{
-	unsigned int cisr;
-
-	disable_irq(IRQ_CAMERA);
-	cisr = CISR;
-
-	if (cisr & CI_CISR_SOF)
-		CISR |= CI_CISR_SOF;
-
-	if (cisr & CI_CISR_EOF)
-		CISR |= CI_CISR_EOF;
-
-	enable_irq(IRQ_CAMERA);
-	return IRQ_HANDLED;
-}
-
-static int __init pxa_camera_init(void)
-{
-	if (request_irq(IRQ_CAMERA, pxa_camera_irq, 0, "PXA Camera", &vd))
-	{
-		dbg_print("Camera interrupt register failed failed number \n");
-		return -EIO;
-	}
-	dbg_print ("Camera interrupt register successful \n");
-
-	if(video_register_device(&vd, VFL_TYPE_GRABBER, 0) < 0)
-	{
-		dbg_print("PXA_CAMERA: video_register_device failed\n");
-		return -EIO;
-	}
-
-	dbg_print("PXA_CAMERA: video_register_device successfully. /dev/video%d \n", 0);
-
-	return 0;
-}
-
-static void __exit pxa_camera_exit(void)
-{
-	free_irq(IRQ_CAMERA,  &vd);
-	video_unregister_device(&vd);
-}
-
-
-//-------------------------------------------------------------------------------------------------------
-//      Configuration APIs
-//-------------------------------------------------------------------------------------------------------
-
-void pxa_dma_repeat(camera_context_t  *cam_ctx)
-{
-        pxa_dma_desc *cnt_head, *cnt_tail;
-	int cnt_block;
-
-	cnt_block = (cam_ctx->block_header + 1) % cam_ctx->block_number;
-    
-    // FIFO0
-	cnt_head = (pxa_dma_desc *)cam_ctx->fifo0_descriptors_virtual + 
-                                cnt_block * cam_ctx->fifo0_num_descriptors;
-                                
-	cnt_tail = cnt_head + cam_ctx->fifo0_num_descriptors - 1;
-	cnt_tail->ddadr = cnt_head->ddadr - sizeof(pxa_dma_desc);
-    
-    // FIFO1
-	if(cam_ctx->fifo1_transfer_size) 
-    {
-		cnt_head = (pxa_dma_desc *)cam_ctx->fifo1_descriptors_virtual + 
-                    cnt_block * cam_ctx->fifo1_num_descriptors;
-                    
-		cnt_tail = cnt_head + cam_ctx->fifo1_num_descriptors - 1;
-		cnt_tail->ddadr = cnt_head->ddadr - sizeof(pxa_dma_desc);
-	}
-    
-    // FIFO2
-	if(cam_ctx->fifo2_transfer_size) 
-    {
-		cnt_head = (pxa_dma_desc *)cam_ctx->fifo2_descriptors_virtual + 
-                    cnt_block * cam_ctx->fifo2_num_descriptors;
-                    
-		cnt_tail = cnt_head + cam_ctx->fifo2_num_descriptors - 1;
-		cnt_tail->ddadr = cnt_head->ddadr - sizeof(pxa_dma_desc);
-	}
-}
-
-void pxa_dma_continue(camera_context_t *cam_ctx)
-{
-   	pxa_dma_desc *cnt_head, *cnt_tail;
-	pxa_dma_desc *next_head;
-	int cnt_block, next_block;
-
-	cnt_block = cam_ctx->block_header;
-	next_block = (cnt_block + 1) % cam_ctx->block_number;
-    
-    // FIFO0
-	cnt_head  = (pxa_dma_desc *)cam_ctx->fifo0_descriptors_virtual + 
-                cnt_block * cam_ctx->fifo0_num_descriptors;
-                
-	cnt_tail  = cnt_head + cam_ctx->fifo0_num_descriptors - 1;
-    
-	next_head = (pxa_dma_desc *)cam_ctx->fifo0_descriptors_virtual +
-                next_block * cam_ctx->fifo0_num_descriptors;
-
-    cnt_tail->ddadr = next_head->ddadr - sizeof(pxa_dma_desc);
-    
-    // FIFO1
-	if(cam_ctx->fifo1_transfer_size) 
-    {
-		cnt_head  = (pxa_dma_desc *)cam_ctx->fifo1_descriptors_virtual + 
-                    cnt_block * cam_ctx->fifo1_num_descriptors;
-                    
-		cnt_tail  = cnt_head + cam_ctx->fifo1_num_descriptors - 1;
-        
-		next_head = (pxa_dma_desc *)cam_ctx->fifo1_descriptors_virtual + 
-                     next_block * cam_ctx->fifo1_num_descriptors;
-                     
-		cnt_tail->ddadr = next_head->ddadr - sizeof(pxa_dma_desc);
-	}
-    
-    // FIFO2
-	if(cam_ctx->fifo2_transfer_size) 
-    {
-		cnt_head  = (pxa_dma_desc *)cam_ctx->fifo2_descriptors_virtual + 
-                   cnt_block * cam_ctx->fifo2_num_descriptors;
-                   
-		cnt_tail  = cnt_head + cam_ctx->fifo2_num_descriptors - 1;
-        
-		next_head = (pxa_dma_desc *)cam_ctx->fifo2_descriptors_virtual + 
-                    next_block * cam_ctx->fifo2_num_descriptors;
-                    
-		cnt_tail->ddadr = next_head->ddadr - sizeof(pxa_dma_desc);
-	}
-	return;
-
-}
-
-/*
-Generate dma descriptors
-Pre-condition: these variables must be set properly
-                block_number, fifox_transfer_size 
-                dma_descriptors_virtual, dma_descriptors_physical, dma_descirptors_size
-Post-condition: these variables will be set
-                fifox_descriptors_virtual, fifox_descriptors_physical              
-                fifox_num_descriptors 
-*/
-//#ifdef  CONFIG_PXA_EZX_E680
-static int generate_fifo2_dma_chain(p_camera_context_t camera_context, pxa_dma_desc ** cur_vir, pxa_dma_desc ** cur_phy)
-{
-    pxa_dma_desc *cur_des_virtual, *cur_des_physical, *last_des_virtual = NULL;
-    int des_transfer_size, remain_size, target_page_num;
-    unsigned int i,j;
-
-    cur_des_virtual  = (pxa_dma_desc *)camera_context->fifo2_descriptors_virtual;
-    cur_des_physical = (pxa_dma_desc *)camera_context->fifo2_descriptors_physical;
-
-    for(i=0; i<camera_context->block_number; i++) 
-    {
-        // in each iteration, generate one dma chain for one frame
-        remain_size = camera_context->fifo2_transfer_size;
-
-        target_page_num = camera_context->pages_per_block * i +
-        camera_context->pages_per_fifo0 +
-        camera_context->pages_per_fifo1;
-
-        if (camera_context->pages_per_fifo1 > 1) 
-        {
-            for(j=0; j<camera_context->fifo2_num_descriptors; j++) 
-            {
-                // set descriptor
-                if (remain_size > SINGLE_DESC_TRANS_MAX) 
-                {
-                    des_transfer_size = SINGLE_DESC_TRANS_MAX;
-                }
-                else
-                {
-                    des_transfer_size = remain_size;
-                }
-                    
-                cur_des_virtual->ddadr = (unsigned)cur_des_physical + sizeof(pxa_dma_desc);
-                cur_des_virtual->dsadr = CIBR2_PHY;      // FIFO2 physical address
-                cur_des_virtual->dtadr =
-                virt_to_bus(camera_context->page_array[target_page_num]);
-                cur_des_virtual->dcmd = des_transfer_size | DCMD_FLOWSRC | DCMD_INCTRGADDR | DCMD_BURST32;
-
-                // advance pointers
-                remain_size -= des_transfer_size;
-                cur_des_virtual++;
-                cur_des_physical++;
-                target_page_num++;
-            }
-            // stop the dma transfer on one frame captured
-            last_des_virtual = cur_des_virtual - 1;
-        }
-        else 
-        {
-            for(j=0; j<camera_context->fifo2_num_descriptors; j++) 
-            {
-                // set descriptor
-                if (remain_size > SINGLE_DESC_TRANS_MAX/2) 
-                {
-                    des_transfer_size = SINGLE_DESC_TRANS_MAX/2;
-                }
-                else
-                {
-                    des_transfer_size = remain_size;
-                }
-                cur_des_virtual->ddadr = (unsigned)cur_des_physical + sizeof(pxa_dma_desc);
-                cur_des_virtual->dsadr = CIBR2_PHY;      // FIFO2 physical address
-                if (!(j % 2))
-                {
-                    cur_des_virtual->dtadr =
-                    virt_to_bus(camera_context->page_array[target_page_num]);
-                }
-                else 
-                {
-                    cur_des_virtual->dtadr =
-                    virt_to_bus(camera_context->page_array[target_page_num]) + (PAGE_SIZE/2);
-                }
-
-                cur_des_virtual->dcmd = des_transfer_size | DCMD_FLOWSRC | DCMD_INCTRGADDR | DCMD_BURST32;
-    
-                ddbg_print(" CR: the ddadr = %8x, dtadr = %8x, dcmd = %8x, page = %8x \n", 
-                            cur_des_virtual->ddadr,
-                            cur_des_virtual->dtadr,
-                            cur_des_virtual->dcmd,
-                            virt_to_bus(camera_context->page_array[target_page_num]) );
-    
-                // advance pointers
-                remain_size -= des_transfer_size;
-                cur_des_virtual++;
-                cur_des_physical++;
-        
-                if (j % 2)
-                {
-                    target_page_num++;
-                }
-            }
-
-            // stop the dma transfer on one frame captured
-            last_des_virtual = cur_des_virtual - 1;
-            //last_des_virtual->ddadr |= 0x1;
-        }
-    }
-    last_des_virtual->ddadr = ((unsigned)camera_context->fifo2_descriptors_physical);
-    
-    *cur_vir = cur_des_virtual;
-    *cur_phy = cur_des_physical;
-    return 0;
-}
-
-static int generate_fifo1_dma_chain(p_camera_context_t camera_context, pxa_dma_desc ** cur_vir, pxa_dma_desc ** cur_phy)
-{
-    pxa_dma_desc *cur_des_virtual, *cur_des_physical, *last_des_virtual = NULL;
-    int des_transfer_size, remain_size, target_page_num;
-    unsigned int i,j;
-
-    cur_des_virtual  = (pxa_dma_desc *)camera_context->fifo1_descriptors_virtual;
-    cur_des_physical = (pxa_dma_desc *)camera_context->fifo1_descriptors_physical;
-
-    for(i=0; i<camera_context->block_number; i++)
-    {
-        // in each iteration, generate one dma chain for one frame
-        remain_size = camera_context->fifo1_transfer_size;
-
-        target_page_num = camera_context->pages_per_block * i +
-        camera_context->pages_per_fifo0;
-
-        if (camera_context->pages_per_fifo1 > 1) 
-        {
-            for(j=0; j<camera_context->fifo1_num_descriptors; j++) 
-            {
-                // set descriptor
-                if (remain_size > SINGLE_DESC_TRANS_MAX) 
-                    des_transfer_size = SINGLE_DESC_TRANS_MAX;
-                else
-                    des_transfer_size = remain_size;
-                
-                cur_des_virtual->ddadr = (unsigned)cur_des_physical + sizeof(pxa_dma_desc);
-                cur_des_virtual->dsadr = CIBR1_PHY;      // FIFO1 physical address
-                cur_des_virtual->dtadr =
-                virt_to_bus(camera_context->page_array[target_page_num]);
-                cur_des_virtual->dcmd = des_transfer_size | DCMD_FLOWSRC | DCMD_INCTRGADDR | DCMD_BURST32;
-
-                // advance pointers
-                remain_size -= des_transfer_size;
-                cur_des_virtual++;
-                cur_des_physical++;
-
-                target_page_num++;
-            }
-
-            // stop the dma transfer on one frame captured
-            last_des_virtual = cur_des_virtual - 1;
-            //last_des_virtual->ddadr |= 0x1;
-        }
-        else  
-        {
-            for(j=0; j<camera_context->fifo1_num_descriptors; j++) 
-            {
-                // set descriptor
-                if (remain_size > SINGLE_DESC_TRANS_MAX/2) 
-                {
-                    des_transfer_size = SINGLE_DESC_TRANS_MAX/2;
-                }
-                else
-                {
-                    des_transfer_size = remain_size;
-                }
-                cur_des_virtual->ddadr = (unsigned)cur_des_physical + sizeof(pxa_dma_desc);
-                cur_des_virtual->dsadr = CIBR1_PHY;      // FIFO1 physical address
-                if(!(j % 2))
-                {
-                    cur_des_virtual->dtadr =
-                    virt_to_bus(camera_context->page_array[target_page_num]);
-                }
-                else 
-                {
-                    cur_des_virtual->dtadr =
-                    virt_to_bus(camera_context->page_array[target_page_num]) + (PAGE_SIZE/2);
-                }
-
-                cur_des_virtual->dcmd = des_transfer_size | DCMD_FLOWSRC | DCMD_INCTRGADDR | DCMD_BURST32;
-
-                ddbg_print("CB: the ddadr = %8x, dtadr = %8x, dcmd = %8x, page = %8x \n", 
-                        cur_des_virtual->ddadr,
-                        cur_des_virtual->dtadr,
-                        cur_des_virtual->dcmd,
-                        virt_to_bus(camera_context->page_array[target_page_num]));
-
-                // advance pointers
-                remain_size -= des_transfer_size;
-                cur_des_virtual++;
-                cur_des_physical++;
-                if (j % 2)
-                {
-                    target_page_num++;
-                }
-            }//end of for j...
-            // stop the dma transfer on one frame captured
-            last_des_virtual = cur_des_virtual - 1;
-          }// end of else
-    }//end of for i...
-    last_des_virtual->ddadr = ((unsigned)camera_context->fifo1_descriptors_physical);
-    *cur_vir = cur_des_virtual;
-    *cur_phy = cur_des_physical;
-
-    return 0;
-}
-
-static int generate_fifo0_dma_chain(p_camera_context_t camera_context, pxa_dma_desc ** cur_vir, pxa_dma_desc ** cur_phy)
-{
-    pxa_dma_desc *cur_des_virtual, *cur_des_physical, *last_des_virtual = NULL;
-    int des_transfer_size, remain_size, target_page_num;
-    unsigned int i,j;
-    
-    cur_des_virtual = (pxa_dma_desc *)camera_context->fifo0_descriptors_virtual;
-    cur_des_physical = (pxa_dma_desc *)camera_context->fifo0_descriptors_physical;
-
-    for(i=0; i<camera_context->block_number; i++) 
-    {
-        // in each iteration, generate one dma chain for one frame
-        remain_size = camera_context->fifo0_transfer_size;
-
-        // assume the blocks are stored consecutively
-        target_page_num = camera_context->pages_per_block * i;
-
-        if (camera_context->pages_per_fifo0 > 2) 
-        {
-            for(j=0; j<camera_context->fifo0_num_descriptors; j++) 
-            {
-                // set descriptor
-                if (remain_size > SINGLE_DESC_TRANS_MAX)
-                {
-                    des_transfer_size = SINGLE_DESC_TRANS_MAX;
-                }
-                else
-                {
-                    des_transfer_size = remain_size;
-                }
-                cur_des_virtual->ddadr = (unsigned)cur_des_physical + sizeof(pxa_dma_desc);
-                cur_des_virtual->dsadr = CIBR0_PHY;       // FIFO0 physical address
-                cur_des_virtual->dtadr =
-                virt_to_bus(camera_context->page_array[target_page_num]);
-                cur_des_virtual->dcmd = des_transfer_size | DCMD_FLOWSRC | DCMD_INCTRGADDR | DCMD_BURST32;
-
-                // advance pointers
-                remain_size -= des_transfer_size;
-                cur_des_virtual++;
-                cur_des_physical++;
-                target_page_num++;
-            }
-            // stop the dma transfer on one frame captured
-            last_des_virtual = cur_des_virtual - 1;
-            //last_des_virtual->ddadr |= 0x1;
-        }
-        else
-        {
-            for(j=0; j<camera_context->fifo0_num_descriptors; j++) 
-            {
-                // set descriptor
-                if(remain_size > SINGLE_DESC_TRANS_MAX/2) 
-                {
-                    des_transfer_size = SINGLE_DESC_TRANS_MAX/2;
-                }
-                else
-                {
-                    des_transfer_size = remain_size;
-                }
-                cur_des_virtual->ddadr = (unsigned)cur_des_physical + sizeof(pxa_dma_desc);
-                cur_des_virtual->dsadr = CIBR0_PHY;       // FIFO0 physical address
-                if(!(j % 2))
-                {
-                    cur_des_virtual->dtadr = virt_to_bus(camera_context->page_array[target_page_num]);
-                }
-                else 
-                {
-                    cur_des_virtual->dtadr = virt_to_bus(camera_context->page_array[target_page_num]) + (PAGE_SIZE / 2);
-                }
-
-                cur_des_virtual->dcmd = des_transfer_size | DCMD_FLOWSRC | DCMD_INCTRGADDR | DCMD_BURST32;
- 
-                ddbg_print(" Y: the ddadr = %8x, dtadr = %8x, dcmd = %8x, page = %8x, page_num = %d \n", 
-                            cur_des_virtual->ddadr,
-                            cur_des_virtual->dtadr,
-                            cur_des_virtual->dcmd,
-                            virt_to_bus(camera_context->page_array[target_page_num]),
-                            target_page_num);
-                // advance pointers
-                remain_size -= des_transfer_size;
-                cur_des_virtual++;
-                cur_des_physical++;
-                if (j % 2)
-                {
-                    target_page_num++;
-                }
-            }//end of for j..
-            // stop the dma transfer on one frame captured
-            last_des_virtual = cur_des_virtual - 1;
-            //last_des_virtual->ddadr |= 0x1;
-        }// end of else	
-    }
-    last_des_virtual->ddadr = ((unsigned)camera_context->fifo0_descriptors_physical);
-    *cur_vir = cur_des_virtual;
-    *cur_phy = cur_des_physical;
-    return 0;
-}
-
-
-int update_dma_chain(p_camera_context_t camera_context)
-{
-    pxa_dma_desc *cur_des_virtual, *cur_des_physical; 
-    // clear descriptor pointers
-    camera_context->fifo0_descriptors_virtual = camera_context->fifo0_descriptors_physical = 0;
-    camera_context->fifo1_descriptors_virtual = camera_context->fifo1_descriptors_physical = 0;
-    camera_context->fifo2_descriptors_virtual = camera_context->fifo2_descriptors_physical = 0;
-
-    // calculate how many descriptors are needed per frame
-    camera_context->fifo0_num_descriptors =
-    camera_context->pages_per_fifo0 > 2 ? camera_context->pages_per_fifo0 : (camera_context->fifo0_transfer_size / (PAGE_SIZE/2) + 1);
-
-    camera_context->fifo1_num_descriptors =
-    camera_context->pages_per_fifo1  > 1 ? camera_context->pages_per_fifo1 : (camera_context->fifo1_transfer_size / (PAGE_SIZE/2) + 1);
-
-    camera_context->fifo2_num_descriptors =
-    camera_context->pages_per_fifo2  > 1 ? camera_context->pages_per_fifo2 : (camera_context->fifo2_transfer_size / (PAGE_SIZE/2) + 1);
-
-    // check if enough memory to generate descriptors
-    if((camera_context->fifo0_num_descriptors + camera_context->fifo1_num_descriptors + 
-        camera_context->fifo2_num_descriptors) * camera_context->block_number 
-         > camera_context->dma_descriptors_size)
-    {
-      return -1;
-    }
-
-    // generate fifo0 dma chains
-    camera_context->fifo0_descriptors_virtual = (unsigned)camera_context->dma_descriptors_virtual;
-    camera_context->fifo0_descriptors_physical = (unsigned)camera_context->dma_descriptors_physical;
-    // generate fifo0 dma chains
-    generate_fifo0_dma_chain(camera_context, &cur_des_virtual, &cur_des_physical);
-     
-    // generate fifo1 dma chains
-    if(!camera_context->fifo1_transfer_size)
-    {
-       return 0;
-    }
-    // record fifo1 descriptors' start address
-    camera_context->fifo1_descriptors_virtual = (unsigned)cur_des_virtual;
-    camera_context->fifo1_descriptors_physical = (unsigned)cur_des_physical;
-    // generate fifo1 dma chains
-    generate_fifo1_dma_chain(camera_context, &cur_des_virtual, &cur_des_physical);
-    
-    if(!camera_context->fifo2_transfer_size) 
-    {
-      return 0;
-    }
-    // record fifo1 descriptors' start address
-    camera_context->fifo2_descriptors_virtual = (unsigned)cur_des_virtual;
-    camera_context->fifo2_descriptors_physical = (unsigned)cur_des_physical;
-    // generate fifo2 dma chains
-    generate_fifo2_dma_chain(camera_context,  &cur_des_virtual, &cur_des_physical);
-        
-    return 0;   
-}
-
-int camera_deinit( p_camera_context_t camera_context )
-{
-#if 0
-    // deinit sensor
-	if(camera_context->camera_functions)
-		camera_context->camera_functions->deinit(camera_context);  
-	
-	// capture interface deinit
-	ci_deinit();
-	//camera_gpio_deinit();
-	return 0;
-#else
-#warning TODO: camera_deinit is unimplemented
-	return 0;
-#endif
-}
-
-int camera_ring_buf_init(p_camera_context_t camera_context)
-{
-	unsigned         frame_size;
-    dbg_print("");    
-    switch(camera_context->capture_output_format)
-    {
-    case CAMERA_IMAGE_FORMAT_RGB565:
-        frame_size = camera_context->capture_width * camera_context->capture_height * 2;
-        camera_context->fifo0_transfer_size = frame_size;
-        camera_context->fifo1_transfer_size = 0;
-        camera_context->fifo2_transfer_size = 0;
-        break;
-    case CAMERA_IMAGE_FORMAT_YCBCR422_PACKED:
-        frame_size = camera_context->capture_width * camera_context->capture_height * 2;
-        camera_context->fifo0_transfer_size = frame_size;
-        camera_context->fifo1_transfer_size = 0;
-        camera_context->fifo2_transfer_size = 0;
-        break;
-    case CAMERA_IMAGE_FORMAT_YCBCR422_PLANAR:
-        frame_size = camera_context->capture_width * camera_context->capture_height * 2;
-        camera_context->fifo0_transfer_size = frame_size / 2;
-        camera_context->fifo1_transfer_size = frame_size / 4;
-        camera_context->fifo2_transfer_size = frame_size / 4;
-        break;
-    case CAMERA_IMAGE_FORMAT_RGB666_PLANAR:
-        frame_size = camera_context->capture_width * camera_context->capture_height * 4;
-        camera_context->fifo0_transfer_size = frame_size;
-        camera_context->fifo1_transfer_size = 0;
-        camera_context->fifo2_transfer_size = 0;
-        break;
-    case CAMERA_IMAGE_FORMAT_RGB666_PACKED:
-        frame_size = camera_context->capture_width * camera_context->capture_height * 3;
-        camera_context->fifo0_transfer_size = frame_size;
-        camera_context->fifo1_transfer_size = 0;
-        camera_context->fifo2_transfer_size = 0;
-        break;
-    default:
-        return STATUS_WRONG_PARAMETER;
-        break;
-    }
-
-    camera_context->block_size = frame_size;
-
-	camera_context->pages_per_fifo0 =
-		(PAGE_ALIGN(camera_context->fifo0_transfer_size) / PAGE_SIZE);
-	camera_context->pages_per_fifo1 =
-		(PAGE_ALIGN(camera_context->fifo1_transfer_size) / PAGE_SIZE);
-	camera_context->pages_per_fifo2 =
-		(PAGE_ALIGN(camera_context->fifo2_transfer_size) / PAGE_SIZE);
-
-	camera_context->pages_per_block =
-		camera_context->pages_per_fifo0 +
-		camera_context->pages_per_fifo1 +
-		camera_context->pages_per_fifo2;
-
-	camera_context->page_aligned_block_size =
-		camera_context->pages_per_block * PAGE_SIZE;
-
-	camera_context->block_number_max =
-		camera_context->pages_allocated /
-		camera_context->pages_per_block;
-
-
-    //restrict max block number 
-    if(camera_context->block_number_max > FRAMES_IN_BUFFER)
-    {
-       camera_context->block_number = FRAMES_IN_BUFFER; 
-    }
-    else
-    {
-       camera_context->block_number = camera_context->block_number_max;
-    }
-	camera_context->block_header = camera_context->block_tail = 0;
-	// generate dma descriptor chain
-	return update_dma_chain(camera_context);
-
-}
-
-
-/***********************************************************************
- *
- * Capture APIs
- *
- ***********************************************************************/
-// Set the image format
-int camera_set_capture_format(p_camera_context_t camera_context)
-{
-
-	int status=-1;
-	CI_IMAGE_FORMAT  ci_input_format, ci_output_format;
-	CI_MP_TIMING     timing;
-
-	if(camera_context->capture_input_format >  CAMERA_IMAGE_FORMAT_MAX ||
-	   camera_context->capture_output_format > CAMERA_IMAGE_FORMAT_MAX )
-    {
-		return STATUS_WRONG_PARAMETER;
-    }
-
-	ci_input_format  = FORMAT_MAPPINGS[camera_context->capture_input_format];
-	ci_output_format = FORMAT_MAPPINGS[camera_context->capture_output_format];
-    
-	if(ci_input_format == CI_INVALID_FORMAT || ci_output_format == CI_INVALID_FORMAT)
-    {
-	  return STATUS_WRONG_PARAMETER;
-    }
-    
-	ci_set_image_format(ci_input_format, ci_output_format);
-
- 
-    timing.BFW = 0;
-    timing.BLW = 0;
- 
-    ci_configure_mp(camera_context->capture_width-1, camera_context->capture_height-1, &timing);
-
-    if(camera_context == NULL || camera_context->camera_functions == NULL || 
-       camera_context->camera_functions->set_capture_format == NULL)
-    {
-	  dbg_print("camera_context point NULL!!!");
-	  return -1;
-    } 
-    status = camera_ring_buf_init(camera_context);
-	// set sensor setting
-	if(camera_context->camera_functions->set_capture_format(camera_context))
-    {
- 	   return -1;
-    }
-   
-    // ring buffer init
-    return status;
-    
-}
-
-// take a picture and copy it into the ring buffer
-int camera_capture_still_image(p_camera_context_t camera_context, unsigned int block_id)
-{
-	// init buffer status & capture
-    camera_set_int_mask(camera_context, 0x3ff | 0x0400);
-    still_image_mode = 1;
-    first_video_frame = 0;
-    task_waiting = 0;
-	camera_context->block_header   = camera_context->block_tail = block_id;  
-	camera_context->capture_status = 0;
-    still_image_rdy = 0;
-	return  start_capture(camera_context, block_id, 1);
-    
-}
-
-// capture motion video and copy it to the ring buffer
-int camera_start_video_capture( p_camera_context_t camera_context, unsigned int block_id )
-{
-	//init buffer status & capture
-    camera_set_int_mask(camera_context, 0x3ff | 0x0400);
-    still_image_mode = 0;
-    first_video_frame = 1;
-	camera_context->block_header   = camera_context->block_tail = block_id; 
-	camera_context->capture_status = CAMERA_STATUS_VIDEO_CAPTURE_IN_PROCESS;
-	return start_capture(camera_context, block_id, 0);
-}
-
-void stop_dma_transfer(p_camera_context_t camera_context)
-{	
-    int ch0, ch1, ch2;
-
-    ch0 = camera_context->dma_channels[0];
-    ch1 = camera_context->dma_channels[1];
-    ch2 = camera_context->dma_channels[2];
-
-    DCSR(ch0) &= ~DCSR_RUN;
-    DCSR(ch1) &= ~DCSR_RUN;
-    DCSR(ch2) &= ~DCSR_RUN;
-	camera_context->dma_started = 0;
-
-    return;
-}
-
-int start_capture(p_camera_context_t camera_context, unsigned int block_id, unsigned int frames)
-{
-#if 0
-    int status;
-    status = camera_context->camera_functions->start_capture(camera_context, frames);
-
-	return status;
-#else
-#warning start_capture is not implemented
-	return 0;
-#endif
-}
-
-
-// disable motion video image capture
-void camera_stop_video_capture( p_camera_context_t camera_context )
-{
-	
-	//stop capture
-	camera_context->camera_functions->stop_capture(camera_context);
-  
-	//stop dma
-	stop_dma_transfer(camera_context);
-    
-	//update the flag
-	if(!(camera_context->capture_status & CAMERA_STATUS_RING_BUFFER_FULL))
-    {
-		camera_context->capture_status &= ~CAMERA_STATUS_VIDEO_CAPTURE_IN_PROCESS;
-    }
-}
-
-
-module_init(pxa_camera_init);
-module_exit(pxa_camera_exit);
-
-MODULE_DESCRIPTION("Bulverde Camera Interface driver");
-MODULE_LICENSE("GPL");
-
diff -ruN -X X hnd-linux-trunk/drivers/media/video/pxa_camera_ioctl.c hnd-cleanup/drivers/media/video/pxa_camera_ioctl.c
--- hnd-linux-trunk/drivers/media/video/pxa_camera_ioctl.c	2007-09-17 22:45:41.000000000 +0400
+++ hnd-cleanup/drivers/media/video/pxa_camera_ioctl.c	1970-01-01 03:00:00.000000000 +0300
@@ -1,457 +0,0 @@
-/*
- *  pxa_camera.c
- *
- *  Bulverde Processor Camera Interface driver.
- *
- *  Copyright (C) 2003, Intel Corporation
- *  Copyright (C) 2003, Montavista Software Inc.
- *  Copyright (C) 2003-2006 Motorola Inc.
- *
- *  Author: Intel Corporation Inc.
- *          MontaVista Software, Inc.
- *           source@mvista.com
- *          Motorola Inc.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- *  V4L2 conversion (C) 2007 Sergey Lapin
- */
-#warning "Not finished yet, don't try to use!!!"
-#include <linux/module.h>
-#include <linux/delay.h>
-#include <linux/errno.h>
-#include <linux/fs.h>
-#include <linux/kernel.h>
-#include <linux/slab.h>
-#include <linux/mm.h>
-#include <linux/ioport.h>
-#include <linux/init.h>
-#include <linux/sched.h>
-#include <linux/pci.h>
-#include <linux/random.h>
-#include <linux/version.h>
-#include <linux/videodev2.h>
-#include <linux/dma-mapping.h>
-
-// #include <linux/config.h>
-#include <linux/module.h>
-#include <linux/version.h>
-#include <linux/init.h>
-#include <linux/fs.h>
-#include <linux/vmalloc.h>
-#include <linux/delay.h>
-#include <linux/slab.h>
-#include <linux/proc_fs.h>
-#include <linux/ctype.h>
-#include <linux/pagemap.h>
-// #include <linux/wrapper.h>
-#include <media/v4l2-dev.h>
-#include <linux/pci.h>
-#include <linux/pm.h>
-#include <linux/poll.h>
-#include <linux/wait.h>
-
-#include <linux/types.h>
-#include <asm/mach-types.h>
-#include <asm/io.h>
-#include <asm/semaphore.h>
-#include <asm/hardware.h>
-#include <asm/dma.h>
-#include <asm/arch/irqs.h>
-#include <asm/irq.h>
-#include <linux/interrupt.h>
-
-#include <asm/arch/pxa-regs.h>
-
-#ifdef CONFIG_VIDEO_V4L1_COMPAT
-/* Include V4L1 specific functions. Should be removed soon */
-#include <linux/videodev.h>
-#endif
-
-#include "pxa_ci_types.h"
-
-
-extern camera_context_t  *g_camera_context;
-
-struct reg_set_s 
-{
-	int  val1;
-	int  val2;
-};
-
-/*ioctl sub functions*/
-static int pxa_camera_VIDIOCGCAP(p_camera_context_t cam_ctx, void * param)
-{
-    dbg_print("VIDIOCGCAP");
-    /*
-      add a vc member to camera context
-    */
-    if(copy_to_user(param, &(cam_ctx->vc), sizeof(struct video_capability)))
-    {
-        return -EFAULT;
-    }
-    return 0;
-}
-
-static int pxa_camera_VIDIOCGWIN(p_camera_context_t cam_ctx, void * param)
-{
-    struct video_window vw;
-    dbg_print("VIDIOCGWIN");
-    vw.width  = cam_ctx->capture_width;
-    vw.height = cam_ctx->capture_height;
-    if(copy_to_user(param, &vw, sizeof(struct video_window)))
-    {
-        return -EFAULT;
-    }
-    return 0;
-}
-
-static int pxa_camera_VIDIOCSWIN(p_camera_context_t cam_ctx, void * param)
-{
-    struct video_window vw;
-    dbg_print("VIDIOCSWIN");
-    if(copy_from_user(&vw, param, sizeof(vw))) 
-    {
-        dbg_print("VIDIOCSWIN get parameter error!");
-        return  -EFAULT;
-    } 
-    
-    if(vw.width > cam_ctx->vc.maxwidth  ||
-       vw.height > cam_ctx->vc.maxheight || 
-       vw.width < cam_ctx->vc.minwidth   || 
-       vw.height < cam_ctx->vc.minheight) 
-    {
-        dbg_print("VIDIOCSWIN error parameter!");
-        dbg_print("vw.width:%d, MAX_WIDTH:%d, MIN_WIDTH:%d", vw.width, cam_ctx->vc.maxwidth, cam_ctx->vc.minwidth);
-        dbg_print("vw.height:%d, MAX_HEIGHT:%d, MIN_HEIGHT:%d", vw.width, cam_ctx->vc.maxheight, cam_ctx->vc.minheight);	
-        return  -EFAULT;
-    }
-    
-    //make it in an even multiple of 8 
-    
-    cam_ctx->capture_width  = (vw.width+7)/8;
-    cam_ctx->capture_width  *= 8;
-    
-    cam_ctx->capture_height = (vw.height+7)/8;
-    cam_ctx->capture_height *= 8;
-    
-    return camera_set_capture_format(cam_ctx);
-}
-
-static int pxa_camera_VIDIOCSPICT(p_camera_context_t cam_ctx, void * param)
-{
-    struct video_picture vp;
-    dbg_print("VIDIOCSPICT");
-    if(copy_from_user(&vp, param, sizeof(vp))) 
-    {
-        return  -EFAULT;
-    }
-    cam_ctx->capture_output_format = vp.palette;
-
-    return  camera_set_capture_format(cam_ctx);
-    
-}
-
-static int pxa_camera_VIDIOCGPICT(p_camera_context_t cam_ctx, void * param)
-{
-    struct video_picture vp;
-    dbg_print("VIDIOCGPICT");
-    vp.palette = cam_ctx->capture_output_format;
-    if(copy_to_user(param, &vp, sizeof(struct video_picture)))
-    {
-        return  -EFAULT;
-    }
-    return 0;
-}
-
-static int pxa_camera_VIDIOCCAPTURE(p_camera_context_t cam_ctx, void * param)
-{
-    int capture_flag = (int)param;
-    dbg_print("VIDIOCCAPTURE");
-    if(capture_flag > 0) 
-    {			
-        dbg_print("Still Image capture!");
-        camera_capture_still_image(cam_ctx, 0);
-    }
-    else if(capture_flag == 0) 
-    {
-        dbg_print("Video Image capture!");
-        camera_start_video_capture(cam_ctx, 0);
-    }
-    else if(capture_flag == -1) 
-    {
-        dbg_print("Capture stop!"); 
-        camera_set_int_mask(cam_ctx, 0x3ff);
-        camera_stop_video_capture(cam_ctx);
-    }
-    else 
-    {
-        return  -EFAULT;
-    }
-    return 0;
-}
-
-static int pxa_camera_VIDIOCGMBUF(p_camera_context_t cam_ctx, void * param)
-{
-    struct video_mbuf vm;
-    int i;
-
-    dbg_print("VIDIOCGMBUF");
-
-    memset(&vm, 0, sizeof(vm));
-    vm.size   = cam_ctx->buf_size;
-    vm.frames = cam_ctx->block_number;
-    for(i = 0; i < vm.frames; i++)
-    {
-        vm.offsets[i] = cam_ctx->page_aligned_block_size * i;
-    }
-    if(copy_to_user((void *)param, (void *)&vm, sizeof(vm)))
-    {
-        return  -EFAULT;
-    }
-    return 0;
-}
-static int pxa_camera_WCAM_VIDIOCSINFOR(p_camera_context_t cam_ctx, void * param)
-{
-
-    struct reg_set_s reg_s;
-    int ret;
-    dbg_print("WCAM_VIDIOCSINFOR");
-
-    if(copy_from_user(&reg_s, param, sizeof(int) * 2)) 
-    {
-        return  -EFAULT;
-    }
-    
-    cam_ctx->capture_input_format = reg_s.val1;
-    cam_ctx->capture_output_format = reg_s.val2;
-    ret=camera_set_capture_format(cam_ctx);
-    return  ret;
-}
-static int pxa_camera_WCAM_VIDIOCGINFOR(p_camera_context_t cam_ctx, void * param)
-{
-    struct reg_set_s reg_s;
-    dbg_print("WCAM_VIDIOCGINFOR");
-    reg_s.val1 = cam_ctx->capture_input_format;
-    reg_s.val2 = cam_ctx->capture_output_format;
-    if(copy_to_user(param, &reg_s, sizeof(int) * 2)) 
-    {
-        return -EFAULT;
-    }
-    return 0;
-}
-static int pxa_camera_WCAM_VIDIOCGCIREG(p_camera_context_t cam_ctx, void * param)
-{
-
-    int reg_value, offset;
-    dbg_print("WCAM_VIDIOCGCIREG");
-    if(copy_from_user(&offset, param, sizeof(int))) 
-    {
-        return  -EFAULT;
-    }
-    reg_value = ci_get_reg_value (offset);
-    if(copy_to_user(param, &reg_value, sizeof(int)))
-    {
-        return -EFAULT;
-    }
-    return 0;
-}
-
-static int pxa_camera_WCAM_VIDIOCSCIREG(p_camera_context_t cam_ctx, void * param)
-{
-
-    struct reg_set_s reg_s;
-    dbg_print("WCAM_VIDIOCSCIREG");
-    if(copy_from_user(&reg_s, param, sizeof(int) * 2)) 
-    {
-        return  -EFAULT;
-    }
-    ci_set_reg_value (reg_s.val1, reg_s.val2);
-    return 0;
-
-}
-    
-/*get sensor size */
-static int pxa_cam_WCAM_VIDIOCGSSIZE(p_camera_context_t cam_ctx, void * param)
-{
-   struct adcm_window_size{u16 width, height;} size;
-   dbg_print("WCAM_VIDIOCGSSIZE");  
-   size.width = cam_ctx->sensor_width;
-   size.height = cam_ctx->sensor_height;
-
-   if(copy_to_user(param, &size, sizeof(struct adcm_window_size)))
-   {
-       return -EFAULT;
-   }
-  return 0;
-}
-         
-/*get output size*/
-static int pxa_cam_WCAM_VIDIOCGOSIZE(p_camera_context_t cam_ctx, void * param)
-{
-
-   struct adcm_window_size{u16 width, height;}size;
-   dbg_print("WCAM_VIDIOCGOSIZE");  
-   size.width  = cam_ctx->capture_width;
-   size.height = cam_ctx->capture_height;
-   if(copy_to_user(param, &size, sizeof(struct adcm_window_size)))
-   {
-       return -EFAULT;
-   }
-   return 0;
-}
-
-
-
-/*set frame buffer count*/
-static int pxa_cam_WCAM_VIDIOCSBUFCOUNT(p_camera_context_t cam_ctx, void * param)
-{
-	int count;
-	dbg_print("");
- 	if (copy_from_user(&count, param, sizeof(int)))
-		return -EFAULT;
-   
-   if(cam_ctx->block_number_max == 0) {
-     dbg_print("windows size or format not setting!!");
-     return -EFAULT;
-   }
-   
-   if(count < FRAMES_IN_BUFFER)
-   {
-      count = FRAMES_IN_BUFFER;
-   }
-   
-   if(count > cam_ctx->block_number_max)
-   {
-      count = cam_ctx->block_number_max;
-   }
-      
-
-   cam_ctx->block_number = count;
-   cam_ctx->block_header = cam_ctx->block_tail = 0;
-   //generate dma descriptor chain
-   update_dma_chain(cam_ctx);
-     
-   if(copy_to_user(param, &count, sizeof(int)))
-   {
-     return -EFAULT;
-   }
-   
-   return 0;
-}
-         
-/*get cur avaliable frames*/     
-static int pxa_cam_WCAM_VIDIOCGCURFRMS(p_camera_context_t cam_ctx, void * param)
-{
-  //dbg_print("");
-  struct {int first, last;}pos;
-  
-  pos.first = cam_ctx->block_tail;
-  pos.last  = cam_ctx->block_header;
-  
-  if(copy_to_user(param, &pos, sizeof(pos)))
-  {
-     return -EFAULT;
-  }
-  return 0;
-}
-
-/*get sensor type*/
-static int pxa_cam_WCAM_VIDIOCGSTYPE(p_camera_context_t cam_ctx, void * param)
-{
-  dbg_print("");
-  if(copy_to_user(param, &(cam_ctx->sensor_type), sizeof(cam_ctx->sensor_type)))
-  {
-    return -EFAULT;
-  }
-  return 0;
-}
-
-int pxa_camera_ioctl(struct inode *inode, struct file *file,
-			    unsigned int cmd, unsigned long arg)
-{
-	void *param = (void *) arg;
-
-   	switch (cmd) 
-    {
-        /*get capture capability*/
-    case VIDIOCGCAP:
-        return pxa_camera_VIDIOCGCAP(g_camera_context, param);
-        /* get capture size */
-    case VIDIOCGWIN:
-        return  pxa_camera_VIDIOCGWIN(g_camera_context, param);
-
-        /* set capture size. */
-    case VIDIOCSWIN:
-        return pxa_camera_VIDIOCSWIN(g_camera_context, param);
-        /*set capture output format*/
-    case VIDIOCSPICT:
-        return pxa_camera_VIDIOCSPICT(g_camera_context, param);
-
-        /*get capture output format*/
-    case VIDIOCGPICT:
-        return pxa_camera_VIDIOCGPICT(g_camera_context, param);
-
-        /*start capture */
-    case VIDIOCCAPTURE:
-        return pxa_camera_VIDIOCCAPTURE(g_camera_context, param);
-
-        /* mmap interface */
-    case VIDIOCGMBUF:
-         return pxa_camera_VIDIOCGMBUF(g_camera_context, param);
-
-        /* Application extended IOCTL.  */
-        /* Register access interface	*/
-    case WCAM_VIDIOCSINFOR:
-         return pxa_camera_WCAM_VIDIOCSINFOR(g_camera_context, param);
-
-        /*get capture format*/
-    case WCAM_VIDIOCGINFOR:
-         return pxa_camera_WCAM_VIDIOCGINFOR(g_camera_context, param);
-
-        /*get ci reg value*/
-    case WCAM_VIDIOCGCIREG:
-        return pxa_camera_WCAM_VIDIOCGCIREG(g_camera_context, param);
-
-        /*set ci reg*/
-    case WCAM_VIDIOCSCIREG:
-        return pxa_camera_WCAM_VIDIOCSCIREG(g_camera_context, param);
-            
-        /*get sensor size */  
-    case WCAM_VIDIOCGSSIZE:
-         return pxa_cam_WCAM_VIDIOCGSSIZE(g_camera_context, param);
-    
-         /*get output size*/
-    case WCAM_VIDIOCGOSIZE:
-         return pxa_cam_WCAM_VIDIOCGOSIZE(g_camera_context, param);
-
-         /*set frame buffer count*/     
-    case WCAM_VIDIOCSBUFCOUNT:
-         return pxa_cam_WCAM_VIDIOCSBUFCOUNT(g_camera_context, param);
-         
-         /*get cur avaliable frames*/     
-    case WCAM_VIDIOCGCURFRMS:
-         return pxa_cam_WCAM_VIDIOCGCURFRMS(g_camera_context, param);
-         
-         /*get cur sensor type*/
-    case WCAM_VIDIOCGSTYPE:
-         return pxa_cam_WCAM_VIDIOCGSTYPE(g_camera_context, param);
-    
-    default:
-         return  g_camera_context->camera_functions->command(g_camera_context, cmd, param);
-    }
-    
-   return 0;
-}
diff -ruN -X X hnd-linux-trunk/drivers/media/video/pxa_ci.c hnd-cleanup/drivers/media/video/pxa_ci.c
--- hnd-linux-trunk/drivers/media/video/pxa_ci.c	2007-09-17 22:45:40.000000000 +0400
+++ hnd-cleanup/drivers/media/video/pxa_ci.c	1970-01-01 03:00:00.000000000 +0300
@@ -1,568 +0,0 @@
-/*
- *  pxa_camera.c
- *
- *  Bulverde Processor Camera Interface driver.
- *
- *  Copyright (C) 2003, Intel Corporation
- *  Copyright (C) 2003, Montavista Software Inc.
- *  Copyright (C) 2003-2006 Motorola Inc.
- *
- *  Author: Intel Corporation Inc.
- *          MontaVista Software, Inc.
- *           source@mvista.com
- *          Motorola Inc.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- *  V4L2 conversion (C) 2007 Sergey Lapin
- */
-#warning "Not finished yet, don't try to use!!!"
-#include <linux/module.h>
-#include <linux/delay.h>
-#include <linux/errno.h>
-#include <linux/fs.h>
-#include <linux/kernel.h>
-#include <linux/slab.h>
-#include <linux/mm.h>
-#include <linux/ioport.h>
-#include <linux/init.h>
-#include <linux/sched.h>
-#include <linux/pci.h>
-#include <linux/random.h>
-#include <linux/version.h>
-#include <linux/videodev2.h>
-#include <linux/dma-mapping.h>
-
-// #include <linux/config.h>
-#include <linux/module.h>
-#include <linux/version.h>
-#include <linux/init.h>
-#include <linux/fs.h>
-#include <linux/vmalloc.h>
-#include <linux/delay.h>
-#include <linux/slab.h>
-#include <linux/proc_fs.h>
-#include <linux/ctype.h>
-#include <linux/pagemap.h>
-// #include <linux/wrapper.h>
-#include <media/v4l2-dev.h>
-#include <linux/pci.h>
-#include <linux/pm.h>
-#include <linux/poll.h>
-#include <linux/wait.h>
-
-#include <linux/types.h>
-#include <asm/mach-types.h>
-#include <asm/io.h>
-#include <asm/semaphore.h>
-#include <asm/hardware.h>
-#include <asm/dma.h>
-#include <asm/arch/irqs.h>
-#include <asm/irq.h>
-#include <linux/interrupt.h>
-
-#include <asm/arch/pxa-regs.h>
-
-#ifdef CONFIG_VIDEO_V4L1_COMPAT
-/* Include V4L1 specific functions. Should be removed soon */
-#include <linux/videodev.h>
-#endif
-
-#include "pxa_ci_types.h"
-
-void ci_set_image_format(CI_IMAGE_FORMAT input_format, CI_IMAGE_FORMAT output_format)
-{
-
-	unsigned int value, tbit, rgbt_conv, rgb_conv, rgb_f, ycbcr_f, rgb_bpp, raw_bpp, cspace;
-	// write cicr1: preserve ppl value and data width value
-	dbg_print("0");
-	value = CICR1;
-	dbg_print("1");
-	value &= ( (CI_CICR1_PPL_SMASK << CI_CICR1_PPL_SHIFT) | ((CI_CICR1_DW_SMASK) << CI_CICR1_DW_SHIFT));
-	tbit = rgbt_conv = rgb_conv = rgb_f = ycbcr_f = rgb_bpp = raw_bpp = cspace = 0;
-	switch(input_format)
-	{
-		case CI_RAW8:
-			cspace = 0;
-			raw_bpp = 0;
-			break;
-		case CI_RAW9:
-			cspace = 0;
-			raw_bpp = 1;
-			break;
-		case CI_RAW10:
-			cspace = 0;
-			raw_bpp = 2;
-			break;
-		case CI_YCBCR422:
-		case CI_YCBCR422_PLANAR:
-			cspace = 2;
-			if(output_format == CI_YCBCR422_PLANAR) {
-				ycbcr_f = 1;
-			}
-			break;
-		case CI_RGB444:
-			cspace = 1;
-			rgb_bpp = 0;
-			break;
-		case CI_RGB555:
-			cspace = 1;
-			rgb_bpp = 1;
-			if(output_format == CI_RGBT555_0) {
-				rgbt_conv = 2;
-				tbit = 0;
-			}
-			else if(output_format == CI_RGBT555_1) {
-				rgbt_conv = 2;
-				tbit = 1;
-			}
-			break;
-		case CI_RGB565:
-			cspace = 1;
-			rgb_bpp = 2;
-			rgb_f = 1;
-			break;
-		case CI_RGB666:
-			cspace = 1;
-			rgb_bpp = 3;
-			if(output_format == CI_RGB666_PACKED) {
-				rgb_f = 1;
-			}
-			break;
-		case CI_RGB888:
-		case CI_RGB888_PACKED:
-			cspace = 1;
-			rgb_bpp = 4;
-			switch(output_format)
-			{
-				case CI_RGB888_PACKED:
-					rgb_f = 1;
-					break;
-				case CI_RGBT888_0:
-					rgbt_conv = 1;
-					tbit = 0;
-					break;
-				case CI_RGBT888_1:
-					rgbt_conv = 1;
-					tbit = 1;
-					break;
-				case CI_RGB666:
-					rgb_conv = 1;
-					break;
-					// RGB666 PACKED - JamesL
-				case CI_RGB666_PACKED:
-					rgb_conv = 1;
-					rgb_f = 1;
-					break;
-					// end
-				case CI_RGB565:
-					dbg_print("format : 565");
-					rgb_conv = 2;
-					break;
-				case CI_RGB555:
-					rgb_conv = 3;
-					break;
-				case CI_RGB444:
-					rgb_conv = 4;
-					break;
-				default:
-					break;
-			}
-			break;
-		default:
-			break;
-	}
-	dbg_print("2");
-	value |= (tbit==1) ? CI_CICR1_TBIT : 0;
-	value |= rgbt_conv << CI_CICR1_RGBT_CONV_SHIFT;
-	value |= rgb_conv << CI_CICR1_RGB_CONV_SHIFT;
-	value |= (rgb_f==1) ? CI_CICR1_RBG_F : 0;
-	value |= (ycbcr_f==1) ? CI_CICR1_YCBCR_F : 0;
-	value |= rgb_bpp << CI_CICR1_RGB_BPP_SHIFT;
-	value |= raw_bpp << CI_CICR1_RAW_BPP_SHIFT;
-	value |= cspace << CI_CICR1_COLOR_SP_SHIFT;
-	CICR1 = value;
-
-}
-
-
-void ci_set_mode(CI_MODE mode, CI_DATA_WIDTH data_width)
-{
-	unsigned int value;
-
-	// write mode field in cicr0
-	value = CICR0;
-	value &= ~(CI_CICR0_SIM_SMASK << CI_CICR0_SIM_SHIFT);
-	value |= (unsigned int)mode << CI_CICR0_SIM_SHIFT;
-	CICR0 = value;
-
-	// write data width cicr1
-	value = CICR1;
-	value &= ~(CI_CICR1_DW_SMASK << CI_CICR1_DW_SHIFT);
-	value |= ((unsigned)data_width) << CI_CICR1_DW_SHIFT;
-	CICR1 = value;
-	return;
-}
-
-
-void ci_configure_mp(unsigned int ppl, unsigned int lpf, CI_MP_TIMING* timing)
-{
-	unsigned int value;
-	// write ppl field in cicr1
-	value = CICR1;
-	value &= ~(CI_CICR1_PPL_SMASK << CI_CICR1_PPL_SHIFT);
-	value |= (ppl & CI_CICR1_PPL_SMASK) << CI_CICR1_PPL_SHIFT;
-	CICR1 = value;
-
-	// write BLW, ELW in cicr2
-	value = CICR2;
-	value &= ~(CI_CICR2_BLW_SMASK << CI_CICR2_BLW_SHIFT | CI_CICR2_ELW_SMASK << CI_CICR2_ELW_SHIFT );
-	value |= (timing->BLW & CI_CICR2_BLW_SMASK) << CI_CICR2_BLW_SHIFT;
-	CICR2 = value;
-
-	// write BFW, LPF in cicr3
-	value = CICR3;
-	value &= ~(CI_CICR3_BFW_SMASK << CI_CICR3_BFW_SHIFT | CI_CICR3_LPF_SMASK << CI_CICR3_LPF_SHIFT );
-	value |= (timing->BFW & CI_CICR3_BFW_SMASK) << CI_CICR3_BFW_SHIFT;
-	value |= (lpf & CI_CICR3_LPF_SMASK) << CI_CICR3_LPF_SHIFT;
-	CICR3 = value;
-
-}
-
-
-void ci_configure_sp(unsigned int ppl, unsigned int lpf, CI_SP_TIMING* timing)
-{
-	unsigned int value;
-
-	// write ppl field in cicr1
-	value = CICR1;
-	value &= ~(CI_CICR1_PPL_SMASK << CI_CICR1_PPL_SHIFT);
-	value |= (ppl & CI_CICR1_PPL_SMASK) << CI_CICR1_PPL_SHIFT;
-	CICR1 = value;
-
-	// write cicr2
-	value = CICR2;
-	value |= (timing->BLW & CI_CICR2_BLW_SMASK) << CI_CICR2_BLW_SHIFT;
-	value |= (timing->ELW & CI_CICR2_ELW_SMASK) << CI_CICR2_ELW_SHIFT;
-	value |= (timing->HSW & CI_CICR2_HSW_SMASK) << CI_CICR2_HSW_SHIFT;
-	value |= (timing->BFPW & CI_CICR2_BFPW_SMASK) << CI_CICR2_BFPW_SHIFT;
-	value |= (timing->FSW & CI_CICR2_FSW_SMASK) << CI_CICR2_FSW_SHIFT;
-	CICR2 = value;
-
-	// write cicr3
-	value = CICR3;
-	value |= (timing->BFW & CI_CICR3_BFW_SMASK) << CI_CICR3_BFW_SHIFT;
-	value |= (timing->EFW & CI_CICR3_EFW_SMASK) << CI_CICR3_EFW_SHIFT;
-	value |= (timing->VSW & CI_CICR3_VSW_SMASK) << CI_CICR3_VSW_SHIFT;
-	value |= (lpf & CI_CICR3_LPF_SMASK) << CI_CICR3_LPF_SHIFT;
-	CICR3 = value;
-	return;
-}
-
-
-void ci_configure_ms(unsigned int ppl, unsigned int lpf, CI_MS_TIMING* timing)
-{
-	// the operation is same as Master-Parallel
-	ci_configure_mp(ppl, lpf, (CI_MP_TIMING*)timing);
-}
-
-
-void ci_configure_ep(int parity_check)
-{
-	unsigned int value;
-
-	// write parity_enable field in cicr0
-	value = CICR0;
-	if(parity_check)
-	{
-		value |= CI_CICR0_PAR_EN;
-	}
-	else
-	{
-		value &= ~CI_CICR0_PAR_EN;
-	}
-	CICR0 = value;
-	return;
-}
-
-
-void ci_configure_es(int parity_check)
-{
-	// the operationi is same as Embedded-Parallel
-	ci_configure_ep(parity_check);
-}
-
-
-void ci_set_clock(unsigned int clk_regs_base, int pclk_enable, int mclk_enable, unsigned int mclk_khz)
-{
-	unsigned int ciclk,  value, div, cccr_l, K;
-
-	// determine the LCLK frequency programmed into the CCCR.
-	cccr_l = (CCCR & 0x0000001F);
-
-	if(cccr_l < 8)
-		K = 1;
-	else if(cccr_l < 17)
-		K = 2;
-	else
-		K = 3;
-
-	ciclk = (13 * cccr_l) / K;
-
-	div = (ciclk + mclk_khz) / ( 2 * mclk_khz ) - 1;
-	dbg_print("cccr=%xciclk=%d,cccr_l=%d,K=%d,div=%d,mclk=%d\n",CCCR,ciclk,cccr_l,K,div,mclk_khz);
-	// write cicr4
-	value = CICR4;
-	value &= ~(CI_CICR4_PCLK_EN | CI_CICR4_MCLK_EN | CI_CICR4_DIV_SMASK<<CI_CICR4_DIV_SHIFT);
-	value |= (pclk_enable) ? CI_CICR4_PCLK_EN : 0;
-	value |= (mclk_enable) ? CI_CICR4_MCLK_EN : 0;
-	value |= div << CI_CICR4_DIV_SHIFT;
-	CICR4 = value;
-	return;
-}
-
-
-void ci_set_polarity(int pclk_sample_falling, int hsync_active_low, int vsync_active_low)
-{
-	unsigned int value;
-	dbg_print("");
-
-	// write cicr4
-	value = CICR4;
-	value &= ~(CI_CICR4_PCP | CI_CICR4_HSP | CI_CICR4_VSP);
-	value |= (pclk_sample_falling)? CI_CICR4_PCP : 0;
-	value |= (hsync_active_low) ? CI_CICR4_HSP : 0;
-	value |= (vsync_active_low) ? CI_CICR4_VSP : 0;
-	CICR4 = value;
-	return;
-}
-
-
-void ci_set_fifo(unsigned int timeout, CI_FIFO_THRESHOLD threshold, int fifo1_enable,
-int fifo2_enable)
-{
-	unsigned int value;
-	dbg_print("");
-	// write citor
-	CITOR = timeout;
-
-	// write cifr: always enable fifo 0! also reset input fifo
-	value = CIFR;
-	value &= ~(CI_CIFR_FEN0 | CI_CIFR_FEN1 | CI_CIFR_FEN2 | CI_CIFR_RESETF |
-		CI_CIFR_THL_0_SMASK<<CI_CIFR_THL_0_SHIFT);
-	value |= (unsigned int)threshold << CI_CIFR_THL_0_SHIFT;
-	value |= (fifo1_enable) ? CI_CIFR_FEN1 : 0;
-	value |= (fifo2_enable) ? CI_CIFR_FEN2 : 0;
-	value |= CI_CIFR_RESETF | CI_CIFR_FEN0;
-	CIFR = value;
-}
-
-
-void ci_reset_fifo()
-{
-	unsigned int value;
-	value = CIFR;
-	value |= CI_CIFR_RESETF;
-	CIFR = value;
-}
-
-
-void ci_set_int_mask(unsigned int mask)
-{
-	unsigned int value;
-
-	// write mask in cicr0
-	value = CICR0;
-	value &= ~CI_CICR0_INTERRUPT_MASK;
-	value |= (mask & CI_CICR0_INTERRUPT_MASK);
-	dbg_print("-----------value=0x%x\n",value);
-	CICR0 = value;
-	return;
-}
-
-
-unsigned int ci_get_int_mask()
-{
-	unsigned int value;
-
-	// write mask in cicr0
-	value = CICR0;
-	return (value & CI_CICR0_INTERRUPT_MASK);
-}
-
-
-void ci_clear_int_status(unsigned int status)
-{
-	// write 1 to clear
-	CISR = status;
-}
-
-
-unsigned int ci_get_int_status()
-{
-	int value;
-
-	value = CISR;
-
-	return  value;
-}
-
-
-void ci_set_reg_value(unsigned int reg_offset, unsigned int value)
-{
-	switch(reg_offset)
-	{
-		case 0:
-			CICR0 = value;
-			break;
-		case 1:
-			CICR1 = value;
-			break;
-		case 2:
-			CICR2 = value;
-			break;
-		case 3:
-			CICR3 = value;
-			break;
-		case 4:
-			CICR4 = value;
-			break;
-		case 5:
-			CISR  = value;
-			break;
-		case 6:
-			CIFR = value;
-			break;
-		case 7:
-			CITOR = value;
-			break;
-	}
-}
-
-
-int ci_get_reg_value(unsigned int reg_offset)
-{
-
-	unsigned values[] = {CICR0, CICR1, CICR2, CICR3, CICR4, CISR, CIFR, CITOR};
-
-	if(reg_offset >=0 && reg_offset <= 7)
-		return values[reg_offset];
-	else
-		return CISR;
-}
-
-void ci_enable(int dma_en)
-{        
-	unsigned int value;
-
-	// write mask in cicr0  
-	value = CICR0;
-	value |= CI_CICR0_ENB;
-	if(dma_en) {
-		value |= CI_CICR0_DMA_EN;
-	}
-	CICR0 = value;   
-	return; 
-}
-
-int ci_disable(int quick)
-{
-	volatile unsigned int value, mask;
-	int retry;
-
-	// write control bit in cicr0   
-	value = CICR0;
-	if(quick)
-        {
-		value &= ~CI_CICR0_ENB;
-		mask = CI_CISR_CQD;
-	}
-	else 
-        {
-		value |= CI_CICR0_DIS;
-		mask = CI_CISR_CDD;
-	}
-	CICR0 = value;   
-	
-	// wait shutdown complete
-	retry = 50;
-	while ( retry-- > 0 ) 
-    {
- 	value = CISR;
-	 if( value & mask ) 
-     {
-		CISR = mask;
-		return 0;
-	 }
-	 mdelay(10);
-	}
-	return -1; 
-}
-
-void ci_slave_capture_enable()
-{
-	unsigned int value;
-
-	// write mask in cicr0  
-	value = CICR0;
-	value |= CI_CICR0_SL_CAP_EN;
-	CICR0 = value;   
-	return; 
-}
-
-void ci_slave_capture_disable()
-{
-	unsigned int value;
-	
-	// write mask in cicr0  
-	value = CICR0;
-	value &= ~CI_CICR0_SL_CAP_EN;
-	CICR0 = value;   
-	return; 
-}
-
-void ci_set_frame_rate(CI_FRAME_CAPTURE_RATE frate)
-{
-	unsigned int value;
-	// write cicr4
-	value = CICR4;
-	value &= ~(CI_CICR4_FR_RATE_SMASK << CI_CICR4_FR_RATE_SHIFT);
-	value |= (unsigned)frate << CI_CICR4_FR_RATE_SHIFT;
-	CICR4 = value;
-}
-
-
-CI_FRAME_CAPTURE_RATE ci_get_frame_rate(void)
-{
-	unsigned int value;
-	value = CICR4;
-	return (CI_FRAME_CAPTURE_RATE)((value >> CI_CICR4_FR_RATE_SHIFT) & CI_CICR4_FR_RATE_SMASK);
-}
-
-
-/* Debug */
-
-void ci_dump(void)
-{
-    dbg_print ("CICR0 = 0x%8x ", CICR0);
-    dbg_print ("CICR1 = 0x%8x ", CICR1);
-    dbg_print ("CICR2 = 0x%8x ", CICR2);
-    dbg_print ("CICR3 = 0x%8x ", CICR3);
-    dbg_print ("CICR4 = 0x%8x ", CICR4);
-    dbg_print ("CISR  = 0x%8x ", CISR);
-    dbg_print ("CITOR = 0x%8x ", CITOR);
-    dbg_print ("CIFR  = 0x%8x ", CIFR);
-}
-
diff -ruN -X X hnd-linux-trunk/drivers/media/video/pxa_ci_types.h hnd-cleanup/drivers/media/video/pxa_ci_types.h
--- hnd-linux-trunk/drivers/media/video/pxa_ci_types.h	2007-09-17 22:45:40.000000000 +0400
+++ hnd-cleanup/drivers/media/video/pxa_ci_types.h	1970-01-01 03:00:00.000000000 +0300
@@ -1,714 +0,0 @@
-/*
- *  camera.h
- *
- *  Bulverde Processor Camera Interface driver.
- *
- *  Copyright (C) 2003, Intel Corporation
- *  Copyright (C) 2003, Montavista Software Inc.
- *  Copyright (C) 2003-2006 Motorola Inc.
- *
- *  Author: Intel Corporation Inc.
- *          MontaVista Software, Inc.
- *           source@mvista.com
- *          Motorola Inc.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
-
-Revision History:
- Modification     Tracking
-	 Date         Description of Changes
- ------------   -------------------------
-  12/19/2003     Created
-  02/26/2004     Update algorithm for DMA transfer
-  04/12/2006     fix sensor name
-
-*/
-
-/*================================================================================
-								 INCLUDE FILES
-================================================================================*/
-#ifndef PXA_CI_TYPES_H_
-#define PXA_CI_TYPES_H_
-
-#include <linux/pxa_camera.h>
-#include <linux/irq.h>
-#include <linux/videodev.h> /* FIXME - needed for video_capability */
-
-#define DEBUG   1
-
-/*
-Bpp definition
-*/
-
-#define YUV422_BPP              16
-#define RGB565_BPP              16
-#define RGB666_UNPACKED_BPP       32
-#define RGB666_PACKED_BPP         24
-
-//---------------------------------------------------------------------------
-// Register definitions
-//---------------------------------------------------------------------------
-
-enum CI_REGBITS_CICR0
-{
-	CI_CICR0_FOM       = 0x00000001,
-	CI_CICR0_EOFM      = 0x00000002,
-	CI_CICR0_SOFM      = 0x00000004,
-	CI_CICR0_CDM       = 0x00000008,
-	CI_CICR0_QDM       = 0x00000010,
-	CI_CICR0_PERRM     = 0x00000020,
-	CI_CICR0_EOLM      = 0x00000040,
-	CI_CICR0_FEM       = 0x00000080,
-	CI_CICR0_RDAVM     = 0x00000100,
-	CI_CICR0_TOM       = 0x00000200,
-	CI_CICR0_RESERVED  = 0x03FFFC00,
-	CI_CICR0_SIM_SHIFT = 24,
-	CI_CICR0_SIM_SMASK = 0x7,
-	CI_CICR0_DIS       = 0x08000000,
-	CI_CICR0_ENB       = 0x10000000,
-	CI_CICR0_SL_CAP_EN = 0x20000000,
-	CI_CICR0_PAR_EN    = 0x40000000,
-	CI_CICR0_DMA_EN    = 0x80000000,
-	CI_CICR0_INTERRUPT_MASK = 0x3FF
-};
-
-enum CI_REGBITS_CICR1
-{
-	CI_CICR1_DW_SHIFT       = 0,
-	CI_CICR1_DW_SMASK       = 0x7,
-	CI_CICR1_COLOR_SP_SHIFT = 3,
-	CI_CICR1_COLOR_SP_SMASK = 0x3,
-	CI_CICR1_RAW_BPP_SHIFT  = 5,
-	CI_CICR1_RAW_BPP_SMASK  = 0x3,
-	CI_CICR1_RGB_BPP_SHIFT  = 7,
-	CI_CICR1_RGB_BPP_SMASK  = 0x7,
-	CI_CICR1_YCBCR_F        = 0x00000400,
-	CI_CICR1_RBG_F          = 0x00000800,
-	CI_CICR1_RGB_CONV_SHIFT = 12,
-	CI_CICR1_RGB_CONV_SMASK = 0x7,
-	CI_CICR1_PPL_SHIFT      = 15,
-	CI_CICR1_PPL_SMASK      = 0x7FF,
-	CI_CICR1_RESERVED       = 0x1C000000,
-	CI_CICR1_RGBT_CONV_SHIFT= 29,
-	CI_CICR1_RGBT_CONV_SMASK= 0x3,
-	CI_CICR1_TBIT           = 0x80000000
-};
-
-enum CI_REGBITS_CICR2
-{
-	CI_CICR2_FSW_SHIFT = 0,
-	CI_CICR2_FSW_SMASK = 0x3,
-	CI_CICR2_BFPW_SHIFT= 3,
-	CI_CICR2_BFPW_SMASK= 0x3F,
-	CI_CICR2_RESERVED  = 0x00000200,
-	CI_CICR2_HSW_SHIFT = 10,
-	CI_CICR2_HSW_SMASK = 0x3F,
-	CI_CICR2_ELW_SHIFT = 16,
-	CI_CICR2_ELW_SMASK = 0xFF,
-	CI_CICR2_BLW_SHIFT = 24,
-	CI_CICR2_BLW_SMASK = 0xFF
-};
-
-enum CI_REGBITS_CICR3
-{
-	CI_CICR3_LPF_SHIFT = 0,
-	CI_CICR3_LPF_SMASK = 0x7FF,
-	CI_CICR3_VSW_SHIFT = 11,
-	CI_CICR3_VSW_SMASK = 0x1F,
-	CI_CICR3_EFW_SHIFT = 16,
-	CI_CICR3_EFW_SMASK = 0xFF,
-	CI_CICR3_BFW_SHIFT = 24,
-	CI_CICR3_BFW_SMASK = 0xFF
-};
-
-enum CI_REGBITS_CICR4
-{
-	CI_CICR4_DIV_SHIFT = 0,
-	CI_CICR4_DIV_SMASK = 0xFF,
-	CI_CICR4_FR_RATE_SHIFT = 8,
-	CI_CICR4_FR_RATE_SMASK = 0x7,
-	CI_CICR4_RESERVED1 = 0x0007F800,
-	CI_CICR4_MCLK_EN   = 0x00080000,
-	CI_CICR4_VSP       = 0x00100000,
-	CI_CICR4_HSP       = 0x00200000,
-	CI_CICR4_PCP       = 0x00400000,
-	CI_CICR4_PCLK_EN   = 0x00800000,
-	CI_CICR4_RESERVED2 = 0xFF000000,
-	CI_CICR4_RESERVED  = CI_CICR4_RESERVED1 | CI_CICR4_RESERVED2
-};
-
-enum CI_REGBITS_CISR
-{
-	CI_CISR_IFO_0      = 0x00000001,
-	CI_CISR_IFO_1      = 0x00000002,
-	CI_CISR_IFO_2      = 0x00000004,
-	CI_CISR_EOF        = 0x00000008,
-	CI_CISR_SOF        = 0x00000010,
-	CI_CISR_CDD        = 0x00000020,
-	CI_CISR_CQD        = 0x00000040,
-	CI_CISR_PAR_ERR    = 0x00000080,
-	CI_CISR_EOL        = 0x00000100,
-	CI_CISR_FEMPTY_0   = 0x00000200,
-	CI_CISR_FEMPTY_1   = 0x00000400,
-	CI_CISR_FEMPTY_2   = 0x00000800,
-	CI_CISR_RDAV_0     = 0x00001000,
-	CI_CISR_RDAV_1     = 0x00002000,
-	CI_CISR_RDAV_2     = 0x00004000,
-	CI_CISR_FTO        = 0x00008000,
-	CI_CISR_RESERVED   = 0xFFFF0000
-};
-
-enum CI_REGBITS_CIFR
-{
-	CI_CIFR_FEN0       = 0x00000001,
-	CI_CIFR_FEN1       = 0x00000002,
-	CI_CIFR_FEN2       = 0x00000004,
-	CI_CIFR_RESETF     = 0x00000008,
-	CI_CIFR_THL_0_SHIFT= 4,
-	CI_CIFR_THL_0_SMASK= 0x3,
-	CI_CIFR_RESERVED1  = 0x000000C0,
-	CI_CIFR_FLVL0_SHIFT= 8,
-	CI_CIFR_FLVL0_SMASK= 0xFF,
-	CI_CIFR_FLVL1_SHIFT= 16,
-	CI_CIFR_FLVL1_SMASK= 0x7F,
-	CI_CIFR_FLVL2_SHIFT= 23,
-	CI_CIFR_FLVL2_SMASK= 0x7F,
-	CI_CIFR_RESERVED2  = 0xC0000000,
-	CI_CIFR_RESERVED   = CI_CIFR_RESERVED1 | CI_CIFR_RESERVED2
-};
-
-//---------------------------------------------------------------------------
-//     Parameter Type definitions
-//---------------------------------------------------------------------------
-typedef enum
-{
-	CI_RAW8 = 0,				 //RAW
-	CI_RAW9,
-	CI_RAW10,
-	CI_YCBCR422,				 //YCBCR
-	CI_YCBCR422_PLANAR,			 //YCBCR Planaried
-	CI_RGB444,					 //RGB
-	CI_RGB555,
-	CI_RGB565,
-	CI_RGB666,
-	CI_RGB888,
-	CI_RGBT555_0,				 //RGB+Transparent bit 0
-	CI_RGBT888_0,
-	CI_RGBT555_1,				 //RGB+Transparent bit 1
-	CI_RGBT888_1,
-	CI_RGB666_PACKED,			 //RGB Packed
-	CI_RGB888_PACKED,
-	CI_INVALID_FORMAT = 0xFF
-} CI_IMAGE_FORMAT;
-
-typedef enum
-{
-	CI_INTSTATUS_IFO_0      = 0x00000001,
-	CI_INTSTATUS_IFO_1      = 0x00000002,
-	CI_INTSTATUS_IFO_2      = 0x00000004,
-	CI_INTSTATUS_EOF        = 0x00000008,
-	CI_INTSTATUS_SOF        = 0x00000010,
-	CI_INTSTATUS_CDD        = 0x00000020,
-	CI_INTSTATUS_CQD        = 0x00000040,
-	CI_INTSTATUS_PAR_ERR    = 0x00000080,
-	CI_INTSTATUS_EOL        = 0x00000100,
-	CI_INTSTATUS_FEMPTY_0   = 0x00000200,
-	CI_INTSTATUS_FEMPTY_1   = 0x00000400,
-	CI_INTSTATUS_FEMPTY_2   = 0x00000800,
-	CI_INTSTATUS_RDAV_0     = 0x00001000,
-	CI_INTSTATUS_RDAV_1     = 0x00002000,
-	CI_INTSTATUS_RDAV_2     = 0x00004000,
-	CI_INTSTATUS_FTO        = 0x00008000,
-	CI_INTSTATUS_ALL       = 0x0000FFFF
-} CI_INTERRUPT_STATUS;
-
-typedef enum
-{
-	CI_INT_IFO      = 0x00000001,
-	CI_INT_EOF      = 0x00000002,
-	CI_INT_SOF      = 0x00000004,
-	CI_INT_CDD      = 0x00000008,
-	CI_INT_CQD      = 0x00000010,
-	CI_INT_PAR_ERR  = 0x00000020,
-	CI_INT_EOL      = 0x00000040,
-	CI_INT_FEMPTY   = 0x00000080,
-	CI_INT_RDAV     = 0x00000100,
-	CI_INT_FTO      = 0x00000200,
-	CI_INT_ALL      = 0x000003FF
-} CI_INTERRUPT_MASK;
-#define CI_INT_MAX 10
-
-typedef enum CI_MODE
-{
-	CI_MODE_MP,					 // Master-Parallel
-	CI_MODE_SP,					 // Slave-Parallel
-	CI_MODE_MS,					 // Master-Serial
-	CI_MODE_EP,					 // Embedded-Parallel
-	CI_MODE_ES					 // Embedded-Serial
-} CI_MODE;
-
-typedef enum
-{
-	CI_FR_ALL = 0,				 // Capture all incoming frames
-	CI_FR_1_2,					 // Capture 1 out of every 2 frames
-	CI_FR_1_3,					 // Capture 1 out of every 3 frames
-	CI_FR_1_4,
-	CI_FR_1_5,
-	CI_FR_1_6,
-	CI_FR_1_7,
-	CI_FR_1_8
-} CI_FRAME_CAPTURE_RATE;
-
-typedef enum
-{
-	CI_FIFO_THL_32 = 0,
-	CI_FIFO_THL_64,
-	CI_FIFO_THL_96
-} CI_FIFO_THRESHOLD;
-
-typedef struct
-{
-	unsigned int BFW;
-	unsigned int BLW;
-} CI_MP_TIMING, CI_MS_TIMING;
-
-typedef struct
-{
-	unsigned int BLW;
-	unsigned int ELW;
-	unsigned int HSW;
-	unsigned int BFPW;
-	unsigned int FSW;
-	unsigned int BFW;
-	unsigned int EFW;
-	unsigned int VSW;
-} CI_SP_TIMING;
-
-typedef enum
-{
-	CI_DATA_WIDTH4 = 0x0,
-	CI_DATA_WIDTH5 = 0x1,
-	CI_DATA_WIDTH8 = 0x2,
-	CI_DATA_WIDTH9 = 0x3,
-	CI_DATA_WIDTH10= 0x4
-} CI_DATA_WIDTH;
-
-//-------------------------------------------------------------------------------------------------------
-//      Configuration APIs
-//-------------------------------------------------------------------------------------------------------
-
-void ci_set_frame_rate(CI_FRAME_CAPTURE_RATE frate);
-CI_FRAME_CAPTURE_RATE ci_get_frame_rate(void);
-void ci_set_image_format(CI_IMAGE_FORMAT input_format, CI_IMAGE_FORMAT output_format);
-void ci_set_mode(CI_MODE mode, CI_DATA_WIDTH data_width);
-void ci_configure_mp(unsigned int PPL, unsigned int LPF, CI_MP_TIMING* timing);
-void ci_configure_sp(unsigned int PPL, unsigned int LPF, CI_SP_TIMING* timing);
-void ci_configure_ms(unsigned int PPL, unsigned int LPF, CI_MS_TIMING* timing);
-void ci_configure_ep(int parity_check);
-void ci_configure_es(int parity_check);
-void ci_set_clock(int pclk_enable, int mclk_enable, unsigned int mclk_mhz);
-unsigned int ci_get_clock(void);
-void ci_set_polarity(int pclk_sample_falling, int hsync_active_low, int vsync_active_low);
-void ci_set_fifo( unsigned int timeout, CI_FIFO_THRESHOLD threshold, int fifo1_enable,
-int fifo2_enable);
-void ci_set_int_mask( unsigned int mask);
-void ci_clear_int_status( unsigned int status);
-void ci_set_reg_value( unsigned int reg_offset, unsigned int value);
-int ci_get_reg_value(unsigned int reg_offset);
-
-void ci_reset_fifo(void);
-unsigned int ci_get_int_mask(void);
-unsigned int ci_get_int_status(void);
-void ci_slave_capture_enable(void);
-void ci_slave_capture_disable(void);
-void pxa_ci_dma_irq_y(int channel, void *data);
-void pxa_ci_dma_irq_cb(int channel, void *data);
-void pxa_ci_dma_irq_cr(int channel, void *data);
-
-
-//-------------------------------------------------------------------------------------------------------
-//      Control APIs
-//-------------------------------------------------------------------------------------------------------
-int  ci_init(void);
-void ci_deinit(void);
-void ci_enable( int dma_en);
-int  ci_disable(int quick);
-
-//debug
-void ci_dump(void);
-// IRQ
-void pxa_fvgpio_interrupt(int irq, void *dev_id, struct pt_regs *regs);
-
-#define err_print(fmt, args...) printk(KERN_ERR "fun %s "fmt"\n", __FUNCTION__, ##args)
-
-#ifdef DEBUG
-
-#define dbg_print(fmt, args...) printk(KERN_INFO "fun %s "fmt"\n", __FUNCTION__, ##args)
-
-#if DEBUG > 1
-#define ddbg_print(fmt, args...) printk(KERN_INFO "fun %s "fmt"\n", __FUNCTION__, ##args)
-#else
-#define ddbg_print(fmt, args...) ;
-#endif
-
-#else
-
-#define dbg_print(fmt, args...)  ;
-#define ddbg_print(fmt, args...) ;
-#endif
-
-								 /* subject to change */
-#define VID_HARDWARE_PXA_CAMERA     50
-
-#define STATUS_FAILURE  (0)
-#define STATUS_SUCCESS  (1)
-#define STATUS_WRONG_PARAMETER  -1
-
-/*
-Macros
-*/
-
-/*
-Image format definition
-*/
-//#define CAMERA_IMAGE_FORMAT_MAX                CAMERA_IMAGE_FORMAT_YCBCR444_PLANAR
-
-// Interrupt mask
-#define CAMERA_INTMASK_FIFO_OVERRUN            0x0001
-#define CAMERA_INTMASK_END_OF_FRAME            0x0002
-#define CAMERA_INTMASK_START_OF_FRAME          0x0004
-#define CAMERA_INTMASK_CI_DISABLE_DONE         0x0008
-#define CAMERA_INTMASK_CI_QUICK_DISABLE        0x0010
-#define CAMERA_INTMASK_PARITY_ERROR            0x0020
-#define CAMERA_INTMASK_END_OF_LINE             0x0040
-#define CAMERA_INTMASK_FIFO_EMPTY              0x0080
-#define CAMERA_INTMASK_RCV_DATA_AVALIBLE       0x0100
-#define CAMERA_INTMASK_TIME_OUT                0x0200
-#define CAMERA_INTMASK_END_OF_DMA              0x0400
-
-// Interrupt status
-#define CAMERA_INTSTATUS_FIFO_OVERRUN_0        0x00000001
-#define CAMERA_INTSTATUS_FIFO_OVERRUN_1        0x00000002
-#define CAMERA_INTSTATUS_FIFO_OVERRUN_2        0x00000004
-#define CAMERA_INTSTATUS_END_OF_FRAME          0x00000008
-#define CAMERA_INTSTATUS_START_OF_FRAME        0x00000010
-#define CAMERA_INTSTATUS_CI_DISABLE_DONE       0x00000020
-#define CAMERA_INTSTATUS_CI_QUICK_DISABLE      0x00000040
-#define CAMERA_INTSTATUS_PARITY_ERROR          0x00000080
-#define CAMERA_INTSTATUS_END_OF_LINE           0x00000100
-#define CAMERA_INTSTATUS_FIFO_EMPTY_0          0x00000200
-#define CAMERA_INTSTATUS_FIFO_EMPTY_1          0x00000400
-#define CAMERA_INTSTATUS_FIFO_EMPTY_2          0x00000800
-#define CAMERA_INTSTATUS_RCV_DATA_AVALIBLE_0   0x00001000
-#define CAMERA_INTSTATUS_RCV_DATA_AVALIBLE_1   0x00002000
-#define CAMERA_INTSTATUS_RCV_DATA_AVALIBLE_2   0x00004000
-#define CAMERA_INTSTATUS_TIME_OUT              0x00008000
-#define CAMERA_INTSTATUS_END_OF_DMA            0x00010000
-
-// Capture status
-#define CAMERA_STATUS_VIDEO_CAPTURE_IN_PROCESS 0x0001
-#define CAMERA_STATUS_RING_BUFFER_FULL         0x0002
-
-#define CAMERA_ERROR_NONE                      0
-#define CAMERA_ERROR_FVNOTSYNC                 -1
-#define CAMERA_ERROR_FIFONOTEMPTY              -2
-#define CAMERA_ERROR_UNEXPECTEDINT             -3
-
-/*
-Structures
-*/
-typedef struct camera_context_s camera_context_t, *p_camera_context_t;
-
-typedef struct
-{
-	int (*init)(p_camera_context_t context);
-	int (*deinit)(p_camera_context_t);
-	int (*set_capture_format)(p_camera_context_t);
-	int (*start_capture)(p_camera_context_t, unsigned int frames);
-	int (*stop_capture)(p_camera_context_t);
-	int (*command)(p_camera_context_t, unsigned int cmd, void *param);
-	int (*pm_management)(p_camera_context_t, int suspend);
-} camera_function_t, *p_camera_function_t;
-// context
-
-struct camera_context_s
-{
-	// syncronization stuff
-	atomic_t refcount;
-
-	/*
-	 * DRIVER FILLED PARAMTER
-	 */
-
-	// sensor info
-	unsigned int sensor_type;
-
-	// capture image info
-	unsigned int capture_width;
-	unsigned int capture_height;
-	unsigned int sensor_width;
-	unsigned int sensor_height;
-	unsigned int still_width;
-	unsigned int still_height;
-
-	unsigned int camera_width;
-	unsigned int camera_height;
-
-	unsigned int    capture_input_format;
-	unsigned int    capture_output_format;
-	unsigned int    still_input_format;
-	unsigned int    still_output_format;
-
-	unsigned int    capture_digital_zoom;
-	unsigned int    still_digital_zoom;
-
-	int             plane_number;
-
-	int             still_image_mode;
-	int             camera_mode;
-
-	int             jpeg_quality;
-
-	int             waiting_frame;
-	int             fv_rising_edge;
-	int             preferred_block_num;
-	int             still_image_rdy;
-	int             task_waiting;
-	int             detected_sensor_type;
-
-	V4l_PIC_STYLE   capture_style;
-	V4l_PIC_WB      capture_light;
-	int             capture_bright;
-	int             capture_contrast;
-	int             flicker_freq;
-
-	struct video_capability vc;
-
-	// frame rate control
-	unsigned int frame_rate;
-	unsigned int fps;
-	unsigned int mini_fps;
-
-	unsigned int mclk;
-
-	// ring buffers
-	// note: must pass in 8 bytes aligned address
-	void *buffer_virtual;
-	void *buffer_physical;
-	unsigned int buf_size;
-
-	// memory for dma descriptors, layout:
-	//  dma descriptor chain 0,
-	//  dma descriptor chain 1,
-	//  ...
-	void *dma_descriptors_virtual;
-	void *dma_descriptors_physical;
-	unsigned int dma_descriptors_size;
-
-	// os mapped register address
-	unsigned int clk_reg_base;
-	unsigned int ost_reg_base;
-	unsigned int gpio_reg_base;
-	unsigned int ci_reg_base;
-	unsigned int board_reg_base;
-
-	// function dispatch table
-	p_camera_function_t camera_functions;
-
-	/*
-	 * FILLED PARAMTER
-	 */
-	int dma_channels[3];
-	unsigned int capture_status;
-
-	unsigned planeOffset[VIDEO_MAX_FRAME][3];
-	unsigned planeBytes[VIDEO_MAX_FRAME][3];
-
-	/*
-	 * INTERNALLY USED: DON'T TOUCH!
-	 */
-	unsigned int block_number, block_size, block_number_max;
-	unsigned int block_header, block_tail;
-	unsigned int fifo0_descriptors_virtual, fifo0_descriptors_physical;
-	unsigned int fifo1_descriptors_virtual, fifo1_descriptors_physical;
-	unsigned int fifo2_descriptors_virtual, fifo2_descriptors_physical;
-	unsigned int fifo0_num_descriptors;
-	unsigned int fifo1_num_descriptors;
-	unsigned int fifo2_num_descriptors;
-	unsigned int fifo0_transfer_size;
-	unsigned int fifo1_transfer_size;
-	unsigned int fifo2_transfer_size;
-
-	struct page **page_array;
-
-	unsigned int pages_allocated;
-	unsigned int page_aligned_block_size;
-	unsigned int pages_per_block;
-	unsigned int pages_per_fifo0;
-	unsigned int pages_per_fifo1;
-	unsigned int pages_per_fifo2;
-
-	#ifdef CONFIG_DPM
-	struct pm_dev *pmdev;
-	#endif
-	int dma_started;
-};
-
-/*
-Prototypes
-*/
-/***********************************************************************
- *
- * Init/Deinit APIs
- *
- ***********************************************************************/
-// Setup the sensor type, configure image capture format (RGB, yuv 444, yuv 422, yuv 420, packed | planar, MJPEG) regardless
-// of current operating mode (i.e. sets mode for both still capture and video capture)
-int camera_init( p_camera_context_t camera_context );
-
-// Power off sensor
-int camera_deinit( p_camera_context_t camera_context );
-
-/***********************************************************************
- *
- * Capture APIs
- *
- ***********************************************************************/
-// Set the image format
-int camera_set_capture_format( p_camera_context_t camera_context);
-
-// take a picture and copy it into the ring buffer
-int camera_capture_still_image( p_camera_context_t camera_context, unsigned int block_id );
-
-// capture motion video and copy it the ring buffer
-int camera_start_video_capture( p_camera_context_t camera_context, unsigned int block_id);
-
-// disable motion video image capture
-void camera_stop_video_capture( p_camera_context_t camera_context );
-
-// skip frame before capture video or still image
-void camera_skip_frame( p_camera_context_t camera_context, int skip_frame_num );
-
-int camera_func_ov9640_command(p_camera_context_t camera_context, unsigned int cmd, void *param);
-
-/***********************************************************************
- *
- * Flow Control APIs
- *
- ***********************************************************************/
-// continue capture image to next available buffer
-// Returns the continued buffer id, -1 means buffer full and no transfer started
-void camera_continue_transfer( p_camera_context_t camera_context );
-
-// Return 1: there is available buffer, 0: buffer is full
-int camera_next_buffer_available( p_camera_context_t camera_context );
-
-// Application supplies the FrameBufferID to the driver to tell it that the application has completed processing of the given frame buffer, and that buffer is now available for re-use.
-void camera_release_frame_buffer( p_camera_context_t camera_context, unsigned int frame_buffer_id );
-
-// Returns the FrameBufferID for the first filled frame
-// Note: -1 represents buffer empty
-int camera_get_first_frame_buffer_id( p_camera_context_t camera_context );
-
-/*
-Returns the FrameBufferID for the last filled frame, this would be used if we were polling for image completion data,
-or we wanted to make sure there were no frames waiting for us to process.
-Note: -1 represents buffer empty
-*/
-int camera_get_last_frame_buffer_id( p_camera_context_t camera_context );
-
-/***********************************************************************
- *
- * Buffer Info APIs
- *
- ***********************************************************************/
-// Return: the number of frame buffers allocated for use.
-unsigned int camera_get_num_frame_buffers( p_camera_context_t camera_context );
-
-/* 
-FrameBufferID is a number between 0 and N-1, where N is the total number of frame buffers in use.
-Returns the address of the given frame buffer.
-The application will call this once for each frame buffer at application initialization only.
-*/
-void* camera_get_frame_buffer_addr( p_camera_context_t camera_context, unsigned int frame_buffer_id );
-
-// Return the block id
-int camera_get_frame_buffer_id( p_camera_context_t camera_context, void* address );
-
-/***********************************************************************
- *
- * Frame rate APIs
- *
- ***********************************************************************/
-// Set desired frame rate
-void camera_set_capture_frame_rate( p_camera_context_t camera_context );
-
-// return current setting
-void camera_get_capture_frame_rate( p_camera_context_t camera_context );
-
-/***********************************************************************
- *
- * Interrupt APIs
- *
- ***********************************************************************/
-// set interrupt mask
-void camera_set_int_mask( p_camera_context_t camera_context, unsigned int mask );
-
-// get interrupt mask
-unsigned int camera_get_int_mask( p_camera_context_t camera_context );
-
-// clear interrupt status
-void camera_clear_int_status( p_camera_context_t camera_context, unsigned int status );
-
-// gpio init
-void camera_gpio_init(void);
-void camera_gpio_deinit(void);
-
-// ci functions
-void ci_reset(void);
-
-// dma functions
-extern void start_dma_transfer(p_camera_context_t camera_context, unsigned block_id);
-extern void stop_dma_transfer(p_camera_context_t camera_context);
-extern int camera_ring_buf_init(p_camera_context_t camera_context);
-
-// power management deep idle
-#define USE_CAM_IPM_HOOK
-extern int cam_ipm_hook(void);
-extern void cam_ipm_unhook(void);
-
-// lock functions
-extern void camera_lock(void);
-extern void camera_unlock(void);
-extern int camera_trylock(void);
-
-/*
-Image format definition
-*/
-#define CAMERA_IMAGE_FORMAT_MAX                CAMERA_IMAGE_FORMAT_YCBCR444_PLANAR
-
-#define CIBR0_PHY	(0x50000000 + 0x28)
-#define CIBR1_PHY	(0x50000000 + 0x30)
-#define CIBR2_PHY	(0x50000000 + 0x38)
-
-/*
- * It is required to have at least 3 frames in buffer
- * in current implementation
- */
-#define FRAMES_IN_BUFFER    	3
-#define SINGLE_DESC_TRANS_MAX  	 PAGE_SIZE
-
-#endif
diff -ruN -X X hnd-linux-trunk/drivers/misc/fsi_drv.c hnd-cleanup/drivers/misc/fsi_drv.c
--- hnd-linux-trunk/drivers/misc/fsi_drv.c	2007-09-17 22:46:10.000000000 +0400
+++ hnd-cleanup/drivers/misc/fsi_drv.c	2007-09-17 23:24:27.000000000 +0400
@@ -26,24 +26,26 @@
 #include <asm/arch/irqs.h>
 
 #include <asm/arch/fsi.h>
+#include <asm/arch/pxa-regs.h>
+#include <asm/arch/h5400-gpio.h>
 
 #include "samcop_fsi.h"
 
-atomic_t fsi_in_use;
-DECLARE_WAIT_QUEUE_HEAD(fsi_rqueue);
-struct timer_list fsi_temp_timer;
-
-unsigned int fsi_prescale = 19;
-unsigned int fsi_dmi = 1124;
-unsigned int fsi_treshold_on = 20;
-unsigned int fsi_treshold_off = 4;
-unsigned int fsi_buffer_size = FSI_FRAME_SIZE * (sizeof(unsigned long)) * 3;
+static atomic_t fsi_in_use;
+static DECLARE_WAIT_QUEUE_HEAD(fsi_rqueue);
+static struct timer_list fsi_temp_timer;
+
+static unsigned int fsi_prescale = 19;
+static unsigned int fsi_dmi = 1124;
+static unsigned int fsi_treshold_on = 20;
+static unsigned int fsi_treshold_off = 4;
+static unsigned int fsi_buffer_size = FSI_FRAME_SIZE * (sizeof(unsigned long)) * 3;
 
 volatile unsigned char fsi_lfrm = 0;
 
 static struct samcop_fsi *fsi_ = NULL;
 
-void fsi_set_mode(unsigned int cmd)
+static void fsi_set_mode(unsigned int cmd)
 {
 	static unsigned int current_mode = 0;
 	static unsigned long control_register = 0;
@@ -107,14 +109,14 @@
 	}
 }
 
-void fsi_timer_temp_callback(unsigned long input)
+static void fsi_timer_temp_callback(unsigned long input)
 {
 	printk(KERN_DEBUG "%s: stopping temperature increase (status=%d)\n", __FUNCTION__,
 	       samcop_fsi_get_control(fsi_) & FSI_CONTROL_TEMP);
 	fsi_set_mode(FSI_CMD_STOP_TEMP);
 }
 
-inline int fsi_analyze_column(struct fsi_read_state *read_state, unsigned int data)
+static inline int fsi_analyze_column(struct fsi_read_state *read_state, unsigned int data)
 {
 	if ((data & 0xEFEF) == 0xE0E0) { /* sync column */
 		read_state->frame_number++;
@@ -158,7 +160,7 @@
 	return 0;
 }
 
-void fsi_run_tasklet(unsigned long state_ptr)
+static void fsi_run_tasklet(unsigned long state_ptr)
 {
 	unsigned int i;
 	unsigned long data;
@@ -202,14 +204,14 @@
 
 DECLARE_TASKLET_DISABLED(fsi_tasklet,fsi_run_tasklet,0);
 
-int fsi_irq_handler(int irq, void *dev_id, struct pt_regs *regs)
+static irqreturn_t fsi_irq_handler(int irq, void *dev_id)
 {
 	unsigned int fifo_status;
 
 
 	fifo_status = samcop_fsi_get_status(fsi_);
 
-	if (fifo_status & 1) {
+	if (fifo_status & 1) { /* FIFO trigger */
 		fsi_set_mode(FSI_CMD_STOP_ACQ_INT);
 		tasklet_schedule(&fsi_tasklet);
 	}
@@ -226,10 +228,10 @@
 		fsi_lfrm = 1;
 		tasklet_schedule(&fsi_tasklet);
 	}
-	return 0;
+	return IRQ_HANDLED;
 }
 
-int fsi_copy_to_user(struct fsi_read_state *read_state, char *buf)
+static int fsi_copy_to_user(struct fsi_read_state *read_state, char *buf)
 {
 	unsigned int avail_words;
 
@@ -240,7 +242,14 @@
 	else
 		avail_words = read_state->write_pos - read_state->read_pos;
 	
-	if (copy_to_user(buf+read_state->word_count*4,read_state->buffer+read_state->read_pos,avail_words*4))
+	/* 'buf' is 'char*', but word_count denotes count in array of 'unsigned
+	 * long'. To get proper destination address, we need to multiple it by
+	 * sizeof(unsigned long).
+	 */
+
+	if (copy_to_user(buf+read_state->word_count*sizeof(unsigned long), 
+		read_state->buffer+read_state->read_pos,
+		avail_words*sizeof(unsigned long)))
 		return -EFAULT;
 
 	read_state->word_count += avail_words;
@@ -284,10 +293,13 @@
 
 	filp->private_data = read_state;
 
-#if 0
+#if 1 
 	/* GPIO61 turns out to be serial power, not fingerchip power.
 	   Any other guesses?  */
-	SET_GPIO(POWER_FP_N, 0); /* power on */
+	/* it _IS_ this GPIO. No idea what else it powers, but without it, ATMEL
+	 * chip returns zeroes. */
+	//SET_GPIO(POWER_FP_N, 0); /* power on */
+	SET_H5400_GPIO(POWER_RS232_N_OR_FS, 0);
 #endif
 	/* init hardware */
 	samcop_fsi_up(fsi_);
@@ -295,18 +307,19 @@
 	return 0;
 }
 
-int fsi_release(struct inode *inode, struct file *filp)
+static int fsi_release(struct inode *inode, struct file *filp)
 {
 	/* put scanner to sleep before we exit */
 	samcop_fsi_down(fsi_);
 
 	kfree(filp->private_data);
 	atomic_inc(&fsi_in_use);
+	SET_H5400_GPIO(POWER_RS232_N_OR_FS, 1);
 
 	return 0;
 }
 
-ssize_t fsi_read(struct file *filp, char *buf, size_t count, loff_t *offp)
+static ssize_t fsi_read(struct file *filp, char *buf, size_t count, loff_t *offp)
 {
 	int errval = 0;
 	struct fsi_read_state *read_state;
@@ -321,6 +334,7 @@
 	/* allocate buffer and initialize state */
 	read_state->buffer_size = fsi_buffer_size;
 	read_state->buffer = kmalloc(read_state->buffer_size,GFP_KERNEL);
+	read_state->buffer_size = fsi_buffer_size/sizeof(unsigned long);
 	if (read_state->buffer == NULL)
 		return -ENOMEM;
 
@@ -347,6 +361,7 @@
 
 	/* gather data */
 	while (read_state->word_count < read_state->word_dest) {
+		//printk (KERN_INFO "word_count: %d, word_dest: %d\n", read_state->word_count, read_state->word_dest);
 		interruptible_sleep_on(&fsi_rqueue);
 		if (signal_pending(current)) {
 			errval = -ERESTARTSYS;
@@ -380,7 +395,7 @@
 	return count;
 }
 
-int fsi_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg)
+static int fsi_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg)
 {
 	struct fsi_read_state *read_state;
 
@@ -474,15 +489,20 @@
 	return 0; 
 }
 
-void
+int
 fsi_detach(void)
 {
+	if (atomic_dec_and_test(&fsi_in_use)) {
+		atomic_inc(&fsi_in_use);
+		/* someone is using FSI at the moment, we can't quit */
+		return -EBUSY;
+	}
 	fsi_set_mode(FSI_CMD_STOP_TEMP);
 	del_timer(&fsi_temp_timer);
-	samcop_fsi_down(fsi_); /* Stop h/w */
 	free_irq(fsi_->irq, NULL);
 	fsi_ = NULL;
 	misc_deregister(&fsi_miscdev);
+	return 0;
 }
 
 MODULE_AUTHOR("J°rgen Andreas Michaelsen <jorgenam@ifi.uio.no>");
diff -ruN -X X hnd-linux-trunk/drivers/misc/samcop_fsi.c hnd-cleanup/drivers/misc/samcop_fsi.c
--- hnd-linux-trunk/drivers/misc/samcop_fsi.c	2007-09-17 22:46:10.000000000 +0400
+++ hnd-cleanup/drivers/misc/samcop_fsi.c	2007-09-17 23:24:27.000000000 +0400
@@ -9,6 +9,7 @@
  *
  */
 
+
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
@@ -18,24 +19,24 @@
 #include <linux/clk.h>
 #include <asm/hardware.h>
 #include <asm/io.h>
-#include <asm/arch/ipaq.h>
 #include <asm/hardware/ipaq-samcop.h>
-#include <asm/hardware/samcop_base.h>
+#include <linux/mfd/samcop_base.h>
 #include <asm/hardware/samcop-fsi.h>
 
 #include "samcop_fsi.h"
 
 static inline void
-samcop_fsi_write_register (struct samcop_fsi *fsi, u32 reg, u16 val)
+samcop_fsi_write_register (struct samcop_fsi *fsi, u32 reg, u32 val)
 {
-	__raw_writew (val, reg + fsi->map);
+	fsi->fsi_data->write_reg (fsi->me, reg, val);
 }
 
-static inline u16
+static inline u32
 samcop_fsi_read_register (struct samcop_fsi *fsi, u32 reg)
 {
-	return __raw_readw (reg + fsi->map);
+	return fsi->fsi_data->read_reg (fsi->me, reg);
 }
+
 /*
  * Helper functions that provide samcop access to the fcd and fsi parts of the
  * fingerprint scanner
@@ -44,6 +45,7 @@
 void
 samcop_fsi_set_control (struct samcop_fsi *fsi, u32 val)
 {
+	val &= 0xff;
 	samcop_fsi_write_register (fsi, _SAMCOP_FSI_Control, val);
 }
 
@@ -100,7 +102,7 @@
 	/* tell scanner to sleep */
 	u32 control_register = 0;
 	control_register = samcop_fsi_get_control(fsi);
-	control_register |= ~SAMCOP_FSI_CONTROL_TEMP_PWR_ON;
+	control_register &= ~SAMCOP_FSI_CONTROL_TEMP_PWR_ON; // |= was here originally
 	samcop_fsi_set_control(fsi, control_register);
 
 	/* disable PCLK */
@@ -110,40 +112,69 @@
 void
 samcop_fsi_set_status (struct samcop_fsi *fsi, u32 val)
 {
-	samcop_fsi_write_register (fsi, SAMCOP_FSI_STA, val);
+	samcop_fsi_write_register (fsi, _SAMCOP_FSI_STA, val);
 }
 
 u32
 samcop_fsi_get_status (struct samcop_fsi *fsi)
 {
-	return samcop_fsi_read_register (fsi, SAMCOP_FSI_STA);
+	return samcop_fsi_read_register (fsi, _SAMCOP_FSI_STA);
 }
 
 u32
 samcop_fsi_read_data (struct samcop_fsi *fsi)
 {
-	return samcop_fsi_read_register (fsi, SAMCOP_FSI_DAT);
+	return samcop_fsi_read_register (fsi, _SAMCOP_FSI_DAT);
 }
 
 static int
-samcop_fsi_probe (struct device *dev)
+samcop_fsi_probe (struct platform_device *pdev)
 {
 	int result = 0;
 	struct samcop_fsi *fsi;
-	struct platform_device *sdev = to_platform_device (dev);
 
 	fsi = kmalloc (sizeof (*fsi), GFP_KERNEL);
 	if (!fsi)
 		return -ENOMEM;
 	memset (fsi, 0, sizeof (*fsi));
 
-	fsi->parent = dev->parent;
-	dev->driver_data = fsi;
+	fsi->parent = pdev->dev.parent;
+	platform_set_drvdata(pdev, fsi);
 
-	fsi->map = (void *)sdev->resource[1].start;
-	fsi->irq = sdev->resource[2].start;
+	/* Is this really correct? Some other drivers use this approach, but
+	 * this was already once ioremapped by samcop_base, so we could possibly
+	 * use that mapping and not create new one (approach similar to
+	 * samcop_sdi).
+	 */
+
+	fsi->map = ioremap(pdev->resource[0].start, 
+			pdev->resource[0].end - pdev->resource[0].start + 1);
+	fsi->irq = pdev->resource[1].start;
+	pr_debug("FSI at 0x%p, IRQ %d\n", fsi->map, fsi->irq);
+
+	fsi->clk = clk_get(&pdev->dev, "fsi");
+	if (!fsi->clk) {
+		printk(KERN_ERR "samcop_fsi: Could not get fsi clock");
+		iounmap(fsi->map);
+		kfree(fsi);
+		result = -EBUSY;
+	};
+
+	fsi->fsi_data = pdev->dev.platform_data;
+	fsi->me = &pdev->dev;
+/*	
+	fsi->set_control = samcop_fsi_set_control;
+	fsi->get_control = samcop_fsi_get_control;
+	fsi->set_status = samcop_fsi_set_status;
+	fsi->get_status = samcop_fsi_get_status;
+	fsi->read_data = samcop_fsi_read_data;
+	fsi->up = samcop_fsi_up;
+	fsi->down = samcop_fsi_down;
+	fsi->set_fifo_control = samcop_fsi_set_fifo_control;
+	fsi->set_prescaler = samcop_fsi_set_prescaler;
+	fsi->set_dmc = samcop_fsi_set_dmc;
+*/
 
-	fsi->clk = clk_get(dev, "fsi");
 	if (IS_ERR(fsi->clk)) {
 		printk(KERN_ERR "failed to get fsi clock\n");
 		kfree (fsi);
@@ -154,33 +185,40 @@
 		printk("couldn't attach fsi driver: error %d\n", result);
 		kfree (fsi);
 	}
+	
 
 	return result;
 }
 
 static int
-samcop_fsi_remove (struct device *dev)
+samcop_fsi_remove (struct platform_device *dev)
 {
-	struct samcop_fsi *fsi = dev->driver_data;
-	fsi_detach();
+	struct samcop_fsi *fsi = platform_get_drvdata(dev);
+	int result = 0;
+	result = fsi_detach();
+	if (result != 0)
+		return result;
+	iounmap(fsi->map);
 	kfree (fsi);
-	return 0;
+	return result;
 }
 
 static int
-samcop_fsi_suspend (struct device *dev, pm_message_t state)
+samcop_fsi_suspend (struct platform_device *dev, pm_message_t state)
 {
 	return 0;
 }
 
 static int
-samcop_fsi_resume (struct device *dev)
+samcop_fsi_resume (struct platform_device *dev)
 {
 	return 0;
 }
 
-struct device_driver samcop_fsi_device_driver = {
-	.name    = "samcop fsi",
+struct platform_driver samcop_fsi_device_driver = {
+	.driver = {
+		.name    = "samcop fsi",
+	},
 	.probe   = samcop_fsi_probe,
 	.remove  = samcop_fsi_remove,
 	.suspend = samcop_fsi_suspend,
@@ -189,12 +227,12 @@
 
 static int samcop_fsi_init (void)
 {
-	return driver_register (&samcop_fsi_device_driver);
+	return platform_driver_register (&samcop_fsi_device_driver);
 }
 
 static void samcop_fsi_cleanup (void)
 {
-	driver_unregister (&samcop_fsi_device_driver);
+	platform_driver_unregister (&samcop_fsi_device_driver);
 }
 
 module_init(samcop_fsi_init);
diff -ruN -X X hnd-linux-trunk/drivers/misc/samcop_fsi.h hnd-cleanup/drivers/misc/samcop_fsi.h
--- hnd-linux-trunk/drivers/misc/samcop_fsi.h	2007-09-17 22:46:10.000000000 +0400
+++ hnd-cleanup/drivers/misc/samcop_fsi.h	2007-09-17 23:24:27.000000000 +0400
@@ -10,14 +10,26 @@
 #ifndef _SAMCOP_FSI_H_
 #define _SAMCOP_FSI_H_
 
+
+struct samcop_fsi_data {
+	u32     (*read_reg)(struct device *dev, u32 reg);
+	void    (*write_reg)(struct device *dev, u32 reg, u32 val);
+};
+
+
 struct samcop_fsi {
 	struct device 		*parent;	// parent struct for access to
 						// samcop registers
+	struct device 		*me;
 	void			*map;		// fsi register map
 	int			irq;		// data ready irq
 	struct clk		*clk;		// samcop fsi clk
+
+	struct samcop_fsi_data *fsi_data;
 };
 
+
+
 extern void samcop_fsi_set_control (struct samcop_fsi *fsi, u32 val);
 extern u32 samcop_fsi_get_control (struct samcop_fsi *fsi);
 extern void samcop_fsi_set_status (struct samcop_fsi *fsi, u32 val);
@@ -29,7 +41,8 @@
 extern void samcop_fsi_set_prescaler (struct samcop_fsi *fsi, u32 val);
 extern void samcop_fsi_set_dmc (struct samcop_fsi *fsi, u32 val);
 
+
 extern int fsi_attach (struct samcop_fsi *fsi);
-extern void fsi_detach (void);
+extern int fsi_detach (void);
 
 #endif /* _SAMCOP_FSI_H_ */
diff -ruN -X X hnd-linux-trunk/drivers/pcmcia/pxa2xx_base.c hnd-cleanup/drivers/pcmcia/pxa2xx_base.c
--- hnd-linux-trunk/drivers/pcmcia/pxa2xx_base.c	2007-09-17 22:46:11.000000000 +0400
+++ hnd-cleanup/drivers/pcmcia/pxa2xx_base.c	2007-09-17 23:24:28.000000000 +0400
@@ -59,7 +59,12 @@
 				     u_int mem_clk_10khz)
 {
 	u_int code = pcmcia_cycle_ns * mem_clk_10khz;
+// FIXME: There shouldn't be such #ifdef, added 20070803, resolve max in 6months
+#ifdef CONFIG_ARCH_H5400
+	return (code / 300000) + ((code % 300000) ? 1 : 0) + 1;
+#else
 	return (code / 300000) + ((code % 300000) ? 1 : 0) - 1;
+#endif
 }
 
 static inline u_int pxa2xx_mcxx_setup(u_int pcmcia_cycle_ns,
diff -ruN -X X hnd-linux-trunk/drivers/video/backlight/Makefile hnd-cleanup/drivers/video/backlight/Makefile
--- hnd-linux-trunk/drivers/video/backlight/Makefile	2007-09-17 22:46:03.000000000 +0400
+++ hnd-cleanup/drivers/video/backlight/Makefile	2007-09-17 23:24:21.000000000 +0400
@@ -1,13 +1,13 @@
 # Backlight & LCD drivers
 
-obj-$(CONFIG_LCD_CLASS_DEVICE)		+= lcd.o
-obj-$(CONFIG_BACKLIGHT_CLASS_DEVICE)	+= backlight.o
-obj-$(CONFIG_BACKLIGHT_CORGI)		+= corgi_bl.o
-obj-$(CONFIG_BACKLIGHT_HP680)		+= hp680_bl.o
-obj-$(CONFIG_BACKLIGHT_LOCOMO)		+= locomolcd.o
-obj-$(CONFIG_BACKLIGHT_PROGEAR)		+= progear_bl.o
-obj-$(CONFIG_BACKLIGHT_HX2750)		+= hx2750_bl.o
-obj-$(CONFIG_BACKLIGHT_H2200)		+= h2200_bl.o
-obj-$(CONFIG_LCD_H2200)			+= h2200_lcd.o
-obj-$(CONFIG_BACKLIGHT_S3C2410)		+= s3c2410_lcd.o
+obj-$(CONFIG_LCD_CLASS_DEVICE)     += lcd.o
+obj-$(CONFIG_BACKLIGHT_CLASS_DEVICE) += backlight.o
+obj-$(CONFIG_BACKLIGHT_CORGI)	+= corgi_bl.o
+obj-$(CONFIG_BACKLIGHT_HP680)	+= hp680_bl.o
+obj-$(CONFIG_BACKLIGHT_LOCOMO)	+= locomolcd.o
+obj-$(CONFIG_BACKLIGHT_PROGEAR) += progear_bl.o
+obj-$(CONFIG_BACKLIGHT_HX2750)	+= hx2750_bl.o
+obj-$(CONFIG_BACKLIGHT_H2200)	+= h2200_bl.o
+obj-$(CONFIG_LCD_H2200)		+= h2200_lcd.o
+obj-$(CONFIG_BACKLIGHT_S3C2410)       += s3c2410_lcd.o
 
diff -ruN -X X hnd-linux-trunk/fs/aufs/aufs.h hnd-cleanup/fs/aufs/aufs.h
--- hnd-linux-trunk/fs/aufs/aufs.h	2007-09-17 22:43:40.000000000 +0400
+++ hnd-cleanup/fs/aufs/aufs.h	1970-01-01 03:00:00.000000000 +0300
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2005, 2006, 2007 Junjiro Okajima
- *
- * This program, aufs is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- */
-
-/* $Id: aufs.h,v 1.26 2007/06/04 02:15:32 sfjro Exp $ */
-
-#ifndef __AUFS_H__
-#define __AUFS_H__
-
-#ifdef __KERNEL__
-
-#include <linux/version.h>
-
-/* limited support before 2.6.16, curretly 2.6.15 only. */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16)
-#define atomic_long_t		atomic_t
-#define atomic_long_set		atomic_set
-#define timespec_to_ns(ts)	({(long long)(ts)->tv_sec;})
-#define D_CHILD			d_child
-#else
-#define D_CHILD			d_u.d_child
-#endif
-
-/* ---------------------------------------------------------------------- */
-
-#include "debug.h"
-
-#include "branch.h"
-#include "cpup.h"
-#include "dcsub.h"
-#include "dentry.h"
-#include "dir.h"
-#include "file.h"
-#include "inode.h"
-#include "misc.h"
-#include "module.h"
-#include "opts.h"
-#include "super.h"
-#include "sysaufs.h"
-#include "vfsub.h"
-#include "whout.h"
-#include "wkq.h"
-//#include "xattr.h"
-
-#define AuUse_ISSUBDIR
-#ifdef CONFIG_AUFS_MODULE
-
-/* call ksize() or not */
-#ifndef CONFIG_AUFS_KSIZE_PATCH
-#define ksize(p)	(0U)
-#endif
-
-/* call is_subdir() or not */
-#ifndef CONFIG_AUFS_ISSUBDIR_PATCH
-#undef AuUse_ISSUBDIR
-#endif
-
-#endif /* CONFIG_AUFS_MODULE */
-
-#endif /* __KERNEL__ */
-#endif /* __AUFS_H__ */
diff -ruN -X X hnd-linux-trunk/fs/aufs/branch.c hnd-cleanup/fs/aufs/branch.c
--- hnd-linux-trunk/fs/aufs/branch.c	2007-09-17 22:43:40.000000000 +0400
+++ hnd-cleanup/fs/aufs/branch.c	1970-01-01 03:00:00.000000000 +0300
@@ -1,815 +0,0 @@
-/*
- * Copyright (C) 2005, 2006, 2007 Junjiro Okajima
- *
- * This program, aufs is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- */
-
-/* $Id: branch.c,v 1.51 2007/06/04 02:15:32 sfjro Exp $ */
-
-//#include <linux/fs.h>
-//#include <linux/namei.h>
-#include "aufs.h"
-
-static void free_branch(struct aufs_branch *br)
-{
-	TraceEnter();
-
-	if (br->br_xino)
-		fput(br->br_xino);
-	dput(br->br_wh);
-	dput(br->br_plink);
-	mntput(br->br_mnt);
-	AuDebugOn(br_count(br) || atomic_read(&br->br_wh_running));
-	kfree(br);
-}
-
-/*
- * frees all branches
- */
-void free_branches(struct aufs_sbinfo *sbinfo)
-{
-	aufs_bindex_t bmax;
-	struct aufs_branch **br;
-
-	TraceEnter();
-	bmax = sbinfo->si_bend + 1;
-	br = sbinfo->si_branch;
-	while (bmax--)
-		free_branch(*br++);
-}
-
-/*
- * find the index of a branch which is specified by @br_id.
- */
-int find_brindex(struct super_block *sb, aufs_bindex_t br_id)
-{
-	aufs_bindex_t bindex, bend;
-
-	TraceEnter();
-
-	bend = sbend(sb);
-	for (bindex = 0; bindex <= bend; bindex++)
-		if (sbr_id(sb, bindex) == br_id)
-			return bindex;
-	return -1;
-}
-
-/*
- * test if the @br is readonly or not.
- */
-int br_rdonly(struct aufs_branch *br)
-{
-	return ((br->br_mnt->mnt_sb->s_flags & MS_RDONLY)
-		|| !br_writable(br->br_perm))
-		? -EROFS : 0;
-}
-
-/*
- * returns writable branch index, otherwise an error.
- * todo: customizable writable-branch-policy
- */
-static int find_rw_parent(struct dentry *dentry, aufs_bindex_t bend)
-{
-	int err;
-	aufs_bindex_t bindex, candidate;
-	struct super_block *sb;
-	struct dentry *parent, *hidden_parent;
-
-	err = bend;
-	sb = dentry->d_sb;
-	parent = dget_parent(dentry);
-#if 1 // branch policy
-	hidden_parent = au_h_dptr_i(parent, bend);
-	if (hidden_parent && !br_rdonly(stobr(sb, bend)))
-		goto out; /* success */
-#endif
-
-	candidate = -1;
-	for (bindex = dbstart(parent); bindex <= bend; bindex++) {
-		hidden_parent = au_h_dptr_i(parent, bindex);
-		if (hidden_parent && !br_rdonly(stobr(sb, bindex))) {
-#if 0 // branch policy
-			if (candidate == -1)
-				candidate = bindex;
-			if (!au_test_perm(hidden_parent->d_inode, MAY_WRITE))
-				return bindex;
-#endif
-			err = bindex;
-			goto out; /* success */
-		}
-	}
-#if 0 // branch policy
-	err = candidate;
-	if (candidate != -1)
-		goto out; /* success */
-#endif
-	err = -EROFS;
-
- out:
-	dput(parent);
-	return err;
-}
-
-int find_rw_br(struct super_block *sb, aufs_bindex_t bend)
-{
-	aufs_bindex_t bindex;
-
-	for (bindex = bend; bindex >= 0; bindex--)
-		if (!br_rdonly(stobr(sb, bindex)))
-			return bindex;
-	return -EROFS;
-}
-
-int find_rw_parent_br(struct dentry *dentry, aufs_bindex_t bend)
-{
-	int err;
-
-	err = find_rw_parent(dentry, bend);
-	if (err >= 0)
-		return err;
-	return find_rw_br(dentry->d_sb, bend);
-}
-
-/* ---------------------------------------------------------------------- */
-
-/*
- * test if two hidden_dentries have overlapping branches.
- */
-static int do_is_overlap(struct super_block *sb, struct dentry *hidden_d1,
-			 struct dentry *hidden_d2)
-{
-	int err;
-
-	LKTRTrace("%.*s, %.*s\n", DLNPair(hidden_d1), DLNPair(hidden_d2));
-
-	err = au_is_subdir(hidden_d1, hidden_d2);
-	TraceErr(err);
-	return err;
-}
-
-#if defined(CONFIG_BLK_DEV_LOOP) || defined(CONFIG_BLK_DEV_LOOP_MODULE)
-#include <linux/loop.h>
-static int is_overlap_loopback(struct super_block *sb, struct dentry *hidden_d1,
-			       struct dentry *hidden_d2)
-{
-	struct inode *hidden_inode;
-	struct loop_device *l;
-
-	hidden_inode = hidden_d1->d_inode;
-	if (MAJOR(hidden_inode->i_sb->s_dev) != LOOP_MAJOR)
-		return 0;
-
-	l = hidden_inode->i_sb->s_bdev->bd_disk->private_data;
-	hidden_d1 = l->lo_backing_file->f_dentry;
-	if (unlikely(hidden_d1->d_sb == sb))
-		return 1;
-	return do_is_overlap(sb, hidden_d1, hidden_d2);
-}
-#else
-#define is_overlap_loopback(sb, hidden_d1, hidden_d2) 0
-#endif
-
-static int is_overlap(struct super_block *sb, struct dentry *hidden_d1,
-		      struct dentry *hidden_d2)
-{
-	LKTRTrace("d1 %.*s, d2 %.*s\n", DLNPair(hidden_d1), DLNPair(hidden_d2));
-	if (unlikely(hidden_d1 == hidden_d2))
-		return 1;
-	return do_is_overlap(sb, hidden_d1, hidden_d2)
-		|| do_is_overlap(sb, hidden_d2, hidden_d1)
-		|| is_overlap_loopback(sb, hidden_d1, hidden_d2)
-		|| is_overlap_loopback(sb, hidden_d2, hidden_d1);
-}
-
-/* ---------------------------------------------------------------------- */
-
-static int init_br_wh(struct super_block *sb, aufs_bindex_t bindex,
-		      struct aufs_branch *br, int new_perm,
-		      struct dentry *h_root, struct vfsmount *h_mnt)
-{
-	int err, old_perm;
-	struct inode *dir = sb->s_root->d_inode,
-		*h_dir = h_root->d_inode;
-	const int new = (bindex < 0);
-
-	LKTRTrace("b%d, new_perm %d\n", bindex, new_perm);
-
-	if (new)
-		hi_lock_parent(h_dir);
-	else
-		hdir_lock(h_dir, dir, bindex);
-
-	br_wh_write_lock(br);
-	old_perm = br->br_perm;
-	br->br_perm = new_perm;
-	err = init_wh(h_root, br, au_do_nfsmnt(h_mnt), sb);
-	br->br_perm = old_perm;
-	br_wh_write_unlock(br);
-
-	if (new)
-		i_unlock(h_dir);
-	else
-		hdir_unlock(h_dir, dir, bindex);
-
-	TraceErr(err);
-	return err;
-}
-
-/* ---------------------------------------------------------------------- */
-
-/*
- * returns a newly allocated branch. @new_nbranch is a number of branches
- * after adding a branch.
- */
-static struct aufs_branch *alloc_addbr(struct super_block *sb, int new_nbranch)
-{
-	struct aufs_branch **branchp, *add_branch;
-	int sz;
-	void *p;
-	struct dentry *root;
-	struct inode *inode;
-	struct aufs_hinode *hinodep;
-	struct aufs_hdentry *hdentryp;
-
-	LKTRTrace("new_nbranch %d\n", new_nbranch);
-	SiMustWriteLock(sb);
-	root = sb->s_root;
-	DiMustWriteLock(root);
-	inode = root->d_inode;
-	IiMustWriteLock(inode);
-
-	add_branch = kmalloc(sizeof(*add_branch), GFP_KERNEL);
-	//if (LktrCond) {kfree(add_branch); add_branch = NULL;}
-	if (unlikely(!add_branch))
-		goto out;
-
-	sz = sizeof(*branchp) * (new_nbranch - 1);
-	if (unlikely(!sz))
-		sz = sizeof(*branchp);
-	p = stosi(sb)->si_branch;
-	branchp = au_kzrealloc(p, sz, sizeof(*branchp) * new_nbranch,
-			       GFP_KERNEL);
-	//if (LktrCond) branchp = NULL;
-	if (unlikely(!branchp))
-		goto out;
-	stosi(sb)->si_branch = branchp;
-
-	sz = sizeof(*hdentryp) * (new_nbranch - 1);
-	if (unlikely(!sz))
-		sz = sizeof(*hdentryp);
-	p = dtodi(root)->di_hdentry;
-	hdentryp = au_kzrealloc(p, sz, sizeof(*hdentryp) * new_nbranch,
-				GFP_KERNEL);
-	//if (LktrCond) hdentryp = NULL;
-	if (unlikely(!hdentryp))
-		goto out;
-	dtodi(root)->di_hdentry = hdentryp;
-
-	sz = sizeof(*hinodep) * (new_nbranch - 1);
-	if (unlikely(!sz))
-		sz = sizeof(*hinodep);
-	p = itoii(inode)->ii_hinode;
-	hinodep = au_kzrealloc(p, sz, sizeof(*hinodep) * new_nbranch,
-			       GFP_KERNEL);
-	//if (LktrCond) hinodep = NULL; // unavailable test
-	if (unlikely(!hinodep))
-		goto out;
-	itoii(inode)->ii_hinode = hinodep;
-	return add_branch; /* success */
-
- out:
-	kfree(add_branch);
-	TraceErr(-ENOMEM);
-	return ERR_PTR(-ENOMEM);
-}
-
-/*
- * test if the branch permission is legal or not.
- */
-static int test_br(struct super_block *sb, struct inode *inode, int brperm,
-		   char *path)
-{
-	int err;
-
-	err = 0;
-	if (unlikely(br_writable(brperm) && IS_RDONLY(inode))) {
-		Err("write permission for readonly fs or inode, %s\n", path);
-		err = -EINVAL;
-	}
-
-	TraceErr(err);
-	return err;
-}
-
-/*
- * retunrs,,,
- * 0: success, the caller will add it
- * plus: success, it is already unified, the caller should ignore it
- * minus: error
- */
-static int test_add(struct super_block *sb, struct opt_add *add, int remount)
-{
-	int err;
-	struct dentry *root;
-	struct inode *inode, *hidden_inode;
-	aufs_bindex_t bend, bindex;
-
-	LKTRTrace("%s, remo%d\n", add->path, remount);
-
-	root = sb->s_root;
-	if (unlikely(au_find_dbindex(root, add->nd.dentry) != -1)) {
-		err = 1;
-		if (!remount) {
-			err = -EINVAL;
-			Err("%s duplicated\n", add->path);
-		}
-		goto out;
-	}
-
-	err = -ENOSPC; //-E2BIG;
-	bend = sbend(sb);
-	//if (LktrCond) bend = AUFS_BRANCH_MAX;
-	if (unlikely(AUFS_BRANCH_MAX <= add->bindex
-		     || AUFS_BRANCH_MAX - 1 <= bend)) {
-		Err("number of branches exceeded %s\n", add->path);
-		goto out;
-	}
-
-	err = -EDOM;
-	if (unlikely(add->bindex < 0 || bend + 1 < add->bindex)) {
-		Err("bad index %d\n", add->bindex);
-		goto out;
-	}
-
-	inode = add->nd.dentry->d_inode;
-	AuDebugOn(!inode || !S_ISDIR(inode->i_mode));
-	err = -ENOENT;
-	if (unlikely(!inode->i_nlink)) {
-		Err("no existence %s\n", add->path);
-		goto out;
-	}
-
-	err = -EINVAL;
-	if (unlikely(inode->i_sb == sb)) {
-		Err("%s must be outside\n", add->path);
-		goto out;
-	}
-
-#if 1 //ndef CONFIG_AUFS_ROBR
-	if (unlikely(au_is_aufs(inode->i_sb)
-		     || !strcmp(au_sbtype(inode->i_sb), "unionfs"))) {
-		Err("nested " AUFS_NAME " %s\n", add->path);
-		goto out;
-	}
-#endif
-
-#ifdef AuNoNfsBranch
-	if (unlikely(au_is_nfs(inode->i_sb))) {
-		Err(AuNoNfsBranchMsg ". %s\n", add->path);
-		goto out;
-	}
-#endif
-
-	err = test_br(sb, add->nd.dentry->d_inode, add->perm, add->path);
-	if (unlikely(err))
-		goto out;
-
-	if (unlikely(bend == -1))
-		return 0; /* success */
-
-	hidden_inode = au_h_dptr(root)->d_inode;
-	if (unlikely(au_flag_test(sb, AuFlag_WARN_PERM)
-		     && ((hidden_inode->i_mode & S_IALLUGO)
-			 != (inode->i_mode & S_IALLUGO)
-			 || hidden_inode->i_uid != inode->i_uid
-			 || hidden_inode->i_gid != inode->i_gid)))
-		Warn("uid/gid/perm %s %u/%u/0%o, %u/%u/0%o\n",
-		     add->path,
-		     inode->i_uid, inode->i_gid, (inode->i_mode & S_IALLUGO),
-		     hidden_inode->i_uid, hidden_inode->i_gid,
-		     (hidden_inode->i_mode & S_IALLUGO));
-
-	err = -EINVAL;
-	for (bindex = 0; bindex <= bend; bindex++)
-		if (unlikely(is_overlap(sb, add->nd.dentry,
-					au_h_dptr_i(root, bindex)))) {
-			Err("%s is overlapped\n", add->path);
-			goto out;
-		}
-	err = 0;
-
- out:
-	TraceErr(err);
-	return err;
-}
-
-int br_add(struct super_block *sb, struct opt_add *add, int remount)
-{
-	int err, sz;
-	aufs_bindex_t bend, add_bindex;
-	struct dentry *root;
-	struct aufs_iinfo *iinfo;
-	struct aufs_sbinfo *sbinfo;
-	struct aufs_dinfo *dinfo;
-	struct inode *root_inode;
-	unsigned long long maxb;
-	struct aufs_branch **branchp, *add_branch;
-	struct aufs_hdentry *hdentryp;
-	struct aufs_hinode *hinodep;
-
-	LKTRTrace("b%d, %s, 0x%x, %.*s\n", add->bindex, add->path,
-		  add->perm, DLNPair(add->nd.dentry));
-	SiMustWriteLock(sb);
-	root = sb->s_root;
-	DiMustWriteLock(root);
-	root_inode = root->d_inode;
-	IMustLock(root_inode);
-	IiMustWriteLock(root_inode);
-
-	err = test_add(sb, add, remount);
-	if (unlikely(err < 0))
-		goto out;
-	if (unlikely(err))
-		return 0; /* success */
-
-	bend = sbend(sb);
-	add_branch = alloc_addbr(sb, bend + 2);
-	err = PTR_ERR(add_branch);
-	if (IS_ERR(add_branch))
-		goto out;
-
-	err = 0;
-	rw_init_nolock(&add_branch->br_wh_rwsem);
-	add_branch->br_wh = add_branch->br_plink = NULL;
-	if (unlikely(br_writable(add->perm))) {
-		err = init_br_wh(sb, /*bindex*/-1, add_branch, add->perm,
-				 add->nd.dentry, add->nd.mnt);
-		if (unlikely(err)) {
-			kfree(add_branch);
-			goto out;
-		}
-	}
-	add_branch->br_xino = NULL;
-	add_branch->br_mnt = mntget(add->nd.mnt);
-	atomic_set(&add_branch->br_wh_running, 0);
-	add_branch->br_id = new_br_id(sb);
-	add_branch->br_perm = add->perm;
-	atomic_set(&add_branch->br_count, 0);
-
-	sbinfo = stosi(sb);
-	dinfo = dtodi(root);
-	iinfo = itoii(root_inode);
-
-	add_bindex = add->bindex;
-	sz = sizeof(*(sbinfo->si_branch)) * (bend + 1 - add_bindex);
-	branchp = sbinfo->si_branch + add_bindex;
-	memmove(branchp + 1, branchp, sz);
-	*branchp = add_branch;
-	sz = sizeof(*hdentryp) * (bend + 1 - add_bindex);
-	hdentryp = dinfo->di_hdentry + add_bindex;
-	memmove(hdentryp + 1, hdentryp, sz);
-	hdentryp->hd_dentry = NULL;
-	sz = sizeof(*hinodep) * (bend + 1 - add_bindex);
-	hinodep = iinfo->ii_hinode + add_bindex;
-	memmove(hinodep + 1, hinodep, sz);
-	hinodep->hi_inode = NULL;
-	hinodep->hi_notify = NULL;
-
-	sbinfo->si_bend++;
-	dinfo->di_bend++;
-	iinfo->ii_bend++;
-	if (unlikely(bend == -1)) {
-		dinfo->di_bstart = 0;
-		iinfo->ii_bstart = 0;
-	}
-	set_h_dptr(root, add_bindex, dget(add->nd.dentry));
-	set_h_iptr(root_inode, add_bindex, igrab(add->nd.dentry->d_inode), 0);
-	if (!add_bindex)
-		au_cpup_attr_all(root_inode);
-	else
-		au_add_nlink(root_inode, add->nd.dentry->d_inode);
-	maxb = add->nd.dentry->d_sb->s_maxbytes;
-	if (sb->s_maxbytes < maxb)
-		sb->s_maxbytes = maxb;
-
-	if (au_flag_test(sb, AuFlag_XINO)) {
-		struct file *base_file = stobr(sb, 0)->br_xino;
-		if (!add_bindex)
-			base_file = stobr(sb, 1)->br_xino;
-		err = xino_init(sb, add_bindex, base_file, /*do_test*/1);
-		if (unlikely(err)) {
-			AuDebugOn(add_branch->br_xino);
-			Err("ignored xino err %d, force noxino\n", err);
-			err = 0;
-			au_flag_clr(sb, AuFlag_XINO);
-		}
-	}
-
- out:
-	TraceErr(err);
-	return err;
-}
-
-/* ---------------------------------------------------------------------- */
-
-/*
- * test if the branch is deletable or not.
- */
-static int test_children_busy(struct dentry *root, aufs_bindex_t bindex)
-{
-	int err, i, j, ndentry, sigen;
-	struct au_dcsub_pages dpages;
-
-	LKTRTrace("b%d\n", bindex);
-	SiMustWriteLock(root->d_sb);
-	DiMustWriteLock(root);
-
-	err = au_dpages_init(&dpages, GFP_KERNEL);
-	if (unlikely(err))
-		goto out;
-	err = au_dcsub_pages(&dpages, root, NULL, NULL);
-	if (unlikely(err))
-		goto out_dpages;
-
-	sigen = au_sigen(root->d_sb);
-	DiMustNoWaiters(root);
-	IiMustNoWaiters(root->d_inode);
-	di_write_unlock(root);
-	for (i = 0; !err && i < dpages.ndpage; i++) {
-		struct au_dpage *dpage;
-		dpage = dpages.dpages + i;
-		ndentry = dpage->ndentry;
-		for (j = 0; !err && j < ndentry; j++) {
-			struct dentry *d;
-
-			d = dpage->dentries[j];
-			if (au_digen(d) == sigen)
-				di_read_lock_child(d, AUFS_I_RLOCK);
-			else {
-				di_write_lock_child(d);
-				err = au_reval_dpath(d, sigen);
-				if (!err)
-					di_downgrade_lock(d, AUFS_I_RLOCK);
-				else {
-					di_write_unlock(d);
-					break;
-				}
-			}
-
-			if (au_h_dptr_i(d, bindex)
-			    && (!S_ISDIR(d->d_inode->i_mode)
-				|| dbstart(d) == dbend(d)))
-				err = -EBUSY;
-			di_read_unlock(d, AUFS_I_RLOCK);
-			if (err)
-				LKTRTrace("%.*s\n", DLNPair(d));
-		}
-	}
-	di_write_lock_child(root); /* aufs_write_lock() calls ..._child() */
-
- out_dpages:
-	au_dpages_free(&dpages);
- out:
-	TraceErr(err);
-	return err;
-}
-
-int br_del(struct super_block *sb, struct opt_del *del, int remount)
-{
-	int err, do_wh, rerr;
-	struct dentry *root;
-	struct inode *inode, *hidden_dir;
-	aufs_bindex_t bindex, bend, br_id;
-	struct aufs_sbinfo *sbinfo;
-	struct aufs_dinfo *dinfo;
-	struct aufs_iinfo *iinfo;
-	struct aufs_branch *br;
-
-	LKTRTrace("%s, %.*s\n", del->path, DLNPair(del->h_root));
-	SiMustWriteLock(sb);
-	root = sb->s_root;
-	DiMustWriteLock(root);
-	inode = root->d_inode;
-	IiMustWriteLock(inode);
-
-	bindex = au_find_dbindex(root, del->h_root);
-	if (unlikely(bindex < 0)) {
-		if (remount)
-			return 0; /* success */
-		err = -ENOENT;
-		Err("%s no such branch\n", del->path);
-		goto out;
-	}
-	LKTRTrace("bindex b%d\n", bindex);
-
-	err = -EBUSY;
-	bend = sbend(sb);
-	br = stobr(sb, bindex);
-	if (unlikely(!bend || br_count(br))) {
-		LKTRTrace("bend %d, br_count %d\n", bend, br_count(br));
-		goto out;
-	}
-
-	do_wh = 0;
-	hidden_dir = del->h_root->d_inode;
-	if (unlikely(br->br_wh || br->br_plink)) {
-#if 0
-		/* remove whiteout base */
-		err = init_br_wh(sb, bindex, br, AuBr_RO, del->h_root,
-				 br->br_mnt);
-		if (unlikely(err))
-			goto out;
-#else
-		dput(br->br_wh);
-		dput(br->br_plink);
-		br->br_wh = br->br_plink = NULL;
-#endif
-		do_wh = 1;
-	}
-
-	err = test_children_busy(root, bindex);
-	if (unlikely(err)) {
-		if (unlikely(do_wh))
-			goto out_wh;
-		goto out;
-	}
-
-	err = 0;
-	sbinfo = stosi(sb);
-	dinfo = dtodi(root);
-	iinfo = itoii(inode);
-
-	dput(au_h_dptr_i(root, bindex));
-	aufs_hiput(iinfo->ii_hinode + bindex);
-	br_id = br->br_id;
-	free_branch(br);
-
-	//todo: realloc and shrink memeory
-	if (bindex < bend) {
-		const aufs_bindex_t n = bend - bindex;
-		struct aufs_branch **brp;
-		struct aufs_hdentry *hdp;
-		struct aufs_hinode *hip;
-
-		brp = sbinfo->si_branch + bindex;
-		memmove(brp, brp + 1, sizeof(*brp) * n);
-		hdp = dinfo->di_hdentry + bindex;
-		memmove(hdp, hdp + 1, sizeof(*hdp) * n);
-		hip = iinfo->ii_hinode + bindex;
-		memmove(hip, hip + 1, sizeof(*hip) * n);
-	}
-	sbinfo->si_branch[0 + bend] = NULL;
-	dinfo->di_hdentry[0 + bend].hd_dentry = NULL;
-	iinfo->ii_hinode[0 + bend].hi_inode = NULL;
-	iinfo->ii_hinode[0 + bend].hi_notify = NULL;
-
-	sbinfo->si_bend--;
-	dinfo->di_bend--;
-	iinfo->ii_bend--;
-	if (!bindex)
-		au_cpup_attr_all(inode);
-	else
-		au_sub_nlink(inode, del->h_root->d_inode);
-	if (au_flag_test(sb, AuFlag_PLINK))
-		half_refresh_plink(sb, br_id);
-
-	if (sb->s_maxbytes == del->h_root->d_sb->s_maxbytes) {
-		bend--;
-		sb->s_maxbytes = 0;
-		for (bindex = 0; bindex <= bend; bindex++) {
-			unsigned long long maxb;
-			maxb = sbr_sb(sb, bindex)->s_maxbytes;
-			if (sb->s_maxbytes < maxb)
-				sb->s_maxbytes = maxb;
-		}
-	}
-	goto out; /* success */
-
- out_wh:
-	/* revert */
-	rerr = init_br_wh(sb, bindex, br, br->br_perm, del->h_root, br->br_mnt);
-	if (rerr)
-		Warn("failed re-creating base whiteout, %s. (%d)\n",
-		     del->path, rerr);
- out:
-	TraceErr(err);
-	return err;
-}
-
-static int do_need_sigen_inc(int a, int b)
-{
-	return (br_whable(a) && !br_whable(b));
-}
-
-static int need_sigen_inc(int old, int new)
-{
-	return (do_need_sigen_inc(old, new)
-		|| do_need_sigen_inc(new, old));
-}
-
-int br_mod(struct super_block *sb, struct opt_mod *mod, int remount,
-	   int *do_update)
-{
-	int err;
-	struct dentry *root;
-	aufs_bindex_t bindex;
-	struct aufs_branch *br;
-	struct inode *hidden_dir;
-
-	LKTRTrace("%s, %.*s, 0x%x\n",
-		  mod->path, DLNPair(mod->h_root), mod->perm);
-	SiMustWriteLock(sb);
-	root = sb->s_root;
-	DiMustWriteLock(root);
-	IiMustWriteLock(root->d_inode);
-
-	bindex = au_find_dbindex(root, mod->h_root);
-	if (unlikely(bindex < 0)) {
-		if (remount)
-			return 0; /* success */
-		err = -ENOENT;
-		Err("%s no such branch\n", mod->path);
-		goto out;
-	}
-	LKTRTrace("bindex b%d\n", bindex);
-
-	hidden_dir = mod->h_root->d_inode;
-	err = test_br(sb, hidden_dir, mod->perm, mod->path);
-	if (unlikely(err))
-		goto out;
-
-	br = stobr(sb, bindex);
-	if (unlikely(br->br_perm == mod->perm))
-		return 0; /* success */
-
-	if (br_writable(br->br_perm)) {
-#if 1
-		/* remove whiteout base */
-		//todo: mod->perm?
-		err = init_br_wh(sb, bindex, br, AuBr_RO, mod->h_root,
-				 br->br_mnt);
-		if (unlikely(err))
-			goto out;
-#else
-		dput(br->br_wh);
-		dput(br->br_plink);
-		br->br_wh = br->br_plink = NULL;
-#endif
-
-		if (!br_writable(mod->perm)) {
-			/* rw --> ro, file might be mmapped */
-			struct file *file, *hf;
-
-#if 1 // test here
-			DiMustNoWaiters(root);
-			IiMustNoWaiters(root->d_inode);
-			di_write_unlock(root);
-
-			// no need file_list_lock() since sbinfo is locked
-			//file_list_lock();
-			list_for_each_entry(file, &sb->s_files, f_u.fu_list) {
-				LKTRTrace("%.*s\n", DLNPair(file->f_dentry));
-				fi_read_lock(file);
-				if (!S_ISREG(file->f_dentry->d_inode->i_mode)
-				    || !(file->f_mode & FMODE_WRITE)
-				    || fbstart(file) != bindex) {
-					FiMustNoWaiters(file);
-					fi_read_unlock(file);
-					continue;
-				}
-
-				// todo: already flushed?
-				hf = au_h_fptr(file);
-				hf->f_flags = au_file_roflags(hf->f_flags);
-				hf->f_mode &= ~FMODE_WRITE;
-				FiMustNoWaiters(file);
-				fi_read_unlock(file);
-			}
-			//file_list_unlock();
-
-			/* aufs_write_lock() calls ..._child() */
-			di_write_lock_child(root);
-#endif
-		}
-	}
-
-	*do_update |= need_sigen_inc(br->br_perm, mod->perm);
-	br->br_perm = mod->perm;
-	return err; /* success */
-
- out:
-	TraceErr(err);
-	return err;
-}
diff -ruN -X X hnd-linux-trunk/fs/aufs/branch.h hnd-cleanup/fs/aufs/branch.h
--- hnd-linux-trunk/fs/aufs/branch.h	2007-09-17 22:43:40.000000000 +0400
+++ hnd-cleanup/fs/aufs/branch.h	1970-01-01 03:00:00.000000000 +0300
@@ -1,235 +0,0 @@
-/*
- * Copyright (C) 2005, 2006, 2007 Junjiro Okajima
- *
- * This program, aufs is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- */
-
-/* $Id: branch.h,v 1.30 2007/05/14 03:41:51 sfjro Exp $ */
-
-#ifndef __AUFS_BRANCH_H__
-#define __AUFS_BRANCH_H__
-
-#ifdef __KERNEL__
-
-#include <linux/fs.h>
-#include <linux/mount.h>
-#include <linux/version.h>
-#include <linux/aufs_type.h>
-#include "misc.h"
-#include "super.h"
-
-/* protected by superblock rwsem */
-struct aufs_branch {
-	struct file		*br_xino;
-	readf_t			br_xino_read;
-	writef_t		br_xino_write;
-
-	aufs_bindex_t		br_id;
-
-	int			br_perm;
-	struct vfsmount		*br_mnt;
-	atomic_t		br_count;
-
-	/* whiteout base */
-	struct aufs_rwsem	br_wh_rwsem;
-	struct dentry		*br_wh;
-	atomic_t 		br_wh_running;
-
-	/* pseudo-link dir */
-	struct dentry		*br_plink;
-};
-
-/* ---------------------------------------------------------------------- */
-
-/* branch permission and attribute */
-enum {
-	AuBr_RW,		/* writable, linkable wh */
-	AuBr_RO,		/* readonly, no wh */
-	AuBr_RR,		/* natively readonly, no wh */
-
-	AuBr_RWNoLinkWH,	/* un-linkable whiteouts */
-
-	AuBr_ROWH,
-	AuBr_RRWH,		/* whiteout-able */
-
-	AuBr_Last
-};
-
-static inline int br_writable(int brperm)
-{
-	return (brperm == AuBr_RW
-		|| brperm == AuBr_RWNoLinkWH);
-}
-
-static inline int br_whable(int brperm)
-{
-	return (brperm == AuBr_RW
-		|| brperm == AuBr_ROWH
-		|| brperm == AuBr_RRWH);
-}
-
-static inline int br_linkable_wh(int brperm)
-{
-	return (brperm == AuBr_RW);
-}
-
-/* ---------------------------------------------------------------------- */
-
-#define _AuNoNfsBranchMsg "NFS branch is not supported"
-#if LINUX_VERSION_CODE == KERNEL_VERSION(2,6,15)
-#define AuNoNfsBranch
-#define AuNoNfsBranchMsg _AuNoNfsBranchMsg
-#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19) \
-	&& !defined(CONFIG_AUFS_LHASH_PATCH)
-#define AuNoNfsBranch
-#define AuNoNfsBranchMsg _AuNoNfsBranchMsg \
-	", try lhash.patch and CONFIG_AUFS_LHASH_PATCH"
-#endif
-
-/* ---------------------------------------------------------------------- */
-
-struct aufs_sbinfo;
-void free_branches(struct aufs_sbinfo *sinfo);
-int br_rdonly(struct aufs_branch *br);
-int find_brindex(struct super_block *sb, aufs_bindex_t br_id);
-int find_rw_br(struct super_block *sb, aufs_bindex_t bend);
-int find_rw_parent_br(struct dentry *dentry, aufs_bindex_t bend);
-struct opt_add;
-int br_add(struct super_block *sb, struct opt_add *add, int remount);
-struct opt_del;
-int br_del(struct super_block *sb, struct opt_del *del, int remount);
-struct opt_mod;
-int br_mod(struct super_block *sb, struct opt_mod *mod, int remount,
-	   int *do_update);
-
-/* ---------------------------------------------------------------------- */
-
-static inline int br_count(struct aufs_branch *br)
-{
-	return atomic_read(&br->br_count);
-}
-
-static inline void br_get(struct aufs_branch *br)
-{
-	atomic_inc(&br->br_count);
-}
-
-static inline void br_put(struct aufs_branch *br)
-{
-	atomic_dec(&br->br_count);
-}
-
-/* ---------------------------------------------------------------------- */
-
-/* Superblock to branch */
-static inline aufs_bindex_t sbr_id(struct super_block *sb, aufs_bindex_t bindex)
-{
-	return stobr(sb, bindex)->br_id;
-}
-
-static inline
-struct vfsmount *sbr_mnt(struct super_block *sb, aufs_bindex_t bindex)
-{
-	return stobr(sb, bindex)->br_mnt;
-}
-
-static inline
-struct super_block *sbr_sb(struct super_block *sb, aufs_bindex_t bindex)
-{
-	return sbr_mnt(sb, bindex)->mnt_sb;
-}
-
-#if 0
-static inline int sbr_count(struct super_block *sb, aufs_bindex_t bindex)
-{
-	return br_count(stobr(sb, bindex));
-}
-
-static inline void sbr_get(struct super_block *sb, aufs_bindex_t bindex)
-{
-	br_get(stobr(sb, bindex));
-}
-#endif
-
-static inline void sbr_put(struct super_block *sb, aufs_bindex_t bindex)
-{
-	br_put(stobr(sb, bindex));
-}
-
-static inline int sbr_perm(struct super_block *sb, aufs_bindex_t bindex)
-{
-	return stobr(sb, bindex)->br_perm;
-}
-
-static inline int sbr_is_whable(struct super_block *sb, aufs_bindex_t bindex)
-{
-	return br_whable(sbr_perm(sb, bindex));
-}
-
-/* ---------------------------------------------------------------------- */
-
-#ifdef CONFIG_AUFS_LHASH_PATCH
-static inline struct vfsmount *au_do_nfsmnt(struct vfsmount *h_mnt)
-{
-	if (!au_is_nfs(h_mnt->mnt_sb))
-		return NULL;
-	return h_mnt;
-}
-
-/* it doesn't mntget() */
-static inline
-struct vfsmount *au_nfsmnt(struct super_block *sb, aufs_bindex_t bindex)
-{
-	return au_do_nfsmnt(sbr_mnt(sb, bindex));
-}
-#else
-static inline struct vfsmount *au_do_nfsmnt(struct vfsmount *h_mnt)
-{
-	return NULL;
-}
-
-static inline
-struct vfsmount *au_nfsmnt(struct super_block *sb, aufs_bindex_t bindex)
-{
-	return NULL;
-}
-#endif /* CONFIG_AUFS_LHASH_PATCH */
-
-/* ---------------------------------------------------------------------- */
-
-/*
- * br_wh_read_lock, br_wh_write_lock
- * br_wh_read_unlock, br_wh_write_unlock, br_wh_downgrade_lock
- */
-SimpleRwsemFuncs(br_wh, struct aufs_branch *br, br->br_wh_rwsem);
-
-/* to debug easier, do not make them inlined functions */
-#define BrWhMustReadLock(br) do { \
-	/* SiMustAnyLock(sb); */ \
-	RwMustReadLock(&(br)->br_wh_rwsem); \
-} while (0)
-
-#define BrWhMustWriteLock(br) do { \
-	/* SiMustAnyLock(sb); */ \
-	RwMustWriteLock(&(br)->br_wh_rwsem); \
-} while (0)
-
-#define BrWhMustAnyLock(br) do { \
-	/* SiMustAnyLock(sb); */ \
-	RwMustAnyLock(&(br)->br_wh_rwsem); \
-} while (0)
-
-#endif /* __KERNEL__ */
-#endif /* __AUFS_BRANCH_H__ */
diff -ruN -X X hnd-linux-trunk/fs/aufs/cpup.c hnd-cleanup/fs/aufs/cpup.c
--- hnd-linux-trunk/fs/aufs/cpup.c	2007-09-17 22:43:40.000000000 +0400
+++ hnd-cleanup/fs/aufs/cpup.c	1970-01-01 03:00:00.000000000 +0300
@@ -1,772 +0,0 @@
-/*
- * Copyright (C) 2005, 2006, 2007 Junjiro Okajima
- *
- * This program, aufs is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- */
-
-/* $Id: cpup.c,v 1.40 2007/06/04 02:17:34 sfjro Exp $ */
-
-#include <asm/uaccess.h>
-#include "aufs.h"
-
-/* violent cpup_attr_*() functions don't care inode lock */
-void au_cpup_attr_timesizes(struct inode *inode)
-{
-	struct inode *hidden_inode;
-
-	LKTRTrace("i%lu\n", inode->i_ino);
-	//IMustLock(inode);
-	hidden_inode = au_h_iptr(inode);
-	AuDebugOn(!hidden_inode);
-	//IMustLock(!hidden_inode);
-
-	inode->i_atime = hidden_inode->i_atime;
-	inode->i_mtime = hidden_inode->i_mtime;
-	inode->i_ctime = hidden_inode->i_ctime;
-	spin_lock(&inode->i_lock);
-	i_size_write(inode, i_size_read(hidden_inode));
-	inode->i_blocks = hidden_inode->i_blocks;
-	spin_unlock(&inode->i_lock);
-}
-
-void au_cpup_attr_nlink(struct inode *inode)
-{
-	struct inode *h_inode;
-
-	LKTRTrace("i%lu\n", inode->i_ino);
-	//IMustLock(inode);
-	AuDebugOn(!inode->i_mode);
-
-	h_inode = au_h_iptr(inode);
-	inode->i_nlink = h_inode->i_nlink;
-
-	/*
-	 * fewer nlink makes find(1) noisy, but larger nlink doesn't.
-	 * it may includes whplink directory.
-	 */
-	if (unlikely(S_ISDIR(h_inode->i_mode))) {
-		aufs_bindex_t bindex, bend;
-		bend = ibend(inode);
-		for (bindex = ibstart(inode) + 1; bindex <= bend; bindex++) {
-			h_inode = au_h_iptr_i(inode, bindex);
-			if (h_inode)
-				au_add_nlink(inode, h_inode);
-		}
-	}
-}
-
-void au_cpup_attr_changable(struct inode *inode)
-{
-	struct inode *hidden_inode;
-
-	LKTRTrace("i%lu\n", inode->i_ino);
-	//IMustLock(inode);
-	hidden_inode = au_h_iptr(inode);
-	AuDebugOn(!hidden_inode);
-
-	inode->i_mode = hidden_inode->i_mode;
-	inode->i_uid = hidden_inode->i_uid;
-	inode->i_gid = hidden_inode->i_gid;
-	au_cpup_attr_timesizes(inode);
-
-	//??
-	inode->i_flags = hidden_inode->i_flags;
-}
-
-void au_cpup_igen(struct inode *inode, struct inode *h_inode)
-{
-	inode->i_generation = h_inode->i_generation;
-	itoii(inode)->ii_hsb1 = h_inode->i_sb;
-}
-
-void au_cpup_attr_all(struct inode *inode)
-{
-	struct inode *hidden_inode;
-
-	LKTRTrace("i%lu\n", inode->i_ino);
-	//IMustLock(inode);
-	hidden_inode = au_h_iptr(inode);
-	AuDebugOn(!hidden_inode);
-
-	au_cpup_attr_changable(inode);
-	if (inode->i_nlink > 0)
-		au_cpup_attr_nlink(inode);
-
-	switch (inode->i_mode & S_IFMT) {
-	case S_IFBLK:
-	case S_IFCHR:
-		inode->i_rdev = hidden_inode->i_rdev;
-	}
-	inode->i_blkbits = hidden_inode->i_blkbits;
-	au_cpup_attr_blksize(inode, hidden_inode);
-	au_cpup_igen(inode, hidden_inode);
-}
-
-/* ---------------------------------------------------------------------- */
-
-/* Note: dt_dentry and dt_hidden_dentry are not dget/dput-ed */
-
-/* keep the timestamps of the parent dir when cpup */
-void dtime_store(struct dtime *dt, struct dentry *dentry,
-		 struct dentry *hidden_dentry)
-{
-	struct inode *inode;
-
-	TraceEnter();
-	AuDebugOn(!dentry || !hidden_dentry || !hidden_dentry->d_inode);
-
-	dt->dt_dentry = dentry;
-	dt->dt_h_dentry = hidden_dentry;
-	inode = hidden_dentry->d_inode;
-	dt->dt_atime = inode->i_atime;
-	dt->dt_mtime = inode->i_mtime;
-	//smp_mb();
-}
-
-// todo: remove extra parameter
-void dtime_revert(struct dtime *dt, int h_parent_is_locked)
-{
-	struct iattr attr;
-	int err;
-	struct dentry *dentry;
-
-	LKTRTrace("h_parent locked %d\n", h_parent_is_locked);
-
-	attr.ia_atime = dt->dt_atime;
-	attr.ia_mtime = dt->dt_mtime;
-	attr.ia_valid = ATTR_FORCE | ATTR_MTIME | ATTR_MTIME_SET
-		| ATTR_ATIME | ATTR_ATIME_SET;
-	//smp_mb();
-	dentry = NULL;
-	if (!h_parent_is_locked /* && !IS_ROOT(dt->dt_dentry) */)
-		dentry = dt->dt_dentry;
-	err = vfsub_notify_change(dt->dt_h_dentry, &attr,
-				  need_dlgt(dt->dt_dentry->d_sb));
-	if (unlikely(err))
-		Warn("restoring timestamps failed(%d). ignored\n", err);
-}
-
-/* ---------------------------------------------------------------------- */
-
-static int cpup_iattr(struct dentry *hidden_dst, struct dentry *hidden_src,
-		      int dlgt)
-{
-	int err;
-	struct iattr ia;
-	struct inode *hidden_isrc, *hidden_idst;
-
-	LKTRTrace("%.*s\n", DLNPair(hidden_dst));
-	hidden_idst = hidden_dst->d_inode;
-	//IMustLock(hidden_idst);
-	hidden_isrc = hidden_src->d_inode;
-	//IMustLock(hidden_isrc);
-
-	ia.ia_valid = ATTR_FORCE | ATTR_MODE | ATTR_UID | ATTR_GID
-		| ATTR_ATIME | ATTR_MTIME
-		| ATTR_ATIME_SET | ATTR_MTIME_SET;
-	ia.ia_mode = hidden_isrc->i_mode;
-	ia.ia_uid = hidden_isrc->i_uid;
-	ia.ia_gid = hidden_isrc->i_gid;
-	ia.ia_atime = hidden_isrc->i_atime;
-	ia.ia_mtime = hidden_isrc->i_mtime;
-	err = vfsub_notify_change(hidden_dst, &ia, dlgt);
-	//if (LktrCond) err = -1;
-	if (!err)
-		hidden_idst->i_flags = hidden_isrc->i_flags; //??
-
-	TraceErr(err);
-	return err;
-}
-
-/*
- * to support a sparse file which is opened with O_APPEND,
- * we need to close the file.
- */
-static int cpup_regular(struct dentry *dentry, aufs_bindex_t bdst,
-			aufs_bindex_t bsrc, loff_t len)
-{
-	int err, i, sparse;
-	struct super_block *sb;
-	struct inode *hidden_inode;
-	enum {SRC, DST};
-	struct {
-		aufs_bindex_t bindex;
-		unsigned int flags;
-		struct dentry *dentry;
-		struct file *file;
-		void *label, *label_file;
-	} *h, hidden[] = {
-		{
-			.bindex = bsrc,
-			.flags = O_RDONLY | O_NOATIME | O_LARGEFILE,
-			.file = NULL,
-			.label = &&out,
-			.label_file = &&out_src_file
-		},
-		{
-			.bindex = bdst,
-			.flags = O_WRONLY | O_NOATIME | O_LARGEFILE,
-			.file = NULL,
-			.label = &&out_src_file,
-			.label_file = &&out_dst_file
-		}
-	};
-
-	LKTRTrace("dentry %.*s, bdst %d, bsrc %d, len %lld\n",
-		  DLNPair(dentry), bdst, bsrc, len);
-	AuDebugOn(bsrc <= bdst);
-	AuDebugOn(!len);
-	sb = dentry->d_sb;
-	AuDebugOn(test_ro(sb, bdst, dentry->d_inode));
-	// bsrc branch can be ro/rw.
-
-	h = hidden;
-	for (i = 0; i < 2; i++, h++) {
-		h->dentry = au_h_dptr_i(dentry, h->bindex);
-		AuDebugOn(!h->dentry);
-		hidden_inode = h->dentry->d_inode;
-		AuDebugOn(!hidden_inode || !S_ISREG(hidden_inode->i_mode));
-		h->file = hidden_open(dentry, h->bindex, h->flags);
-		//if (LktrCond)
-		//{fput(h->file); sbr_put(sb, h->bindex); h->file = ERR_PTR(-1);}
-		err = PTR_ERR(h->file);
-		if (IS_ERR(h->file))
-			goto *h->label;
-		err = -EINVAL;
-		if (unlikely(!h->file->f_op))
-			goto *h->label_file;
-	}
-
-	/* stop updating while we copyup */
-	IMustLock(hidden[SRC].dentry->d_inode);
-	sparse = 0;
-	err = au_copy_file(hidden[DST].file, hidden[SRC].file, len, sb,
-			   &sparse);
-
-	/* sparse file: update i_blocks next time */
-	if (unlikely(!err && sparse))
-		d_drop(dentry);
-
- out_dst_file:
-	fput(hidden[DST].file);
-	sbr_put(sb, hidden[DST].bindex);
- out_src_file:
-	fput(hidden[SRC].file);
-	sbr_put(sb, hidden[SRC].bindex);
- out:
-	TraceErr(err);
-	return err;
-}
-
-// unnecessary?
-unsigned int au_flags_cpup(unsigned int init, struct dentry *parent)
-{
-	if (unlikely(parent && IS_ROOT(parent)))
-		init |= CPUP_LOCKED_GHDIR;
-	return init;
-}
-
-/* return with hidden dst inode is locked */
-static int cpup_entry(struct dentry *dentry, aufs_bindex_t bdst,
-		      aufs_bindex_t bsrc, loff_t len, unsigned int flags,
-		      int dlgt)
-{
-	int err, isdir, symlen;
-	struct dentry *hidden_src, *hidden_dst, *hidden_parent, *parent;
-	struct inode *hidden_inode, *hidden_dir, *dir;
-	struct dtime dt;
-	umode_t mode;
-	char *sym;
-	mm_segment_t old_fs;
-	const int do_dt = flags & CPUP_DTIME;
-	struct super_block *sb;
-
-	LKTRTrace("%.*s, i%lu, bdst %d, bsrc %d, len %Ld, flags 0x%x\n",
-		  DLNPair(dentry), dentry->d_inode->i_ino, bdst, bsrc, len,
-		  flags);
-	sb = dentry->d_sb;
-	AuDebugOn(bdst >= bsrc || test_ro(sb, bdst, NULL));
-	// bsrc branch can be ro/rw.
-
-	hidden_src = au_h_dptr_i(dentry, bsrc);
-	AuDebugOn(!hidden_src);
-	hidden_inode = hidden_src->d_inode;
-	AuDebugOn(!hidden_inode);
-
-	/* stop refrencing while we are creating */
-	parent = dget_parent(dentry);
-	dir = parent->d_inode;
-	hidden_dst = au_h_dptr_i(dentry, bdst);
-	AuDebugOn(hidden_dst && hidden_dst->d_inode);
-	hidden_parent = dget_parent(hidden_dst);
-	hidden_dir = hidden_parent->d_inode;
-	IMustLock(hidden_dir);
-
-	if (do_dt)
-		dtime_store(&dt, parent, hidden_parent);
-
-	isdir = 0;
-	mode = hidden_inode->i_mode;
-	switch (mode & S_IFMT) {
-	case S_IFREG:
-		/* stop updating while we are referencing */
-		IMustLock(hidden_inode);
-		err = vfsub_create(hidden_dir, hidden_dst, mode | S_IWUSR, NULL,
-				   dlgt);
-		//if (LktrCond) {vfs_unlink(hidden_dir, hidden_dst); err = -1;}
-		if (!err) {
-			loff_t l = i_size_read(hidden_inode);
-			if (len == -1 || l < len)
-				len = l;
-			if (len) {
-				err = cpup_regular(dentry, bdst, bsrc, len);
-				//if (LktrCond) err = -1;
-			}
-			if (unlikely(err)) {
-				int rerr;
-				rerr = vfsub_unlink(hidden_dir, hidden_dst,
-						    dlgt);
-				if (rerr) {
-					IOErr("failed unlinking cpup-ed %.*s"
-					      "(%d, %d)\n",
-					      DLNPair(hidden_dst), err, rerr);
-					err = -EIO;
-				}
-			}
-		}
-		break;
-	case S_IFDIR:
-		isdir = 1;
-		err = vfsub_mkdir(hidden_dir, hidden_dst, mode, dlgt);
-		//if (LktrCond) {vfs_rmdir(hidden_dir, hidden_dst); err = -1;}
-		if (!err) {
-			/* setattr case: dir is not locked */
-			if (0 && ibstart(dir) == bdst)
-				au_cpup_attr_nlink(dir);
-			au_cpup_attr_nlink(dentry->d_inode);
-		}
-		break;
-	case S_IFLNK:
-		err = -ENOMEM;
-		sym = __getname();
-		//if (LktrCond) {__putname(sym); sym = NULL;}
-		if (unlikely(!sym))
-			break;
-		old_fs = get_fs();
-		set_fs(KERNEL_DS);
-		err = symlen = hidden_inode->i_op->readlink
-			(hidden_src, (char __user*)sym, PATH_MAX);
-		//if (LktrCond) err = symlen = -1;
-		set_fs(old_fs);
-		if (symlen > 0) {
-			sym[symlen] = 0;
-			err = vfsub_symlink(hidden_dir, hidden_dst, sym, mode,
-					    dlgt);
-			//if (LktrCond)
-			//{vfs_unlink(hidden_dir, hidden_dst); err = -1;}
-		}
-		__putname(sym);
-		break;
-	case S_IFCHR:
-	case S_IFBLK:
-		AuDebugOn(!capable(CAP_MKNOD));
-		/*FALLTHROUGH*/
-	case S_IFIFO:
-	case S_IFSOCK:
-		err = vfsub_mknod(hidden_dir, hidden_dst, mode,
-				  hidden_inode->i_rdev, dlgt);
-		//if (LktrCond) {vfs_unlink(hidden_dir, hidden_dst); err = -1;}
-		break;
-	default:
-		IOErr("Unknown inode type 0%o\n", mode);
-		err = -EIO;
-	}
-
-	if (do_dt)
-		dtime_revert(&dt, flags & CPUP_LOCKED_GHDIR);
-	dput(parent);
-	dput(hidden_parent);
-	TraceErr(err);
-	return err;
-}
-
-/*
- * copyup the @dentry from @bsrc to @bdst.
- * the caller must set the both of hidden dentries.
- * @len is for trucating when it is -1 copyup the entire file.
- */
-int cpup_single(struct dentry *dentry, aufs_bindex_t bdst, aufs_bindex_t bsrc,
-		loff_t len, unsigned int flags)
-{
-	int err, rerr, isdir, dlgt;
-	struct dentry *hidden_src, *hidden_dst, *parent, *h_parent;
-	struct inode *dst_inode, *hidden_dir, *inode, *src_inode;
-	struct super_block *sb;
-	aufs_bindex_t old_ibstart;
-	struct dtime dt;
-
-	LKTRTrace("%.*s, i%lu, bdst %d, bsrc %d, len %Ld, flags 0x%x\n",
-		  DLNPair(dentry), dentry->d_inode->i_ino, bdst, bsrc, len,
-		  flags);
-	sb = dentry->d_sb;
-	AuDebugOn(bsrc <= bdst);
-	hidden_dst = au_h_dptr_i(dentry, bdst);
-	AuDebugOn(!hidden_dst || hidden_dst->d_inode);
-	h_parent = dget_parent(hidden_dst);
-	hidden_dir = h_parent->d_inode;
-	IMustLock(hidden_dir);
-	hidden_src = au_h_dptr_i(dentry, bsrc);
-	AuDebugOn(!hidden_src || !hidden_src->d_inode);
-	inode = dentry->d_inode;
-	IiMustWriteLock(inode);
-
-	dlgt = need_dlgt(sb);
-	dst_inode = au_h_iptr_i(inode, bdst);
-	if (unlikely(dst_inode)) {
-		if (unlikely(!au_flag_test(sb, AuFlag_PLINK))) {
-			err = -EIO;
-			IOErr("i%lu exists on a upper branch "
-			      "but plink is disabled\n", inode->i_ino);
-			goto out;
-		}
-
-		if (dst_inode->i_nlink) {
-			hidden_src = lkup_plink(sb, bdst, inode);
-			err = PTR_ERR(hidden_src);
-			if (IS_ERR(hidden_src))
-				goto out;
-			AuDebugOn(!hidden_src->d_inode);
-			// vfs_link() does lock the inode
-			err = vfsub_link(hidden_src, hidden_dir, hidden_dst,
-					 dlgt);
-			dput(hidden_src);
-			goto out;
-		} else
-			/* udba work */
-			au_update_brange(inode, 1);
-	}
-
-	old_ibstart = ibstart(inode);
-	err = cpup_entry(dentry, bdst, bsrc, len, flags, dlgt);
-	if (unlikely(err))
-		goto out;
-	dst_inode = hidden_dst->d_inode;
-	hi_lock_child2(dst_inode);
-
-	//todo: test dlgt
-	err = cpup_iattr(hidden_dst, hidden_src, dlgt);
-	//if (LktrCond) err = -1;
-#if 0 // xattr
-	if (0 && !err)
-		err = cpup_xattrs(hidden_src, hidden_dst);
-#endif
-	isdir = S_ISDIR(dst_inode->i_mode);
-	if (!err) {
-		if (bdst < old_ibstart)
-			set_ibstart(inode, bdst);
-		set_h_iptr(inode, bdst, igrab(dst_inode),
-			   au_hi_flags(inode, isdir));
-		i_unlock(dst_inode);
-		src_inode = hidden_src->d_inode;
-		if (!isdir) {
-			if (src_inode->i_nlink > 1
-			    && au_flag_test(sb, AuFlag_PLINK))
-				append_plink(sb, inode, hidden_dst, bdst);
-			else {
-				/* braces are added to stop a warning */
-				;//xino_write0(sb, bsrc, src_inode->i_ino);
-				/* ignore this error */
-			}
-		}
-		goto out; /* success */
-	}
-
-	/* revert */
-	i_unlock(dst_inode);
-	parent = dget_parent(dentry);
-	dtime_store(&dt, parent, h_parent);
-	dput(parent);
-	if (!isdir)
-		rerr = vfsub_unlink(hidden_dir, hidden_dst, dlgt);
-	else
-		rerr = vfsub_rmdir(hidden_dir, hidden_dst, dlgt);
-	//rerr = -1;
-	dtime_revert(&dt, flags & CPUP_LOCKED_GHDIR);
-	if (rerr) {
-		IOErr("failed removing broken entry(%d, %d)\n", err, rerr);
-		err = -EIO;
-	}
-
- out:
-	dput(h_parent);
-	TraceErr(err);
-	return err;
-}
-
-struct cpup_single_args {
-	int *errp;
-	struct dentry *dentry;
-	aufs_bindex_t bdst, bsrc;
-	loff_t len;
-	unsigned int flags;
-};
-
-static void call_cpup_single(void *args)
-{
-	struct cpup_single_args *a = args;
-	*a->errp = cpup_single(a->dentry, a->bdst, a->bsrc, a->len, a->flags);
-}
-
-int sio_cpup_single(struct dentry *dentry, aufs_bindex_t bdst,
-		    aufs_bindex_t bsrc, loff_t len, unsigned int flags)
-{
-	int err, wkq_err;
-	struct dentry *hidden_dentry;
-	umode_t mode;
-
-	LKTRTrace("%.*s, i%lu, bdst %d, bsrc %d, len %Ld, flags 0x%x\n",
-		  DLNPair(dentry), dentry->d_inode->i_ino, bdst, bsrc, len,
-		  flags);
-
-	hidden_dentry = au_h_dptr_i(dentry, bsrc);
-	mode = hidden_dentry->d_inode->i_mode & S_IFMT;
-	if ((mode != S_IFCHR && mode != S_IFBLK)
-	    || capable(CAP_MKNOD))
-		err = cpup_single(dentry, bdst, bsrc, len, flags);
-	else {
-		struct cpup_single_args args = {
-			.errp	= &err,
-			.dentry	= dentry,
-			.bdst	= bdst,
-			.bsrc	= bsrc,
-			.len	= len,
-			.flags	= flags
-		};
-		wkq_err = au_wkq_wait(call_cpup_single, &args, /*dlgt*/0);
-		if (unlikely(wkq_err))
-			err = wkq_err;
-	}
-
-	TraceErr(err);
-	return err;
-}
-
-/*
- * copyup the @dentry from the first active hidden branch to @bdst,
- * using cpup_single().
- */
-int cpup_simple(struct dentry *dentry, aufs_bindex_t bdst, loff_t len,
-		unsigned int flags)
-{
-	int err;
-	struct inode *inode;
-	aufs_bindex_t bsrc, bend;
-
-	LKTRTrace("%.*s, bdst %d, len %Ld, flags 0x%x\n",
-		  DLNPair(dentry), bdst, len, flags);
-	inode = dentry->d_inode;
-	AuDebugOn(!S_ISDIR(inode->i_mode) && dbstart(dentry) < bdst);
-
-	bend = dbend(dentry);
-	for (bsrc = bdst + 1; bsrc <= bend; bsrc++)
-		if (au_h_dptr_i(dentry, bsrc))
-			break;
-	AuDebugOn(!au_h_dptr_i(dentry, bsrc));
-
-	err = lkup_neg(dentry, bdst);
-	//err = -1;
-	if (!err) {
-		err = cpup_single(dentry, bdst, bsrc, len, flags);
-		if (!err)
-			return 0; /* success */
-
-		/* revert */
-		set_h_dptr(dentry, bdst, NULL);
-		set_dbstart(dentry, bsrc);
-	}
-
-	TraceErr(err);
-	return err;
-}
-
-struct cpup_simple_args {
-	int *errp;
-	struct dentry *dentry;
-	aufs_bindex_t bdst;
-	loff_t len;
-	unsigned int flags;
-};
-
-static void call_cpup_simple(void *args)
-{
-	struct cpup_simple_args *a = args;
-	*a->errp = cpup_simple(a->dentry, a->bdst, a->len, a->flags);
-}
-
-int sio_cpup_simple(struct dentry *dentry, aufs_bindex_t bdst, loff_t len,
-		    unsigned int flags)
-{
-	int err, do_sio, dlgt, wkq_err;
-	struct dentry *parent;
-	struct inode *hidden_dir, *dir;
-
-	LKTRTrace("%.*s, b%d, len %Ld, flags 0x%x\n",
-		  DLNPair(dentry), bdst, len, flags);
-
-	parent = dget_parent(dentry);
-	dir = parent->d_inode;
-	hidden_dir = au_h_iptr_i(dir, bdst);
-	dlgt = need_dlgt(dir->i_sb);
-	do_sio = au_test_perm(hidden_dir, MAY_EXEC | MAY_WRITE, dlgt);
-	if (!do_sio) {
-		umode_t mode = dentry->d_inode->i_mode & S_IFMT;
-		do_sio = ((mode == S_IFCHR || mode == S_IFBLK)
-			  && !capable(CAP_MKNOD));
-	}
-	if (!do_sio)
-		err = cpup_simple(dentry, bdst, len, flags);
-	else {
-		struct cpup_simple_args args = {
-			.errp	= &err,
-			.dentry	= dentry,
-			.bdst	= bdst,
-			.len	= len,
-			.flags	= flags
-		};
-		wkq_err = au_wkq_wait(call_cpup_simple, &args, /*dlgt*/0);
-		if (unlikely(wkq_err))
-			err = wkq_err;
-	}
-
-	dput(parent);
-	TraceErr(err);
-	return err;
-}
-
-//todo: dcsub
-/* cf. revalidate function in file.c */
-int cpup_dirs(struct dentry *dentry, aufs_bindex_t bdst, struct dentry *locked)
-{
-	int err;
-	struct super_block *sb;
-	struct dentry *d, *parent, *hidden_parent;
-	unsigned int udba;
-
-	LKTRTrace("%.*s, b%d, parent i%lu, locked %p\n",
-		  DLNPair(dentry), bdst, parent_ino(dentry), locked);
-	sb = dentry->d_sb;
-	AuDebugOn(test_ro(sb, bdst, NULL));
-	parent = dentry->d_parent;
-	IiMustWriteLock(parent->d_inode);
-	if (unlikely(IS_ROOT(parent)))
-		return 0;
-	if (locked) {
-		DiMustAnyLock(locked);
-		IiMustAnyLock(locked->d_inode);
-	}
-
-	/* slow loop, keep it simple and stupid */
-	err = 0;
-	udba = au_flag_test(sb, AuFlag_UDBA_INOTIFY);
-	while (1) {
-		parent = dentry->d_parent; // dget_parent()
-		hidden_parent = au_h_dptr_i(parent, bdst);
-		if (hidden_parent)
-			return 0; /* success */
-
-		/* find top dir which is needed to cpup */
-		do {
-			d = parent;
-			parent = d->d_parent; // dget_parent()
-			if (parent != locked)
-				di_read_lock_parent3(parent, !AUFS_I_RLOCK);
-			hidden_parent = au_h_dptr_i(parent, bdst);
-			if (parent != locked)
-				di_read_unlock(parent, !AUFS_I_RLOCK);
-		} while (!hidden_parent);
-
-		if (d != dentry->d_parent)
-			di_write_lock_child3(d);
-
-		/* somebody else might create while we were sleeping */
-		if (!au_h_dptr_i(d, bdst) || !au_h_dptr_i(d, bdst)->d_inode) {
-			struct inode *h_dir = hidden_parent->d_inode,
-				*dir = parent->d_inode,
-				*h_gdir, *gdir;
-
-			if (au_h_dptr_i(d, bdst))
-				au_update_dbstart(d);
-			//AuDebugOn(dbstart(d) <= bdst);
-			if (parent != locked)
-				di_read_lock_parent3(parent, AUFS_I_RLOCK);
-			h_gdir = gdir = NULL;
-			if (unlikely(udba && !IS_ROOT(parent))) {
-				gdir = parent->d_parent->d_inode;
-				h_gdir = hidden_parent->d_parent->d_inode;
-				hgdir_lock(h_gdir, gdir, bdst);
-			}
-			hdir_lock(h_dir, dir, bdst);
-			err = sio_cpup_simple(d, bdst, -1,
-					      au_flags_cpup(CPUP_DTIME,
-							    parent));
-			//if (LktrCond) err = -1;
-			hdir_unlock(h_dir, dir, bdst);
-			if (unlikely(gdir))
-				hdir_unlock(h_gdir, gdir, bdst);
-			if (parent != locked)
-				di_read_unlock(parent, AUFS_I_RLOCK);
-		}
-
-		if (d != dentry->d_parent)
-			di_write_unlock(d);
-		if (unlikely(err))
-			break;
-	}
-
-// out:
-	TraceErr(err);
-	return err;
-}
-
-int test_and_cpup_dirs(struct dentry *dentry, aufs_bindex_t bdst,
-		       struct dentry *locked)
-{
-	int err;
-	struct dentry *parent;
-	struct inode *dir;
-
-	parent = dentry->d_parent;
-	dir = parent->d_inode;
-	LKTRTrace("%.*s, b%d, parent i%lu, locked %p\n",
-		  DLNPair(dentry), bdst, dir->i_ino, locked);
-	DiMustReadLock(parent);
-	IiMustReadLock(dir);
-
-	if (au_h_iptr_i(dir, bdst))
-		return 0;
-
-	err = 0;
-	di_read_unlock(parent, AUFS_I_RLOCK);
-	di_write_lock_parent(parent);
-	if (au_h_iptr_i(dir, bdst))
-		goto out;
-
-	err = cpup_dirs(dentry, bdst, locked);
-
- out:
-	di_downgrade_lock(parent, AUFS_I_RLOCK);
-	TraceErr(err);
-	return err;
-}
diff -ruN -X X hnd-linux-trunk/fs/aufs/cpup.h hnd-cleanup/fs/aufs/cpup.h
--- hnd-linux-trunk/fs/aufs/cpup.h	2007-09-17 22:43:40.000000000 +0400
+++ hnd-cleanup/fs/aufs/cpup.h	1970-01-01 03:00:00.000000000 +0300
@@ -1,72 +0,0 @@
-/*
- * Copyright (C) 2005, 2006, 2007 Junjiro Okajima
- *
- * This program, aufs is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- */
-
-/* $Id: cpup.h,v 1.15 2007/05/14 03:41:52 sfjro Exp $ */
-
-#ifndef __AUFS_CPUP_H__
-#define __AUFS_CPUP_H__
-
-#ifdef __KERNEL__
-
-#include <linux/fs.h>
-#include <linux/version.h>
-#include <linux/aufs_type.h>
-
-static inline
-void au_cpup_attr_blksize(struct inode *inode, struct inode *h_inode)
-{
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
-	inode->i_blksize = h_inode->i_blksize;
-#endif
-}
-
-void au_cpup_attr_timesizes(struct inode *inode);
-void au_cpup_attr_nlink(struct inode *inode);
-void au_cpup_attr_changable(struct inode *inode);
-void au_cpup_igen(struct inode *inode, struct inode *h_inode);
-void au_cpup_attr_all(struct inode *inode);
-
-#define CPUP_DTIME		1	// do dtime_store/revert
-// todo: remove this
-#define CPUP_LOCKED_GHDIR	2	// grand parent hidden dir is locked
-unsigned int au_flags_cpup(unsigned int init, struct dentry *parent);
-
-int cpup_single(struct dentry *dentry, aufs_bindex_t bdst, aufs_bindex_t bsrc,
-		loff_t len, unsigned int flags);
-int sio_cpup_single(struct dentry *dentry, aufs_bindex_t bdst,
-		    aufs_bindex_t bsrc, loff_t len, unsigned int flags);
-int cpup_simple(struct dentry *dentry, aufs_bindex_t bdst, loff_t len,
-		unsigned int flags);
-int sio_cpup_simple(struct dentry *dentry, aufs_bindex_t bdst, loff_t len,
-		    unsigned int flags);
-
-int cpup_dirs(struct dentry *dentry, aufs_bindex_t bdst, struct dentry *locked);
-int test_and_cpup_dirs(struct dentry *dentry, aufs_bindex_t bdst,
-		       struct dentry *locked);
-
-/* keep timestamps when copyup */
-struct dtime {
-	struct dentry *dt_dentry, *dt_h_dentry;
-	struct timespec dt_atime, dt_mtime;
-};
-void dtime_store(struct dtime *dt, struct dentry *dentry,
-		 struct dentry *h_dentry);
-void dtime_revert(struct dtime *dt, int h_parent_is_locked);
-
-#endif /* __KERNEL__ */
-#endif /* __AUFS_CPUP_H__ */
diff -ruN -X X hnd-linux-trunk/fs/aufs/dcsub.c hnd-cleanup/fs/aufs/dcsub.c
--- hnd-linux-trunk/fs/aufs/dcsub.c	2007-09-17 22:43:40.000000000 +0400
+++ hnd-cleanup/fs/aufs/dcsub.c	1970-01-01 03:00:00.000000000 +0300
@@ -1,249 +0,0 @@
-/*
- * Copyright (C) 2007 Junjiro Okajima
- *
- * This program, aufs is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- */
-
-/* $Id: dcsub.c,v 1.5 2007/06/04 02:15:32 sfjro Exp $ */
-
-#include "aufs.h"
-
-static void au_dpage_free(struct au_dpage *dpage)
-{
-	int i;
-
-	TraceEnter();
-	AuDebugOn(!dpage);
-
-	for (i = 0; i < dpage->ndentry; i++)
-		dput(dpage->dentries[i]);
-	free_page((unsigned long)dpage->dentries);
-}
-
-int au_dpages_init(struct au_dcsub_pages *dpages, gfp_t gfp)
-{
-	int err;
-	void *p;
-
-	TraceEnter();
-
-	err = -ENOMEM;
-	dpages->dpages = kmalloc(sizeof(*dpages->dpages), gfp);
-	if (unlikely(!dpages->dpages))
-		goto out;
-	p = (void*)__get_free_page(gfp);
-	if (unlikely(!p))
-		goto out_dpages;
-	dpages->dpages[0].ndentry = 0;
-	dpages->dpages[0].dentries = p;
-	dpages->ndpage = 1;
-	return 0; /* success */
-
- out_dpages:
-	kfree(dpages->dpages);
- out:
-	TraceErr(err);
-	return err;
-}
-
-void au_dpages_free(struct au_dcsub_pages *dpages)
-{
-	int i;
-
-	TraceEnter();
-
-	for (i = 0; i < dpages->ndpage; i++)
-		au_dpage_free(dpages->dpages + i);
-	kfree(dpages->dpages);
-}
-
-static int au_dpages_append(struct au_dcsub_pages *dpages,
-			    struct dentry *dentry, gfp_t gfp)
-{
-	int err, sz;
-	struct au_dpage *dpage;
-	void *p;
-
-	//TraceEnter();
-
-	dpage = dpages->dpages + dpages->ndpage - 1;
-	AuDebugOn(!dpage);
-	sz = PAGE_SIZE / sizeof(dentry);
-	if (unlikely(dpage->ndentry >= sz)) {
-		LKTRLabel(new dpage);
-		err = -ENOMEM;
-		sz = dpages->ndpage * sizeof(*dpages->dpages);
-		p = au_kzrealloc(dpages->dpages, sz,
-				 sz + sizeof(*dpages->dpages), gfp);
-		if (unlikely(!p))
-			goto out;
-		dpage = dpages->dpages + dpages->ndpage;
-		p = (void*)__get_free_page(gfp);
-		if (unlikely(!p))
-			goto out;
-		dpage->ndentry = 0;
-		dpage->dentries = p;
-		dpages->ndpage++;
-	}
-
-	dpage->dentries[dpage->ndentry++] = dget(dentry);
-	return 0; /* success */
-
- out:
-	//TraceErr(err);
-	return err;
-}
-
-int au_dcsub_pages(struct au_dcsub_pages *dpages, struct dentry *root,
-		   au_dpages_test test, void *arg)
-{
-	int err;
-	struct dentry *this_parent = root;
-	struct list_head *next;
-	struct super_block *sb = root->d_sb;
-
-	TraceEnter();
-
-	err = 0;
-	spin_lock(&dcache_lock);
- repeat:
-	next = this_parent->d_subdirs.next;
- resume:
-	if (this_parent->d_sb == sb
-	    && !IS_ROOT(this_parent)
-	    && atomic_read(&this_parent->d_count)
-	    && this_parent->d_inode
-	    && (!test || test(this_parent, arg))) {
-		err = au_dpages_append(dpages, this_parent, GFP_ATOMIC);
-		if (unlikely(err))
-			goto out;
-	}
-
-	while (next != &this_parent->d_subdirs) {
-		struct list_head *tmp = next;
-		struct dentry *dentry = list_entry(tmp, struct dentry, D_CHILD);
-		next = tmp->next;
-		if (unlikely(/*d_unhashed(dentry) || */!dentry->d_inode))
-			continue;
-		if (!list_empty(&dentry->d_subdirs)) {
-			this_parent = dentry;
-			goto repeat;
-		}
-		if (dentry->d_sb == sb
-		    && atomic_read(&dentry->d_count)
-		    && (!test || test(dentry, arg))) {
-			err = au_dpages_append(dpages, dentry, GFP_ATOMIC);
-			if (unlikely(err))
-				goto out;
-		}
-	}
-
-	if (this_parent != root) {
-		next = this_parent->D_CHILD.next;
-		this_parent = this_parent->d_parent;
-		goto resume;
-	}
- out:
-	spin_unlock(&dcache_lock);
-#if 0
-	if (!err) {
-		int i, j;
-		j = 0;
-		for (i = 0; i < dpages->ndpage; i++) {
-			if ((dpages->dpages + i)->ndentry)
-				Dbg("%d: %d\n",
-				    i, (dpages->dpages + i)->ndentry);
-			j += (dpages->dpages + i)->ndentry;
-		}
-		if (j)
-			Dbg("ndpage %d, %d\n", dpages->ndpage, j);
-	}
-#endif
-	TraceErr(err);
-	return err;
-}
-
-int au_dcsub_pages_rev(struct au_dcsub_pages *dpages, struct dentry *dentry,
-		       int do_include, au_dpages_test test, void *arg)
-{
-	int err;
-
-	TraceEnter();
-
-	err = 0;
-	spin_lock(&dcache_lock);
-	if (do_include && (!test || test(dentry, arg))) {
-		err = au_dpages_append(dpages, dentry, GFP_ATOMIC);
-		if (unlikely(err))
-			goto out;
-	}
-	while (!IS_ROOT(dentry)) {
-		dentry = dentry->d_parent;
-		if (!test || test(dentry, arg)) {
-			err = au_dpages_append(dpages, dentry, GFP_ATOMIC);
-			if (unlikely(err))
-				break;
-		}
-	}
-
- out:
-	spin_unlock(&dcache_lock);
-
-	TraceErr(err);
-	return err;
-}
-
-int au_is_subdir(struct dentry *d1, struct dentry *d2)
-{
-	int err;
-#ifndef AuUse_ISSUBDIR
-	int i, j;
-	struct au_dcsub_pages dpages;
-	struct au_dpage *dpage;
-	struct dentry **dentries;
-#endif
-
-	LKTRTrace("%.*s, %.*s\n", DLNPair(d1), DLNPair(d2));
-
-#ifdef AuUse_ISSUBDIR
-	spin_lock(&dcache_lock);
-	err = is_subdir(d1, d2);
-	spin_unlock(&dcache_lock);
-#else
-	err = au_dpages_init(&dpages, GFP_KERNEL);
-	if (unlikely(err))
-		goto out;
-	err = au_dcsub_pages_rev(&dpages, d1, /*do_include*/1, NULL, NULL);
-	if (unlikely(err))
-		goto out_dpages;
-
-	for (i = dpages.ndpage - 1; !err && i >= 0; i--) {
-		dpage = dpages.dpages + i;
-		dentries = dpage->dentries;
-		for (j = dpage->ndentry - 1; !err && j >= 0; j--) {
-			struct dentry *d;
-			d = dentries[j];
-			//Dbg("d %.*s\n", DLNPair(d));
-			err = (d == d2);
-		}
-	}
-
- out_dpages:
-	au_dpages_free(&dpages);
- out:
-#endif
-	TraceErr(err);
-	return err;
-}
diff -ruN -X X hnd-linux-trunk/fs/aufs/dcsub.h hnd-cleanup/fs/aufs/dcsub.h
--- hnd-linux-trunk/fs/aufs/dcsub.h	2007-09-17 22:43:40.000000000 +0400
+++ hnd-cleanup/fs/aufs/dcsub.h	1970-01-01 03:00:00.000000000 +0300
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2007 Junjiro Okajima
- *
- * This program, aufs is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- */
-
-/* $Id: dcsub.h,v 1.4 2007/06/04 02:15:32 sfjro Exp $ */
-
-#ifndef __AUFS_DCSUB_H__
-#define __AUFS_DCSUB_H__
-
-#ifdef __KERNEL__
-
-#include <linux/dcache.h>
-
-struct au_dpage {
-	int ndentry;
-	struct dentry **dentries;
-};
-
-struct au_dcsub_pages {
-	int ndpage;
-	struct au_dpage *dpages;
-};
-
-/* ---------------------------------------------------------------------- */
-
-int au_dpages_init(struct au_dcsub_pages *dpages, gfp_t gfp);
-void au_dpages_free(struct au_dcsub_pages *dpages);
-typedef int (*au_dpages_test)(struct dentry *dentry, void *arg);
-int au_dcsub_pages(struct au_dcsub_pages *dpages, struct dentry *root,
-		   au_dpages_test test, void *arg);
-int au_dcsub_pages_rev(struct au_dcsub_pages *dpages, struct dentry *dentry,
-		       int do_include, au_dpages_test test, void *arg);
-int au_is_subdir(struct dentry *d1, struct dentry *d2);
-
-#endif /* __KERNEL__ */
-#endif /* __AUFS_DCSUB_H__ */
diff -ruN -X X hnd-linux-trunk/fs/aufs/debug.c hnd-cleanup/fs/aufs/debug.c
--- hnd-linux-trunk/fs/aufs/debug.c	2007-09-17 22:43:40.000000000 +0400
+++ hnd-cleanup/fs/aufs/debug.c	1970-01-01 03:00:00.000000000 +0300
@@ -1,261 +0,0 @@
-/*
- * Copyright (C) 2005, 2006, 2007 Junjiro Okajima
- *
- * This program, aufs is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- */
-
-/* $Id: debug.c,v 1.28 2007/06/04 02:17:34 sfjro Exp $ */
-
-#include "aufs.h"
-
-atomic_t aufs_cond = ATOMIC_INIT(0);
-
-#if defined(CONFIG_LKTR) || defined(CONFIG_LKTR_MODULE)
-#define dpri(fmt, arg...) \
-	do {if (LktrCond) printk(KERN_DEBUG fmt, ##arg);} while (0)
-#else
-#define dpri(fmt, arg...)	printk(KERN_DEBUG fmt, ##arg)
-#endif
-
-/* ---------------------------------------------------------------------- */
-
-void au_dpri_whlist(struct aufs_nhash *whlist)
-{
-	int i;
-	struct hlist_head *head;
-	struct aufs_wh *tpos;
-	struct hlist_node *pos;
-
-	for (i = 0; i < AUFS_NHASH_SIZE; i++) {
-		head = whlist->heads + i;
-		hlist_for_each_entry(tpos, pos, head, wh_hash)
-			dpri("b%d, %.*s, %d\n",
-			     tpos->wh_bindex,
-			     tpos->wh_str.len, tpos->wh_str.name,
-			     tpos->wh_str.len);
-	}
-}
-
-void au_dpri_vdir(struct aufs_vdir *vdir)
-{
-	int i;
-	union aufs_deblk_p p;
-	unsigned char *o;
-
-	if (!vdir || IS_ERR(vdir)) {
-		dpri("err %ld\n", PTR_ERR(vdir));
-		return;
-	}
-
-	dpri("nblk %d, deblk %p %d, last{%d, %p}, ver %lu\n",
-	     vdir->vd_nblk, vdir->vd_deblk, ksize(vdir->vd_deblk),
-	     vdir->vd_last.i, vdir->vd_last.p.p, vdir->vd_version);
-	for (i = 0; i < vdir->vd_nblk; i++) {
-		p.deblk = vdir->vd_deblk[i];
-		o = p.p;
-		dpri("[%d]: %p %d\n", i, o, ksize(o));
-#if 0 // verbose
-		int j;
-		for (j = 0; j < 8; j++) {
-			dpri("%p(+%d) {%02x %02x %02x %02x %02x %02x %02x %02x "
-			     "%02x %02x %02x %02x %02x %02x %02x %02x}\n",
-			     p.p, p.p - o,
-			     p.p[0], p.p[1], p.p[2], p.p[3],
-			     p.p[4], p.p[5], p.p[6], p.p[7],
-			     p.p[8], p.p[9], p.p[10], p.p[11],
-			     p.p[12], p.p[13], p.p[14], p.p[15]);
-			p.p += 16;
-		}
-#endif
-	}
-}
-
-static int do_pri_inode(aufs_bindex_t bindex, struct inode *inode)
-{
-	if (!inode || IS_ERR(inode)) {
-		dpri("i%d: err %ld\n", bindex, PTR_ERR(inode));
-		return -1;
-	}
-
-	/* the type of i_blocks depends upon CONFIG_LSF */
-	BUILD_BUG_ON(sizeof(inode->i_blocks) != sizeof(unsigned long)
-		     && sizeof(inode->i_blocks) != sizeof(u64));
-	dpri("i%d: i%lu, %s, cnt %d, nl %u, 0%o, sz %Lu, blk %Lu,"
-	     " ct %Ld, np %lu, st 0x%lx, g %x\n",
-	     bindex,
-	     inode->i_ino, inode->i_sb ? au_sbtype(inode->i_sb) : "??",
-	     atomic_read(&inode->i_count), inode->i_nlink, inode->i_mode,
-	     i_size_read(inode), (u64)inode->i_blocks,
-	     timespec_to_ns(&inode->i_ctime) & 0x0ffff,
-	     inode->i_mapping ? inode->i_mapping->nrpages : 0,
-	     inode->i_state, inode->i_generation);
-	return 0;
-}
-
-void au_dpri_inode(struct inode *inode)
-{
-	struct aufs_iinfo *iinfo;
-	aufs_bindex_t bindex;
-	int err;
-
-	err = do_pri_inode(-1, inode);
-	if (err || !au_is_aufs(inode->i_sb))
-		return;
-
-	iinfo = itoii(inode);
-	if (!iinfo)
-		return;
-	dpri("i-1: bstart %d, bend %d, gen %d\n",
-	     iinfo->ii_bstart, iinfo->ii_bend, au_iigen(inode));
-	if (iinfo->ii_bstart < 0)
-		return;
-	for (bindex = iinfo->ii_bstart; bindex <= iinfo->ii_bend; bindex++)
-		do_pri_inode(bindex, iinfo->ii_hinode[0 + bindex].hi_inode);
-}
-
-static int do_pri_dentry(aufs_bindex_t bindex, struct dentry *dentry)
-{
-	if (!dentry || IS_ERR(dentry)) {
-		dpri("d%d: err %ld\n", bindex, PTR_ERR(dentry));
-		return -1;
-	}
-	dpri("d%d: %.*s/%.*s, %s, cnt %d, flags 0x%x\n",
-	     bindex,
-	     DLNPair(dentry->d_parent), DLNPair(dentry),
-	     dentry->d_sb ? au_sbtype(dentry->d_sb) : "??",
-	     atomic_read(&dentry->d_count), dentry->d_flags);
-	do_pri_inode(bindex, dentry->d_inode);
-	return 0;
-}
-
-void au_dpri_dentry(struct dentry *dentry)
-{
-	struct aufs_dinfo *dinfo;
-	aufs_bindex_t bindex;
-	int err;
-
-	err = do_pri_dentry(-1, dentry);
-	if (err || !au_is_aufs(dentry->d_sb))
-		return;
-
-	dinfo = dtodi(dentry);
-	if (!dinfo)
-		return;
-	dpri("d-1: bstart %d, bend %d, bwh %d, bdiropq %d, gen %d\n",
-	     dinfo->di_bstart, dinfo->di_bend,
-	     dinfo->di_bwh, dinfo->di_bdiropq, au_digen(dentry));
-	if (dinfo->di_bstart < 0)
-		return;
-	for (bindex = dinfo->di_bstart; bindex <= dinfo->di_bend; bindex++)
-		do_pri_dentry(bindex, dinfo->di_hdentry[0 + bindex].hd_dentry);
-}
-
-static int do_pri_file(aufs_bindex_t bindex, struct file *file)
-{
-	char a[32];
-
-	if (!file || IS_ERR(file)) {
-		dpri("f%d: err %ld\n", bindex, PTR_ERR(file));
-		return -1;
-	}
-	a[0] = 0;
-	if (bindex == -1 && ftofi(file))
-		snprintf(a, sizeof(a), ", mmapped %d", au_is_mmapped(file));
-	dpri("f%d: mode 0x%x, flags 0%o, cnt %d, pos %Lu%s\n",
-	     bindex, file->f_mode, file->f_flags, file_count(file),
-	     file->f_pos, a);
-	do_pri_dentry(bindex, file->f_dentry);
-	return 0;
-}
-
-void au_dpri_file(struct file *file)
-{
-	struct aufs_finfo *finfo;
-	aufs_bindex_t bindex;
-	int err;
-
-	err = do_pri_file(-1, file);
-	if (err || !file->f_dentry || !au_is_aufs(file->f_dentry->d_sb))
-		return;
-
-	finfo = ftofi(file);
-	if (!finfo)
-		return;
-	if (finfo->fi_bstart < 0)
-		return;
-	for (bindex = finfo->fi_bstart; bindex <= finfo->fi_bend; bindex++) {
-		struct aufs_hfile *hf;
-		//dpri("bindex %d\n", bindex);
-		hf = finfo->fi_hfile + bindex;
-		do_pri_file(bindex, hf ? hf->hf_file : NULL);
-	}
-}
-
-static int do_pri_br(aufs_bindex_t bindex, struct aufs_branch *br)
-{
-	struct vfsmount *mnt;
-	struct super_block *sb;
-
-	if (!br || IS_ERR(br)
-	    || !(mnt = br->br_mnt) || IS_ERR(mnt)
-	    || !(sb = mnt->mnt_sb) || IS_ERR(sb)) {
-		dpri("s%d: err %ld\n", bindex, PTR_ERR(br));
-		return -1;
-	}
-
-	dpri("s%d: {perm 0x%x, cnt %d}, "
-	     "%s, flags 0x%lx, cnt(BIAS) %d, active %d, xino %p %p\n",
-	     bindex, br->br_perm, br_count(br),
-	     au_sbtype(sb), sb->s_flags, sb->s_count - S_BIAS,
-	     atomic_read(&sb->s_active), br->br_xino,
-	     br->br_xino ? br->br_xino->f_dentry : NULL);
-	return 0;
-}
-
-void au_dpri_sb(struct super_block *sb)
-{
-	struct aufs_sbinfo *sbinfo;
-	aufs_bindex_t bindex;
-	int err;
-	struct vfsmount mnt = {.mnt_sb = sb};
-	struct aufs_branch fake = {
-		.br_perm = 0,
-		.br_mnt = &mnt,
-		.br_count = ATOMIC_INIT(0),
-		.br_xino = NULL
-	};
-
-	atomic_set(&fake.br_count, 0);
-	err = do_pri_br(-1, &fake);
-	dpri("dev 0x%x\n", sb->s_dev);
-	if (err || !au_is_aufs(sb))
-		return;
-
-	sbinfo = stosi(sb);
-	if (!sbinfo)
-		return;
-	for (bindex = 0; bindex <= sbinfo->si_bend; bindex++) {
-		//dpri("bindex %d\n", bindex);
-		do_pri_br(bindex, sbinfo->si_branch[0 + bindex]);
-	}
-}
-
-/* ---------------------------------------------------------------------- */
-
-void au_dbg_sleep(int sec)
-{
-	static DECLARE_WAIT_QUEUE_HEAD(wq);
-	wait_event_timeout(wq, 0, sec * HZ);
-}
diff -ruN -X X hnd-linux-trunk/fs/aufs/debug.h hnd-cleanup/fs/aufs/debug.h
--- hnd-linux-trunk/fs/aufs/debug.h	2007-09-17 22:43:40.000000000 +0400
+++ hnd-cleanup/fs/aufs/debug.h	1970-01-01 03:00:00.000000000 +0300
@@ -1,130 +0,0 @@
-/*
- * Copyright (C) 2005, 2006, 2007 Junjiro Okajima
- *
- * This program, aufs is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- */
-
-/* $Id: debug.h,v 1.33 2007/06/04 02:17:34 sfjro Exp $ */
-
-#ifndef __AUFS_DEBUG_H__
-#define __AUFS_DEBUG_H__
-
-#ifdef __KERNEL__
-
-#include <linux/fs.h>
-
-#ifdef CONFIG_AUFS_DEBUG
-#define AuDebugOn(a)		BUG_ON(a)
-extern atomic_t aufs_cond;
-#define au_debug_on()		atomic_inc(&aufs_cond)
-#define au_debug_off()		atomic_dec(&aufs_cond)
-#define au_is_debug()		atomic_read(&aufs_cond)
-#else
-#define AuDebugOn(a)		do{}while(0)
-#define au_debug_on()		do{}while(0)
-#define au_debug_off()		do{}while(0)
-#define au_is_debug()		0
-#endif
-
-#define MtxMustLock(mtx)	AuDebugOn(!mutex_is_locked(mtx))
-
-/* ---------------------------------------------------------------------- */
-
-/* debug print */
-#if defined(CONFIG_LKTR) || defined(CONFIG_LKTR_MODULE)
-#include <linux/lktr.h>
-#ifdef CONFIG_AUFS_DEBUG
-#undef LktrCond
-#define LktrCond	unlikely((lktr_cond && lktr_cond()) || au_is_debug())
-#endif
-#else
-#define LktrCond			au_is_debug()
-#define LKTRDumpVma(pre, vma, suf)	do{}while(0)
-#define LKTRDumpStack()			do{}while(0)
-#define LKTRTrace(fmt, args...) do { \
-	if (LktrCond) \
-		Dbg(fmt, ##args); \
-} while (0)
-#define LKTRLabel(label)		LKTRTrace("%s\n", #label)
-#endif /* CONFIG_LKTR */
-
-#define TraceErr(e) do { \
-	if (unlikely((e) < 0)) \
-		LKTRTrace("err %d\n", (int)(e)); \
-} while (0)
-#define TraceErrPtr(p) do { \
-	if (IS_ERR(p)) \
-		LKTRTrace("err %ld\n", PTR_ERR(p)); \
-} while (0)
-#define TraceEnter()	LKTRLabel(enter)
-
-/* dirty macros for debug print, use with "%.*s" and caution */
-#define LNPair(qstr)		(qstr)->len,(qstr)->name
-#define DLNPair(d)		LNPair(&(d)->d_name)
-
-/* ---------------------------------------------------------------------- */
-
-#define Dpri(lvl, fmt, arg...) \
-	printk(lvl AUFS_NAME " %s:%d:%s[%d]: " fmt, \
-	       __func__, __LINE__, current->comm, current->pid, ##arg)
-#define Dbg(fmt, arg...)	Dpri(KERN_DEBUG, fmt, ##arg)
-#define Warn(fmt, arg...)	Dpri(KERN_WARNING, fmt, ##arg)
-#define Warn1(fmt, arg...) do { \
-	static unsigned char c; \
-	if (!c++) Warn(fmt, ##arg); \
-	} while (0)
-#define Err(fmt, arg...)	Dpri(KERN_ERR, fmt, ##arg)
-#define Err1(fmt, arg...) do { \
-	static unsigned char c; \
-	if (!c++) Err(fmt, ##arg); \
-	} while (0)
-#define IOErr(fmt, arg...)	Err("I/O Error, " fmt, ##arg)
-#define IOErr1(fmt, arg...) do { \
-	static unsigned char c; \
-	if (!c++) IOErr(fmt, ##arg); \
-	} while (0)
-#define IOErrWhck(fmt, arg...)	Err("I/O Error, try whck. " fmt, ##arg)
-
-/* ---------------------------------------------------------------------- */
-
-#ifdef CONFIG_AUFS_DEBUG
-struct aufs_nhash;
-void au_dpri_whlist(struct aufs_nhash *whlist);
-struct aufs_vdir;
-void au_dpri_vdir(struct aufs_vdir *vdir);
-void au_dpri_inode(struct inode *inode);
-void au_dpri_dentry(struct dentry *dentry);
-void au_dpri_file(struct file *filp);
-void au_dpri_sb(struct super_block *sb);
-void au_dbg_sleep(int sec);
-#define DbgWhlist(w)		do{LKTRTrace(#w "\n"); au_dpri_whlist(w);}while(0)
-#define DbgVdir(v)		do{LKTRTrace(#v "\n"); au_dpri_vdir(v);}while(0)
-#define DbgInode(i)		do{LKTRTrace(#i "\n"); au_dpri_inode(i);}while(0)
-#define DbgDentry(d)		do{LKTRTrace(#d "\n"); au_dpri_dentry(d);}while(0)
-#define DbgFile(f)		do{LKTRTrace(#f "\n"); au_dpri_file(f);}while(0)
-#define DbgSb(sb)		do{LKTRTrace(#sb "\n"); au_dpri_sb(sb);}while(0)
-#define DbgSleep(sec)		do{Dbg("sleep %d sec\n", sec); au_dbg_sleep(sec);}while(0)
-#else
-#define DbgWhlist(w)		do{}while(0)
-#define DbgVdir(v)		do{}while(0)
-#define DbgInode(i)		do{}while(0)
-#define DbgDentry(d)		do{}while(0)
-#define DbgFile(f)		do{}while(0)
-#define DbgSb(sb)		do{}while(0)
-#define DbgSleep(sec)		do{}while(0)
-#endif
-
-#endif /* __KERNEL__ */
-#endif /* __AUFS_DEBUG_H__ */
diff -ruN -X X hnd-linux-trunk/fs/aufs/dentry.c hnd-cleanup/fs/aufs/dentry.c
--- hnd-linux-trunk/fs/aufs/dentry.c	2007-09-17 22:43:40.000000000 +0400
+++ hnd-cleanup/fs/aufs/dentry.c	1970-01-01 03:00:00.000000000 +0300
@@ -1,968 +0,0 @@
-/*
- * Copyright (C) 2005, 2006, 2007 Junjiro Okajima
- *
- * This program, aufs is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- */
-
-/* $Id: dentry.c,v 1.44 2007/06/04 02:17:34 sfjro Exp $ */
-
-//#include <linux/fs.h>
-//#include <linux/namei.h>
-#include "aufs.h"
-
-#ifdef CONFIG_AUFS_LHASH_PATCH
-
-#ifdef CONFIG_AUFS_DLGT
-struct lookup_hash_args {
-	struct dentry **errp;
-	struct qstr *name;
-	struct dentry *base;
-	struct nameidata *nd;
-};
-
-static void call_lookup_hash(void *args)
-{
-	struct lookup_hash_args *a = args;
-	*a->errp = __lookup_hash(a->name, a->base, a->nd);
-}
-#endif /* CONFIG_AUFS_DLGT */
-
-static struct dentry *lkup_hash(const char *name, struct dentry *parent,
-				int len, struct lkup_args *lkup)
-{
-	struct dentry *dentry;
-	char *p;
-	unsigned long hash;
-	struct qstr this;
-	unsigned int c;
-	struct nameidata tmp_nd;
-
-	dentry = ERR_PTR(-EACCES);
-	this.name = name;
-	this.len = len;
-	if (unlikely(!len))
-		goto out;
-
-	p = (void*)name;
-	hash = init_name_hash();
-	while (len--) {
-		c = *p++;
-		if (unlikely(c == '/' || c == '\0'))
-			goto out;
-		hash = partial_name_hash(c, hash);
-	}
-	this.hash = end_name_hash(hash);
-
-	memset(&tmp_nd, 0, sizeof(tmp_nd));
-	tmp_nd.dentry = dget(parent);
-	tmp_nd.mnt = mntget(lkup->nfsmnt);
-#ifndef CONFIG_AUFS_DLGT
-	dentry = __lookup_hash(&this, parent, &tmp_nd);
-#else
-	if (!lkup->dlgt)
-		dentry = __lookup_hash(&this, parent, &tmp_nd);
-	else {
-		int wkq_err;
-		struct lookup_hash_args args = {
-			.errp	= &dentry,
-			.name	= &this,
-			.base	= parent,
-			.nd	= &tmp_nd
-		};
-		wkq_err = au_wkq_wait(call_lookup_hash, &args, /*dlgt*/1);
-		if (unlikely(wkq_err))
-			dentry = ERR_PTR(wkq_err);
-	}
-#endif
-	path_release(&tmp_nd);
-
- out:
-	TraceErrPtr(dentry);
-	return dentry;
-}
-#elif defined(CONFIG_AUFS_DLGT)
-static struct dentry *lkup_hash(const char *name, struct dentry *parent,
-				int len, struct lkup_args *lkup)
-{
-	return ERR_PTR(-ENOSYS);
-}
-#endif
-
-#ifdef CONFIG_AUFS_DLGT
-struct lookup_one_len_args {
-	struct dentry **errp;
-	const char *name;
-	struct dentry *parent;
-	int len;
-};
-
-static void call_lookup_one_len(void *args)
-{
-	struct lookup_one_len_args *a = args;
-	*a->errp = lookup_one_len(a->name, a->parent, a->len);
-}
-#endif /* CONFIG_AUFS_DLGT */
-
-#if defined(CONFIG_AUFS_LHASH_PATCH) || defined(CONFIG_AUFS_DLGT)
-/* cf. lookup_one_len() in linux/fs/namei.c */
-struct dentry *lkup_one(const char *name, struct dentry *parent, int len,
-			struct lkup_args *lkup)
-{
-	struct dentry *dentry;
-
-	LKTRTrace("%.*s/%.*s, lkup{%p, %d}\n",
-		  DLNPair(parent), len, name, lkup->nfsmnt, lkup->dlgt);
-
-	if (!lkup->nfsmnt) {
-#ifndef CONFIG_AUFS_DLGT
-		dentry = lookup_one_len(name, parent, len);
-#else
-		if (!lkup->dlgt)
-			dentry = lookup_one_len(name, parent, len);
-		else {
-			int wkq_err;
-			struct lookup_one_len_args args = {
-				.errp	= &dentry,
-				.name	= name,
-				.parent	= parent,
-				.len	= len
-			};
-			wkq_err = au_wkq_wait(call_lookup_one_len, &args,
-					      /*dlgt*/1);
-			if (unlikely(wkq_err))
-				dentry = ERR_PTR(wkq_err);
-		}
-#endif
-	} else
-		dentry = lkup_hash(name, parent, len, lkup);
-
-	TraceErrPtr(dentry);
-	return dentry;
-}
-#endif
-
-struct lkup_one_args {
-	struct dentry **errp;
-	const char *name;
-	struct dentry *parent;
-	int len;
-	struct lkup_args *lkup;
-};
-
-static void call_lkup_one(void *args)
-{
-	struct lkup_one_args *a = args;
-	*a->errp = lkup_one(a->name, a->parent, a->len, a->lkup);
-}
-
-/*
- * returns positive/negative dentry, NULL or an error.
- * NULL means whiteout-ed or not-found.
- */
-static struct dentry *do_lookup(struct dentry *hidden_parent,
-				struct dentry *dentry, aufs_bindex_t bindex,
-				struct qstr *wh_name, int allow_neg,
-				mode_t type, int dlgt)
-{
-	struct dentry *hidden_dentry;
-	int wh_found, wh_able, opq;
-	struct inode *hidden_dir, *hidden_inode;
-	struct qstr *name;
-	struct super_block *sb;
-	struct lkup_args lkup = {.dlgt = dlgt};
-
-	LKTRTrace("%.*s/%.*s, b%d, allow_neg %d, type 0%o, dlgt %d\n",
-		  DLNPair(hidden_parent), DLNPair(dentry), bindex, allow_neg,
-		  type, dlgt);
-	AuDebugOn(IS_ROOT(dentry));
-	hidden_dir = hidden_parent->d_inode;
-	IMustLock(hidden_dir);
-
-	wh_found = 0;
-	sb = dentry->d_sb;
-	wh_able = sbr_is_whable(sb, bindex);
-	lkup.nfsmnt = au_nfsmnt(sb, bindex);
-	name = &dentry->d_name;
-	if (unlikely(wh_able)) {
-#if 0 //def CONFIG_AUFS_ROBR
-		if (strncmp(name->name, AUFS_WH_PFX, AUFS_WH_PFX_LEN))
-			wh_found = is_wh(hidden_parent, wh_name, /*try_sio*/0,
-					 &lkup);
-		else
-			wh_found = -EPERM;
-#else
-		wh_found = is_wh(hidden_parent, wh_name, /*try_sio*/0, &lkup);
-#endif
-	}
-	//if (LktrCond) wh_found = -1;
-	hidden_dentry = ERR_PTR(wh_found);
-	if (!wh_found)
-		goto real_lookup;
-	if (unlikely(wh_found < 0))
-		goto out;
-
-	/* We found a whiteout */
-	//set_dbend(dentry, bindex);
-	set_dbwh(dentry, bindex);
-	if (!allow_neg)
-		return NULL; /* success */
-
- real_lookup:
-	// do not superio.
-	hidden_dentry = lkup_one(name->name, hidden_parent, name->len, &lkup);
-	//if (LktrCond) {dput(hidden_dentry); hidden_dentry = ERR_PTR(-1);}
-	if (IS_ERR(hidden_dentry))
-		goto out;
-	AuDebugOn(d_unhashed(hidden_dentry));
-	hidden_inode = hidden_dentry->d_inode;
-	if (!hidden_inode) {
-		if (!allow_neg)
-			goto out_neg;
-	} else if (wh_found
-		   || (type && type != (hidden_inode->i_mode & S_IFMT)))
-		goto out_neg;
-
-	if (dbend(dentry) <= bindex)
-		set_dbend(dentry, bindex);
-	if (dbstart(dentry) == -1 || bindex < dbstart(dentry))
-		set_dbstart(dentry, bindex);
-	set_h_dptr(dentry, bindex, hidden_dentry);
-
-	if (!hidden_inode || !S_ISDIR(hidden_inode->i_mode) || !wh_able)
-		return hidden_dentry; /* success */
-
-	hi_lock_child(hidden_inode);
-	opq = is_diropq(hidden_dentry, &lkup);
-	//if (LktrCond) opq = -1;
-	i_unlock(hidden_inode);
-	if (opq > 0)
-		set_dbdiropq(dentry, bindex);
-	else if (unlikely(opq < 0)) {
-		set_h_dptr(dentry, bindex, NULL);
-		hidden_dentry = ERR_PTR(opq);
-	}
-	goto out;
-
- out_neg:
-	dput(hidden_dentry);
-	hidden_dentry = NULL;
- out:
-	TraceErrPtr(hidden_dentry);
-	return hidden_dentry;
-}
-
-/*
- * returns the number of hidden positive dentries,
- * otherwise an error.
- */
-int lkup_dentry(struct dentry *dentry, aufs_bindex_t bstart, mode_t type)
-{
-	int npositive, err, allow_neg, dlgt;
-	struct dentry *parent;
-	aufs_bindex_t bindex, btail;
-	const struct qstr *name = &dentry->d_name;
-	struct qstr whname;
-	struct super_block *sb;
-
-	LKTRTrace("%.*s, b%d, type 0%o\n", LNPair(name), bstart, type);
-	AuDebugOn(bstart < 0 || IS_ROOT(dentry));
-	parent = dget_parent(dentry);
-
-#if 1 //ndef CONFIG_AUFS_ROBR
-	err = -EPERM;
-	if (unlikely(!strncmp(name->name, AUFS_WH_PFX, AUFS_WH_PFX_LEN)))
-		goto out;
-#endif
-
-	err = au_alloc_whname(name->name, name->len, &whname);
-	//if (LktrCond) {au_free_whname(&whname); err = -1;}
-	if (unlikely(err))
-		goto out;
-
-	sb = dentry->d_sb;
-	dlgt = need_dlgt(sb);
-	allow_neg = !type;
-	npositive = 0;
-	btail = dbtaildir(parent);
-	for (bindex = bstart; bindex <= btail; bindex++) {
-		struct dentry *hidden_parent, *hidden_dentry;
-		struct inode *hidden_inode;
-		struct inode *hidden_dir;
-
-		hidden_dentry = au_h_dptr_i(dentry, bindex);
-		if (hidden_dentry) {
-			if (hidden_dentry->d_inode)
-				npositive++;
-			if (type != S_IFDIR)
-				break;
-			continue;
-		}
-		hidden_parent = au_h_dptr_i(parent, bindex);
-		if (!hidden_parent)
-			continue;
-		hidden_dir = hidden_parent->d_inode;
-		if (!hidden_dir || !S_ISDIR(hidden_dir->i_mode))
-			continue;
-
-		hi_lock_parent(hidden_dir);
-		hidden_dentry = do_lookup(hidden_parent, dentry, bindex,
-					  &whname, allow_neg, type, dlgt);
-		// do not dput for testing
-		//if (LktrCond) {hidden_dentry = ERR_PTR(-1);}
-		i_unlock(hidden_dir);
-		err = PTR_ERR(hidden_dentry);
-		if (IS_ERR(hidden_dentry))
-			goto out_wh;
-		allow_neg = 0;
-
-		if (dbwh(dentry) != -1)
-			break;
-		if (!hidden_dentry)
-			continue;
-		hidden_inode = hidden_dentry->d_inode;
-		if (!hidden_inode)
-			continue;
-		npositive++;
-		if (!type)
-			type = hidden_inode->i_mode & S_IFMT;
-		if (type != S_IFDIR)
-			break;
-		else if (dbdiropq(dentry) != -1)
-			break;
-	}
-
-	if (npositive) {
-		LKTRLabel(positive);
-		au_update_dbstart(dentry);
-	}
-	err = npositive;
-
- out_wh:
-	au_free_whname(&whname);
- out:
-	dput(parent);
-	TraceErr(err);
-	return err;
-}
-
-struct dentry *sio_lkup_one(const char *name, struct dentry *parent, int len,
-			    struct lkup_args *lkup)
-{
-	struct dentry *dentry;
-	int wkq_err;
-
-	LKTRTrace("%.*s/%.*s\n", DLNPair(parent), len, name);
-	IMustLock(parent->d_inode);
-
-	if (!au_test_perm(parent->d_inode, MAY_EXEC, lkup->dlgt))
-		dentry = lkup_one(name, parent, len, lkup);
-	else {
-		// ugly
-		int dlgt = lkup->dlgt;
-		struct lkup_one_args args = {
-			.errp	= &dentry,
-			.name	= name,
-			.parent	= parent,
-			.len	= len,
-			.lkup	= lkup
-		};
-
-		lkup->dlgt = 0;
-		wkq_err = au_wkq_wait(call_lkup_one, &args, /*dlgt*/0);
-		if (unlikely(wkq_err))
-			dentry = ERR_PTR(wkq_err);
-		lkup->dlgt = dlgt;
-	}
-
-	TraceErrPtr(dentry);
-	return dentry;
-}
-
-/*
- * lookup @dentry on @bindex which should be negative.
- */
-int lkup_neg(struct dentry *dentry, aufs_bindex_t bindex)
-{
-	int err;
-	struct dentry *parent, *hidden_parent, *hidden_dentry;
-	struct inode *hidden_dir;
-	struct lkup_args lkup;
-
-	LKTRTrace("%.*s, b%d\n", DLNPair(dentry), bindex);
-	parent = dget_parent(dentry);
-	AuDebugOn(!parent || !parent->d_inode
-		  || !S_ISDIR(parent->d_inode->i_mode));
-	hidden_parent = au_h_dptr_i(parent, bindex);
-	AuDebugOn(!hidden_parent);
-	hidden_dir = hidden_parent->d_inode;
-	AuDebugOn(!hidden_dir || !S_ISDIR(hidden_dir->i_mode));
-	IMustLock(hidden_dir);
-
-	lkup.nfsmnt = au_nfsmnt(dentry->d_sb, bindex);
-	lkup.dlgt = need_dlgt(dentry->d_sb);
-	hidden_dentry = sio_lkup_one(dentry->d_name.name, hidden_parent,
-				     dentry->d_name.len, &lkup);
-	//if (LktrCond) {dput(hidden_dentry); hidden_dentry = ERR_PTR(-1);}
-	err = PTR_ERR(hidden_dentry);
-	if (IS_ERR(hidden_dentry))
-		goto out;
-	if (unlikely(hidden_dentry->d_inode)) {
-		err = -EIO;
-		IOErr("b%d %.*s should be negative.%s\n",
-		      bindex, DLNPair(hidden_dentry),
-		      au_flag_test(dentry->d_sb, AuFlag_UDBA_INOTIFY) ? "" :
-		      " Try udba=inotify.");
-		dput(hidden_dentry);
-		goto out;
-	}
-
-	if (bindex < dbstart(dentry))
-		set_dbstart(dentry, bindex);
-	if (dbend(dentry) < bindex)
-		set_dbend(dentry, bindex);
-	set_h_dptr(dentry, bindex, hidden_dentry);
-	err = 0;
-
- out:
-	dput(parent);
-	TraceErr(err);
-	return err;
-}
-
-/*
- * returns the number of found hidden positive dentries,
- * otherwise an error.
- */
-int au_refresh_hdentry(struct dentry *dentry, mode_t type)
-{
-	int npositive, pgen, new_sz, sgen, dgen;
-	struct aufs_dinfo *dinfo;
-	struct super_block *sb;
-	struct dentry *parent;
-	aufs_bindex_t bindex, parent_bend, parent_bstart, bwh, bdiropq, bend;
-	struct aufs_hdentry *p;
-	//struct nameidata nd;
-
-	LKTRTrace("%.*s, type 0%o\n", DLNPair(dentry), type);
-	DiMustWriteLock(dentry);
-	sb = dentry->d_sb;
-	AuDebugOn(IS_ROOT(dentry));
-	parent = dget_parent(dentry);
-	pgen = au_digen(parent);
-	sgen = au_sigen(sb);
-	dgen = au_digen(dentry);
-	AuDebugOn(pgen != sgen);
-
-	npositive = -ENOMEM;
-	new_sz = sizeof(*dinfo->di_hdentry) * (sbend(sb) + 1);
-	dinfo = dtodi(dentry);
-	p = au_kzrealloc(dinfo->di_hdentry, sizeof(*p) * (dinfo->di_bend + 1),
-			 new_sz, GFP_KERNEL);
-	//p = NULL;
-	if (unlikely(!p))
-		goto out;
-	dinfo->di_hdentry = p;
-
-	bend = dinfo->di_bend;
-	bwh = dinfo->di_bwh;
-	bdiropq = dinfo->di_bdiropq;
-	p += dinfo->di_bstart;
-	for (bindex = dinfo->di_bstart; bindex <= bend; bindex++, p++) {
-		struct dentry *hd, *hdp;
-		struct aufs_hdentry tmp, *q;
-		aufs_bindex_t new_bindex;
-
-		hd = p->hd_dentry;
-		if (!hd)
-			continue;
-		hdp = dget_parent(hd);
-		if (hdp == au_h_dptr_i(parent, bindex)) {
-			dput(hdp);
-			continue;
-		}
-
-		new_bindex = au_find_dbindex(parent, hdp);
-		dput(hdp);
-		AuDebugOn(new_bindex == bindex);
-		if (dinfo->di_bwh == bindex)
-			bwh = new_bindex;
-		if (dinfo->di_bdiropq == bindex)
-			bdiropq = new_bindex;
-		if (new_bindex < 0) { // test here
-			hdput(p);
-			p->hd_dentry = NULL;
-			continue;
-		}
-		/* swap two hidden dentries, and loop again */
-		q = dinfo->di_hdentry + new_bindex;
-		tmp = *q;
-		*q = *p;
-		*p = tmp;
-		if (tmp.hd_dentry) {
-			bindex--;
-			p--;
-		}
-	}
-
-	// test here
-	dinfo->di_bwh = -1;
-	if (unlikely(bwh != -1 && bwh <= sbend(sb) && sbr_is_whable(sb, bwh)))
-		dinfo->di_bwh = bwh;
-	dinfo->di_bdiropq = -1;
-	if (unlikely(bdiropq != -1 && bdiropq <= sbend(sb)
-		     && sbr_is_whable(sb, bdiropq)))
-		dinfo->di_bdiropq = bdiropq;
-	parent_bend = dbend(parent);
-	p = dinfo->di_hdentry;
-	for (bindex = 0; bindex <= parent_bend; bindex++, p++)
-		if (p->hd_dentry) {
-			dinfo->di_bstart = bindex;
-			break;
-		}
-	p = dinfo->di_hdentry + parent_bend;
-	//for (bindex = parent_bend; bindex > dinfo->di_bstart; bindex--, p--)
-	for (bindex = parent_bend; bindex >= 0; bindex--, p--)
-		if (p->hd_dentry) {
-			dinfo->di_bend = bindex;
-			break;
-		}
-
-	npositive = 0;
-	parent_bstart = dbstart(parent);
-	if (type != S_IFDIR && dinfo->di_bstart == parent_bstart)
-		goto out_dgen; /* success */
-
-#if 0
-	nd.last_type = LAST_ROOT;
-	nd.flags = LOOKUP_FOLLOW;
-	nd.depth = 0;
-	nd.mnt = mntget(??);
-	nd.dentry = dget(parent);
-#endif
-	npositive = lkup_dentry(dentry, parent_bstart, type);
-	//if (LktrCond) npositive = -1;
-	if (npositive < 0)
-		goto out;
-
- out_dgen:
-	au_update_digen(dentry);
- out:
-	dput(parent);
-	TraceErr(npositive);
-	return npositive;
-}
-
-static int h_d_revalidate(struct dentry *dentry, struct nameidata *nd,
-			  int do_udba)
-{
-	int err, plus, locked, unhashed, is_root, h_plus, is_nfs;
-	struct nameidata fake_nd, *p;
-	aufs_bindex_t bindex, btail, bstart, ibs, ibe;
-	struct super_block *sb;
-	struct inode *inode, *first, *h_inode, *h_cached_inode;
-	umode_t mode, h_mode;
-	struct dentry *h_dentry;
-	int (*reval)(struct dentry *, struct nameidata *);
-	struct qstr *name;
-
-	LKTRTrace("%.*s\n", DLNPair(dentry));
-	inode = dentry->d_inode;
-	AuDebugOn(inode && au_digen(dentry) != au_iigen(inode));
-	//DbgDentry(dentry);
-	//DbgInode(inode);
-
-	err = 0;
-	sb = dentry->d_sb;
-	plus = 0;
-	mode = 0;
-	first = NULL;
-	ibs = ibe = -1;
-	unhashed = d_unhashed(dentry);
-	is_root = IS_ROOT(dentry);
-	name = &dentry->d_name;
-
-	/*
-	 * Theoretically, REVAL test should be unnecessary in case of INOTIFY.
-	 * But inotify doesn't fire some necessary events,
-	 *	IN_ATTRIB for atime/nlink/pageio
-	 *	IN_DELETE for NFS dentry
-	 * Let's do REVAL test too.
-	 */
-	if (do_udba && inode) {
-		mode = (inode->i_mode & S_IFMT);
-		plus = (inode->i_nlink > 0);
-		first = au_h_iptr(inode);
-		ibs = ibstart(inode);
-		ibe = ibend(inode);
-	}
-
-	btail = bstart = dbstart(dentry);
-	if (inode && S_ISDIR(inode->i_mode))
-		btail = dbtaildir(dentry);
-	locked = 0;
-	if (nd) {
-		fake_nd = *nd;
-#ifndef CONFIG_AUFS_FAKE_DM
-		if (dentry != nd->dentry) {
-			di_read_lock_parent(nd->dentry, 0);
-			locked = 1;
-		}
-#endif
-	}
-	for (bindex = bstart; bindex <= btail; bindex++) {
-		h_dentry = au_h_dptr_i(dentry, bindex);
-		if (unlikely(!h_dentry))
-			continue;
-		if (unlikely(do_udba
-			     && !is_root
-			     && (unhashed != d_unhashed(h_dentry)
-#if 1
-				 || name->len != h_dentry->d_name.len
-				 || memcmp(name->name, h_dentry->d_name.name,
-					   name->len)
-#endif
-				     ))) {
-			LKTRTrace("unhash 0x%x 0x%x, %.*s %.*s\n",
-				  unhashed, d_unhashed(h_dentry),
-				  DLNPair(dentry), DLNPair(h_dentry));
-			goto err;
-		}
-
-		reval = NULL;
-		if (h_dentry->d_op)
-			reval = h_dentry->d_op->d_revalidate;
-		if (unlikely(reval)) {
-			//LKTRLabel(hidden reval);
-			p = fake_dm(&fake_nd, nd, sb, bindex);
-			AuDebugOn(IS_ERR(p));
-			err = !reval(h_dentry, p);
-			fake_dm_release(p);
-			if (unlikely(err)) {
-				//Dbg("here\n");
-				goto err;
-			}
-		}
-
-		if (unlikely(!do_udba))
-			continue;
-
-		/* UDBA tests */
-		h_inode = h_dentry->d_inode;
-		if (unlikely(!!inode != !!h_inode)) {
-			//Dbg("here\n");
-			goto err;
-		}
-
-		h_plus = plus;
-		h_mode = mode;
-		h_cached_inode = h_inode;
-		is_nfs = 0;
-		if (h_inode) {
-			h_mode = (h_inode->i_mode & S_IFMT);
-			h_plus = (h_inode->i_nlink > 0);
-		}
-		if (inode && ibs <= bindex && bindex <= ibe) {
-			h_cached_inode = au_h_iptr_i(inode, bindex);
-			//is_nfs = au_is_nfs(h_cached_inode->i_sb);
-		}
-
-		LKTRTrace("{%d, 0%o, %p}, h{%d, 0%o, %p}\n",
-			  plus, mode, h_cached_inode,
-			  h_plus, h_mode, h_inode);
-		if (unlikely(plus != h_plus || mode != h_mode
-			     || (h_cached_inode != h_inode /* && !is_nfs */))) {
-			//Dbg("here\n");
-			goto err;
-		}
-		continue;
-
-	err:
-		err = -EINVAL;
-		break;
-	}
-#ifndef CONFIG_AUFS_FAKE_DM
-	if (unlikely(locked))
-		di_read_unlock(nd->dentry, 0);
-#endif
-
-#if 0
-	// some filesystem uses CURRENT_TIME_SEC instead of CURRENT_TIME.
-	// NFS may stop IN_DELETE because of DCACHE_NFSFS_RENAMED.
-#if 0
-		     && (!timespec_equal(&inode->i_ctime, &first->i_ctime)
-			 || !timespec_equal(&inode->i_atime, &first->i_atime))
-#endif
-	if (unlikely(!err && udba && first))
-		au_cpup_attr_all(inode);
-#endif
-
-	TraceErr(err);
-	return err;
-}
-
-static int simple_reval_dpath(struct dentry *dentry, int sgen)
-{
-	int err;
-	mode_t type;
-	struct dentry *parent;
-	struct inode *inode;
-
-	LKTRTrace("%.*s, sgen %d\n", DLNPair(dentry), sgen);
-	SiMustAnyLock(dentry->d_sb);
-	DiMustWriteLock(dentry);
-	inode = dentry->d_inode;
-	AuDebugOn(!inode);
-
-	if (au_digen(dentry) == sgen)
-		return 0;
-
-	parent = dget_parent(dentry);
-	di_read_lock_parent(parent, AUFS_I_RLOCK);
-	AuDebugOn(au_digen(parent) != sgen);
-#ifdef CONFIG_AUFS_DEBUG
-	{
-		int i, j;
-		struct au_dcsub_pages dpages;
-		struct au_dpage *dpage;
-		struct dentry **dentries;
-
-		err = au_dpages_init(&dpages, GFP_KERNEL);
-		AuDebugOn(err);
-		err = au_dcsub_pages_rev(&dpages, parent, /*do_include*/1, NULL,
-					 NULL);
-		AuDebugOn(err);
-		for (i = dpages.ndpage - 1; !err && i >= 0; i--) {
-			dpage = dpages.dpages + i;
-			dentries = dpage->dentries;
-			for (j = dpage->ndentry - 1; !err && j >= 0; j--)
-				AuDebugOn(au_digen(dentries[j]) != sgen);
-		}
-		au_dpages_free(&dpages);
-	}
-#endif
-	type = (inode->i_mode & S_IFMT);
-	/* returns a number of positive dentries */
-	err = au_refresh_hdentry(dentry, type);
-	if (err >= 0)
-		err = au_refresh_hinode(inode, dentry);
-	di_read_unlock(parent, AUFS_I_RLOCK);
-	dput(parent);
-	TraceErr(err);
-	return err;
-}
-
-int au_reval_dpath(struct dentry *dentry, int sgen)
-{
-	int err;
-	struct dentry *d, *parent;
-	struct inode *inode;
-
-	LKTRTrace("%.*s, sgen %d\n", DLNPair(dentry), sgen);
-	AuDebugOn(!dentry->d_inode);
-	DiMustWriteLock(dentry);
-
-	if (!stosi(dentry->d_sb)->si_failed_refresh_dirs)
-		return simple_reval_dpath(dentry, sgen);
-
-	/* slow loop, keep it simple and stupid */
-	/* cf: cpup_dirs() */
-	err = 0;
-	while (au_digen(dentry) != sgen) {
-		d = dentry;
-		while (1) {
-			parent = d->d_parent; // dget_parent()
-			if (au_digen(parent) == sgen)
-				break;
-			d = parent;
-		}
-
-		inode = d->d_inode;
-		if (d != dentry) {
-			//i_lock(inode);
-			di_write_lock_child(d);
-		}
-
-		/* someone might update our dentry while we were sleeping */
-		if (au_digen(d) != sgen) {
-			di_read_lock_parent(parent, AUFS_I_RLOCK);
-			/* returns a number of positive dentries */
-			err = au_refresh_hdentry(d, inode->i_mode & S_IFMT);
-			//err = -1;
-			if (err >= 0)
-				err = au_refresh_hinode(inode, d);
-			//err = -1;
-			di_read_unlock(parent, AUFS_I_RLOCK);
-		}
-
-		if (d != dentry) {
-			di_write_unlock(d);
-			//i_unlock(inode);
-		}
-		if (unlikely(err))
-			break;
-	}
-
-	TraceErr(err);
-	return err;
-}
-
-/*
- * THIS IS A BOOLEAN FUNCTION: returns 1 if valid, 0 otherwise.
- * nfsd passes NULL as nameidata.
- */
-static int aufs_d_revalidate(struct dentry *dentry, struct nameidata *nd)
-{
-	int valid, sgen, err, do_udba;
-	struct super_block *sb;
-	struct inode *inode;
-
-	LKTRTrace("dentry %.*s\n", DLNPair(dentry));
-	if (nd && nd->dentry)
-		LKTRTrace("nd %.*s\n", DLNPair(nd->dentry));
-	//dir case: AuDebugOn(dentry->d_parent != nd->dentry);
-	//remove failure case: AuDebugOn(!IS_ROOT(dentry) && d_unhashed(dentry));
-	AuDebugOn(!dentry->d_fsdata);
-	//DbgDentry(dentry);
-
-	err = -EINVAL;
-	inode = dentry->d_inode;
-	//DbgInode(inode);
-	sb = dentry->d_sb;
-	si_read_lock(sb);
-	sgen = au_sigen(sb);
-	if (au_digen(dentry) == sgen)
-		di_read_lock_child(dentry, !AUFS_I_RLOCK);
-	else {
-		AuDebugOn(IS_ROOT(dentry));
-#ifdef ForceInotify
-		Dbg("UDBA or digen, %.*s\n", DLNPair(dentry));
-#endif
-		//i_lock(inode);
-		di_write_lock_child(dentry);
-		if (inode)
-			err = au_reval_dpath(dentry, sgen);
-		//err = -1;
-		di_downgrade_lock(dentry, AUFS_I_RLOCK);
-		//i_unlock(inode);
-		if (unlikely(err))
-			goto out;
-		ii_read_unlock(inode);
-		AuDebugOn(au_iigen(inode) != sgen);
-	}
-
-	if (inode) {
-		if (au_iigen(inode) == sgen)
-			ii_read_lock_child(inode);
-		else {
-			AuDebugOn(IS_ROOT(dentry));
-#ifdef ForceInotify
-			Dbg("UDBA or survived, %.*s\n", DLNPair(dentry));
-#endif
-			ii_write_lock_child(inode);
-			err = au_refresh_hinode(inode, dentry);
-			ii_downgrade_lock(inode);
-			if (unlikely(err))
-				goto out;
-			AuDebugOn(au_iigen(inode) != sgen);
-		}
-	}
-
-#if 0 // fix it
-	/* parent dir i_nlink is not updated in the case of setattr */
-	if (S_ISDIR(inode->i_mode)) {
-		i_lock(inode);
-		ii_write_lock(inode);
-		au_cpup_attr_nlink(inode);
-		ii_write_unlock(inode);
-		i_unlock(inode);
-	}
-#endif
-
-	err = -EINVAL;
-	do_udba = !au_flag_test(sb, AuFlag_UDBA_NONE);
-	if (do_udba && inode && ibstart(inode) >= 0
-	    && au_test_higen(inode, au_h_iptr(inode)))
-		goto out;
-	err = h_d_revalidate(dentry, nd, do_udba);
-	//err = -1;
-
- out:
-	aufs_read_unlock(dentry, AUFS_I_RLOCK);
-	TraceErr(err);
-	valid = !err;
-	//au_debug_on();
-	if (!valid)
-		LKTRTrace("%.*s invalid\n", DLNPair(dentry));
-	//au_debug_off();
-	return valid;
-}
-
-static void aufs_d_release(struct dentry *dentry)
-{
-	struct aufs_dinfo *dinfo;
-	aufs_bindex_t bend, bindex;
-
-	LKTRTrace("%.*s\n", DLNPair(dentry));
-	AuDebugOn(!d_unhashed(dentry));
-
-	dinfo = dentry->d_fsdata;
-	if (unlikely(!dinfo))
-		return;
-
-	/* dentry may not be revalidated */
-	bindex = dinfo->di_bstart;
-	if (bindex >= 0) {
-		struct aufs_hdentry *p;
-		bend = dinfo->di_bend;
-		AuDebugOn(bend < bindex);
-		p = dinfo->di_hdentry + bindex;
-		while (bindex++ <= bend) {
-			if (p->hd_dentry)
-				hdput(p);
-			p++;
-		}
-	}
-	kfree(dinfo->di_hdentry);
-	cache_free_dinfo(dinfo);
-}
-
-#if 0
-/* it may be called at remount time, too */
-static void aufs_d_iput(struct dentry *dentry, struct inode *inode)
-{
-	struct super_block *sb;
-
-	LKTRTrace("%.*s, i%lu\n", DLNPair(dentry), inode->i_ino);
-
-	sb = dentry->d_sb;
-#if 0
-	si_read_lock(sb);
-	if (unlikely(au_flag_test(sb, AuFlag_PLINK)
-		     && au_is_plinked(sb, inode))) {
-		ii_write_lock(inode);
-		au_update_brange(inode, 1);
-		ii_write_unlock(inode);
-	}
-	si_read_unlock(sb);
-#endif
-	iput(inode);
-}
-#endif
-
-struct dentry_operations aufs_dop = {
-	.d_revalidate	= aufs_d_revalidate,
-	.d_release	= aufs_d_release
-	//.d_iput		= aufs_d_iput
-};
diff -ruN -X X hnd-linux-trunk/fs/aufs/dentry.h hnd-cleanup/fs/aufs/dentry.h
--- hnd-linux-trunk/fs/aufs/dentry.h	2007-09-17 22:43:40.000000000 +0400
+++ hnd-cleanup/fs/aufs/dentry.h	1970-01-01 03:00:00.000000000 +0300
@@ -1,183 +0,0 @@
-/*
- * Copyright (C) 2005, 2006, 2007 Junjiro Okajima
- *
- * This program, aufs is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- */
-
-/* $Id: dentry.h,v 1.25 2007/05/14 03:41:52 sfjro Exp $ */
-
-#ifndef __AUFS_DENTRY_H__
-#define __AUFS_DENTRY_H__
-
-#ifdef __KERNEL__
-
-#include <linux/fs.h>
-#include <linux/aufs_type.h>
-#include "misc.h"
-
-struct aufs_hdentry {
-	struct dentry	*hd_dentry;
-};
-
-struct aufs_dinfo {
-	atomic_t		di_generation;
-
-	struct aufs_rwsem	di_rwsem;
-	aufs_bindex_t		di_bstart, di_bend, di_bwh, di_bdiropq;
-	struct aufs_hdentry	*di_hdentry;
-};
-
-struct lkup_args {
-	struct vfsmount *nfsmnt;
-	int dlgt;
-	//struct super_block *sb;
-};
-
-/* ---------------------------------------------------------------------- */
-
-/* dentry.c */
-#if defined(CONFIG_AUFS_LHASH_PATCH) || defined(CONFIG_AUFS_DLGT)
-struct dentry *lkup_one(const char *name, struct dentry *parent, int len,
-			struct lkup_args *lkup);
-#else
-static inline
-struct dentry *lkup_one(const char *name, struct dentry *parent, int len,
-			struct lkup_args *lkup)
-{
-	return lookup_one_len(name, parent, len);
-}
-#endif
-
-extern struct dentry_operations aufs_dop;
-struct dentry *sio_lkup_one(const char *name, struct dentry *parent, int len,
-			    struct lkup_args *lkup);
-int lkup_dentry(struct dentry *dentry, aufs_bindex_t bstart, mode_t type);
-int lkup_neg(struct dentry *dentry, aufs_bindex_t bindex);
-int au_refresh_hdentry(struct dentry *dentry, mode_t type);
-int au_reval_dpath(struct dentry *dentry, int sgen);
-
-/* dinfo.c */
-int au_alloc_dinfo(struct dentry *dentry);
-struct aufs_dinfo *dtodi(struct dentry *dentry);
-
-void di_read_lock(struct dentry *d, int flags, unsigned int lsc);
-void di_read_unlock(struct dentry *d, int flags);
-void di_downgrade_lock(struct dentry *d, int flags);
-void di_write_lock(struct dentry *d, unsigned int lsc);
-void di_write_unlock(struct dentry *d);
-void di_write_lock2_child(struct dentry *d1, struct dentry *d2, int isdir);
-void di_write_lock2_parent(struct dentry *d1, struct dentry *d2, int isdir);
-void di_write_unlock2(struct dentry *d1, struct dentry *d2);
-
-aufs_bindex_t dbstart(struct dentry *dentry);
-aufs_bindex_t dbend(struct dentry *dentry);
-aufs_bindex_t dbwh(struct dentry *dentry);
-aufs_bindex_t dbdiropq(struct dentry *dentry);
-struct dentry *au_h_dptr_i(struct dentry *dentry, aufs_bindex_t bindex);
-struct dentry *au_h_dptr(struct dentry *dentry);
-
-aufs_bindex_t dbtail(struct dentry *dentry);
-aufs_bindex_t dbtaildir(struct dentry *dentry);
-aufs_bindex_t dbtail_generic(struct dentry *dentry);
-
-void set_dbstart(struct dentry *dentry, aufs_bindex_t bindex);
-void set_dbend(struct dentry *dentry, aufs_bindex_t bindex);
-void set_dbwh(struct dentry *dentry, aufs_bindex_t bindex);
-void set_dbdiropq(struct dentry *dentry, aufs_bindex_t bindex);
-void hdput(struct aufs_hdentry *hdentry);
-void set_h_dptr(struct dentry *dentry, aufs_bindex_t bindex,
-		struct dentry *h_dentry);
-
-void au_update_digen(struct dentry *dentry);
-void au_update_dbstart(struct dentry *dentry);
-int au_find_dbindex(struct dentry *dentry, struct dentry *h_dentry);
-
-/* ---------------------------------------------------------------------- */
-
-static inline int au_digen(struct dentry *d)
-{
-	return atomic_read(&dtodi(d)->di_generation);
-}
-
-#ifdef CONFIG_AUFS_HINOTIFY
-static inline void au_digen_dec(struct dentry *d)
-{
-	atomic_dec(&dtodi(d)->di_generation);
-}
-#endif /* CONFIG_AUFS_HINOTIFY */
-
-/* ---------------------------------------------------------------------- */
-
-/* lock subclass for dinfo */
-enum {
-	AuLsc_DI_CHILD,		/* child first */
-	AuLsc_DI_CHILD2,	/* rename(2), link(2), and cpup at hinotify */
-	AuLsc_DI_CHILD3,	/* copyup dirs */
-	AuLsc_DI_PARENT,
-	AuLsc_DI_PARENT2,
-	AuLsc_DI_PARENT3
-};
-
-/*
- * di_read_lock_child, di_write_lock_child,
- * di_read_lock_child2, di_write_lock_child2,
- * di_read_lock_child3, di_write_lock_child3,
- * di_read_lock_parent, di_write_lock_parent,
- * di_read_lock_parent2, di_write_lock_parent2,
- * di_read_lock_parent3, di_write_lock_parent3,
- */
-#define ReadLockFunc(name, lsc) \
-static inline void di_read_lock_##name(struct dentry *d, int flags) \
-{di_read_lock(d, flags, AuLsc_DI_##lsc);}
-
-#define WriteLockFunc(name, lsc) \
-static inline void di_write_lock_##name(struct dentry *d) \
-{di_write_lock(d, AuLsc_DI_##lsc);}
-
-#define RWLockFuncs(name, lsc) \
-	ReadLockFunc(name, lsc); \
-	WriteLockFunc(name, lsc)
-
-RWLockFuncs(child, CHILD);
-RWLockFuncs(child2, CHILD2);
-RWLockFuncs(child3, CHILD3);
-RWLockFuncs(parent, PARENT);
-RWLockFuncs(parent2, PARENT2);
-RWLockFuncs(parent3, PARENT3);
-
-#undef ReadLockFunc
-#undef WriteLockFunc
-#undef RWLockFunc
-
-/* to debug easier, do not make them inlined functions */
-#define DiMustReadLock(d) do { \
-	SiMustAnyLock((d)->d_sb); \
-	RwMustReadLock(&dtodi(d)->di_rwsem); \
-} while (0)
-
-#define DiMustWriteLock(d) do { \
-	SiMustAnyLock((d)->d_sb); \
-	RwMustWriteLock(&dtodi(d)->di_rwsem); \
-} while (0)
-
-#define DiMustAnyLock(d) do { \
-	SiMustAnyLock((d)->d_sb); \
-	RwMustAnyLock(&dtodi(d)->di_rwsem); \
-} while (0)
-
-#define DiMustNoWaiters(d)	RwMustNoWaiters(&dtodi(d)->di_rwsem)
-
-#endif /* __KERNEL__ */
-#endif /* __AUFS_DENTRY_H__ */
diff -ruN -X X hnd-linux-trunk/fs/aufs/dinfo.c hnd-cleanup/fs/aufs/dinfo.c
--- hnd-linux-trunk/fs/aufs/dinfo.c	2007-09-17 22:43:40.000000000 +0400
+++ hnd-cleanup/fs/aufs/dinfo.c	1970-01-01 03:00:00.000000000 +0300
@@ -1,411 +0,0 @@
-/*
- * Copyright (C) 2005, 2006, 2007 Junjiro Okajima
- *
- * This program, aufs is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- */
-
-/* $Id: dinfo.c,v 1.26 2007/06/11 01:42:40 sfjro Exp $ */
-
-#include "aufs.h"
-
-int au_alloc_dinfo(struct dentry *dentry)
-{
-	struct aufs_dinfo *dinfo;
-	struct super_block *sb;
-	int nbr;
-
-	LKTRTrace("%.*s\n", DLNPair(dentry));
-	AuDebugOn(dentry->d_fsdata);
-
-	dinfo = cache_alloc_dinfo();
-	//if (LktrCond) {cache_free_dinfo(dinfo); dinfo = NULL;}
-	if (dinfo) {
-		sb = dentry->d_sb;
-		nbr = sbend(sb) + 1;
-		if (unlikely(!nbr))
-			nbr++;
-		dinfo->di_hdentry = kcalloc(nbr, sizeof(*dinfo->di_hdentry),
-					    GFP_KERNEL);
-		//if (LktrCond)
-		//{kfree(dinfo->di_hdentry); dinfo->di_hdentry = NULL;}
-		if (dinfo->di_hdentry) {
-			rw_init_wlock_nested(&dinfo->di_rwsem, AuLsc_DI_PARENT);
-			dinfo->di_bstart = dinfo->di_bend = -1;
-			dinfo->di_bwh = dinfo->di_bdiropq = -1;
-			atomic_set(&dinfo->di_generation, au_sigen(sb));
-
-			dentry->d_fsdata = dinfo;
-			dentry->d_op = &aufs_dop;
-			return 0; /* success */
-		}
-		cache_free_dinfo(dinfo);
-	}
-	TraceErr(-ENOMEM);
-	return -ENOMEM;
-}
-
-struct aufs_dinfo *dtodi(struct dentry *dentry)
-{
-	struct aufs_dinfo *dinfo = dentry->d_fsdata;
-	AuDebugOn(!dinfo
-		 || !dinfo->di_hdentry
-		 /* || stosi(dentry->d_sb)->si_bend < dinfo->di_bend */
-		 || dinfo->di_bend < dinfo->di_bstart
-		 /* dbwh can be outside of this range */
-		 || (0 <= dinfo->di_bdiropq
-		     && (dinfo->di_bdiropq < dinfo->di_bstart
-			 /* || dinfo->di_bend < dinfo->di_bdiropq */))
-		);
-	return dinfo;
-}
-
-/* ---------------------------------------------------------------------- */
-
-static void do_ii_write_lock(struct inode *inode, unsigned int lsc)
-{
-	switch (lsc) {
-	case AuLsc_DI_CHILD:
-		ii_write_lock_child(inode);
-		break;
-	case AuLsc_DI_CHILD2:
-		ii_write_lock_child2(inode);
-		break;
-	case AuLsc_DI_CHILD3:
-		ii_write_lock_child3(inode);
-		break;
-	case AuLsc_DI_PARENT:
-		ii_write_lock_parent(inode);
-		break;
-	case AuLsc_DI_PARENT2:
-		ii_write_lock_parent2(inode);
-		break;
-	case AuLsc_DI_PARENT3:
-		ii_write_lock_parent3(inode);
-		break;
-	default:
-		BUG();
-	}
-}
-
-static void do_ii_read_lock(struct inode *inode, unsigned int lsc)
-{
-	switch (lsc) {
-	case AuLsc_DI_CHILD:
-		ii_read_lock_child(inode);
-		break;
-	case AuLsc_DI_CHILD2:
-		ii_read_lock_child2(inode);
-		break;
-	case AuLsc_DI_CHILD3:
-		ii_read_lock_child3(inode);
-		break;
-	case AuLsc_DI_PARENT:
-		ii_read_lock_parent(inode);
-		break;
-	case AuLsc_DI_PARENT2:
-		ii_read_lock_parent2(inode);
-		break;
-	case AuLsc_DI_PARENT3:
-		ii_read_lock_parent3(inode);
-		break;
-	default:
-		BUG();
-	}
-}
-
-void di_read_lock(struct dentry *d, int flags, unsigned int lsc)
-{
-	SiMustAnyLock(d->d_sb);
-	// todo: always nested?
-	rw_read_lock_nested(&dtodi(d)->di_rwsem, lsc);
-	if (d->d_inode) {
-		if (flags & AUFS_I_WLOCK)
-			do_ii_write_lock(d->d_inode, lsc);
-		else if (flags & AUFS_I_RLOCK)
-			do_ii_read_lock(d->d_inode, lsc);
-	}
-}
-
-void di_read_unlock(struct dentry *d, int flags)
-{
-	SiMustAnyLock(d->d_sb);
-	if (d->d_inode) {
-		if (flags & AUFS_I_WLOCK)
-			ii_write_unlock(d->d_inode);
-		else if (flags & AUFS_I_RLOCK)
-			ii_read_unlock(d->d_inode);
-	}
-	rw_read_unlock(&dtodi(d)->di_rwsem);
-}
-
-void di_downgrade_lock(struct dentry *d, int flags)
-{
-	SiMustAnyLock(d->d_sb);
-	rw_dgrade_lock(&dtodi(d)->di_rwsem);
-	if (d->d_inode && (flags & AUFS_I_RLOCK))
-		ii_downgrade_lock(d->d_inode);
-}
-
-void di_write_lock(struct dentry *d, unsigned int lsc)
-{
-	SiMustAnyLock(d->d_sb);
-	// todo: always nested?
-	rw_write_lock_nested(&dtodi(d)->di_rwsem, lsc);
-	if (d->d_inode)
-		do_ii_write_lock(d->d_inode, lsc);
-}
-
-void di_write_unlock(struct dentry *d)
-{
-	SiMustAnyLock(d->d_sb);
-	if (d->d_inode)
-		ii_write_unlock(d->d_inode);
-	rw_write_unlock(&dtodi(d)->di_rwsem);
-}
-
-void di_write_lock2_child(struct dentry *d1, struct dentry *d2, int isdir)
-{
-	TraceEnter();
-	AuDebugOn(d1 == d2
-		  || d1->d_inode == d2->d_inode
-		  || d1->d_sb != d2->d_sb);
-
-	if (isdir && au_is_subdir(d1, d2)) {
-		di_write_lock_child(d1);
-		di_write_lock_child2(d2);
-	} else {
-		/* there should be no races */
-		di_write_lock_child(d2);
-		di_write_lock_child2(d1);
-	}
-}
-
-void di_write_lock2_parent(struct dentry *d1, struct dentry *d2, int isdir)
-{
-	TraceEnter();
-	AuDebugOn(d1 == d2
-		  || d1->d_inode == d2->d_inode
-		  || d1->d_sb != d2->d_sb);
-
-	if (isdir && au_is_subdir(d1, d2)) {
-		di_write_lock_parent(d1);
-		di_write_lock_parent2(d2);
-	} else {
-		/* there should be no races */
-		di_write_lock_parent(d2);
-		di_write_lock_parent2(d1);
-	}
-}
-
-void di_write_unlock2(struct dentry *d1, struct dentry *d2)
-{
-	di_write_unlock(d1);
-	if (d1->d_inode == d2->d_inode)
-		rw_write_unlock(&dtodi(d2)->di_rwsem);
-	else
-		di_write_unlock(d2);
-}
-
-/* ---------------------------------------------------------------------- */
-
-aufs_bindex_t dbstart(struct dentry *dentry)
-{
-	DiMustAnyLock(dentry);
-	return dtodi(dentry)->di_bstart;
-}
-
-aufs_bindex_t dbend(struct dentry *dentry)
-{
-	DiMustAnyLock(dentry);
-	return dtodi(dentry)->di_bend;
-}
-
-aufs_bindex_t dbwh(struct dentry *dentry)
-{
-	DiMustAnyLock(dentry);
-	return dtodi(dentry)->di_bwh;
-}
-
-aufs_bindex_t dbdiropq(struct dentry *dentry)
-{
-	DiMustAnyLock(dentry);
-	AuDebugOn(dentry->d_inode
-		  && dentry->d_inode->i_mode
-		  && !S_ISDIR(dentry->d_inode->i_mode));
-	return dtodi(dentry)->di_bdiropq;
-}
-
-struct dentry *au_h_dptr_i(struct dentry *dentry, aufs_bindex_t bindex)
-{
-	struct dentry *d;
-
-	DiMustAnyLock(dentry);
-	if (dbstart(dentry) < 0 || bindex < dbstart(dentry))
-		return NULL;
-	AuDebugOn(bindex < 0
-		  /* || bindex > sbend(dentry->d_sb) */);
-	d = dtodi(dentry)->di_hdentry[0 + bindex].hd_dentry;
-	AuDebugOn(d && (atomic_read(&d->d_count) <= 0));
-	return d;
-}
-
-struct dentry *au_h_dptr(struct dentry *dentry)
-{
-	return au_h_dptr_i(dentry, dbstart(dentry));
-}
-
-aufs_bindex_t dbtail(struct dentry *dentry)
-{
-	aufs_bindex_t bend, bwh;
-
-	bend = dbend(dentry);
-	if (0 <= bend) {
-		bwh = dbwh(dentry);
-		//AuDebugOn(bend < bwh);
-		if (!bwh)
-			return bwh;
-		if (0 < bwh && bwh < bend)
-			return bwh - 1;
-	}
-	return bend;
-}
-
-aufs_bindex_t dbtaildir(struct dentry *dentry)
-{
-	aufs_bindex_t bend, bopq;
-
-	AuDebugOn(dentry->d_inode
-		  && dentry->d_inode->i_mode
-		  && !S_ISDIR(dentry->d_inode->i_mode));
-
-	bend = dbtail(dentry);
-	if (0 <= bend) {
-		bopq = dbdiropq(dentry);
-		AuDebugOn(bend < bopq);
-		if (0 <= bopq && bopq < bend)
-			bend = bopq;
-	}
-	return bend;
-}
-
-aufs_bindex_t dbtail_generic(struct dentry *dentry)
-{
-	struct inode *inode;
-
-	inode = dentry->d_inode;
-	if (inode && S_ISDIR(inode->i_mode))
-		return dbtaildir(dentry);
-	else
-		return dbtail(dentry);
-}
-
-/* ---------------------------------------------------------------------- */
-
-// hard/soft set
-void set_dbstart(struct dentry *dentry, aufs_bindex_t bindex)
-{
-	DiMustWriteLock(dentry);
-	AuDebugOn(sbend(dentry->d_sb) < bindex);
-	/* */
-	dtodi(dentry)->di_bstart = bindex;
-}
-
-void set_dbend(struct dentry *dentry, aufs_bindex_t bindex)
-{
-	DiMustWriteLock(dentry);
-	AuDebugOn(sbend(dentry->d_sb) < bindex
-		  || bindex < dbstart(dentry));
-	dtodi(dentry)->di_bend = bindex;
-}
-
-void set_dbwh(struct dentry *dentry, aufs_bindex_t bindex)
-{
-	DiMustWriteLock(dentry);
-	AuDebugOn(sbend(dentry->d_sb) < bindex);
-	/* dbwh can be outside of bstart - bend range */
-	dtodi(dentry)->di_bwh = bindex;
-}
-
-void set_dbdiropq(struct dentry *dentry, aufs_bindex_t bindex)
-{
-	DiMustWriteLock(dentry);
-	AuDebugOn(sbend(dentry->d_sb) < bindex);
-	AuDebugOn((bindex != -1
-		   && (bindex < dbstart(dentry) || dbend(dentry) < bindex))
-		  || (dentry->d_inode
-		      && dentry->d_inode->i_mode
-		      && !S_ISDIR(dentry->d_inode->i_mode)));
-	dtodi(dentry)->di_bdiropq = bindex;
-}
-
-void hdput(struct aufs_hdentry *hd)
-{
-	dput(hd->hd_dentry);
-}
-
-void set_h_dptr(struct dentry *dentry, aufs_bindex_t bindex,
-		struct dentry *h_dentry)
-{
-	struct aufs_hdentry *hd = dtodi(dentry)->di_hdentry + bindex;
-	DiMustWriteLock(dentry);
-	AuDebugOn(bindex < dtodi(dentry)->di_bstart
-		  || bindex > dtodi(dentry)->di_bend
-		  || (h_dentry && atomic_read(&h_dentry->d_count) <= 0)
-		  || (h_dentry && hd->hd_dentry)
-		);
-	if (hd->hd_dentry)
-		hdput(hd);
-	hd->hd_dentry = h_dentry;
-}
-
-/* ---------------------------------------------------------------------- */
-
-void au_update_digen(struct dentry *dentry)
-{
-	//DiMustWriteLock(dentry);
-	AuDebugOn(!dentry->d_sb);
-	atomic_set(&dtodi(dentry)->di_generation, au_sigen(dentry->d_sb));
-}
-
-void au_update_dbstart(struct dentry *dentry)
-{
-	aufs_bindex_t bindex, bstart = dbstart(dentry), bend = dbend(dentry);
-	struct dentry *hidden_dentry;
-
-	DiMustWriteLock(dentry);
-	for (bindex = bstart; bindex <= bend; bindex++) {
-		hidden_dentry = au_h_dptr_i(dentry, bindex);
-		if (!hidden_dentry)
-			continue;
-		if (hidden_dentry->d_inode) {
-			set_dbstart(dentry, bindex);
-			return;
-		}
-		set_h_dptr(dentry, bindex, NULL);
-	}
-	//set_dbstart(dentry, -1);
-	//set_dbend(dentry, -1);
-}
-
-int au_find_dbindex(struct dentry *dentry, struct dentry *hidden_dentry)
-{
-	aufs_bindex_t bindex, bend;
-
-	bend = dbend(dentry);
-	for (bindex = dbstart(dentry); bindex <= bend; bindex++)
-		if (au_h_dptr_i(dentry, bindex) == hidden_dentry)
-			return bindex;
-	return -1;
-}
diff -ruN -X X hnd-linux-trunk/fs/aufs/dir.c hnd-cleanup/fs/aufs/dir.c
--- hnd-linux-trunk/fs/aufs/dir.c	2007-09-17 22:43:40.000000000 +0400
+++ hnd-cleanup/fs/aufs/dir.c	1970-01-01 03:00:00.000000000 +0300
@@ -1,566 +0,0 @@
-/*
- * Copyright (C) 2005, 2006, 2007 Junjiro Okajima
- *
- * This program, aufs is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- */
-
-/* $Id: dir.c,v 1.39 2007/06/04 02:17:34 sfjro Exp $ */
-
-#include "aufs.h"
-
-static int reopen_dir(struct file *file)
-{
-	int err;
-	struct dentry *dentry, *hidden_dentry;
-	aufs_bindex_t bindex, btail, bstart;
-	struct file *hidden_file;
-
-	dentry = file->f_dentry;
-	LKTRTrace("%.*s\n", DLNPair(dentry));
-	AuDebugOn(!S_ISDIR(dentry->d_inode->i_mode));
-
-	/* open all hidden dirs */
-	bstart = dbstart(dentry);
-#if 1
-	for (bindex = fbstart(file); bindex < bstart; bindex++)
-		set_h_fptr(file, bindex, NULL);
-#endif
-	set_fbstart(file, bstart);
-	btail = dbtaildir(dentry);
-#if 1
-	for (bindex = fbend(file); btail < bindex; bindex--)
-		set_h_fptr(file, bindex, NULL);
-#endif
-	set_fbend(file, btail);
-	for (bindex = bstart; bindex <= btail; bindex++) {
-		hidden_dentry = au_h_dptr_i(dentry, bindex);
-		if (!hidden_dentry)
-			continue;
-		hidden_file = au_h_fptr_i(file, bindex);
-		if (hidden_file) {
-			AuDebugOn(hidden_file->f_dentry != hidden_dentry);
-			continue;
-		}
-
-		hidden_file = hidden_open(dentry, bindex, file->f_flags);
-		// unavailable
-		//if (LktrCond) {fput(hidden_file);
-		//br_put(stobr(dentry->d_sb, bindex));hidden_file=ERR_PTR(-1);}
-		err = PTR_ERR(hidden_file);
-		if (IS_ERR(hidden_file))
-			goto out; // close all?
-		//cpup_file_flags(hidden_file, file);
-		set_h_fptr(file, bindex, hidden_file);
-	}
-	err = 0;
-
- out:
-	TraceErr(err);
-	return err;
-}
-
-static int do_open_dir(struct file *file, int flags)
-{
-	int err;
-	aufs_bindex_t bindex, btail;
-	struct dentry *dentry, *hidden_dentry;
-	struct file *hidden_file;
-
-	dentry = file->f_dentry;
-	LKTRTrace("%.*s, 0x%x\n", DLNPair(dentry), flags);
-	AuDebugOn(!dentry->d_inode || !S_ISDIR(dentry->d_inode->i_mode));
-
-	err = 0;
-	set_fvdir_cache(file, NULL);
-	file->f_version = dentry->d_inode->i_version;
-	bindex = dbstart(dentry);
-	set_fbstart(file, bindex);
-	btail = dbtaildir(dentry);
-	set_fbend(file, btail);
-	for (; !err && bindex <= btail; bindex++) {
-		hidden_dentry = au_h_dptr_i(dentry, bindex);
-		if (!hidden_dentry)
-			continue;
-
-		hidden_file = hidden_open(dentry, bindex, flags);
-		//if (LktrCond) {fput(hidden_file);
-		//br_put(stobr(dentry->d_sb, bindex));hidden_file=ERR_PTR(-1);}
-		if (!IS_ERR(hidden_file)) {
-			set_h_fptr(file, bindex, hidden_file);
-			continue;
-		}
-		err = PTR_ERR(hidden_file);
-	}
-	if (!err)
-		return 0; /* success */
-
-	/* close all */
-	for (bindex = fbstart(file); !err && bindex <= btail; bindex++)
-		set_h_fptr(file, bindex, NULL);
-	set_fbstart(file, -1);
-	set_fbend(file, -1);
-	return err;
-}
-
-static int aufs_open_dir(struct inode *inode, struct file *file)
-{
-	return au_do_open(inode, file, do_open_dir);
-}
-
-static int aufs_release_dir(struct inode *inode, struct file *file)
-{
-	struct aufs_vdir *vdir_cache;
-	struct super_block *sb;
-
-	LKTRTrace("i%lu, %.*s\n", inode->i_ino, DLNPair(file->f_dentry));
-
-	sb = file->f_dentry->d_sb;
-	si_read_lock(sb);
-	fi_write_lock(file);
-	vdir_cache = fvdir_cache(file);
-	if (vdir_cache)
-		free_vdir(vdir_cache);
-	fi_write_unlock(file);
-	au_fin_finfo(file);
-	si_read_unlock(sb);
-	return 0;
-}
-
-static int fsync_dir(struct dentry *dentry, int datasync)
-{
-	int err;
-	struct inode *inode;
-	struct super_block *sb;
-	aufs_bindex_t bend, bindex;
-
-	LKTRTrace("%.*s, %d\n", DLNPair(dentry), datasync);
-	DiMustAnyLock(dentry);
-	sb = dentry->d_sb;
-	SiMustAnyLock(sb);
-	inode = dentry->d_inode;
-	IMustLock(inode);
-	IiMustAnyLock(inode);
-
-	err = 0;
-	bend = dbend(dentry);
-	for (bindex = dbstart(dentry); !err && bindex <= bend; bindex++) {
-		struct dentry *h_dentry;
-		struct inode *h_inode;
-		struct file_operations *fop;
-
-		if (test_ro(sb, bindex, inode))
-			continue;
-		h_dentry = au_h_dptr_i(dentry, bindex);
-		if (!h_dentry)
-			continue;
-		h_inode = h_dentry->d_inode;
-		if (!h_inode)
-			continue;
-
-		/* cf. fs/nsfd/vfs.c and fs/nfsd/nfs4recover.c */
-		//hdir_lock(h_inode, inode, bindex);
-		i_lock(h_inode);
-		fop = (void*)h_inode->i_fop;
-		err = filemap_fdatawrite(h_inode->i_mapping);
-		if (!err && fop && fop->fsync)
-			err = fop->fsync(NULL, h_dentry, datasync);
-		if (!err)
-			err = filemap_fdatawrite(h_inode->i_mapping);
-		//hdir_unlock(h_inode, inode, bindex);
-		i_unlock(h_inode);
-	}
-
-	TraceErr(err);
-	return err;
-}
-
-/*
- * @file may be NULL
- */
-static int aufs_fsync_dir(struct file *file, struct dentry *dentry,
-			  int datasync)
-{
-	int err;
-	struct inode *inode;
-	struct file *hidden_file;
-	struct super_block *sb;
-	aufs_bindex_t bend, bindex;
-
-	LKTRTrace("%.*s, %d\n", DLNPair(dentry), datasync);
-	inode = dentry->d_inode;
-	IMustLock(inode);
-
-	err = 0;
-	sb = dentry->d_sb;
-	si_read_lock(sb);
-	if (file) {
-		err = au_reval_and_lock_finfo(file, reopen_dir, /*wlock*/1,
-					      /*locked*/1);
-		//err = -1;
-		if (unlikely(err))
-			goto out;
-	} else
-		di_read_lock_child(dentry, !AUFS_I_WLOCK);
-
-	ii_write_lock_child(inode);
-	if (file) {
-		bend = fbend(file);
-		for (bindex = fbstart(file); !err && bindex <= bend; bindex++) {
-			hidden_file = au_h_fptr_i(file, bindex);
-			if (!hidden_file || test_ro(sb, bindex, inode))
-				continue;
-
-			err = -EINVAL;
-			if (hidden_file->f_op && hidden_file->f_op->fsync) {
-				// todo: try do_fsync() in fs/sync.c
-#if 0
-				AuDebugOn(hidden_file->f_dentry->d_inode
-					  != au_h_iptr_i(inode, bindex));
-				hdir_lock(hidden_file->f_dentry->d_inode, inode,
-					  bindex);
-#else
-				i_lock(hidden_file->f_dentry->d_inode);
-#endif
-				err = hidden_file->f_op->fsync
-					(hidden_file, hidden_file->f_dentry,
-					 datasync);
-				//err = -1;
-#if 0
-				hdir_unlock(hidden_file->f_dentry->d_inode,
-					    inode, bindex);
-#else
-				i_unlock(hidden_file->f_dentry->d_inode);
-#endif
-			}
-		}
-	} else
-		err = fsync_dir(dentry, datasync);
-	au_cpup_attr_timesizes(inode);
-	ii_write_unlock(inode);
-	if (file)
-		fi_write_unlock(file);
-	else
-		di_read_unlock(dentry, !AUFS_I_WLOCK);
-
- out:
-	si_read_unlock(sb);
-	TraceErr(err);
-	return err;
-}
-
-/* ---------------------------------------------------------------------- */
-
-static int aufs_readdir(struct file *file, void *dirent, filldir_t filldir)
-{
-	int err;
-	struct dentry *dentry;
-	struct inode *inode;
-	struct super_block *sb;
-
-	dentry = file->f_dentry;
-	LKTRTrace("%.*s, pos %Ld\n", DLNPair(dentry), file->f_pos);
-	inode = dentry->d_inode;
-	IMustLock(inode);
-
-	au_nfsd_lockdep_off();
-	sb = dentry->d_sb;
-	si_read_lock(sb);
-	err = au_reval_and_lock_finfo(file, reopen_dir, /*wlock*/1,
-				      /*locked*/1);
-	if (unlikely(err))
-		goto out;
-
-	ii_write_lock_child(inode);
-	err = au_init_vdir(file);
-	if (unlikely(err)) {
-		ii_write_unlock(inode);
-		goto out_unlock;
-	}
-	//DbgVdir(fvdir_cache(file));// goto out_unlock;
-
-	/* nfsd filldir calls lookup_one_len(). */
-	ii_downgrade_lock(inode);
-	err = au_fill_de(file, dirent, filldir);
-	//DbgVdir(fvdir_cache(file));// goto out_unlock;
-
-	inode->i_atime = au_h_iptr(inode)->i_atime;
-	ii_read_unlock(inode);
-
- out_unlock:
-	fi_write_unlock(file);
- out:
-	si_read_unlock(sb);
-	au_nfsd_lockdep_on();
-#if 0 // debug
-	if (LktrCond)
-		igrab(inode);
-#endif
-	TraceErr(err);
-	return err;
-}
-
-/* ---------------------------------------------------------------------- */
-
-struct test_empty_arg {
-	struct aufs_nhash *whlist;
-	int whonly;
-	aufs_bindex_t bindex;
-	int err, called;
-};
-
-static int test_empty_cb(void *__arg, const char *__name, int namelen,
-			 loff_t offset, filldir_ino_t ino, unsigned int d_type)
-{
-	struct test_empty_arg *arg = __arg;
-	char *name = (void*)__name;
-
-	LKTRTrace("%.*s\n", namelen, name);
-
-	arg->err = 0;
-	arg->called++;
-	//smp_mb();
-	if (name[0] == '.'
-	    && (namelen == 1 || (name[1] == '.' && namelen == 2)))
-		return 0; /* success */
-
-	if (namelen <= AUFS_WH_PFX_LEN
-	    || memcmp(name, AUFS_WH_PFX, AUFS_WH_PFX_LEN)) {
-		if (arg->whonly && !test_known_wh(arg->whlist, name, namelen))
-			arg->err = -ENOTEMPTY;
-		goto out;
-	}
-
-	name += AUFS_WH_PFX_LEN;
-	namelen -= AUFS_WH_PFX_LEN;
-	if (!test_known_wh(arg->whlist, name, namelen))
-		arg->err = append_wh(arg->whlist, name, namelen, arg->bindex);
-
- out:
-	//smp_mb();
-	TraceErr(arg->err);
-	return arg->err;
-}
-
-static int do_test_empty(struct dentry *dentry, struct test_empty_arg *arg)
-{
-	int err, dlgt;
-	struct file *hidden_file;
-
-	LKTRTrace("%.*s, {%p, %d, %d}\n",
-		  DLNPair(dentry), arg->whlist, arg->whonly, arg->bindex);
-
-	hidden_file = hidden_open(dentry, arg->bindex,
-				  O_RDONLY | O_NONBLOCK | O_DIRECTORY
-				  | O_LARGEFILE);
-	err = PTR_ERR(hidden_file);
-	if (IS_ERR(hidden_file))
-		goto out;
-
-	dlgt = need_dlgt(dentry->d_sb);
-	//hidden_file->f_pos = 0;
-	do {
-		arg->err = 0;
-		arg->called = 0;
-		//smp_mb();
-		err = vfsub_readdir(hidden_file, test_empty_cb, arg, dlgt);
-		if (err >= 0)
-			err = arg->err;
-	} while (!err && arg->called);
-	fput(hidden_file);
-	sbr_put(dentry->d_sb, arg->bindex);
-
- out:
-	TraceErr(err);
-	return err;
-}
-
-struct do_test_empty_args {
-	int *errp;
-	struct dentry *dentry;
-	struct test_empty_arg *arg;
-};
-
-static void call_do_test_empty(void *args)
-{
-	struct do_test_empty_args *a = args;
-	*a->errp = do_test_empty(a->dentry, a->arg);
-}
-
-static int sio_test_empty(struct dentry *dentry, struct test_empty_arg *arg)
-{
-	int err, wkq_err;
-	struct dentry *hidden_dentry;
-	struct inode *hidden_inode;
-
-	LKTRTrace("%.*s\n", DLNPair(dentry));
-	hidden_dentry = au_h_dptr_i(dentry, arg->bindex);
-	AuDebugOn(!hidden_dentry);
-	hidden_inode = hidden_dentry->d_inode;
-	AuDebugOn(!hidden_inode || !S_ISDIR(hidden_inode->i_mode));
-
-	hi_lock_child(hidden_inode);
-	err = au_test_perm(hidden_inode, MAY_EXEC | MAY_READ,
-			   need_dlgt(dentry->d_sb));
-	i_unlock(hidden_inode);
-	if (!err)
-		err = do_test_empty(dentry, arg);
-	else {
-		struct do_test_empty_args args = {
-			.errp	= &err,
-			.dentry	= dentry,
-			.arg	= arg
-		};
-		wkq_err = au_wkq_wait(call_do_test_empty, &args, /*dlgt*/0);
-		if (unlikely(wkq_err))
-			err = wkq_err;
-	}
-
-	TraceErr(err);
-	return err;
-}
-
-int au_test_empty_lower(struct dentry *dentry)
-{
-	int err;
-	struct inode *inode;
-	struct test_empty_arg arg;
-	struct aufs_nhash *whlist;
-	aufs_bindex_t bindex, bstart, btail;
-
-	LKTRTrace("%.*s\n", DLNPair(dentry));
-	inode = dentry->d_inode;
-	AuDebugOn(!inode || !S_ISDIR(inode->i_mode));
-
-	whlist = nhash_new(GFP_KERNEL);
-	err = PTR_ERR(whlist);
-	if (IS_ERR(whlist))
-		goto out;
-
-	bstart = dbstart(dentry);
-	arg.whlist = whlist;
-	arg.whonly = 0;
-	arg.bindex = bstart;
-	err = do_test_empty(dentry, &arg);
-	if (unlikely(err))
-		goto out_whlist;
-
-	arg.whonly = 1;
-	btail = dbtaildir(dentry);
-	for (bindex = bstart + 1; !err && bindex <= btail; bindex++) {
-		struct dentry *hidden_dentry;
-		hidden_dentry = au_h_dptr_i(dentry, bindex);
-		if (hidden_dentry && hidden_dentry->d_inode) {
-			AuDebugOn(!S_ISDIR(hidden_dentry->d_inode->i_mode));
-			arg.bindex = bindex;
-			err = do_test_empty(dentry, &arg);
-		}
-	}
-
- out_whlist:
-	nhash_del(whlist);
- out:
-	TraceErr(err);
-	return err;
-}
-
-int test_empty(struct dentry *dentry, struct aufs_nhash *whlist)
-{
-	int err;
-	struct inode *inode;
-	struct test_empty_arg arg;
-	aufs_bindex_t bindex, btail;
-
-	LKTRTrace("%.*s\n", DLNPair(dentry));
-	inode = dentry->d_inode;
-	AuDebugOn(!inode || !S_ISDIR(inode->i_mode));
-
-	err = 0;
-	arg.whlist = whlist;
-	arg.whonly = 1;
-	btail = dbtaildir(dentry);
-	for (bindex = dbstart(dentry); !err && bindex <= btail; bindex++) {
-		struct dentry *hidden_dentry;
-		hidden_dentry = au_h_dptr_i(dentry, bindex);
-		if (hidden_dentry && hidden_dentry->d_inode) {
-			AuDebugOn(!S_ISDIR(hidden_dentry->d_inode->i_mode));
-			arg.bindex = bindex;
-			err = sio_test_empty(dentry, &arg);
-		}
-	}
-
-	TraceErr(err);
-	return err;
-}
-
-/* ---------------------------------------------------------------------- */
-
-void au_add_nlink(struct inode *dir, struct inode *h_dir)
-{
-	AuDebugOn(!S_ISDIR(dir->i_mode) || !S_ISDIR(h_dir->i_mode));
-	dir->i_nlink += h_dir->i_nlink - 2;
-	if (unlikely(h_dir->i_nlink < 2))
-		dir->i_nlink += 2;
-}
-
-void au_sub_nlink(struct inode *dir, struct inode *h_dir)
-{
-	AuDebugOn(!S_ISDIR(dir->i_mode) || !S_ISDIR(h_dir->i_mode));
-	dir->i_nlink -= h_dir->i_nlink - 2;
-	if (unlikely(h_dir->i_nlink < 2))
-		dir->i_nlink -= 2;
-}
-
-/* ---------------------------------------------------------------------- */
-
-#if 0 // comment
-struct file_operations {
-	struct module *owner;
-	loff_t (*llseek) (struct file *, loff_t, int);
-	ssize_t (*read) (struct file *, char __user *, size_t, loff_t *);
-	ssize_t (*aio_read) (struct kiocb *, char __user *, size_t, loff_t);
-	ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *);
-	ssize_t (*aio_write) (struct kiocb *, const char __user *, size_t, loff_t);
-	int (*readdir) (struct file *, void *, filldir_t);
-	unsigned int (*poll) (struct file *, struct poll_table_struct *);
-	int (*ioctl) (struct inode *, struct file *, unsigned int, unsigned long);
-	long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
-	long (*compat_ioctl) (struct file *, unsigned int, unsigned long);
-	int (*mmap) (struct file *, struct vm_area_struct *);
-	int (*open) (struct inode *, struct file *);
-	int (*flush) (struct file *);
-	int (*release) (struct inode *, struct file *);
-	int (*fsync) (struct file *, struct dentry *, int datasync);
-	int (*aio_fsync) (struct kiocb *, int datasync);
-	int (*fasync) (int, struct file *, int);
-	int (*lock) (struct file *, int, struct file_lock *);
-	ssize_t (*readv) (struct file *, const struct iovec *, unsigned long, loff_t *);
-	ssize_t (*writev) (struct file *, const struct iovec *, unsigned long, loff_t *);
-	ssize_t (*sendfile) (struct file *, loff_t *, size_t, read_actor_t, void *);
-	ssize_t (*sendpage) (struct file *, struct page *, int, size_t, loff_t *, int);
-	unsigned long (*get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long);
-	int (*check_flags)(int);
-	int (*dir_notify)(struct file *file, unsigned long arg);
-	int (*flock) (struct file *, int, struct file_lock *);
-};
-#endif
-
-struct file_operations aufs_dir_fop = {
-	.read		= generic_read_dir,
-	.readdir	= aufs_readdir,
-	.open		= aufs_open_dir,
-	.release	= aufs_release_dir,
-	.flush		= aufs_flush,
-	.fsync		= aufs_fsync_dir,
-};
diff -ruN -X X hnd-linux-trunk/fs/aufs/dir.h hnd-cleanup/fs/aufs/dir.h
--- hnd-linux-trunk/fs/aufs/dir.h	2007-09-17 22:43:40.000000000 +0400
+++ hnd-cleanup/fs/aufs/dir.h	1970-01-01 03:00:00.000000000 +0300
@@ -1,125 +0,0 @@
-/*
- * Copyright (C) 2005, 2006, 2007 Junjiro Okajima
- *
- * This program, aufs is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- */
-
-/* $Id: dir.h,v 1.18 2007/05/14 03:41:52 sfjro Exp $ */
-
-#ifndef __AUFS_DIR_H__
-#define __AUFS_DIR_H__
-
-#ifdef __KERNEL__
-
-#include <linux/fs.h>
-#include <linux/version.h>
-#include <linux/aufs_type.h>
-
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19)
-#define filldir_ino_t	u64
-#else
-#define filldir_ino_t	ino_t
-#endif
-
-/* ---------------------------------------------------------------------- */
-
-/* need to be faster and smaller */
-
-#define AUFS_DEBLK_SIZE 512 // todo: changable
-#define AUFS_NHASH_SIZE	32 // todo: changable
-#if AUFS_DEBLK_SIZE < NAME_MAX || PAGE_SIZE < AUFS_DEBLK_SIZE
-#error invalid size AUFS_DEBLK_SIZE
-#endif
-
-typedef char aufs_deblk_t[AUFS_DEBLK_SIZE];
-
-struct aufs_nhash {
-	struct hlist_head heads[AUFS_NHASH_SIZE];
-};
-
-struct aufs_destr {
-	unsigned char	len;
-	char		name[0];
-} __attribute__ ((packed));
-
-struct aufs_dehstr {
-	struct hlist_node hash;
-	struct aufs_destr *str;
-};
-
-struct aufs_de {
-	ino_t			de_ino;
-	unsigned char		de_type;
-	//caution: packed
-	struct aufs_destr	de_str;
-} __attribute__ ((packed));
-
-struct aufs_wh {
-	struct hlist_node	wh_hash;
-	aufs_bindex_t		wh_bindex;
-	struct aufs_destr	wh_str;
-} __attribute__ ((packed));
-
-union aufs_deblk_p {
-	unsigned char	*p;
-	aufs_deblk_t	*deblk;
-	struct aufs_de	*de;
-};
-
-struct aufs_vdir {
-	aufs_deblk_t	**vd_deblk;
-	int		vd_nblk;
-	struct {
-		int			i;
-		union aufs_deblk_p	p;
-	} vd_last;
-
-	unsigned long	vd_version;
-	unsigned long	vd_jiffy;
-};
-
-/* ---------------------------------------------------------------------- */
-
-/* dir.c */
-extern struct file_operations aufs_dir_fop;
-int au_test_empty_lower(struct dentry *dentry);
-int test_empty(struct dentry *dentry, struct aufs_nhash *whlist);
-void au_add_nlink(struct inode *dir, struct inode *h_dir);
-void au_sub_nlink(struct inode *dir, struct inode *h_dir);
-
-/* vdir.c */
-struct aufs_nhash *nhash_new(gfp_t gfp);
-void nhash_del(struct aufs_nhash *nhash);
-void nhash_init(struct aufs_nhash *nhash);
-void nhash_move(struct aufs_nhash *dst, struct aufs_nhash *src);
-void nhash_fin(struct aufs_nhash *nhash);
-int is_longer_wh(struct aufs_nhash *whlist, aufs_bindex_t btgt, int limit);
-int test_known_wh(struct aufs_nhash *whlist, char *name, int namelen);
-int append_wh(struct aufs_nhash *whlist, char *name, int namelen,
-	      aufs_bindex_t bindex);
-void free_vdir(struct aufs_vdir *vdir);
-int au_init_vdir(struct file *file);
-int au_fill_de(struct file *file, void *dirent, filldir_t filldir);
-
-/* ---------------------------------------------------------------------- */
-
-static inline
-unsigned int au_name_hash(const unsigned char *name, unsigned int len)
-{
-	return (full_name_hash(name, len) % AUFS_NHASH_SIZE);
-}
-
-#endif /* __KERNEL__ */
-#endif /* __AUFS_DIR_H__ */
diff -ruN -X X hnd-linux-trunk/fs/aufs/export.c hnd-cleanup/fs/aufs/export.c
--- hnd-linux-trunk/fs/aufs/export.c	2007-09-17 22:43:40.000000000 +0400
+++ hnd-cleanup/fs/aufs/export.c	1970-01-01 03:00:00.000000000 +0300
@@ -1,590 +0,0 @@
-/*
- * Copyright (C) 2007 Junjiro Okajima
- *
- * This program, aufs is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- */
-
-/* $Id: export.c,v 1.8 2007/05/27 23:03:45 sfjro Exp $ */
-
-#include "aufs.h"
-
-extern struct export_operations export_op_default;
-#define CALL(ops, func)	(((ops)->func) ? ((ops)->func) : export_op_default.func)
-#define is_anon(d)	((d)->d_flags & DCACHE_DISCONNECTED)
-
-union conv {
-#if BITS_PER_LONG == 32
-	__u32 a[1];
-#else
-	__u32 a[2];
-#endif
-	ino_t ino;
-};
-
-static ino_t decode_ino(__u32 *a)
-{
-	union conv u;
-	u.a[0] = a[0];
-#if BITS_PER_LONG == 64
-	u.a[1] = a[1];
-#endif
-	return u.ino;
-}
-
-static void encode_ino(__u32 *a, ino_t ino)
-{
-	union conv u;
-	u.ino = ino;
-	a[0] = u.a[0];
-#if BITS_PER_LONG == 64
-	a[1] = u.a[1];
-#endif
-}
-
-static void decode_br_id_sigen(__u32 a, aufs_bindex_t *br_id,
-			       aufs_bindex_t *sigen)
-{
-	BUILD_BUG_ON((sizeof(*br_id) + sizeof(*sigen)) > sizeof(a));
-	*br_id = a >> 16;
-	AuDebugOn(*br_id < 0);
-	*sigen = a;
-	AuDebugOn(*sigen < 0);
-}
-
-static __u32 encode_br_id_sigen(aufs_bindex_t br_id, aufs_bindex_t sigen)
-{
-	AuDebugOn(br_id < 0 || sigen < 0);
-	return (br_id << 16) | sigen;
-}
-
-/* NFS file handle */
-enum {
-	/* support 64bit inode number */
-	/* but untested */
-	Fh_br_id_sigen,
-	Fh_ino1,
-#if BITS_PER_LONG == 64
-	Fh_ino2,
-#endif
-	Fh_dir_ino1,
-#if BITS_PER_LONG == 64
-	Fh_dir_ino2,
-#endif
-	Fh_h_ino1,
-#if BITS_PER_LONG == 64
-	Fh_h_ino2,
-#endif
-	Fh_h_igen,
-	Fh_h_type,
-	Fh_tail,
-
-	Fh_ino = Fh_ino1,
-	Fh_dir_ino = Fh_dir_ino1,
-	Fh_h_ino = Fh_h_ino1,
-};
-
-/* ---------------------------------------------------------------------- */
-
-static struct dentry *decode_by_ino(struct super_block *sb, ino_t ino,
-				    ino_t dir_ino)
-{
-	struct dentry *dentry, *parent;
-	struct inode *inode;
-
-	LKTRTrace("i%lu, diri%lu\n", ino, dir_ino);
-
-	dentry = NULL;
-	inode = ilookup(sb, ino);
-	if (unlikely(!inode))
-		goto out;
-
-	dentry = ERR_PTR(-ESTALE);
-	if (unlikely(is_bad_inode(inode)))
-		goto out_iput;
-
-	dentry = NULL;
-	if (!S_ISDIR(inode->i_mode)) {
-		struct dentry *d;
-		spin_lock(&dcache_lock);
-		list_for_each_entry(d, &inode->i_dentry, d_alias)
-			if (!is_anon(d)
-			    && d->d_parent->d_inode->i_ino == dir_ino) {
-				dentry = dget_locked(d);
-				break;
-			}
-		spin_unlock(&dcache_lock);
-	} else {
-		dentry = d_find_alias(inode);
-		if (dentry && !is_anon(dentry)) {
-			parent = dget_parent(dentry);
-			if (parent->d_inode->i_ino == dir_ino) {
-				dput(parent);
-				goto out_iput; /* success */
-			}
-			dput(parent);
-		}
-
-		dput(dentry);
-		dentry = NULL;
-	}
-
- out_iput:
-	iput(inode);
- out:
-	TraceErrPtr(dentry);
-	return dentry;
-}
-
-/* ---------------------------------------------------------------------- */
-
-struct find_name_by_ino {
-	int called, found;
-	ino_t ino;
-	char *name;
-	int namelen;
-};
-
-static int
-find_name_by_ino(void *arg, const char *name, int namelen, loff_t offset,
-		 filldir_ino_t ino, unsigned int d_type)
-{
-	struct find_name_by_ino *a = arg;
-
-	a->called++;
-	if (a->ino != ino)
-		return 0;
-
-	memcpy(a->name, name, namelen);
-	a->namelen = namelen;
-	a->found = 1;
-	return 1;
-}
-
-static struct dentry *decode_by_dir_ino(struct super_block *sb, ino_t ino,
-					ino_t dir_ino)
-{
-	struct dentry *dentry, *parent;
-	struct inode *dir;
-	struct find_name_by_ino arg;
-	struct file *file;
-	int err;
-
-	LKTRTrace("i%lu, diri%lu\n", ino, dir_ino);
-
-	dentry = NULL;
-	dir = ilookup(sb, dir_ino);
-	if (unlikely(!dir))
-		goto out;
-
-	dentry = ERR_PTR(-ESTALE);
-	if (unlikely(is_bad_inode(dir)))
-		goto out_iput;
-
-	dentry = NULL;
-	parent = d_find_alias(dir);
-	if (parent) {
-		if (unlikely(is_anon(parent))) {
-			dput(parent);
-			goto out_iput;
-		}
-	} else
-		goto out_iput;
-
-	file = dentry_open(parent, NULL, au_dir_roflags);
-	dentry = (void*)file;
-	if (IS_ERR(file))
-		goto out_iput;
-
-	dentry = ERR_PTR(-ENOMEM);
-	arg.name = __getname();
-	if (unlikely(!arg.name))
-		goto out_fput;
-	arg.ino = ino;
-	arg.found = 0;
-
-	do {
-		arg.called = 0;
-		//smp_mb();
-		err = vfsub_readdir(file, find_name_by_ino, &arg, /*dlgt*/0);
-	} while (!err && !arg.found && arg.called);
-	dentry = ERR_PTR(err);
-	if (arg.found) {
-		/* do not call lkup_one(), nor dlgt */
-		i_lock(dir);
-		dentry = lookup_one_len(arg.name, parent, arg.namelen);
-		i_unlock(dir);
-		TraceErrPtr(dentry);
-	}
-
-	//out_putname:
-	__putname(arg.name);
- out_fput:
-	fput(file);
- out_iput:
-	iput(dir);
- out:
-	TraceErrPtr(dentry);
-	return dentry;
-}
-
-/* ---------------------------------------------------------------------- */
-
-struct append_name {
-	int found, called, len;
-	char *h_path;
-	ino_t h_ino;
-};
-
-static int append_name(void *arg, const char *name, int len, loff_t pos,
-		       filldir_ino_t ino, unsigned int d_type)
-{
-	struct append_name *a = arg;
-	char *p;
-
-	a->called++;
-	if (ino != a->h_ino)
-		return 0;
-
-	AuDebugOn(len == 1 && *name == '.');
-	AuDebugOn(len == 2 && name[0] == '.' && name[1] == '.');
-	a->len = strlen(a->h_path);
-	memmove(a->h_path - a->len - 1, a->h_path, a->len);
-	a->h_path -= a->len + 1;
-	p = a->h_path + a->len;
-	*p++ = '/';
-	memcpy(p, name, a->len);
-	a->len += 1 + len;
-	a->found++;
-	return 1;
-}
-
-static int h_acceptable(void *expv, struct dentry *dentry)
-{
-	return 1;
-}
-
-static struct dentry*
-decode_by_path(struct super_block *sb, aufs_bindex_t bindex, __u32 *fh,
-	       int fh_len, void *context)
-{
-	struct dentry *dentry, *h_parent, *root, *h_root;
-	struct super_block *h_sb;
-	char *path, *p;
-	struct vfsmount *h_mnt;
-	struct append_name arg;
-	int len, err;
-	struct file *h_file;
-	struct nameidata nd;
-	struct aufs_branch *br;
-
-	LKTRTrace("b%d\n", bindex);
-	SiMustAnyLock(sb);
-
-	br = stobr(sb, bindex);
-	//br_get(br);
-	h_mnt = br->br_mnt;
-	h_sb = h_mnt->mnt_sb;
-	LKTRTrace("%s, h_decode_fh\n", au_sbtype(h_sb));
-	h_parent = CALL(h_sb->s_export_op, decode_fh)
-		(h_sb, fh + Fh_tail, fh_len - Fh_tail, fh[Fh_h_type],
-		 h_acceptable, /*context*/NULL);
-	dentry = h_parent;
-	if (unlikely(!h_parent || IS_ERR(h_parent))) {
-		Warn1("%s decode_fh failed\n", au_sbtype(h_sb));
-		goto out;
-	}
-	dentry = NULL;
-	if (unlikely(is_anon(h_parent))) {
-		Warn1("%s decode_fh returned a disconnected dentry\n",
-		      au_sbtype(h_sb));
-		dput(h_parent);
-		goto out;
-	}
-
-	dentry = ERR_PTR(-ENOMEM);
-	path = __getname();
-	if (unlikely(!path)) {
-		dput(h_parent);
-		goto out;
-	}
-
-	root = sb->s_root;
-	di_read_lock_parent(root, !AUFS_I_RLOCK);
-	h_root = au_h_dptr_i(root, bindex);
-	di_read_unlock(root, !AUFS_I_RLOCK);
-	arg.h_path = d_path(h_root, h_mnt, path, PATH_MAX);
-	dentry = (void*)arg.h_path;
-	if (unlikely(!arg.h_path || IS_ERR(arg.h_path)))
-		goto out_putname;
-	len = strlen(arg.h_path);
-	arg.h_path = d_path(h_parent, h_mnt, path, PATH_MAX);
-	dentry = (void*)arg.h_path;
-	if (unlikely(!arg.h_path || IS_ERR(arg.h_path)))
-		goto out_putname;
-	LKTRTrace("%s\n", arg.h_path);
-	if (len != 1)
-		arg.h_path += len;
-	LKTRTrace("%s\n", arg.h_path);
-
-	/* cf. fs/exportfs/expfs.c */
-	h_file = dentry_open(h_parent, NULL, au_dir_roflags);
-	dentry = (void*)h_file;
-	if (IS_ERR(h_file))
-		goto out_putname;
-
-	arg.found = 0;
-	arg.h_ino = decode_ino(fh + Fh_h_ino);
-	do {
-		arg.called = 0;
-		err = vfsub_readdir(h_file, append_name, &arg, /*dlgt*/0);
-	} while (!err && !arg.found && arg.called);
-	LKTRTrace("%s, %d\n", arg.h_path, arg.len);
-
-	p = d_path(root, stosi(sb)->si_mnt, path, PATH_MAX - arg.len - 2);
-	dentry = (void*)p;
-	if (unlikely(!p || IS_ERR(p)))
-		goto out_fput;
-	p[strlen(p)] = '/';
-	LKTRTrace("%s\n", p);
-
-	err = path_lookup(p, LOOKUP_FOLLOW, &nd);
-	dentry = ERR_PTR(err);
-	if (!err) {
-		dentry = dget(nd.dentry);
-		if (unlikely(is_anon(dentry))) {
-			dput(dentry);
-			dentry = ERR_PTR(-ESTALE);
-		}
-		path_release(&nd);
-	}
-
- out_fput:
-	fput(h_file);
- out_putname:
-	__putname(path);
- out:
-	//br_put(br);
-	TraceErrPtr(dentry);
-	return dentry;
-}
-
-/* ---------------------------------------------------------------------- */
-
-static struct dentry*
-aufs_decode_fh(struct super_block *sb, __u32 *fh, int fh_len, int fh_type,
-	       int (*acceptable)(void *context, struct dentry *de),
-	       void *context)
-{
-	struct dentry *dentry;
-	ino_t ino, dir_ino;
-	aufs_bindex_t bindex, br_id, sigen_v;
-	struct inode *inode, *h_inode;
-
-	//au_debug_on();
-	LKTRTrace("%d, fh{i%u, br_id_sigen 0x%x, hi%u}\n",
-		  fh_type, fh[Fh_ino], fh[Fh_br_id_sigen], fh[Fh_h_ino]);
-	AuDebugOn(fh_len < Fh_tail);
-
-	si_read_lock(sb);
-	lockdep_off();
-
-	/* branch id may be wrapped around */
-	dentry = ERR_PTR(-ESTALE);
-	decode_br_id_sigen(fh[Fh_br_id_sigen], &br_id, &sigen_v);
-	bindex = find_brindex(sb, br_id);
-	if (unlikely(bindex < 0 || au_sigen(sb) < sigen_v))
-		goto out;
-
-	/* is this inode still cached? */
-	ino = decode_ino(fh + Fh_ino);
-	dir_ino = decode_ino(fh + Fh_dir_ino);
-	dentry = decode_by_ino(sb, ino, dir_ino);
-	if (IS_ERR(dentry))
-		goto out;
-	if (dentry)
-		goto accept;
-
-	/* is the parent dir cached? */
-	dentry = decode_by_dir_ino(sb, ino, dir_ino);
-	if (IS_ERR(dentry))
-		goto out;
-	if (dentry)
-		goto accept;
-
-	/* lookup path */
-	dentry = decode_by_path(sb, bindex, fh, fh_len, context);
-	if (IS_ERR(dentry))
-		goto out;
-	if (unlikely(!dentry))
-		goto out_stale;
-	if (unlikely(dentry->d_inode->i_ino != ino))
-		goto out_dput;
-
- accept:
-	inode = dentry->d_inode;
-	h_inode = NULL;
-	ii_read_lock_child(inode);
-	if (ibstart(inode) <= bindex && bindex <= ibend(inode))
-		h_inode = au_h_iptr_i(inode, bindex);
-	ii_read_unlock(inode);
-	if (h_inode
-	    && h_inode->i_generation == fh[Fh_h_igen]
-	    && acceptable(context, dentry))
-		goto out; /* success */
- out_dput:
-	dput(dentry);
- out_stale:
-	dentry = ERR_PTR(-ESTALE);
- out:
-	lockdep_on();
-	si_read_unlock(sb);
-	TraceErrPtr(dentry);
-	//au_debug_off();
-	return dentry;
-}
-
-/* ---------------------------------------------------------------------- */
-
-static int aufs_encode_fh(struct dentry *dentry, __u32 *fh, int *max_len,
-			  int connectable)
-{
-	int err;
-	struct super_block *sb, *h_sb;
-	struct inode *inode, *h_inode, *dir;
-	aufs_bindex_t bindex;
-	union conv u;
-	struct dentry *parent, *h_parent;
-
-	//au_debug_on();
-	BUILD_BUG_ON(sizeof(u.ino) != sizeof(u.a));
-	LKTRTrace("%.*s, max %d, conn %d\n",
-		  DLNPair(dentry), *max_len, connectable);
-	AuDebugOn(is_anon(dentry));
-	inode = dentry->d_inode;
-	AuDebugOn(!inode);
-	parent = dget_parent(dentry);
-	AuDebugOn(is_anon(parent));
-
-	err = -ENOSPC;
-	if (unlikely(*max_len <= Fh_tail)) {
-		Warn1("NFSv2 client (max_len %d)?\n", *max_len);
-		goto out;
-	}
-
-	sb = dentry->d_sb;
-	si_read_lock(sb);
-	di_read_lock_child(dentry, AUFS_I_RLOCK);
-	di_read_lock_parent(parent, AUFS_I_RLOCK);
-#ifdef CONFIG_AUFS_DEBUG
-	if (unlikely(!au_flag_test(sb, AuFlag_XINO)))
-		Warn1("NFS-exporting requires xino\n");
-#if 0
-	if (unlikely(au_flag_test(sb, AuFlag_UDBA_INOTIFY)))
-		Warn1("udba=inotify is not recommended when exporting\n");
-#endif
-#endif
-
-	err = -EPERM;
-	bindex = ibstart(inode);
-	h_sb = sbr_sb(sb, bindex);
-	if (unlikely(!h_sb->s_export_op)) {
-		Err1("%s branch is not exportable\n", au_sbtype(h_sb));
-		goto out_unlock;
-	}
-
-#if 0 //def CONFIG_AUFS_ROBR
-	if (unlikely(SB_AUFS(h_sb))) {
-		Err1("aufs branch is not supported\n");
-		goto out_unlock;
-	}
-#endif
-
-	/* doesn't support pseudo-link */
-	if (unlikely(bindex < dbstart(dentry)
-		     || dbend(dentry) < bindex
-		     || !au_h_dptr_i(dentry, bindex))) {
-		Err("%.*s/%.*s, b%d, pseudo-link?\n",
-		    DLNPair(parent), DLNPair(dentry), bindex);
-		goto out_unlock;
-	}
-
-	fh[Fh_br_id_sigen] = encode_br_id_sigen(sbr_id(sb, bindex),
-						au_sigen(sb));
-	encode_ino(fh + Fh_ino, inode->i_ino);
-	dir = parent->d_inode;
-	encode_ino(fh + Fh_dir_ino, dir->i_ino);
-	h_inode = au_h_iptr(inode);
-	encode_ino(fh + Fh_h_ino, h_inode->i_ino);
-	fh[Fh_h_igen] = h_inode->i_generation;
-
-	/* it should be set at exporting time */
-	if (unlikely(!h_sb->s_export_op->find_exported_dentry)) {
-		Warn("set default find_exported_dentry for %s\n",
-		     au_sbtype(h_sb));
-		h_sb->s_export_op->find_exported_dentry = find_exported_dentry;
-	}
-
-	*max_len -= Fh_tail;
-	//LKTRTrace("Fh_tail %d, max_len %d\n", Fh_tail, *max_len);
-	h_parent = au_h_dptr_i(parent, bindex);
-	AuDebugOn(is_anon(h_parent));
-	err = fh[Fh_h_type] = CALL(h_sb->s_export_op, encode_fh)
-		(h_parent, fh + Fh_tail, max_len, connectable);
-	*max_len += Fh_tail;
-	if (err != 255)
-		err = 2; //??
-	else
-		Warn1("%s encode_fh failed\n", au_sbtype(h_sb));
-
- out_unlock:
-	di_read_unlock(parent, AUFS_I_RLOCK);
-	aufs_read_unlock(dentry, AUFS_I_RLOCK);
- out:
-	dput(parent);
-	TraceErr(err);
-	//au_debug_off();
-	if (unlikely(err < 0))
-		err = 255;
-	return err;
-}
-
-/* ---------------------------------------------------------------------- */
-
-#if 0
-struct export_operations {
-	struct dentry *(*decode_fh)(struct super_block *sb, __u32 *fh, int fh_len, int fh_type,
-			 int (*acceptable)(void *context, struct dentry *de),
-			 void *context);
-	int (*encode_fh)(struct dentry *de, __u32 *fh, int *max_len,
-			 int connectable);
-
-	/* the following are only called from the filesystem itself */
-	int (*get_name)(struct dentry *parent, char *name,
-			struct dentry *child);
-	struct dentry * (*get_parent)(struct dentry *child);
-	struct dentry * (*get_dentry)(struct super_block *sb, void *inump);
-
-	/* This is set by the exporting module to a standard helper */
-	struct dentry * (*find_exported_dentry)(
-		struct super_block *sb, void *obj, void *parent,
-		int (*acceptable)(void *context, struct dentry *de),
-		void *context);
-};
-#endif
-
-struct export_operations aufs_export_op = {
-	.decode_fh = aufs_decode_fh,
-	.encode_fh = aufs_encode_fh
-};
diff -ruN -X X hnd-linux-trunk/fs/aufs/file.c hnd-cleanup/fs/aufs/file.c
--- hnd-linux-trunk/fs/aufs/file.c	2007-09-17 22:43:40.000000000 +0400
+++ hnd-cleanup/fs/aufs/file.c	1970-01-01 03:00:00.000000000 +0300
@@ -1,848 +0,0 @@
-/*
- * Copyright (C) 2005, 2006, 2007 Junjiro Okajima
- *
- * This program, aufs is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- */
-
-/* $Id: file.c,v 1.46 2007/06/11 01:41:50 sfjro Exp $ */
-
-//#include <linux/fsnotify.h>
-#include <linux/pagemap.h>
-//#include <linux/poll.h>
-//#include <linux/security.h>
-#include "aufs.h"
-
-/* drop flags for writing */
-unsigned int au_file_roflags(unsigned int flags)
-{
-	flags &= ~(O_WRONLY | O_RDWR | O_APPEND | O_CREAT | O_TRUNC);
-	flags |= O_RDONLY | O_NOATIME;
-	return flags;
-}
-
-/* common functions to regular file and dir */
-struct file *hidden_open(struct dentry *dentry, aufs_bindex_t bindex, int flags)
-{
-	struct dentry *hidden_dentry;
-	struct inode *hidden_inode;
-	struct super_block *sb;
-	struct vfsmount *hidden_mnt;
-	struct file *hidden_file;
-	struct aufs_branch *br;
-	loff_t old_size;
-	int udba;
-
-	LKTRTrace("%.*s, b%d, flags 0%o\n", DLNPair(dentry), bindex, flags);
-	AuDebugOn(!dentry);
-	hidden_dentry = au_h_dptr_i(dentry, bindex);
-	AuDebugOn(!hidden_dentry);
-	hidden_inode = hidden_dentry->d_inode;
-	AuDebugOn(!hidden_inode);
-
-	sb = dentry->d_sb;
-	udba = au_flag_test(sb, AuFlag_UDBA_INOTIFY);
-	if (unlikely(udba)) {
-		// test here?
-	}
-
-	br = stobr(sb, bindex);
-	br_get(br);
-	/* drop flags for writing */
-	if (test_ro(sb, bindex, dentry->d_inode))
-		flags = au_file_roflags(flags);
-	flags &= ~O_CREAT;
-	spin_lock(&hidden_inode->i_lock);
-	old_size = i_size_read(hidden_inode);
-	spin_unlock(&hidden_inode->i_lock);
-
-	//DbgSleep(3);
-
-	dget(hidden_dentry);
-	hidden_mnt = mntget(br->br_mnt);
-	hidden_file = dentry_open(hidden_dentry, hidden_mnt, flags);
-	//if (LktrCond) {fput(hidden_file); hidden_file = ERR_PTR(-1);}
-
-	if (!IS_ERR(hidden_file)) {
-#if 0 // remove this
-		if (/* old_size && */ (flags & O_TRUNC)) {
-			au_direval_dec(dentry);
-			if (!IS_ROOT(dentry))
-				au_direval_dec(dentry->d_parent);
-		}
-#endif
-		return hidden_file;
-	}
-
-	br_put(br);
-	TraceErrPtr(hidden_file);
-	return hidden_file;
-}
-
-#if 0
-static int do_coo(struct dentry *dentry, aufs_bindex_t bstart)
-{
-	int err;
-	struct dentry *parent, *h_parent, *h_dentry;
-	aufs_bindex_t bcpup;
-	struct inode *h_dir, *h_inode, *dir;
-
-	LKTRTrace("%.*s\n", DLNPair(dentry));
-	AuDebugOn(IS_ROOT(dentry));
-	DiMustWriteLock(dentry);
-
-	parent = dget_parent(dentry);
-	di_write_lock_parent(parent);
-	bcpup = err = find_rw_parent_br(dentry, bstart);
-	//bcpup = err = find_rw_br(sb, bstart);
-	if (unlikely(err < 0)) {
-		err = 0; // stop copyup, it is not an error
-		goto out;
-	}
-	err = 0;
-
-	h_parent = au_h_dptr_i(parent, bcpup);
-	if (!h_parent) {
-		err = cpup_dirs(dentry, bcpup, NULL);
-		if (unlikely(err))
-			goto out;
-		h_parent = au_h_dptr_i(parent, bcpup);
-	}
-
-	h_dir = h_parent->d_inode;
-	h_dentry = au_h_dptr_i(dentry, bstart);
-	h_inode = h_dentry->d_inode;
-	dir = parent->d_inode;
-	hdir_lock(h_dir, dir, bcpup);
-	hi_lock_child(h_inode);
-	AuDebugOn(au_h_dptr_i(dentry, bcpup));
-	err = sio_cpup_simple(dentry, bcpup, -1,
-			      au_flags_cpup(CPUP_DTIME, parent));
-	TraceErr(err);
-	i_unlock(h_inode);
-	hdir_unlock(h_dir, dir, bcpup);
-
- out:
-	di_write_unlock(parent);
-	dput(parent);
-	TraceErr(err);
-	return err;
-}
-#endif
-
-int au_do_open(struct inode *inode, struct file *file,
-	       int (*open)(struct file *file, int flags))
-{
-	int err, coo;
-	struct dentry *dentry;
-	struct super_block *sb;
-	aufs_bindex_t bstart;
-	//struct inode *h_dir, *dir;
-
-	dentry = file->f_dentry;
-	LKTRTrace("i%lu, %.*s\n", inode->i_ino, DLNPair(dentry));
-
-	sb = dentry->d_sb;
-	si_read_lock(sb);
-	coo = 0;
-#if 0
-	switch (au_flag_test_coo(sb)) {
-	case AuFlag_COO_LEAF:
-		coo = !S_ISDIR(inode->i_mode);
-		break;
-	case AuFlag_COO_ALL:
-		coo = 1;
-		break;
-	}
-#endif
-	err = au_init_finfo(file);
-	//if (LktrCond) {fi_write_unlock(file); fin_finfo(file); err = -1;}
-	if (unlikely(err))
-		goto out;
-
-	if (!coo) {
-		di_read_lock_child(dentry, AUFS_I_RLOCK);
-		bstart = dbstart(dentry);
-#if 0
-	} else {
-		di_write_lock_child(dentry);
-		bstart = dbstart(dentry);
-		if (test_ro(sb, bstart, dentry->d_inode)) {
-			err = do_coo(dentry, bstart);
-			if (err) {
-				di_write_unlock(dentry);
-				goto out_finfo;
-			}
-			bstart = dbstart(dentry);
-		}
-		di_downgrade_lock(dentry, AUFS_I_RLOCK);
-#endif
-	}
-
-	// todo: remove this extra locks
-#if 0
-	dir = dentry->d_parent->d_inode;
-	if (!IS_ROOT(dentry))
-		ii_read_lock_parent(dir);
-	h_dir = au_h_iptr_i(dir, bstart);
-	hdir_lock(h_dir, dir, bstart);
-#endif
-	err = open(file, file->f_flags);
-	//if (LktrCond) err = -1;
-#if 0
-	hdir_unlock(h_dir, dir, bstart);
-	if (!IS_ROOT(dentry))
-		ii_read_unlock(dir);
-#endif
-	di_read_unlock(dentry, AUFS_I_RLOCK);
-
-// out_finfo:
-	fi_write_unlock(file);
-	if (unlikely(err))
-		au_fin_finfo(file);
-	//DbgFile(file);
- out:
-	si_read_unlock(sb);
-	TraceErr(err);
-	return err;
-}
-
-int au_reopen_nondir(struct file *file)
-{
-	int err;
-	struct dentry *dentry;
-	aufs_bindex_t bstart, bindex, bend;
-	struct file *hidden_file, *h_file_tmp;
-
-	dentry = file->f_dentry;
-	LKTRTrace("%.*s\n", DLNPair(dentry));
-	AuDebugOn(S_ISDIR(dentry->d_inode->i_mode)
-		  || !au_h_dptr(dentry)->d_inode);
-	bstart = dbstart(dentry);
-
-	h_file_tmp = NULL;
-	if (fbstart(file) == bstart) {
-		hidden_file = au_h_fptr(file);
-		if (file->f_mode == hidden_file->f_mode)
-			return 0; /* success */
-		h_file_tmp = hidden_file;
-		get_file(h_file_tmp);
-		set_h_fptr(file, bstart, NULL);
-	}
-	AuDebugOn(fbstart(file) < bstart
-		  || ftofi(file)->fi_hfile[0 + bstart].hf_file);
-
-	hidden_file = hidden_open(dentry, bstart, file->f_flags & ~O_TRUNC);
-	//if (LktrCond) {fput(hidden_file); br_put(stobr(dentry->d_sb, bstart));
-	//hidden_file = ERR_PTR(-1);}
-	err = PTR_ERR(hidden_file);
-	if (IS_ERR(hidden_file))
-		goto out; // close all?
-	err = 0;
-	//cpup_file_flags(hidden_file, file);
-	set_fbstart(file, bstart);
-	set_h_fptr(file, bstart, hidden_file);
-	memcpy(&hidden_file->f_ra, &file->f_ra, sizeof(file->f_ra)); //??
-
-	/* close lower files */
-	bend = fbend(file);
-	for (bindex = bstart + 1; bindex <= bend; bindex++)
-		set_h_fptr(file, bindex, NULL);
-	set_fbend(file, bstart);
-
- out:
-	if (h_file_tmp)
-		fput(h_file_tmp);
-	TraceErr(err);
-	return err;
-}
-
-/*
- * copyup the deleted file for writing.
- */
-static int cpup_wh_file(struct file *file, aufs_bindex_t bdst, loff_t len)
-{
-	int err;
-	struct dentry *dentry, *parent, *hidden_parent, *tmp_dentry;
-	struct dentry *hidden_dentry_bstart, *hidden_dentry_bdst;
-	struct inode *hidden_dir;
-	aufs_bindex_t bstart;
-	struct aufs_dinfo *dinfo;
-	struct dtime dt;
-	struct lkup_args lkup;
-	struct super_block *sb;
-
-	dentry = file->f_dentry;
-	LKTRTrace("%.*s, bdst %d, len %Lu\n", DLNPair(dentry), bdst, len);
-	AuDebugOn(S_ISDIR(dentry->d_inode->i_mode)
-		  || !(file->f_mode & FMODE_WRITE));
-	DiMustWriteLock(dentry);
-	parent = dget_parent(dentry);
-	IiMustAnyLock(parent->d_inode);
-	hidden_parent = au_h_dptr_i(parent, bdst);
-	AuDebugOn(!hidden_parent);
-	hidden_dir = hidden_parent->d_inode;
-	AuDebugOn(!hidden_dir);
-	IMustLock(hidden_dir);
-
-	sb = parent->d_sb;
-	lkup.nfsmnt = au_nfsmnt(sb, bdst);
-	lkup.dlgt = need_dlgt(sb);
-	tmp_dentry = lkup_whtmp(hidden_parent, &dentry->d_name, &lkup);
-	//if (LktrCond) {dput(tmp_dentry); tmp_dentry = ERR_PTR(-1);}
-	err = PTR_ERR(tmp_dentry);
-	if (IS_ERR(tmp_dentry))
-		goto out;
-
-	dtime_store(&dt, parent, hidden_parent);
-	dinfo = dtodi(dentry);
-	bstart = dinfo->di_bstart;
-	hidden_dentry_bdst = dinfo->di_hdentry[0 + bdst].hd_dentry;
-	hidden_dentry_bstart = dinfo->di_hdentry[0 + bstart].hd_dentry;
-	dinfo->di_bstart = bdst;
-	dinfo->di_hdentry[0 + bdst].hd_dentry = tmp_dentry;
-	dinfo->di_hdentry[0 + bstart].hd_dentry = au_h_fptr(file)->f_dentry;
-	err = cpup_single(dentry, bdst, bstart, len,
-			  au_flags_cpup(!CPUP_DTIME, parent));
-	//if (LktrCond) err = -1;
-	if (!err)
-		err = au_reopen_nondir(file);
-		//err = -1;
-	dinfo->di_hdentry[0 + bstart].hd_dentry = hidden_dentry_bstart;
-	dinfo->di_hdentry[0 + bdst].hd_dentry = hidden_dentry_bdst;
-	dinfo->di_bstart = bstart;
-	if (unlikely(err))
-		goto out_tmp;
-
-	AuDebugOn(!d_unhashed(dentry));
-	err = vfsub_unlink(hidden_dir, tmp_dentry, lkup.dlgt);
-	//if (LktrCond) err = -1;
-	if (unlikely(err)) {
-		IOErr("failed remove copied-up tmp file %.*s(%d)\n",
-		      DLNPair(tmp_dentry), err);
-		err = -EIO;
-	}
-	dtime_revert(&dt, !CPUP_LOCKED_GHDIR);
-
- out_tmp:
-	dput(tmp_dentry);
- out:
-	dput(parent);
-	TraceErr(err);
-	return err;
-}
-
-struct cpup_wh_file_args {
-	int *errp;
-	struct file *file;
-	aufs_bindex_t bdst;
-	loff_t len;
-};
-
-static void call_cpup_wh_file(void *args)
-{
-	struct cpup_wh_file_args *a = args;
-	*a->errp = cpup_wh_file(a->file, a->bdst, a->len);
-}
-
-/*
- * prepare the @file for writing.
- */
-int au_ready_to_write(struct file *file, loff_t len)
-{
-	int err, wkq_err;
-	struct dentry *dentry, *parent, *hidden_dentry, *hidden_parent;
-	struct inode *hidden_inode, *hidden_dir, *inode, *dir;
-	struct super_block *sb;
-	aufs_bindex_t bstart, bcpup;
-
-	dentry = file->f_dentry;
-	LKTRTrace("%.*s, len %Ld\n", DLNPair(dentry), len);
-	FiMustWriteLock(file);
-
-	sb = dentry->d_sb;
-	bstart = fbstart(file);
-	AuDebugOn(ftobr(file, bstart) != stobr(sb, bstart));
-
-	inode = dentry->d_inode;
-	ii_read_lock_child(inode);
-	LKTRTrace("rdonly %d, bstart %d\n", test_ro(sb, bstart, inode), bstart);
-	err = test_ro(sb, bstart, inode);
-	ii_read_unlock(inode);
-	if (!err && (au_h_fptr(file)->f_mode & FMODE_WRITE))
-		return 0;
-
-	/* need to cpup */
-	parent = dget_parent(dentry);
-	di_write_lock_child(dentry);
-	di_write_lock_parent(parent);
-	bcpup = err = find_rw_parent_br(dentry, bstart);
-	//bcpup = err = find_rw_br(sb, bstart);
-	if (unlikely(err < 0))
-		goto out_unlock;
-	err = 0;
-
-	hidden_parent = au_h_dptr_i(parent, bcpup);
-	if (!hidden_parent) {
-		err = cpup_dirs(dentry, bcpup, NULL);
-		//if (LktrCond) err = -1;
-		if (unlikely(err))
-			goto out_unlock;
-		hidden_parent = au_h_dptr_i(parent, bcpup);
-	}
-
-	hidden_dir = hidden_parent->d_inode;
-	hidden_dentry = au_h_fptr(file)->f_dentry;
-	hidden_inode = hidden_dentry->d_inode;
-	dir = parent->d_inode;
-	hdir_lock(hidden_dir, dir, bcpup);
-	hi_lock_child(hidden_inode);
-	if (d_unhashed(dentry) || d_unhashed(hidden_dentry)
-	    /* || !hidden_inode->i_nlink */) {
-		if (!au_test_perm(hidden_dir, MAY_EXEC | MAY_WRITE,
-				  need_dlgt(sb)))
-			err = cpup_wh_file(file, bcpup, len);
-		else {
-			struct cpup_wh_file_args args = {
-				.errp	= &err,
-				.file	= file,
-				.bdst	= bcpup,
-				.len	= len
-			};
-			wkq_err = au_wkq_wait(call_cpup_wh_file, &args,
-					      /*dlgt*/0);
-			if (unlikely(wkq_err))
-				err = wkq_err;
-		}
-		//if (LktrCond) err = -1;
-		TraceErr(err);
-	} else {
-		if (!au_h_dptr_i(dentry, bcpup))
-			err = sio_cpup_simple(dentry, bcpup, len,
-					      au_flags_cpup(CPUP_DTIME,
-							    parent));
-		//if (LktrCond) err = -1;
-		TraceErr(err);
-		if (!err)
-			err = au_reopen_nondir(file);
-		//if (LktrCond) err = -1;
-		TraceErr(err);
-	}
-	i_unlock(hidden_inode);
-	hdir_unlock(hidden_dir, dir, bcpup);
-
- out_unlock:
-	di_write_unlock(parent);
-	di_write_unlock(dentry);
-	dput(parent);
-	TraceErr(err);
-	return err;
-
-}
-
-/* ---------------------------------------------------------------------- */
-
-/*
- * after branch manipulating, refresh the file.
- */
-static int refresh_file(struct file *file, int (*reopen)(struct file *file))
-{
-	int err, new_sz;
-	struct dentry *dentry;
-	aufs_bindex_t bend, bindex, bstart, brid;
-	struct aufs_hfile *p;
-	struct aufs_finfo *finfo;
-	struct super_block *sb;
-	struct inode *inode;
-	struct file *hidden_file;
-
-	dentry = file->f_dentry;
-	LKTRTrace("%.*s\n", DLNPair(dentry));
-	FiMustWriteLock(file);
-	DiMustReadLock(dentry);
-	inode = dentry->d_inode;
-	IiMustReadLock(inode);
-	//au_debug_on();
-	//DbgDentry(dentry);
-	//DbgFile(file);
-	//au_debug_off();
-
-	err = -ENOMEM;
-	sb = dentry->d_sb;
-	finfo = ftofi(file);
-	bstart = finfo->fi_bstart;
-	bend = finfo->fi_bstart;
-	new_sz = sizeof(*finfo->fi_hfile) * (sbend(sb) + 1);
-	p = au_kzrealloc(finfo->fi_hfile, sizeof(*p) * (finfo->fi_bend + 1),
-			 new_sz, GFP_KERNEL);
-	//p = NULL;
-	if (unlikely(!p))
-		goto out;
-	finfo->fi_hfile = p;
-	hidden_file = p[0 + bstart].hf_file;
-
-	p = finfo->fi_hfile + finfo->fi_bstart;
-	brid = p->hf_br->br_id;
-	bend = finfo->fi_bend;
-	for (bindex = finfo->fi_bstart; bindex <= bend; bindex++, p++) {
-		struct aufs_hfile tmp, *q;
-		aufs_bindex_t new_bindex;
-
-		if (!p->hf_file)
-			continue;
-		new_bindex = find_bindex(sb, p->hf_br);
-		if (new_bindex == bindex)
-			continue;
-		if (new_bindex < 0) { // test here
-			set_h_fptr(file, bindex, NULL);
-			continue;
-		}
-
-		/* swap two hidden inode, and loop again */
-		q = finfo->fi_hfile + new_bindex;
-		tmp = *q;
-		*q = *p;
-		*p = tmp;
-		if (tmp.hf_file) {
-			bindex--;
-			p--;
-		}
-	}
-	{
-		aufs_bindex_t s = finfo->fi_bstart, e = finfo->fi_bend;
-		finfo->fi_bstart = 0;
-		finfo->fi_bend = sbend(sb);
-		//au_debug_on();
-		//DbgFile(file);
-		//au_debug_off();
-		finfo->fi_bstart = s;
-		finfo->fi_bend = e;
-	}
-
-	p = finfo->fi_hfile;
-	if (!au_is_mmapped(file) && !d_unhashed(dentry)) {
-		bend = sbend(sb);
-		for (finfo->fi_bstart = 0; finfo->fi_bstart <= bend;
-		     finfo->fi_bstart++, p++)
-			if (p->hf_file) {
-				if (p->hf_file->f_dentry
-				    && p->hf_file->f_dentry->d_inode)
-					break;
-				else
-					au_hfput(p);
-			}
-	} else {
-		bend = find_brindex(sb, brid);
-		//LKTRTrace("%d\n", bend);
-		for (finfo->fi_bstart = 0; finfo->fi_bstart < bend;
-		     finfo->fi_bstart++, p++)
-			if (p->hf_file)
-				au_hfput(p);
-		//LKTRTrace("%d\n", finfo->fi_bstart);
-		bend = sbend(sb);
-	}
-
-	p = finfo->fi_hfile + bend;
-	for (finfo->fi_bend = bend; finfo->fi_bend >= finfo->fi_bstart;
-	     finfo->fi_bend--, p--)
-		if (p->hf_file) {
-			if (p->hf_file->f_dentry
-			    && p->hf_file->f_dentry->d_inode)
-				break;
-			else
-				au_hfput(p);
-		}
-	//Dbg("%d, %d\n", finfo->fi_bstart, finfo->fi_bend);
-	AuDebugOn(finfo->fi_bend < finfo->fi_bstart);
-	//DbgFile(file);
-	//DbgDentry(file->f_dentry);
-
-	err = 0;
-#if 0 // todo:
-	if (!au_h_dptr(dentry)->d_inode) {
-		au_update_figen(file);
-		goto out; /* success */
-	}
-#endif
-
-	if (unlikely(au_is_mmapped(file) || d_unhashed(dentry)))
-		goto out_update; /* success */
-
- again:
-	bstart = ibstart(inode);
-	if (bstart < finfo->fi_bstart
-	    && au_flag_test(sb, AuFlag_PLINK)
-	    && au_is_plinked(sb, inode)) {
-		struct dentry *parent = dentry->d_parent; // dget_parent()
-		struct inode *dir = parent->d_inode, *h_dir;
-
-		if (test_ro(sb, bstart, inode)) {
-			di_read_lock_parent(parent, !AUFS_I_RLOCK);
-			bstart = err = find_rw_parent_br(dentry, bstart);
-			//bstart = err = find_rw_br(sb, bstart);
-			di_read_unlock(parent, !AUFS_I_RLOCK);
-			//todo: err = -1;
-			if (unlikely(err < 0))
-				goto out;
-		}
-		di_read_unlock(dentry, AUFS_I_RLOCK);
-		di_write_lock_child(dentry);
-		if (bstart != ibstart(inode)) { // todo
-			/* someone changed our inode while we were sleeping */
-			di_downgrade_lock(dentry, AUFS_I_RLOCK);
-			goto again;
-		}
-
-		di_read_lock_parent(parent, AUFS_I_RLOCK);
-		err = test_and_cpup_dirs(dentry, bstart, NULL);
-
-		// always superio.
-#if 1
-		h_dir = au_h_dptr_i(parent, bstart)->d_inode;
-		hdir_lock(h_dir, dir, bstart);
-		err = sio_cpup_simple(dentry, bstart, -1,
-				      au_flags_cpup(CPUP_DTIME, parent));
-		hdir_unlock(h_dir, dir, bstart);
-		di_read_unlock(parent, AUFS_I_RLOCK);
-#else
-		if (!is_au_wkq(current)) {
-			int wkq_err;
-			struct cpup_pseudo_link_args args = {
-				.errp		= &err,
-				.dentry		= dentry,
-				.bdst		= bstart,
-				.do_lock	= 1
-			};
-			wkq_err = au_wkq_wait(call_cpup_pseudo_link, &args);
-			if (unlikely(wkq_err))
-				err = wkq_err;
-		} else
-			err = cpup_pseudo_link(dentry, bstart, /*do_lock*/1);
-#endif
-		di_downgrade_lock(dentry, AUFS_I_RLOCK);
-		if (unlikely(err))
-			goto out;
-	}
-
-	err = reopen(file);
-	//err = -1;
- out_update:
-	if (!err) {
-		au_update_figen(file);
-		//DbgFile(file);
-		return 0; /* success */
-	}
-
-	/* error, close all hidden files */
-	bend = fbend(file);
-	for (bindex = fbstart(file); bindex <= bend; bindex++)
-		set_h_fptr(file, bindex, NULL);
-
- out:
-	TraceErr(err);
-	return err;
-}
-
-/* common function to regular file and dir */
-int au_reval_and_lock_finfo(struct file *file, int (*reopen)(struct file *file),
-			    int wlock, int locked)
-{
-	int err, sgen, fgen, pseudo_link;
-	struct dentry *dentry;
-	struct super_block *sb;
-	aufs_bindex_t bstart;
-
-	dentry = file->f_dentry;
-	LKTRTrace("%.*s, w %d, l %d\n", DLNPair(dentry), wlock, locked);
-	sb = dentry->d_sb;
-	SiMustAnyLock(sb);
-
-	err = 0;
-	sgen = au_sigen(sb);
-	fi_write_lock(file);
-	fgen = au_figen(file);
-	di_read_lock_child(dentry, AUFS_I_RLOCK);
-	bstart = dbstart(dentry);
-	pseudo_link = (bstart != ibstart(dentry->d_inode));
-	di_read_unlock(dentry, AUFS_I_RLOCK);
-	if (sgen == fgen && !pseudo_link && fbstart(file) == bstart) {
-		if (!wlock)
-			fi_downgrade_lock(file);
-		return 0; /* success */
-	}
-
-	LKTRTrace("sgen %d, fgen %d\n", sgen, fgen);
-	if (sgen != au_digen(dentry)) {
-		/*
-		 * d_path() and path_lookup() is a simple and good approach
-		 * to revalidate. but si_rwsem in DEBUG_RWSEM will cause a
-		 * deadlock. removed the code.
-		 */
-		di_write_lock_child(dentry);
-		err = au_reval_dpath(dentry, sgen);
-		//if (LktrCond) err = -1;
-		di_write_unlock(dentry);
-		if (unlikely(err < 0))
-			goto out;
-		AuDebugOn(au_digen(dentry) != sgen);
-	}
-
-	di_read_lock_child(dentry, AUFS_I_RLOCK);
-	err = refresh_file(file, reopen);
-	//if (LktrCond) err = -1;
-	di_read_unlock(dentry, AUFS_I_RLOCK);
-	if (!err) {
-		if (!wlock)
-			fi_downgrade_lock(file);
-	} else
-		fi_write_unlock(file);
-
- out:
-	TraceErr(err);
-	return err;
-}
-
-/* ---------------------------------------------------------------------- */
-
-// cf. aufs_nopage()
-// for madvise(2)
-static int aufs_readpage(struct file *file, struct page *page)
-{
-	TraceEnter();
-	unlock_page(page);
-	return 0;
-}
-
-// they will never be called.
-#ifdef CONFIG_AUFS_DEBUG
-static int aufs_prepare_write(struct file *file, struct page *page,
-			      unsigned from, unsigned to)
-{BUG();return 0;}
-static int aufs_commit_write(struct file *file, struct page *page,
-			     unsigned from, unsigned to)
-{BUG();return 0;}
-static int aufs_writepage(struct page *page, struct writeback_control *wbc)
-{BUG();return 0;}
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,17)
-static void aufs_sync_page(struct page *page)
-{BUG();}
-#else
-static int aufs_sync_page(struct page *page)
-{BUG(); return 0;}
-#endif
-
-#if 0 // comment
-static int aufs_writepages(struct address_space *mapping,
-			   struct writeback_control *wbc)
-{BUG();return 0;}
-static int aufs_readpages(struct file *filp, struct address_space *mapping,
-			  struct list_head *pages, unsigned nr_pages)
-{BUG();return 0;}
-static sector_t aufs_bmap(struct address_space *mapping, sector_t block)
-{BUG();return 0;}
-#endif
-
-static int aufs_set_page_dirty(struct page *page)
-{BUG();return 0;}
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,17)
-static void aufs_invalidatepage (struct page *page, unsigned long offset)
-{BUG();}
-#else
-static int aufs_invalidatepage (struct page *page, unsigned long offset)
-{BUG(); return 0;}
-#endif
-static int aufs_releasepage (struct page *page, gfp_t gfp)
-{BUG();return 0;}
-static ssize_t aufs_direct_IO(int rw, struct kiocb *iocb,
-			      const struct iovec *iov, loff_t offset,
-			      unsigned long nr_segs)
-{BUG();return 0;}
-static struct page* aufs_get_xip_page(struct address_space *mapping,
-				      sector_t offset, int create)
-{BUG();return NULL;}
-//static int aufs_migratepage (struct page *newpage, struct page *page)
-//{BUG();return 0;}
-#endif
-
-#if 0 // comment
-struct address_space {
-	struct inode		*host;		/* owner: inode, block_device */
-	struct radix_tree_root	page_tree;	/* radix tree of all pages */
-	rwlock_t		tree_lock;	/* and rwlock protecting it */
-	unsigned int		i_mmap_writable;/* count VM_SHARED mappings */
-	struct prio_tree_root	i_mmap;		/* tree of private and shared mappings */
-	struct list_head	i_mmap_nonlinear;/*list VM_NONLINEAR mappings */
-	spinlock_t		i_mmap_lock;	/* protect tree, count, list */
-	unsigned int		truncate_count;	/* Cover race condition with truncate */
-	unsigned long		nrpages;	/* number of total pages */
-	pgoff_t			writeback_index;/* writeback starts here */
-	struct address_space_operations *a_ops;	/* methods */
-	unsigned long		flags;		/* error bits/gfp mask */
-	struct backing_dev_info *backing_dev_info; /* device readahead, etc */
-	spinlock_t		private_lock;	/* for use by the address_space */
-	struct list_head	private_list;	/* ditto */
-	struct address_space	*assoc_mapping;	/* ditto */
-} __attribute__((aligned(sizeof(long))));
-
-struct address_space_operations {
-	int (*writepage)(struct page *page, struct writeback_control *wbc);
-	int (*readpage)(struct file *, struct page *);
-	void (*sync_page)(struct page *);
-
-	/* Write back some dirty pages from this mapping. */
-	int (*writepages)(struct address_space *, struct writeback_control *);
-
-	/* Set a page dirty.  Return true if this dirtied it */
-	int (*set_page_dirty)(struct page *page);
-
-	int (*readpages)(struct file *filp, struct address_space *mapping,
-			struct list_head *pages, unsigned nr_pages);
-
-	/*
-	 * ext3 requires that a successful prepare_write() call be followed
-	 * by a commit_write() call - they must be balanced
-	 */
-	int (*prepare_write)(struct file *, struct page *, unsigned, unsigned);
-	int (*commit_write)(struct file *, struct page *, unsigned, unsigned);
-	/* Unfortunately this kludge is needed for FIBMAP. Don't use it */
-	sector_t (*bmap)(struct address_space *, sector_t);
-	void (*invalidatepage) (struct page *, unsigned long);
-	int (*releasepage) (struct page *, gfp_t);
-	ssize_t (*direct_IO)(int, struct kiocb *, const struct iovec *iov,
-			loff_t offset, unsigned long nr_segs);
-	struct page* (*get_xip_page)(struct address_space *, sector_t,
-			int);
-	/* migrate the contents of a page to the specified target */
-	int (*migratepage) (struct page *, struct page *);
-};
-#endif
-
-struct address_space_operations aufs_aop = {
-	.readpage	= aufs_readpage,
-#ifdef CONFIG_AUFS_DEBUG
-	.writepage	= aufs_writepage,
-	.sync_page	= aufs_sync_page,
-	//.writepages	= aufs_writepages,
-	.set_page_dirty	= aufs_set_page_dirty,
-	//.readpages	= aufs_readpages,
-	.prepare_write	= aufs_prepare_write,
-	.commit_write	= aufs_commit_write,
-	//.bmap		= aufs_bmap,
-	.invalidatepage	= aufs_invalidatepage,
-	.releasepage	= aufs_releasepage,
-	.direct_IO	= aufs_direct_IO,
-	.get_xip_page	= aufs_get_xip_page,
-	//.migratepage	= aufs_migratepage
-#endif
-};
diff -ruN -X X hnd-linux-trunk/fs/aufs/file.h hnd-cleanup/fs/aufs/file.h
--- hnd-linux-trunk/fs/aufs/file.h	2007-09-17 22:43:40.000000000 +0400
+++ hnd-cleanup/fs/aufs/file.h	1970-01-01 03:00:00.000000000 +0300
@@ -1,140 +0,0 @@
-/*
- * Copyright (C) 2005, 2006, 2007 Junjiro Okajima
- *
- * This program, aufs is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- */
-
-/* $Id: file.h,v 1.25 2007/05/14 03:41:52 sfjro Exp $ *