From 6dae2c2306684d9e76a04c22dc090380a9009f12 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Fri, 21 Oct 2005 03:21:38 -0400 Subject: [PATCH] gfp_t: dma-mapping (sh) Signed-off-by: Al Viro Signed-off-by: Linus Torvalds --- include/asm-sh/dma-mapping.h | 4 ++-- include/asm-sh/machvec.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'include/asm-sh') diff --git a/include/asm-sh/dma-mapping.h b/include/asm-sh/dma-mapping.h index 80d164c1529e..d3fa5c2b889d 100644 --- a/include/asm-sh/dma-mapping.h +++ b/include/asm-sh/dma-mapping.h @@ -9,7 +9,7 @@ extern struct bus_type pci_bus_type; /* arch/sh/mm/consistent.c */ -extern void *consistent_alloc(int gfp, size_t size, dma_addr_t *handle); +extern void *consistent_alloc(gfp_t gfp, size_t size, dma_addr_t *handle); extern void consistent_free(void *vaddr, size_t size); extern void consistent_sync(void *vaddr, size_t size, int direction); @@ -26,7 +26,7 @@ static inline int dma_set_mask(struct device *dev, u64 mask) } static inline void *dma_alloc_coherent(struct device *dev, size_t size, - dma_addr_t *dma_handle, int flag) + dma_addr_t *dma_handle, gfp_t flag) { if (sh_mv.mv_consistent_alloc) { void *ret; diff --git a/include/asm-sh/machvec.h b/include/asm-sh/machvec.h index 5771f4baa478..3f18aa180516 100644 --- a/include/asm-sh/machvec.h +++ b/include/asm-sh/machvec.h @@ -64,7 +64,7 @@ struct sh_machine_vector void (*mv_heartbeat)(void); - void *(*mv_consistent_alloc)(struct device *, size_t, dma_addr_t *, int); + void *(*mv_consistent_alloc)(struct device *, size_t, dma_addr_t *, gfp_t); int (*mv_consistent_free)(struct device *, size_t, void *, dma_addr_t); }; -- cgit v1.2.3 From eb92f4ef320b738e41ad43476a5d05c8a20d5cc7 Mon Sep 17 00:00:00 2001 From: Rik Van Riel Date: Sat, 29 Oct 2005 18:15:44 -0700 Subject: [PATCH] add sem_is_read/write_locked() Add sem_is_read/write_locked functions to the read/write semaphores, along the same lines of the *_is_locked spinlock functions. The swap token tuning patch uses sem_is_read_locked; sem_is_write_locked is added for completeness. Signed-off-by: Rik van Riel Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/asm-sh/rwsem.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include/asm-sh') diff --git a/include/asm-sh/rwsem.h b/include/asm-sh/rwsem.h index 1be4337f5259..0262d3d1e5e0 100644 --- a/include/asm-sh/rwsem.h +++ b/include/asm-sh/rwsem.h @@ -166,5 +166,10 @@ static inline int rwsem_atomic_update(int delta, struct rw_semaphore *sem) return atomic_add_return(delta, (atomic_t *)(&sem->count)); } +static inline int rwsem_is_locked(struct rw_semaphore *sem) +{ + return (sem->count != 0); +} + #endif /* __KERNEL__ */ #endif /* _ASM_SH_RWSEM_H */ -- cgit v1.2.3 From dfb7dac3af623a68262536437af008ed6aba4d88 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Sun, 30 Oct 2005 15:02:22 -0800 Subject: [PATCH] unify sys_ptrace prototype Make sure we always return, as all syscalls should. Also move the common prototype to Signed-off-by: Christoph Hellwig Signed-off-by: Miklos Szeredi Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/asm-sh/unistd.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include/asm-sh') diff --git a/include/asm-sh/unistd.h b/include/asm-sh/unistd.h index ea89e8f223ea..f2c8e14d1fd9 100644 --- a/include/asm-sh/unistd.h +++ b/include/asm-sh/unistd.h @@ -503,7 +503,6 @@ asmlinkage int sys_vfork(unsigned long r4, unsigned long r5, asmlinkage int sys_pipe(unsigned long r4, unsigned long r5, unsigned long r6, unsigned long r7, struct pt_regs regs); -asmlinkage int sys_ptrace(long request, long pid, long addr, long data); asmlinkage ssize_t sys_pread_wrapper(unsigned int fd, char *buf, size_t count, long dummy, loff_t pos); asmlinkage ssize_t sys_pwrite_wrapper(unsigned int fd, const char *buf, -- cgit v1.2.3 From 1426d7a81dea8e9d85f9d69de85ab04ba37018ab Mon Sep 17 00:00:00 2001 From: Tejun Heo Date: Sun, 30 Oct 2005 15:02:42 -0800 Subject: [PATCH] vm: remove unused/broken page_pte[_prot] macros This patch removes page_pte_prot and page_pte macros from all architectures. Some architectures define both, some only page_pte (broken) and others none. These macros are not used anywhere. page_pte_prot(page, prot) is identical to mk_pte(page, prot) and page_pte(page) is identical to page_pte_prot(page, __pgprot(0)). * The following architectures define both page_pte_prot and page_pte arm, arm26, ia64, sh64, sparc, sparc64 * The following architectures define only page_pte (broken) frv, i386, m32r, mips, sh, x86-64 * All other architectures define neither Signed-off-by: Tejun Heo Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/asm-sh/pgtable.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'include/asm-sh') diff --git a/include/asm-sh/pgtable.h b/include/asm-sh/pgtable.h index 0f4bcaae61bd..aef8ae43de13 100644 --- a/include/asm-sh/pgtable.h +++ b/include/asm-sh/pgtable.h @@ -224,8 +224,6 @@ static inline pgprot_t pgprot_noncached(pgprot_t _prot) static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) { set_pte(&pte, __pte((pte_val(pte) & _PAGE_CHG_MASK) | pgprot_val(newprot))); return pte; } -#define page_pte(page) page_pte_prot(page, __pgprot(0)) - #define pmd_page_kernel(pmd) \ ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) -- cgit v1.2.3 From 727a53bd535fe3bde644ac346db27456ad964083 Mon Sep 17 00:00:00 2001 From: Arthur Othieno Date: Sun, 30 Oct 2005 15:03:14 -0800 Subject: [PATCH] semaphore: Remove __MUTEX_INITIALIZER() __MUTEX_INITIALIZER() has no users, and equates to the more commonly used DECLARE_MUTEX(), thus making it pretty much redundant. Remove it for good. Signed-off-by: Arthur Othieno Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/asm-sh/semaphore.h | 3 --- 1 file changed, 3 deletions(-) (limited to 'include/asm-sh') diff --git a/include/asm-sh/semaphore.h b/include/asm-sh/semaphore.h index b923a77a8a7e..489f7847c5d9 100644 --- a/include/asm-sh/semaphore.h +++ b/include/asm-sh/semaphore.h @@ -33,9 +33,6 @@ struct semaphore { .wait = __WAIT_QUEUE_HEAD_INITIALIZER((name).wait) \ } -#define __MUTEX_INITIALIZER(name) \ - __SEMAPHORE_INITIALIZER(name,1) - #define __DECLARE_SEMAPHORE_GENERIC(name,count) \ struct semaphore name = __SEMAPHORE_INITIALIZER(name,count) -- cgit v1.2.3 From d229401f130941583eb46a2e8886df61241c14eb Mon Sep 17 00:00:00 2001 From: Paul Mundt Date: Mon, 7 Nov 2005 00:58:23 -0800 Subject: [PATCH] sh: pte_mkhuge() compile fix for !CONFIG_HUGETLB_PAGE Presently it is bogus to call pte_mkhuge() outside of the CONFIG_HUGETLB_PAGE context, as the only processors that support _PAGE_SZHUGE do so in the hugetlbpage context only (and this is the only time that _PAGE_SZHUGE is even defined). SH-2 and SH-3 do not support huge pages at all, and so it is not possible to enable this. Signed-off-by: Paul Mundt Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/asm-sh/pgtable.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include/asm-sh') diff --git a/include/asm-sh/pgtable.h b/include/asm-sh/pgtable.h index aef8ae43de13..dee36bcbcf98 100644 --- a/include/asm-sh/pgtable.h +++ b/include/asm-sh/pgtable.h @@ -196,7 +196,9 @@ static inline pte_t pte_mkexec(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _ static inline pte_t pte_mkdirty(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY)); return pte; } static inline pte_t pte_mkyoung(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_ACCESSED)); return pte; } static inline pte_t pte_mkwrite(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_RW)); return pte; } +#ifdef CONFIG_HUGETLB_PAGE static inline pte_t pte_mkhuge(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_SZHUGE)); return pte; } +#endif /* * Macro and implementation to make a page protection as uncachable. -- cgit v1.2.3 From 65463b73b14ed43368dc5961a6c3dcb0d98cfe1f Mon Sep 17 00:00:00 2001 From: Paul Mundt Date: Mon, 7 Nov 2005 00:58:24 -0800 Subject: [PATCH] sh: Drop hp690 discontig support There was only one board using this (hp690 specifically), and it just so happens that it's only physically discontiguous at the "normal" P1 offset. If we bump up the P1 offset, it's possible to hit a shadowed region of memory where we suddenly become magically contiguous. As people have been using this shadowed region workaround for quite some time (and without any adverse effects), it's time to drop the left over discontig bits that no longer have any practical use (it was always very much hp690-centric to begin with). Signed-off-by: Paul Mundt Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/asm-sh/mmzone.h | 61 ------------------------------------------------- include/asm-sh/page.h | 7 ------ 2 files changed, 68 deletions(-) delete mode 100644 include/asm-sh/mmzone.h (limited to 'include/asm-sh') diff --git a/include/asm-sh/mmzone.h b/include/asm-sh/mmzone.h deleted file mode 100644 index 0e7406601fdf..000000000000 --- a/include/asm-sh/mmzone.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * linux/include/asm-sh/mmzone.h - * - * 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. - */ -#ifndef __ASM_SH_MMZONE_H -#define __ASM_SH_MMZONE_H - -#include - -#ifdef CONFIG_DISCONTIGMEM - -/* Currently, just for HP690 */ -#define PHYSADDR_TO_NID(phys) ((((phys) - __MEMORY_START) >= 0x01000000)?1:0) - -extern pg_data_t discontig_page_data[MAX_NUMNODES]; -extern bootmem_data_t discontig_node_bdata[MAX_NUMNODES]; - -/* - * Following are macros that each numa implmentation must define. - */ - -/* - * Given a kernel address, find the home node of the underlying memory. - */ -#define KVADDR_TO_NID(kaddr) PHYSADDR_TO_NID(__pa(kaddr)) - -/* - * Return a pointer to the node data for node n. - */ -#define NODE_DATA(nid) (&discontig_page_data[nid]) - -/* - * NODE_MEM_MAP gives the kaddr for the mem_map of the node. - */ -#define NODE_MEM_MAP(nid) (NODE_DATA(nid)->node_mem_map) - -#define phys_to_page(phys) \ -({ unsigned int node = PHYSADDR_TO_NID(phys); \ - NODE_MEM_MAP(node) \ - + (((phys) - NODE_DATA(node)->node_start_paddr) >> PAGE_SHIFT); }) - -static inline int is_valid_page(struct page *page) -{ - unsigned int i; - - for (i = 0; i < MAX_NUMNODES; i++) { - if (page >= NODE_MEM_MAP(i) && - page < NODE_MEM_MAP(i) + NODE_DATA(i)->node_size) - return 1; - } - return 0; -} - -#define VALID_PAGE(page) is_valid_page(page) -#define page_to_phys(page) PHYSADDR(page_address(page)) - -#endif /* CONFIG_DISCONTIGMEM */ -#endif diff --git a/include/asm-sh/page.h b/include/asm-sh/page.h index 324e6cc5ecf7..972c3f655b2a 100644 --- a/include/asm-sh/page.h +++ b/include/asm-sh/page.h @@ -93,11 +93,6 @@ typedef struct { unsigned long pgprot; } pgprot_t; #define __MEMORY_START CONFIG_MEMORY_START #define __MEMORY_SIZE CONFIG_MEMORY_SIZE -#ifdef CONFIG_DISCONTIGMEM -/* Just for HP690, for now.. */ -#define __MEMORY_START_2ND (__MEMORY_START+0x02000000) -#define __MEMORY_SIZE_2ND 0x001000000 /* 16MB */ -#endif #define PAGE_OFFSET (0x80000000UL) #define __pa(x) ((unsigned long)(x)-PAGE_OFFSET) @@ -105,10 +100,8 @@ typedef struct { unsigned long pgprot; } pgprot_t; #define MAP_NR(addr) (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT) -#ifndef CONFIG_DISCONTIGMEM #define phys_to_page(phys) (mem_map + (((phys)-__MEMORY_START) >> PAGE_SHIFT)) #define page_to_phys(page) (((page - mem_map) << PAGE_SHIFT) + __MEMORY_START) -#endif /* PFN start number, because of __MEMORY_START */ #define PFN_START (__MEMORY_START >> PAGE_SHIFT) -- cgit v1.2.3 From 8c65b4a60450590e79a28e9717ceffa9e4debb3f Mon Sep 17 00:00:00 2001 From: Tim Schmielau Date: Mon, 7 Nov 2005 00:59:43 -0800 Subject: [PATCH] fix remaining missing includes Fix more include file problems that surfaced since I submitted the previous fix-missing-includes.patch. This should now allow not to include sched.h from module.h, which is done by a followup patch. Signed-off-by: Tim Schmielau Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/asm-sh/elf.h | 1 + include/asm-sh/pgtable.h | 2 ++ 2 files changed, 3 insertions(+) (limited to 'include/asm-sh') diff --git a/include/asm-sh/elf.h b/include/asm-sh/elf.h index 8fe00a1981ce..1b63dfeea4f2 100644 --- a/include/asm-sh/elf.h +++ b/include/asm-sh/elf.h @@ -111,6 +111,7 @@ typedef struct user_fpu_struct elf_fpregset_t; #ifdef __KERNEL__ #define SET_PERSONALITY(ex, ibcs2) set_personality(PER_LINUX_32BIT) +struct task_struct; extern int dump_task_regs (struct task_struct *, elf_gregset_t *); extern int dump_task_fpu (struct task_struct *, elf_fpregset_t *); diff --git a/include/asm-sh/pgtable.h b/include/asm-sh/pgtable.h index dee36bcbcf98..bb0efb31a8cb 100644 --- a/include/asm-sh/pgtable.h +++ b/include/asm-sh/pgtable.h @@ -284,6 +284,8 @@ typedef pte_t *pte_addr_t; #define GET_IOSPACE(pfn) 0 #define GET_PFN(pfn) (pfn) +struct mm_struct; + /* * No page table caches to initialise */ -- cgit v1.2.3 From 83ae20c849f1bff32100fa8584408dca99ce4a62 Mon Sep 17 00:00:00 2001 From: Bjorn Helgaas Date: Wed, 9 Nov 2005 22:58:07 +0100 Subject: [PATCH] ide: move CONFIG_IDE_MAX_HWIFS into linux/ide.h CONFIG_IDE_MAX_HWIFS is a generic thing, no need to have it duplicated by every arch that uses it. Signed-off-by: Bjorn Helgaas Signed-off-by: Bartlomiej Zolnierkiewicz --- include/asm-sh/ide.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'include/asm-sh') diff --git a/include/asm-sh/ide.h b/include/asm-sh/ide.h index f42cf3977a57..711dad4cb48b 100644 --- a/include/asm-sh/ide.h +++ b/include/asm-sh/ide.h @@ -16,10 +16,6 @@ #include -#ifndef MAX_HWIFS -#define MAX_HWIFS CONFIG_IDE_MAX_HWIFS -#endif - #define ide_default_io_ctl(base) (0) #include -- cgit v1.2.3 From 4a6dae6d382e9edf3ff440b819e554ed706359bc Mon Sep 17 00:00:00 2001 From: Nick Piggin Date: Sun, 13 Nov 2005 16:07:24 -0800 Subject: [PATCH] atomic: cmpxchg Introduce an atomic_cmpxchg operation. Signed-off-by: Nick Piggin Cc: "Paul E. McKenney" Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/asm-sh/atomic.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'include/asm-sh') diff --git a/include/asm-sh/atomic.h b/include/asm-sh/atomic.h index 3c4f805da1ac..a148c762d366 100644 --- a/include/asm-sh/atomic.h +++ b/include/asm-sh/atomic.h @@ -87,6 +87,20 @@ static __inline__ int atomic_sub_return(int i, atomic_t * v) #define atomic_inc(v) atomic_add(1,(v)) #define atomic_dec(v) atomic_sub(1,(v)) +static inline int atomic_cmpxchg(atomic_t *v, int old, int new) +{ + int ret; + unsigned long flags; + + local_irq_save(flags); + ret = v->counter; + if (likely(ret == old)) + v->counter = new; + local_irq_restore(flags); + + return ret; +} + static __inline__ void atomic_clear_mask(unsigned int mask, atomic_t *v) { unsigned long flags; -- cgit v1.2.3 From 8426e1f6af0fd7f44d040af7263750c5a52f3cc3 Mon Sep 17 00:00:00 2001 From: Nick Piggin Date: Sun, 13 Nov 2005 16:07:25 -0800 Subject: [PATCH] atomic: inc_not_zero Introduce an atomic_inc_not_zero operation. Make this a special case of atomic_add_unless because lockless pagecache actually wants atomic_inc_not_negativeone due to its offset refcount. Signed-off-by: Nick Piggin Cc: "Paul E. McKenney" Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/asm-sh/atomic.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'include/asm-sh') diff --git a/include/asm-sh/atomic.h b/include/asm-sh/atomic.h index a148c762d366..aabfd334462c 100644 --- a/include/asm-sh/atomic.h +++ b/include/asm-sh/atomic.h @@ -101,6 +101,21 @@ static inline int atomic_cmpxchg(atomic_t *v, int old, int new) return ret; } +static inline int atomic_add_unless(atomic_t *v, int a, int u) +{ + int ret; + unsigned long flags; + + local_irq_save(flags); + ret = v->counter; + if (ret != u) + v->counter += a; + local_irq_restore(flags); + + return ret != u; +} +#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) + static __inline__ void atomic_clear_mask(unsigned int mask, atomic_t *v) { unsigned long flags; -- cgit v1.2.3