From 309c8c5331eba8c9fc8b0e239f4a5966739af63a Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Thu, 2 Jun 2011 19:18:47 +0100 Subject: [PATCH] --- yaml --- r: 261855 b: refs/heads/master c: ca7a71824ac957b1b9d3322656c05aad38d7275c h: refs/heads/master i: 261853: 09384612a50232b49e6738a4c42fd59f0c6c6d68 261851: 8759c0af4fde623a5c49788b17cfcebdaa7bb106 261847: 06b98ae56795cb840a98877542fc37d767655186 261839: a1d6fd5e30fa1287516b7953c6c040a914de71f3 261823: 014f9e01c26d1f34c5aeac3ba2c63f157b3365cb v: v3 --- [refs] | 2 +- trunk/arch/m68k/Kconfig.mmu | 6 + trunk/arch/m68k/amiga/chipram.c | 136 +++--- trunk/arch/m68k/atari/stram.c | 354 ++++++++++++--- trunk/arch/m68k/include/asm/atari_stram.h | 3 +- trunk/arch/m68k/include/asm/atarihw.h | 4 +- trunk/arch/m68k/kernel/setup_mm.c | 2 - trunk/arch/m68k/math-emu/fp_log.c | 3 + trunk/arch/m68k/math-emu/multi_arith.h | 530 ++++++++++++++++++++++ trunk/arch/m68k/mm/init_mm.c | 5 + trunk/arch/sparc/kernel/ioport.c | 32 +- trunk/drivers/mfd/wm831x-irq.c | 24 +- trunk/fs/nfs/pnfs.h | 2 +- trunk/include/linux/ioport.h | 1 - trunk/include/linux/mfd/wm831x/core.h | 4 + trunk/include/linux/nfs_fs_sb.h | 2 +- trunk/kernel/resource.c | 21 - 17 files changed, 956 insertions(+), 175 deletions(-) diff --git a/[refs] b/[refs] index fd600f6112a1..b584fa121fd7 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 968e75fc13b6d582f42ce44172e13ba58157e11f +refs/heads/master: ca7a71824ac957b1b9d3322656c05aad38d7275c diff --git a/trunk/arch/m68k/Kconfig.mmu b/trunk/arch/m68k/Kconfig.mmu index 13e20bbc4079..16539b1d5d3a 100644 --- a/trunk/arch/m68k/Kconfig.mmu +++ b/trunk/arch/m68k/Kconfig.mmu @@ -372,6 +372,12 @@ config AMIGA_PCMCIA Include support in the kernel for pcmcia on Amiga 1200 and Amiga 600. If you intend to use pcmcia cards say Y; otherwise say N. +config STRAM_PROC + bool "ST-RAM statistics in /proc" + depends on ATARI + help + Say Y here to report ST-RAM usage statistics in /proc/stram. + config HEARTBEAT bool "Use power LED as a heartbeat" if AMIGA || APOLLO || ATARI || MAC ||Q40 default y if !AMIGA && !APOLLO && !ATARI && !MAC && !Q40 && HP300 diff --git a/trunk/arch/m68k/amiga/chipram.c b/trunk/arch/m68k/amiga/chipram.c index 99449fbf9a72..dd0447db1c90 100644 --- a/trunk/arch/m68k/amiga/chipram.c +++ b/trunk/arch/m68k/amiga/chipram.c @@ -16,7 +16,6 @@ #include #include -#include #include #include @@ -24,100 +23,111 @@ unsigned long amiga_chip_size; EXPORT_SYMBOL(amiga_chip_size); static struct resource chipram_res = { - .name = "Chip RAM", .start = CHIP_PHYSADDR + .name = "Chip RAM", .start = CHIP_PHYSADDR }; -static atomic_t chipavail; +static unsigned long chipavail; void __init amiga_chip_init(void) { - if (!AMIGAHW_PRESENT(CHIP_RAM)) - return; + if (!AMIGAHW_PRESENT(CHIP_RAM)) + return; - chipram_res.end = CHIP_PHYSADDR + amiga_chip_size - 1; - request_resource(&iomem_resource, &chipram_res); + chipram_res.end = amiga_chip_size-1; + request_resource(&iomem_resource, &chipram_res); - atomic_set(&chipavail, amiga_chip_size); + chipavail = amiga_chip_size; } void *amiga_chip_alloc(unsigned long size, const char *name) { - struct resource *res; - void *p; + struct resource *res; - res = kzalloc(sizeof(struct resource), GFP_KERNEL); - if (!res) - return NULL; + /* round up */ + size = PAGE_ALIGN(size); - res->name = name; - p = amiga_chip_alloc_res(size, res); - if (!p) { - kfree(res); - return NULL; - } +#ifdef DEBUG + printk("amiga_chip_alloc: allocate %ld bytes\n", size); +#endif + res = kzalloc(sizeof(struct resource), GFP_KERNEL); + if (!res) + return NULL; + res->name = name; - return p; + if (allocate_resource(&chipram_res, res, size, 0, UINT_MAX, PAGE_SIZE, NULL, NULL) < 0) { + kfree(res); + return NULL; + } + chipavail -= size; +#ifdef DEBUG + printk("amiga_chip_alloc: returning %lx\n", res->start); +#endif + return (void *)ZTWO_VADDR(res->start); } EXPORT_SYMBOL(amiga_chip_alloc); - /* - * Warning: - * amiga_chip_alloc_res is meant only for drivers that need to - * allocate Chip RAM before kmalloc() is functional. As a consequence, - * those drivers must not free that Chip RAM afterwards. - */ + /* + * Warning: + * amiga_chip_alloc_res is meant only for drivers that need to allocate + * Chip RAM before kmalloc() is functional. As a consequence, those + * drivers must not free that Chip RAM afterwards. + */ -void *amiga_chip_alloc_res(unsigned long size, struct resource *res) +void * __init amiga_chip_alloc_res(unsigned long size, struct resource *res) { - int error; - - /* round up */ - size = PAGE_ALIGN(size); - - pr_debug("amiga_chip_alloc_res: allocate %lu bytes\n", size); - error = allocate_resource(&chipram_res, res, size, 0, UINT_MAX, - PAGE_SIZE, NULL, NULL); - if (error < 0) { - pr_err("amiga_chip_alloc_res: allocate_resource() failed %d!\n", - error); - return NULL; - } - - atomic_sub(size, &chipavail); - pr_debug("amiga_chip_alloc_res: returning %pR\n", res); - return (void *)ZTWO_VADDR(res->start); + unsigned long start; + + /* round up */ + size = PAGE_ALIGN(size); + /* dmesg into chipmem prefers memory at the safe end */ + start = CHIP_PHYSADDR + chipavail - size; + +#ifdef DEBUG + printk("amiga_chip_alloc_res: allocate %ld bytes\n", size); +#endif + if (allocate_resource(&chipram_res, res, size, start, UINT_MAX, PAGE_SIZE, NULL, NULL) < 0) { + printk("amiga_chip_alloc_res: first alloc failed!\n"); + if (allocate_resource(&chipram_res, res, size, 0, UINT_MAX, PAGE_SIZE, NULL, NULL) < 0) + return NULL; + } + chipavail -= size; +#ifdef DEBUG + printk("amiga_chip_alloc_res: returning %lx\n", res->start); +#endif + return (void *)ZTWO_VADDR(res->start); } void amiga_chip_free(void *ptr) { - unsigned long start = ZTWO_PADDR(ptr); - struct resource *res; - unsigned long size; - - res = lookup_resource(&chipram_res, start); - if (!res) { - pr_err("amiga_chip_free: trying to free nonexistent region at " - "%p\n", ptr); - return; - } - - size = resource_size(res); - pr_debug("amiga_chip_free: free %lu bytes at %p\n", size, ptr); - atomic_add(size, &chipavail); - release_resource(res); + unsigned long start = ZTWO_PADDR(ptr); + struct resource **p, *res; + unsigned long size; + + for (p = &chipram_res.child; (res = *p); p = &res->sibling) { + if (res->start != start) + continue; + *p = res->sibling; + size = res->end-start; +#ifdef DEBUG + printk("amiga_chip_free: free %ld bytes at %p\n", size, ptr); +#endif + chipavail += size; kfree(res); + return; + } + printk("amiga_chip_free: trying to free nonexistent region at %p\n", ptr); } EXPORT_SYMBOL(amiga_chip_free); unsigned long amiga_chip_avail(void) { - unsigned long n = atomic_read(&chipavail); - - pr_debug("amiga_chip_avail : %lu bytes\n", n); - return n; +#ifdef DEBUG + printk("amiga_chip_avail : %ld bytes\n", chipavail); +#endif + return chipavail; } EXPORT_SYMBOL(amiga_chip_avail); diff --git a/trunk/arch/m68k/atari/stram.c b/trunk/arch/m68k/atari/stram.c index 0810c8d56e59..6ec3b7f33779 100644 --- a/trunk/arch/m68k/atari/stram.c +++ b/trunk/arch/m68k/atari/stram.c @@ -1,5 +1,5 @@ /* - * Functions for ST-RAM allocations + * arch/m68k/atari/stram.c: Functions for ST-RAM allocations * * Copyright 1994-97 Roman Hodek * @@ -30,35 +30,91 @@ #include #include +#undef DEBUG + +#ifdef DEBUG +#define DPRINTK(fmt,args...) printk( fmt, ##args ) +#else +#define DPRINTK(fmt,args...) +#endif + +#if defined(CONFIG_PROC_FS) && defined(CONFIG_STRAM_PROC) +/* abbrev for the && above... */ +#define DO_PROC +#include +#include +#endif /* - * The ST-RAM allocator allocates memory from a pool of reserved ST-RAM of - * configurable size, set aside on ST-RAM init. - * As long as this pool is not exhausted, allocation of real ST-RAM can be - * guaranteed. + * ++roman: + * + * New version of ST-Ram buffer allocation. Instead of using the + * 1 MB - 4 KB that remain when the ST-Ram chunk starts at $1000 + * (1 MB granularity!), such buffers are reserved like this: + * + * - If the kernel resides in ST-Ram anyway, we can take the buffer + * from behind the current kernel data space the normal way + * (incrementing start_mem). + * + * - If the kernel is in TT-Ram, stram_init() initializes start and + * end of the available region. Buffers are allocated from there + * and mem_init() later marks the such used pages as reserved. + * Since each TT-Ram chunk is at least 4 MB in size, I hope there + * won't be an overrun of the ST-Ram region by normal kernel data + * space. + * + * For that, ST-Ram may only be allocated while kernel initialization + * is going on, or exactly: before mem_init() is called. There is also + * no provision now for freeing ST-Ram buffers. It seems that isn't + * really needed. + * */ +/* Start and end (virtual) of ST-RAM */ +static void *stram_start, *stram_end; + +/* set after memory_init() executed and allocations via start_mem aren't + * possible anymore */ +static int mem_init_done; + /* set if kernel is in ST-RAM */ static int kernel_in_stram; -static struct resource stram_pool = { - .name = "ST-RAM Pool" -}; +typedef struct stram_block { + struct stram_block *next; + void *start; + unsigned long size; + unsigned flags; + const char *owner; +} BLOCK; -static unsigned long pool_size = 1024*1024; +/* values for flags field */ +#define BLOCK_FREE 0x01 /* free structure in the BLOCKs pool */ +#define BLOCK_KMALLOCED 0x02 /* structure allocated by kmalloc() */ +#define BLOCK_GFP 0x08 /* block allocated with __get_dma_pages() */ +/* list of allocated blocks */ +static BLOCK *alloc_list; -static int __init atari_stram_setup(char *arg) -{ - if (!MACH_IS_ATARI) - return 0; +/* We can't always use kmalloc() to allocate BLOCK structures, since + * stram_alloc() can be called rather early. So we need some pool of + * statically allocated structures. 20 of them is more than enough, so in most + * cases we never should need to call kmalloc(). */ +#define N_STATIC_BLOCKS 20 +static BLOCK static_blocks[N_STATIC_BLOCKS]; - pool_size = memparse(arg, NULL); - return 0; -} +/***************************** Prototypes *****************************/ -early_param("stram_pool", atari_stram_setup); +static BLOCK *add_region( void *addr, unsigned long size ); +static BLOCK *find_region( void *addr ); +static int remove_region( BLOCK *block ); +/************************* End of Prototypes **************************/ + + +/* ------------------------------------------------------------------------ */ +/* Public Interface */ +/* ------------------------------------------------------------------------ */ /* * This init function is called very early by atari/config.c @@ -67,23 +123,25 @@ early_param("stram_pool", atari_stram_setup); void __init atari_stram_init(void) { int i; - void *stram_start; - /* - * determine whether kernel code resides in ST-RAM - * (then ST-RAM is the first memory block at virtual 0x0) - */ + /* initialize static blocks */ + for( i = 0; i < N_STATIC_BLOCKS; ++i ) + static_blocks[i].flags = BLOCK_FREE; + + /* determine whether kernel code resides in ST-RAM (then ST-RAM is the + * first memory block at virtual 0x0) */ stram_start = phys_to_virt(0); kernel_in_stram = (stram_start == 0); - for (i = 0; i < m68k_num_memory; ++i) { + for( i = 0; i < m68k_num_memory; ++i ) { if (m68k_memory[i].addr == 0) { + /* skip first 2kB or page (supervisor-only!) */ + stram_end = stram_start + m68k_memory[i].size; return; } } - /* Should never come here! (There is always ST-Ram!) */ - panic("atari_stram_init: no ST-RAM found!"); + panic( "atari_stram_init: no ST-RAM found!" ); } @@ -93,68 +151,226 @@ void __init atari_stram_init(void) */ void __init atari_stram_reserve_pages(void *start_mem) { - /* - * always reserve first page of ST-RAM, the first 2 KiB are - * supervisor-only! - */ + /* always reserve first page of ST-RAM, the first 2 kB are + * supervisor-only! */ if (!kernel_in_stram) reserve_bootmem(0, PAGE_SIZE, BOOTMEM_DEFAULT); - stram_pool.start = (resource_size_t)alloc_bootmem_low_pages(pool_size); - stram_pool.end = stram_pool.start + pool_size - 1; - request_resource(&iomem_resource, &stram_pool); +} - pr_debug("atari_stram pool: size = %lu bytes, resource = %pR\n", - pool_size, &stram_pool); +void atari_stram_mem_init_hook (void) +{ + mem_init_done = 1; } -void *atari_stram_alloc(unsigned long size, const char *owner) +/* + * This is main public interface: somehow allocate a ST-RAM block + * + * - If we're before mem_init(), we have to make a static allocation. The + * region is taken in the kernel data area (if the kernel is in ST-RAM) or + * from the start of ST-RAM (if the kernel is in TT-RAM) and added to the + * rsvd_stram_* region. The ST-RAM is somewhere in the middle of kernel + * address space in the latter case. + * + * - If mem_init() already has been called, try with __get_dma_pages(). + * This has the disadvantage that it's very hard to get more than 1 page, + * and it is likely to fail :-( + * + */ +void *atari_stram_alloc(long size, const char *owner) { - struct resource *res; - int error; - - pr_debug("atari_stram_alloc: allocate %lu bytes\n", size); - - /* round up */ - size = PAGE_ALIGN(size); - - res = kzalloc(sizeof(struct resource), GFP_KERNEL); - if (!res) - return NULL; - - res->name = owner; - error = allocate_resource(&stram_pool, res, size, 0, UINT_MAX, - PAGE_SIZE, NULL, NULL); - if (error < 0) { - pr_err("atari_stram_alloc: allocate_resource() failed %d!\n", - error); - kfree(res); - return NULL; + void *addr = NULL; + BLOCK *block; + int flags; + + DPRINTK("atari_stram_alloc(size=%08lx,owner=%s)\n", size, owner); + + if (!mem_init_done) + return alloc_bootmem_low(size); + else { + /* After mem_init(): can only resort to __get_dma_pages() */ + addr = (void *)__get_dma_pages(GFP_KERNEL, get_order(size)); + flags = BLOCK_GFP; + DPRINTK( "atari_stram_alloc: after mem_init, " + "get_pages=%p\n", addr ); } - pr_debug("atari_stram_alloc: returning %pR\n", res); - return (void *)res->start; + if (addr) { + if (!(block = add_region( addr, size ))) { + /* out of memory for BLOCK structure :-( */ + DPRINTK( "atari_stram_alloc: out of mem for BLOCK -- " + "freeing again\n" ); + free_pages((unsigned long)addr, get_order(size)); + return( NULL ); + } + block->owner = owner; + block->flags |= flags; + } + return( addr ); } EXPORT_SYMBOL(atari_stram_alloc); +void atari_stram_free( void *addr ) -void atari_stram_free(void *addr) { - unsigned long start = (unsigned long)addr; - struct resource *res; - unsigned long size; + BLOCK *block; - res = lookup_resource(&stram_pool, start); - if (!res) { - pr_err("atari_stram_free: trying to free nonexistent region " - "at %p\n", addr); + DPRINTK( "atari_stram_free(addr=%p)\n", addr ); + + if (!(block = find_region( addr ))) { + printk( KERN_ERR "Attempt to free non-allocated ST-RAM block at %p " + "from %p\n", addr, __builtin_return_address(0) ); return; } + DPRINTK( "atari_stram_free: found block (%p): size=%08lx, owner=%s, " + "flags=%02x\n", block, block->size, block->owner, block->flags ); + + if (!(block->flags & BLOCK_GFP)) + goto fail; - size = resource_size(res); - pr_debug("atari_stram_free: free %lu bytes at %p\n", size, addr); - release_resource(res); - kfree(res); + DPRINTK("atari_stram_free: is kmalloced, order_size=%d\n", + get_order(block->size)); + free_pages((unsigned long)addr, get_order(block->size)); + remove_region( block ); + return; + + fail: + printk( KERN_ERR "atari_stram_free: cannot free block at %p " + "(called from %p)\n", addr, __builtin_return_address(0) ); } EXPORT_SYMBOL(atari_stram_free); + + +/* ------------------------------------------------------------------------ */ +/* Region Management */ +/* ------------------------------------------------------------------------ */ + + +/* insert a region into the alloced list (sorted) */ +static BLOCK *add_region( void *addr, unsigned long size ) +{ + BLOCK **p, *n = NULL; + int i; + + for( i = 0; i < N_STATIC_BLOCKS; ++i ) { + if (static_blocks[i].flags & BLOCK_FREE) { + n = &static_blocks[i]; + n->flags = 0; + break; + } + } + if (!n && mem_init_done) { + /* if statics block pool exhausted and we can call kmalloc() already + * (after mem_init()), try that */ + n = kmalloc( sizeof(BLOCK), GFP_KERNEL ); + if (n) + n->flags = BLOCK_KMALLOCED; + } + if (!n) { + printk( KERN_ERR "Out of memory for ST-RAM descriptor blocks\n" ); + return( NULL ); + } + n->start = addr; + n->size = size; + + for( p = &alloc_list; *p; p = &((*p)->next) ) + if ((*p)->start > addr) break; + n->next = *p; + *p = n; + + return( n ); +} + + +/* find a region (by start addr) in the alloced list */ +static BLOCK *find_region( void *addr ) +{ + BLOCK *p; + + for( p = alloc_list; p; p = p->next ) { + if (p->start == addr) + return( p ); + if (p->start > addr) + break; + } + return( NULL ); +} + + +/* remove a block from the alloced list */ +static int remove_region( BLOCK *block ) +{ + BLOCK **p; + + for( p = &alloc_list; *p; p = &((*p)->next) ) + if (*p == block) break; + if (!*p) + return( 0 ); + + *p = block->next; + if (block->flags & BLOCK_KMALLOCED) + kfree( block ); + else + block->flags |= BLOCK_FREE; + return( 1 ); +} + + + +/* ------------------------------------------------------------------------ */ +/* /proc statistics file stuff */ +/* ------------------------------------------------------------------------ */ + +#ifdef DO_PROC + +#define PRINT_PROC(fmt,args...) seq_printf( m, fmt, ##args ) + +static int stram_proc_show(struct seq_file *m, void *v) +{ + BLOCK *p; + + PRINT_PROC("Total ST-RAM: %8u kB\n", + (stram_end - stram_start) >> 10); + PRINT_PROC( "Allocated regions:\n" ); + for( p = alloc_list; p; p = p->next ) { + PRINT_PROC("0x%08lx-0x%08lx: %s (", + virt_to_phys(p->start), + virt_to_phys(p->start+p->size-1), + p->owner); + if (p->flags & BLOCK_GFP) + PRINT_PROC( "page-alloced)\n" ); + else + PRINT_PROC( "??)\n" ); + } + + return 0; +} + +static int stram_proc_open(struct inode *inode, struct file *file) +{ + return single_open(file, stram_proc_show, NULL); +} + +static const struct file_operations stram_proc_fops = { + .open = stram_proc_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; + +static int __init proc_stram_init(void) +{ + proc_create("stram", 0, NULL, &stram_proc_fops); + return 0; +} +module_init(proc_stram_init); +#endif + + +/* + * Local variables: + * c-indent-level: 4 + * tab-width: 4 + * End: + */ diff --git a/trunk/arch/m68k/include/asm/atari_stram.h b/trunk/arch/m68k/include/asm/atari_stram.h index 62e27598af91..7546d13963be 100644 --- a/trunk/arch/m68k/include/asm/atari_stram.h +++ b/trunk/arch/m68k/include/asm/atari_stram.h @@ -6,11 +6,12 @@ */ /* public interface */ -void *atari_stram_alloc(unsigned long size, const char *owner); +void *atari_stram_alloc(long size, const char *owner); void atari_stram_free(void *); /* functions called internally by other parts of the kernel */ void atari_stram_init(void); void atari_stram_reserve_pages(void *start_mem); +void atari_stram_mem_init_hook (void); #endif /*_M68K_ATARI_STRAM_H */ diff --git a/trunk/arch/m68k/include/asm/atarihw.h b/trunk/arch/m68k/include/asm/atarihw.h index 0392b28656ab..f51f709bbf30 100644 --- a/trunk/arch/m68k/include/asm/atarihw.h +++ b/trunk/arch/m68k/include/asm/atarihw.h @@ -399,8 +399,8 @@ struct CODEC #define CODEC_OVERFLOW_LEFT 2 u_char unused2, unused3, unused4, unused5; u_char gpio_directions; -#define CODEC_GPIO_IN 0 -#define CODEC_GPIO_OUT 1 +#define GPIO_IN 0 +#define GPIO_OUT 1 u_char unused6; u_char gpio_data; }; diff --git a/trunk/arch/m68k/kernel/setup_mm.c b/trunk/arch/m68k/kernel/setup_mm.c index c3b45061dd08..334d83640376 100644 --- a/trunk/arch/m68k/kernel/setup_mm.c +++ b/trunk/arch/m68k/kernel/setup_mm.c @@ -216,9 +216,7 @@ static void __init m68k_parse_bootinfo(const struct bi_record *record) void __init setup_arch(char **cmdline_p) { -#ifndef CONFIG_SUN3 int i; -#endif /* The bootinfo is located right after the kernel bss */ m68k_parse_bootinfo((const struct bi_record *)_end); diff --git a/trunk/arch/m68k/math-emu/fp_log.c b/trunk/arch/m68k/math-emu/fp_log.c index 3384a5244fbd..367ecee2f981 100644 --- a/trunk/arch/m68k/math-emu/fp_log.c +++ b/trunk/arch/m68k/math-emu/fp_log.c @@ -105,6 +105,9 @@ fp_fetoxm1(struct fp_ext *dest, struct fp_ext *src) fp_monadic_check(dest, src); + if (IS_ZERO(dest)) + return dest; + return dest; } diff --git a/trunk/arch/m68k/math-emu/multi_arith.h b/trunk/arch/m68k/math-emu/multi_arith.h index 4b5eb3d85638..4ad0ca918e2e 100644 --- a/trunk/arch/m68k/math-emu/multi_arith.h +++ b/trunk/arch/m68k/math-emu/multi_arith.h @@ -19,6 +19,246 @@ #ifndef MULTI_ARITH_H #define MULTI_ARITH_H +#if 0 /* old code... */ + +/* Unsigned only, because we don't need signs to multiply and divide. */ +typedef unsigned int int128[4]; + +/* Word order */ +enum { + MSW128, + NMSW128, + NLSW128, + LSW128 +}; + +/* big-endian */ +#define LO_WORD(ll) (((unsigned int *) &ll)[1]) +#define HI_WORD(ll) (((unsigned int *) &ll)[0]) + +/* Convenience functions to stuff various integer values into int128s */ + +static inline void zero128(int128 a) +{ + a[LSW128] = a[NLSW128] = a[NMSW128] = a[MSW128] = 0; +} + +/* Human-readable word order in the arguments */ +static inline void set128(unsigned int i3, unsigned int i2, unsigned int i1, + unsigned int i0, int128 a) +{ + a[LSW128] = i0; + a[NLSW128] = i1; + a[NMSW128] = i2; + a[MSW128] = i3; +} + +/* Convenience functions (for testing as well) */ +static inline void int64_to_128(unsigned long long src, int128 dest) +{ + dest[LSW128] = (unsigned int) src; + dest[NLSW128] = src >> 32; + dest[NMSW128] = dest[MSW128] = 0; +} + +static inline void int128_to_64(const int128 src, unsigned long long *dest) +{ + *dest = src[LSW128] | (long long) src[NLSW128] << 32; +} + +static inline void put_i128(const int128 a) +{ + printk("%08x %08x %08x %08x\n", a[MSW128], a[NMSW128], + a[NLSW128], a[LSW128]); +} + +/* Internal shifters: + + Note that these are only good for 0 < count < 32. + */ + +static inline void _lsl128(unsigned int count, int128 a) +{ + a[MSW128] = (a[MSW128] << count) | (a[NMSW128] >> (32 - count)); + a[NMSW128] = (a[NMSW128] << count) | (a[NLSW128] >> (32 - count)); + a[NLSW128] = (a[NLSW128] << count) | (a[LSW128] >> (32 - count)); + a[LSW128] <<= count; +} + +static inline void _lsr128(unsigned int count, int128 a) +{ + a[LSW128] = (a[LSW128] >> count) | (a[NLSW128] << (32 - count)); + a[NLSW128] = (a[NLSW128] >> count) | (a[NMSW128] << (32 - count)); + a[NMSW128] = (a[NMSW128] >> count) | (a[MSW128] << (32 - count)); + a[MSW128] >>= count; +} + +/* Should be faster, one would hope */ + +static inline void lslone128(int128 a) +{ + asm volatile ("lsl.l #1,%0\n" + "roxl.l #1,%1\n" + "roxl.l #1,%2\n" + "roxl.l #1,%3\n" + : + "=d" (a[LSW128]), + "=d"(a[NLSW128]), + "=d"(a[NMSW128]), + "=d"(a[MSW128]) + : + "0"(a[LSW128]), + "1"(a[NLSW128]), + "2"(a[NMSW128]), + "3"(a[MSW128])); +} + +static inline void lsrone128(int128 a) +{ + asm volatile ("lsr.l #1,%0\n" + "roxr.l #1,%1\n" + "roxr.l #1,%2\n" + "roxr.l #1,%3\n" + : + "=d" (a[MSW128]), + "=d"(a[NMSW128]), + "=d"(a[NLSW128]), + "=d"(a[LSW128]) + : + "0"(a[MSW128]), + "1"(a[NMSW128]), + "2"(a[NLSW128]), + "3"(a[LSW128])); +} + +/* Generalized 128-bit shifters: + + These bit-shift to a multiple of 32, then move whole longwords. */ + +static inline void lsl128(unsigned int count, int128 a) +{ + int wordcount, i; + + if (count % 32) + _lsl128(count % 32, a); + + if (0 == (wordcount = count / 32)) + return; + + /* argh, gak, endian-sensitive */ + for (i = 0; i < 4 - wordcount; i++) { + a[i] = a[i + wordcount]; + } + for (i = 3; i >= 4 - wordcount; --i) { + a[i] = 0; + } +} + +static inline void lsr128(unsigned int count, int128 a) +{ + int wordcount, i; + + if (count % 32) + _lsr128(count % 32, a); + + if (0 == (wordcount = count / 32)) + return; + + for (i = 3; i >= wordcount; --i) { + a[i] = a[i - wordcount]; + } + for (i = 0; i < wordcount; i++) { + a[i] = 0; + } +} + +static inline int orl128(int a, int128 b) +{ + b[LSW128] |= a; +} + +static inline int btsthi128(const int128 a) +{ + return a[MSW128] & 0x80000000; +} + +/* test bits (numbered from 0 = LSB) up to and including "top" */ +static inline int bftestlo128(int top, const int128 a) +{ + int r = 0; + + if (top > 31) + r |= a[LSW128]; + if (top > 63) + r |= a[NLSW128]; + if (top > 95) + r |= a[NMSW128]; + + r |= a[3 - (top / 32)] & ((1 << (top % 32 + 1)) - 1); + + return (r != 0); +} + +/* Aargh. We need these because GCC is broken */ +/* FIXME: do them in assembly, for goodness' sake! */ +static inline void mask64(int pos, unsigned long long *mask) +{ + *mask = 0; + + if (pos < 32) { + LO_WORD(*mask) = (1 << pos) - 1; + return; + } + LO_WORD(*mask) = -1; + HI_WORD(*mask) = (1 << (pos - 32)) - 1; +} + +static inline void bset64(int pos, unsigned long long *dest) +{ + /* This conditional will be optimized away. Thanks, GCC! */ + if (pos < 32) + asm volatile ("bset %1,%0":"=m" + (LO_WORD(*dest)):"id"(pos)); + else + asm volatile ("bset %1,%0":"=m" + (HI_WORD(*dest)):"id"(pos - 32)); +} + +static inline int btst64(int pos, unsigned long long dest) +{ + if (pos < 32) + return (0 != (LO_WORD(dest) & (1 << pos))); + else + return (0 != (HI_WORD(dest) & (1 << (pos - 32)))); +} + +static inline void lsl64(int count, unsigned long long *dest) +{ + if (count < 32) { + HI_WORD(*dest) = (HI_WORD(*dest) << count) + | (LO_WORD(*dest) >> count); + LO_WORD(*dest) <<= count; + return; + } + count -= 32; + HI_WORD(*dest) = LO_WORD(*dest) << count; + LO_WORD(*dest) = 0; +} + +static inline void lsr64(int count, unsigned long long *dest) +{ + if (count < 32) { + LO_WORD(*dest) = (LO_WORD(*dest) >> count) + | (HI_WORD(*dest) << (32 - count)); + HI_WORD(*dest) >>= count; + return; + } + count -= 32; + LO_WORD(*dest) = HI_WORD(*dest) >> count; + HI_WORD(*dest) = 0; +} +#endif + static inline void fp_denormalize(struct fp_ext *reg, unsigned int cnt) { reg->exp += cnt; @@ -241,6 +481,117 @@ static inline void fp_dividemant(union fp_mant128 *dest, struct fp_ext *src, } } +#if 0 +static inline unsigned int fp_fls128(union fp_mant128 *src) +{ + unsigned long data; + unsigned int res, off; + + if ((data = src->m32[0])) + off = 0; + else if ((data = src->m32[1])) + off = 32; + else if ((data = src->m32[2])) + off = 64; + else if ((data = src->m32[3])) + off = 96; + else + return 128; + + asm ("bfffo %1{#0,#32},%0" : "=d" (res) : "dm" (data)); + return res + off; +} + +static inline void fp_shiftmant128(union fp_mant128 *src, int shift) +{ + unsigned long sticky; + + switch (shift) { + case 0: + return; + case 1: + asm volatile ("lsl.l #1,%0" + : "=d" (src->m32[3]) : "0" (src->m32[3])); + asm volatile ("roxl.l #1,%0" + : "=d" (src->m32[2]) : "0" (src->m32[2])); + asm volatile ("roxl.l #1,%0" + : "=d" (src->m32[1]) : "0" (src->m32[1])); + asm volatile ("roxl.l #1,%0" + : "=d" (src->m32[0]) : "0" (src->m32[0])); + return; + case 2 ... 31: + src->m32[0] = (src->m32[0] << shift) | (src->m32[1] >> (32 - shift)); + src->m32[1] = (src->m32[1] << shift) | (src->m32[2] >> (32 - shift)); + src->m32[2] = (src->m32[2] << shift) | (src->m32[3] >> (32 - shift)); + src->m32[3] = (src->m32[3] << shift); + return; + case 32 ... 63: + shift -= 32; + src->m32[0] = (src->m32[1] << shift) | (src->m32[2] >> (32 - shift)); + src->m32[1] = (src->m32[2] << shift) | (src->m32[3] >> (32 - shift)); + src->m32[2] = (src->m32[3] << shift); + src->m32[3] = 0; + return; + case 64 ... 95: + shift -= 64; + src->m32[0] = (src->m32[2] << shift) | (src->m32[3] >> (32 - shift)); + src->m32[1] = (src->m32[3] << shift); + src->m32[2] = src->m32[3] = 0; + return; + case 96 ... 127: + shift -= 96; + src->m32[0] = (src->m32[3] << shift); + src->m32[1] = src->m32[2] = src->m32[3] = 0; + return; + case -31 ... -1: + shift = -shift; + sticky = 0; + if (src->m32[3] << (32 - shift)) + sticky = 1; + src->m32[3] = (src->m32[3] >> shift) | (src->m32[2] << (32 - shift)) | sticky; + src->m32[2] = (src->m32[2] >> shift) | (src->m32[1] << (32 - shift)); + src->m32[1] = (src->m32[1] >> shift) | (src->m32[0] << (32 - shift)); + src->m32[0] = (src->m32[0] >> shift); + return; + case -63 ... -32: + shift = -shift - 32; + sticky = 0; + if ((src->m32[2] << (32 - shift)) || src->m32[3]) + sticky = 1; + src->m32[3] = (src->m32[2] >> shift) | (src->m32[1] << (32 - shift)) | sticky; + src->m32[2] = (src->m32[1] >> shift) | (src->m32[0] << (32 - shift)); + src->m32[1] = (src->m32[0] >> shift); + src->m32[0] = 0; + return; + case -95 ... -64: + shift = -shift - 64; + sticky = 0; + if ((src->m32[1] << (32 - shift)) || src->m32[2] || src->m32[3]) + sticky = 1; + src->m32[3] = (src->m32[1] >> shift) | (src->m32[0] << (32 - shift)) | sticky; + src->m32[2] = (src->m32[0] >> shift); + src->m32[1] = src->m32[0] = 0; + return; + case -127 ... -96: + shift = -shift - 96; + sticky = 0; + if ((src->m32[0] << (32 - shift)) || src->m32[1] || src->m32[2] || src->m32[3]) + sticky = 1; + src->m32[3] = (src->m32[0] >> shift) | sticky; + src->m32[2] = src->m32[1] = src->m32[0] = 0; + return; + } + + if (shift < 0 && (src->m32[0] || src->m32[1] || src->m32[2] || src->m32[3])) + src->m32[3] = 1; + else + src->m32[3] = 0; + src->m32[2] = 0; + src->m32[1] = 0; + src->m32[0] = 0; +} +#endif + static inline void fp_putmant128(struct fp_ext *dest, union fp_mant128 *src, int shift) { @@ -286,4 +637,183 @@ static inline void fp_putmant128(struct fp_ext *dest, union fp_mant128 *src, } } +#if 0 /* old code... */ +static inline int fls(unsigned int a) +{ + int r; + + asm volatile ("bfffo %1{#0,#32},%0" + : "=d" (r) : "md" (a)); + return r; +} + +/* fls = "find last set" (cf. ffs(3)) */ +static inline int fls128(const int128 a) +{ + if (a[MSW128]) + return fls(a[MSW128]); + if (a[NMSW128]) + return fls(a[NMSW128]) + 32; + /* XXX: it probably never gets beyond this point in actual + use, but that's indicative of a more general problem in the + algorithm (i.e. as per the actual 68881 implementation, we + really only need at most 67 bits of precision [plus + overflow]) so I'm not going to fix it. */ + if (a[NLSW128]) + return fls(a[NLSW128]) + 64; + if (a[LSW128]) + return fls(a[LSW128]) + 96; + else + return -1; +} + +static inline int zerop128(const int128 a) +{ + return !(a[LSW128] | a[NLSW128] | a[NMSW128] | a[MSW128]); +} + +static inline int nonzerop128(const int128 a) +{ + return (a[LSW128] | a[NLSW128] | a[NMSW128] | a[MSW128]); +} + +/* Addition and subtraction */ +/* Do these in "pure" assembly, because "extended" asm is unmanageable + here */ +static inline void add128(const int128 a, int128 b) +{ + /* rotating carry flags */ + unsigned int carry[2]; + + carry[0] = a[LSW128] > (0xffffffff - b[LSW128]); + b[LSW128] += a[LSW128]; + + carry[1] = a[NLSW128] > (0xffffffff - b[NLSW128] - carry[0]); + b[NLSW128] = a[NLSW128] + b[NLSW128] + carry[0]; + + carry[0] = a[NMSW128] > (0xffffffff - b[NMSW128] - carry[1]); + b[NMSW128] = a[NMSW128] + b[NMSW128] + carry[1]; + + b[MSW128] = a[MSW128] + b[MSW128] + carry[0]; +} + +/* Note: assembler semantics: "b -= a" */ +static inline void sub128(const int128 a, int128 b) +{ + /* rotating borrow flags */ + unsigned int borrow[2]; + + borrow[0] = b[LSW128] < a[LSW128]; + b[LSW128] -= a[LSW128]; + + borrow[1] = b[NLSW128] < a[NLSW128] + borrow[0]; + b[NLSW128] = b[NLSW128] - a[NLSW128] - borrow[0]; + + borrow[0] = b[NMSW128] < a[NMSW128] + borrow[1]; + b[NMSW128] = b[NMSW128] - a[NMSW128] - borrow[1]; + + b[MSW128] = b[MSW128] - a[MSW128] - borrow[0]; +} + +/* Poor man's 64-bit expanding multiply */ +static inline void mul64(unsigned long long a, unsigned long long b, int128 c) +{ + unsigned long long acc; + int128 acc128; + + zero128(acc128); + zero128(c); + + /* first the low words */ + if (LO_WORD(a) && LO_WORD(b)) { + acc = (long long) LO_WORD(a) * LO_WORD(b); + c[NLSW128] = HI_WORD(acc); + c[LSW128] = LO_WORD(acc); + } + /* Next the high words */ + if (HI_WORD(a) && HI_WORD(b)) { + acc = (long long) HI_WORD(a) * HI_WORD(b); + c[MSW128] = HI_WORD(acc); + c[NMSW128] = LO_WORD(acc); + } + /* The middle words */ + if (LO_WORD(a) && HI_WORD(b)) { + acc = (long long) LO_WORD(a) * HI_WORD(b); + acc128[NMSW128] = HI_WORD(acc); + acc128[NLSW128] = LO_WORD(acc); + add128(acc128, c); + } + /* The first and last words */ + if (HI_WORD(a) && LO_WORD(b)) { + acc = (long long) HI_WORD(a) * LO_WORD(b); + acc128[NMSW128] = HI_WORD(acc); + acc128[NLSW128] = LO_WORD(acc); + add128(acc128, c); + } +} + +/* Note: unsigned */ +static inline int cmp128(int128 a, int128 b) +{ + if (a[MSW128] < b[MSW128]) + return -1; + if (a[MSW128] > b[MSW128]) + return 1; + if (a[NMSW128] < b[NMSW128]) + return -1; + if (a[NMSW128] > b[NMSW128]) + return 1; + if (a[NLSW128] < b[NLSW128]) + return -1; + if (a[NLSW128] > b[NLSW128]) + return 1; + + return (signed) a[LSW128] - b[LSW128]; +} + +inline void div128(int128 a, int128 b, int128 c) +{ + int128 mask; + + /* Algorithm: + + Shift the divisor until it's at least as big as the + dividend, keeping track of the position to which we've + shifted it, i.e. the power of 2 which we've multiplied it + by. + + Then, for this power of 2 (the mask), and every one smaller + than it, subtract the mask from the dividend and add it to + the quotient until the dividend is smaller than the raised + divisor. At this point, divide the dividend and the mask + by 2 (i.e. shift one place to the right). Lather, rinse, + and repeat, until there are no more powers of 2 left. */ + + /* FIXME: needless to say, there's room for improvement here too. */ + + /* Shift up */ + /* XXX: since it just has to be "at least as big", we can + probably eliminate this horribly wasteful loop. I will + have to prove this first, though */ + set128(0, 0, 0, 1, mask); + while (cmp128(b, a) < 0 && !btsthi128(b)) { + lslone128(b); + lslone128(mask); + } + + /* Shift down */ + zero128(c); + do { + if (cmp128(a, b) >= 0) { + sub128(b, a); + add128(mask, c); + } + lsrone128(mask); + lsrone128(b); + } while (nonzerop128(mask)); + + /* The remainder is in a... */ +} +#endif + #endif /* MULTI_ARITH_H */ diff --git a/trunk/arch/m68k/mm/init_mm.c b/trunk/arch/m68k/mm/init_mm.c index bbe525434ccb..9113c2f17607 100644 --- a/trunk/arch/m68k/mm/init_mm.c +++ b/trunk/arch/m68k/mm/init_mm.c @@ -83,6 +83,11 @@ void __init mem_init(void) int initpages = 0; int i; +#ifdef CONFIG_ATARI + if (MACH_IS_ATARI) + atari_stram_mem_init_hook(); +#endif + /* this will put all memory onto the freelists */ totalram_pages = num_physpages = 0; for_each_online_pgdat(pgdat) { diff --git a/trunk/arch/sparc/kernel/ioport.c b/trunk/arch/sparc/kernel/ioport.c index d0479e2163fa..6ffccd6e0156 100644 --- a/trunk/arch/sparc/kernel/ioport.c +++ b/trunk/arch/sparc/kernel/ioport.c @@ -65,6 +65,9 @@ static inline void dma_make_coherent(unsigned long pa, unsigned long len) } #endif +static struct resource *_sparc_find_resource(struct resource *r, + unsigned long); + static void __iomem *_sparc_ioremap(struct resource *res, u32 bus, u32 pa, int sz); static void __iomem *_sparc_alloc_io(unsigned int busno, unsigned long phys, unsigned long size, char *name); @@ -140,11 +143,7 @@ void iounmap(volatile void __iomem *virtual) unsigned long vaddr = (unsigned long) virtual & PAGE_MASK; struct resource *res; - /* - * XXX Too slow. Can have 8192 DVMA pages on sun4m in the worst case. - * This probably warrants some sort of hashing. - */ - if ((res = lookup_resource(&sparc_iomap, vaddr)) == NULL) { + if ((res = _sparc_find_resource(&sparc_iomap, vaddr)) == NULL) { printk("free_io/iounmap: cannot free %lx\n", vaddr); return; } @@ -320,7 +319,7 @@ static void sbus_free_coherent(struct device *dev, size_t n, void *p, struct resource *res; struct page *pgv; - if ((res = lookup_resource(&_sparc_dvma, + if ((res = _sparc_find_resource(&_sparc_dvma, (unsigned long)p)) == NULL) { printk("sbus_free_consistent: cannot free %p\n", p); return; @@ -493,7 +492,7 @@ static void pci32_free_coherent(struct device *dev, size_t n, void *p, { struct resource *res; - if ((res = lookup_resource(&_sparc_dvma, + if ((res = _sparc_find_resource(&_sparc_dvma, (unsigned long)p)) == NULL) { printk("pci_free_consistent: cannot free %p\n", p); return; @@ -716,6 +715,25 @@ static const struct file_operations sparc_io_proc_fops = { }; #endif /* CONFIG_PROC_FS */ +/* + * This is a version of find_resource and it belongs to kernel/resource.c. + * Until we have agreement with Linus and Martin, it lingers here. + * + * XXX Too slow. Can have 8192 DVMA pages on sun4m in the worst case. + * This probably warrants some sort of hashing. + */ +static struct resource *_sparc_find_resource(struct resource *root, + unsigned long hit) +{ + struct resource *tmp; + + for (tmp = root->child; tmp != 0; tmp = tmp->sibling) { + if (tmp->start <= hit && tmp->end >= hit) + return tmp; + } + return NULL; +} + static void register_proc_sparc_ioport(void) { #ifdef CONFIG_PROC_FS diff --git a/trunk/drivers/mfd/wm831x-irq.c b/trunk/drivers/mfd/wm831x-irq.c index 42b928ec891e..b23d8d5ee96c 100644 --- a/trunk/drivers/mfd/wm831x-irq.c +++ b/trunk/drivers/mfd/wm831x-irq.c @@ -348,6 +348,15 @@ static void wm831x_irq_sync_unlock(struct irq_data *data) struct wm831x *wm831x = irq_data_get_irq_chip_data(data); int i; + for (i = 0; i < ARRAY_SIZE(wm831x->gpio_update); i++) { + if (wm831x->gpio_update[i]) { + wm831x_set_bits(wm831x, WM831X_GPIO1_CONTROL + i, + WM831X_GPN_INT_MODE | WM831X_GPN_POL, + wm831x->gpio_update[i]); + wm831x->gpio_update[i] = 0; + } + } + for (i = 0; i < ARRAY_SIZE(wm831x->irq_masks_cur); i++) { /* If there's been a change in the mask write it back * to the hardware. */ @@ -387,7 +396,7 @@ static void wm831x_irq_disable(struct irq_data *data) static int wm831x_irq_set_type(struct irq_data *data, unsigned int type) { struct wm831x *wm831x = irq_data_get_irq_chip_data(data); - int val, irq; + int irq; irq = data->irq - wm831x->irq_base; @@ -399,22 +408,25 @@ static int wm831x_irq_set_type(struct irq_data *data, unsigned int type) return -EINVAL; } + /* We set the high bit to flag that we need an update; don't + * do the update here as we can be called with the bus lock + * held. + */ switch (type) { case IRQ_TYPE_EDGE_BOTH: - val = WM831X_GPN_INT_MODE; + wm831x->gpio_update[irq] = 0x10000 | WM831X_GPN_INT_MODE; break; case IRQ_TYPE_EDGE_RISING: - val = WM831X_GPN_POL; + wm831x->gpio_update[irq] = 0x10000 | WM831X_GPN_POL; break; case IRQ_TYPE_EDGE_FALLING: - val = 0; + wm831x->gpio_update[irq] = 0x10000; break; default: return -EINVAL; } - return wm831x_set_bits(wm831x, WM831X_GPIO1_CONTROL + irq, - WM831X_GPN_INT_MODE | WM831X_GPN_POL, val); + return 0; } static struct irq_chip wm831x_irq_chip = { diff --git a/trunk/fs/nfs/pnfs.h b/trunk/fs/nfs/pnfs.h index 01cbfd54f3cb..e0b5d80a43f6 100644 --- a/trunk/fs/nfs/pnfs.h +++ b/trunk/fs/nfs/pnfs.h @@ -380,7 +380,7 @@ pnfs_roc_drain(struct inode *ino, u32 *barrier) } static inline void set_pnfs_layoutdriver(struct nfs_server *s, - const struct nfs_fh *mntfh, u32 id) + const struct nfs_fh *mntfh, u32 id); { } diff --git a/trunk/include/linux/ioport.h b/trunk/include/linux/ioport.h index 9d57a71775b5..c2ebfe66177c 100644 --- a/trunk/include/linux/ioport.h +++ b/trunk/include/linux/ioport.h @@ -162,7 +162,6 @@ extern int allocate_resource(struct resource *root, struct resource *new, resource_size_t, resource_size_t), void *alignf_data); -struct resource *lookup_resource(struct resource *root, resource_size_t start); int adjust_resource(struct resource *res, resource_size_t start, resource_size_t size); resource_size_t resource_alignment(struct resource *res); diff --git a/trunk/include/linux/mfd/wm831x/core.h b/trunk/include/linux/mfd/wm831x/core.h index 0d515ee1c247..ebead1c401aa 100644 --- a/trunk/include/linux/mfd/wm831x/core.h +++ b/trunk/include/linux/mfd/wm831x/core.h @@ -237,6 +237,7 @@ struct regulator_dev; #define WM831X_NUM_IRQ_REGS 5 +#define WM831X_NUM_GPIO_REGS 16 enum wm831x_parent { WM8310 = 0x8310, @@ -272,6 +273,9 @@ struct wm831x { int num_gpio; + /* Used by the interrupt controller code to post writes */ + int gpio_update[WM831X_NUM_GPIO_REGS]; + struct mutex auxadc_lock; struct completion auxadc_done; diff --git a/trunk/include/linux/nfs_fs_sb.h b/trunk/include/linux/nfs_fs_sb.h index b5479df8378d..82fdfc7987d6 100644 --- a/trunk/include/linux/nfs_fs_sb.h +++ b/trunk/include/linux/nfs_fs_sb.h @@ -131,7 +131,6 @@ struct nfs_server { struct fscache_cookie *fscache; /* superblock cookie */ #endif - u32 pnfs_blksize; /* layout_blksize attr */ #ifdef CONFIG_NFS_V4 u32 attr_bitmask[3];/* V4 bitmask representing the set of attributes supported on this @@ -146,6 +145,7 @@ struct nfs_server { filesystem */ struct pnfs_layoutdriver_type *pnfs_curr_ld; /* Active layout driver */ struct rpc_wait_queue roc_rpcwaitq; + u32 pnfs_blksize; /* layout_blksize attr */ void *pnfs_ld_data; /* per mount point data */ /* the following fields are protected by nfs_client->cl_lock */ diff --git a/trunk/kernel/resource.c b/trunk/kernel/resource.c index 3b3cedc52592..3ff40178dce7 100644 --- a/trunk/kernel/resource.c +++ b/trunk/kernel/resource.c @@ -553,27 +553,6 @@ int allocate_resource(struct resource *root, struct resource *new, EXPORT_SYMBOL(allocate_resource); -/** - * lookup_resource - find an existing resource by a resource start address - * @root: root resource descriptor - * @start: resource start address - * - * Returns a pointer to the resource if found, NULL otherwise - */ -struct resource *lookup_resource(struct resource *root, resource_size_t start) -{ - struct resource *res; - - read_lock(&resource_lock); - for (res = root->child; res; res = res->sibling) { - if (res->start == start) - break; - } - read_unlock(&resource_lock); - - return res; -} - /* * Insert a resource into the resource tree. If successful, return NULL, * otherwise return the conflicting resource (compare to __request_resource())