MUTEX: Introduce simple mutex implementation
Subsystems (122)
PATCH 1/19 MUTEX: Introduce simple mutex implementation
The attached patch introduces a simple mutex implementation as an alternative to the usual semaphore implementation where simple mutex functionality is all that is required.
This is useful in two ways:
(1) A number of archs only provide very simple atomic instructions (such as XCHG on i386, TAS on M68K, SWAP on FRV) which aren't sufficient to implement full semaphore support directly. Instead spinlocks must be employed to implement fuller functionality.
(2) This makes it obvious in what way the semaphore is being used: whether it's being used as a mutex or being used as a counter.
This patch set does the following:
(1) Provides a simple xchg() based semaphore as a default for all architectures that don't wish to override it and provide their own.
Overriding is possible by setting CONFIG_ARCH_IMPLEMENTS_MUTEX and supplying asm/mutex.h
Partial overriding is possible by #defining mutex_grab(), mutex_release() and is_mutex_locked() to perform the appropriate optimised functions.
(2) Provides linux/mutex.h as a common include for gaining access to mutex semaphores.
(3) Provides linux/semaphore.h as a common include for gaining access to all the different types of semaphore that may be used from within the kernel.
(4) Renames down*() to down_sem*() and up() to up_sem() for the traditional semaphores, and removes init_MUTEX*() and DECLARE_MUTEX*() from asm/semaphore.h
(5) Redirects the following to apply to the new mutexes rather than the traditional semaphores:
down()
down_trylock()
down_interruptible()
up()
init_MUTEX()
init_MUTEX_LOCKED()
DECLARE_MUTEX()
DECLARE_MUTEX_LOCKED()
On the basis that most usages of semaphores are as mutexes, this makes sense for in most cases it's just then a matter of changing the type from struct semaphore to struct mutex. In some cases, sema_init() has to be changed to init_MUTEX*() also.
(6) Generally include linux/semaphore.h in place of asm/semaphore.h.
(7) Provides a debugging config option CONFIG_DEBUG_MUTEX_OWNER by which the mutex owner can be tracked and by which over-upping can be detected.
---
warthog>diffstat -p1 mutex-simple-2615rc5.diff
include/linux/mutex-simple.h | 194 +++++++++++++++++++++++++++++++++++++++++++ include/linux/mutex.h | 32 +++++++ include/linux/semaphore.h | 30 ++++++ lib/Kconfig.debug | 8 + lib/Makefile | 4 lib/mutex-simple.c | 178 +++++++++++++++++++++++++++++++++++++++ lib/semaphore-sleepers.c | 8 - 7 files changed, 450 insertions(+), 4 deletions(-)
include/linux/semaphore.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/semaphore.h +30 -0
@@ -0,0 +1,30 @@ +/* semaphore.h: include the various types of semaphore in one package +* +* Copyright (C) 2005 Red Hat, Inc. All Rights Reserved. +* Written by David Howells ([email protected]) +* +* 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. +*/ + +#ifndef _LINUX_SEMAPHORE_H +#define _LINUX_SEMAPHORE_H + +/* +* simple mutex semaphores +*/ +#include <linux/mutex.h> + +/* +* multiple-count semaphores +*/ +#include <asm/semaphore.h> + +/* +* read/write semaphores +*/ +#include <linux/rwsem.h> + +#endif /* _LINUX_SEMAPHORE_H */
include/linux/mutex.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/mutex.h +32 -0
@@ -0,0 +1,32 @@ +/* mutex.h: mutex semaphore implementation base +* +* Copyright (C) 2005 Red Hat, Inc. All Rights Reserved. +* Written by David Howells ([email protected]) +* +* 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. +*/ +#ifndef _LINUX_MUTEX_H +#define _LINUX_MUTEX_H + +#include <linux/config.h> + +#ifdef CONFIG_ARCH_IMPLEMENTS_MUTEX + +/* +* the arch wants to implement the whole mutex itself +*/ +#include <asm/mutex.h> +#else + +/* +* simple exchange-based mutex +* - the arch may override mutex_grab(), mutex_release() and is_mutex_locked() +* to use something other than xchg() by #defining mutex_grab +*/ +#include <linux/mutex-simple.h> +#endif + +#endif /* _LINUX_MUTEX_H */
include/linux/mutex-simple.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/mutex-simple.h +194 -0
194 lines not on this page · raw message
lib/Kconfig.debug renamed from warthog/kernels/linux-2.6.15-rc5/lib/Kconfig.debug +8 -0
@@ -111,6 +111,14 @@ config DEBUG_SPINLOCK_SLEEP If you say Y here, various routines which may sleep will become very noisy if they are called with a spinlock held. +config DEBUG_MUTEX_OWNER + bool "Mutex owner tracking and checking" + depends on DEBUG_KERNEL + help + If you say Y here, the process currently owning a mutex will be + remembered, and a warning will be issued if anyone other than that + process releases it. + config DEBUG_KOBJECT bool "kobject debugging" depends on DEBUG_KERNEL
lib/Makefile renamed from warthog/kernels/linux-2.6.15-rc5/lib/Makefile +4 -0
@@ -28,6 +28,10 @@ ifneq ($(CONFIG_HAVE_DEC_LOCK),y) lib-y += dec_and_lock.o endif +ifneq ($(CONFIG_ARCH_IMPLEMENTS_MUTEX),y) + lib-y += mutex-simple.o +endif + obj-$(CONFIG_CRC_CCITT) += crc-ccitt.o obj-$(CONFIG_CRC16) += crc16.o obj-$(CONFIG_CRC32) += crc32.o
lib/mutex-simple.c renamed from warthog/kernels/linux-2.6.15-rc5/lib/mutex-simple.c +178 -0
178 lines not on this page · raw message
lib/semaphore-sleepers.c renamed from warthog/kernels/linux-2.6.15-rc5/lib/semaphore-sleepers.c +4 -4
@@ -49,12 +49,12 @@* we cannot lose wakeup events. */ -fastcall void __up(struct semaphore *sem) +fastcall void __up_sem(struct semaphore *sem) {wake_up (&sem->wait); } -fastcall void __sched __down(struct semaphore * sem) +fastcall void __sched __down_sem(struct semaphore * sem) {struct task_struct *tsk = current;DECLARE_WAITQUEUE (wait, tsk);
@@ -91,7 +91,7 @@ fastcall void __sched __down(struct sema tsk->state =TASK_RUNNING ; } -fastcall int __sched __down_interruptible(struct semaphore * sem) +fastcall int __sched __down_sem_interruptible(struct semaphore * sem) {int retval =0 ;struct task_struct *tsk = current;
@@ -154,7 +154,7 @@ fastcall int __sched __down_interruptibl* single "cmpxchg" without failure cases, * but then it wouldn't work on a 386. */ -fastcall int __down_trylock(struct semaphore * sem) +fastcall int __down_sem_trylock(struct semaphore * sem) {int sleepers;unsigned long flags;
PATCH 2/19 MUTEX: i386 arch mutex
The attached patch renames the functions of the i386 traditional semaphore implementation to include "_sem" in their names and to remove the MUTEX macros that are now provided by the new mutex facility.
---
warthog>diffstat -p1 mutex-i386-2615rc5.diff
arch/i386/kernel/cpu/proc.c | 2 - arch/i386/kernel/i386_ksyms.c | 12 ++++++--- arch/i386/kernel/semaphore.c | 24 +++++++++--------- include/asm-i386/mmu.h | 4 +-- include/asm-i386/semaphore.h | 55 ++++++++++++++++-------------------------- include/asm-i386/voyager.h | 2 - 6 files changed, 45 insertions(+), 54 deletions(-)
include/asm-i386/mmu.h renamed from warthog/kernels/linux-2.6.15-rc5/include/asm-i386/mmu.h +2 -2
@@ -1,7 +1,7 @@#ifndef __i386_MMU_H#define __i386_MMU_H -#include <asm/semaphore.h> +#include <linux/mutex.h> /* * The i386 doesn't have a mmu context, but * we put the segment information here.
@@ -10,7 +10,7 @@*/ typedef struct {int size; -struct semaphore sem; +struct mutex sem;void *ldt; }mm_context_t ;
include/asm-i386/semaphore.h renamed from warthog/kernels/linux-2.6.15-rc5/include/asm-i386/semaphore.h +21 -34
133 lines not on this page · raw message
include/asm-i386/voyager.h renamed from warthog/kernels/linux-2.6.15-rc5/include/asm-i386/voyager.h +1 -1
@@ -489,7 +489,7 @@ extern struct voyager_SUS *voyager_SUS;/* variables exported always */ extern int voyager_level;extern int kvoyagerd_running; -extern struct semaphore kvoyagerd_sem; +extern struct mutex kvoyagerd_sem;extern struct voyager_status voyager_status;
arch/i386/kernel/cpu/proc.c renamed from warthog/kernels/linux-2.6.15-rc5/arch/i386/kernel/cpu/proc.c +1 -1
@@ -1,7 +1,7 @@#include <linux/smp.h> #include <linux/timex.h> #include <linux/string.h> -#include <asm/semaphore.h> +#include <linux/mutex.h> #include <linux/seq_file.h> /*
arch/i386/kernel/i386_ksyms.c renamed from warthog/kernels/linux-2.6.15-rc5/arch/i386/kernel/i386_ksyms.c +8 -4
@@ -1,15 +1,19 @@#include <linux/config.h> #include <linux/module.h> +#include <linux/mutex.h> #include <asm/checksum.h> #include <asm/desc.h> /* This is definitely a GPL-only symbol */ EXPORT_SYMBOL_GPL (cpu_gdt_table); -EXPORT_SYMBOL (__down_failed); -EXPORT_SYMBOL (__down_failed_interruptible); -EXPORT_SYMBOL (__down_failed_trylock); -EXPORT_SYMBOL (__up_wakeup); +EXPORT_SYMBOL (__down); +EXPORT_SYMBOL (__down_interruptible); +EXPORT_SYMBOL (__up); +EXPORT_SYMBOL (__down_sem_failed); +EXPORT_SYMBOL (__down_sem_failed_interruptible); +EXPORT_SYMBOL (__down_sem_failed_trylock); +EXPORT_SYMBOL (__up_sem_wakeup);/* Networking helper routines. */ EXPORT_SYMBOL (csum_partial_copy_generic);
arch/i386/kernel/semaphore.c renamed from warthog/kernels/linux-2.6.15-rc5/arch/i386/kernel/semaphore.c +12 -12
@@ -28,15 +28,15 @@ asm( ".section .sched.text\n" ".align 4\n" -".globl __down_failed\n" -"__down_failed:\n\t" +".globl __down_sem_failed\n" +"__down_sem_failed:\n\t"#if defined(CONFIG_FRAME_POINTER )"pushl %ebp\n\t" "movl %esp,%ebp\n\t"#endif "pushl %edx\n\t" "pushl %ecx\n\t" -"call __down\n\t" +"call __down_sem\n\t" "popl %ecx\n\t" "popl %edx\n\t"#if defined(CONFIG_FRAME_POINTER )
@@ -49,15 +49,15 @@ asm( asm( ".section .sched.text\n" ".align 4\n" -".globl __down_failed_interruptible\n" -"__down_failed_interruptible:\n\t" +".globl __down_sem_failed_interruptible\n" +"__down_sem_failed_interruptible:\n\t"#if defined(CONFIG_FRAME_POINTER )"pushl %ebp\n\t" "movl %esp,%ebp\n\t"#endif "pushl %edx\n\t" "pushl %ecx\n\t" -"call __down_interruptible\n\t" +"call __down_sem_interruptible\n\t" "popl %ecx\n\t" "popl %edx\n\t"#if defined(CONFIG_FRAME_POINTER )
@@ -70,15 +70,15 @@ asm( asm( ".section .sched.text\n" ".align 4\n" -".globl __down_failed_trylock\n" -"__down_failed_trylock:\n\t" +".globl __down_sem_failed_trylock\n" +"__down_sem_failed_trylock:\n\t"#if defined(CONFIG_FRAME_POINTER )"pushl %ebp\n\t" "movl %esp,%ebp\n\t"#endif "pushl %edx\n\t" "pushl %ecx\n\t" -"call __down_trylock\n\t" +"call __down_sem_trylock\n\t" "popl %ecx\n\t" "popl %edx\n\t"#if defined(CONFIG_FRAME_POINTER )
@@ -91,11 +91,11 @@ asm( asm(".section .sched.text\n" ".align 4\n" -".globl __up_wakeup\n" -"__up_wakeup:\n\t" +".globl __up_sem_wakeup\n" +"__up_sem_wakeup:\n\t" "pushl %edx\n\t" "pushl %ecx\n\t" -"call __up\n\t" +"call __up_sem\n\t" "popl %ecx\n\t" "popl %edx\n\t" "ret"
PATCH 3/19 MUTEX: x86_64 arch mutex
In reply to David HowellsThe attached patch renames the functions of the x86_64 traditional semaphore implementation to include "_sem" in their names and to remove the MUTEX macros that are now provided by the new mutex facility.
---
warthog>diffstat -p1 mutex-x86_64-2615rc5.diff
arch/x86_64/kernel/x8664_ksyms.c | 10 +++---- arch/x86_64/lib/thunk.S | 8 +++--- include/asm-x86_64/mmu.h | 4 +-- include/asm-x86_64/semaphore.h | 49 ++++++++++++++------------------------- 4 files changed, 29 insertions(+), 42 deletions(-)
include/asm-x86_64/mmu.h renamed from warthog/kernels/linux-2.6.15-rc5/include/asm-x86_64/mmu.h +2 -2
@@ -2,7 +2,7 @@#define __x86_64_MMU_H#include <linux/spinlock.h> -#include <asm/semaphore.h> +#include <linux/mutex.h> /* * The x86_64 doesn't have a mmu context, but
@@ -14,7 +14,7 @@ typedef struct {void *ldt;rwlock_t ldtlock;int size; - struct semaphore sem; + struct mutex sem; } mm_context_t;#endif
include/asm-x86_64/semaphore.h renamed from warthog/kernels/linux-2.6.15-rc5/include/asm-x86_64/semaphore.h +18 -31
108 lines not on this page · raw message
arch/x86_64/kernel/x8664_ksyms.c renamed from warthog/kernels/linux-2.6.15-rc5/arch/x86_64/kernel/x8664_ksyms.c +5 -5
@@ -14,8 +14,8 @@#include <linux/syscalls.h> #include <linux/tty.h> #include <linux/ioctl32.h> +#include <linux/semaphore.h> -#include <asm/semaphore.h> #include <asm/processor.h> #include <asm/i387.h> #include <asm/uaccess.h>
@@ -62,10 +62,10 @@ EXPORT_SYMBOL(pm_idle);EXPORT_SYMBOL (pm_power_off);EXPORT_SYMBOL (get_cmos_time); -EXPORT_SYMBOL (__down_failed); -EXPORT_SYMBOL (__down_failed_interruptible); -EXPORT_SYMBOL (__down_failed_trylock); -EXPORT_SYMBOL (__up_wakeup); +EXPORT_SYMBOL (__down_sem_failed); +EXPORT_SYMBOL (__down_sem_failed_interruptible); +EXPORT_SYMBOL (__down_sem_failed_trylock); +EXPORT_SYMBOL (__up_sem_wakeup);/* Networking helper routines. */ EXPORT_SYMBOL (csum_partial_copy_nocheck);EXPORT_SYMBOL (ip_compute_csum);
arch/x86_64/lib/thunk.S renamed from warthog/kernels/linux-2.6.15-rc5/arch/x86_64/lib/thunk.S +4 -4
@@ -44,10 +44,10 @@ #endif thunk do_softirq_thunk,do_softirq - thunk __down_failed,__down - thunk_retrax __down_failed_interruptible,__down_interruptible - thunk_retrax __down_failed_trylock,__down_trylock - thunk __up_wakeup,__up + thunk __down_sem_failed,__down_sem + thunk_retrax __down_sem_failed_interruptible,__down_sem_interruptible + thunk_retrax __down_sem_failed_trylock,__down_sem_trylock + thunk __up_sem_wakeup,__up_sem /* SAVE_ARGS below is used only for the .cfi directives it contains. */ CFI_STARTPROC
PATCH 4/19 MUTEX: FRV arch mutex
In reply to David HowellsThe attached patch renames the functions of the FRV traditional semaphore implementation to include "_sem" in their names and to remove the MUTEX macros that are now provided by the new mutex facility.
---
warthog>diffstat -p1 mutex-frv-2615rc5.diff
arch/frv/kernel/frv_ksyms.c | 2 +- arch/frv/kernel/semaphore.c | 24 ++++++++++++------------ include/asm-frv/semaphore.h | 35 +++++++++++------------------------ 3 files changed, 24 insertions(+), 37 deletions(-)
include/asm-frv/semaphore.h renamed from warthog/kernels/linux-2.6.15-rc5/include/asm-frv/semaphore.h +11 -24
@@ -50,29 +50,16 @@ struct semaphore {#define __DECLARE_SEMAPHORE_GENERIC (name,count) \ struct semaphore name = __SEMAPHORE_INITIALIZER(name,count) -#define DECLARE_MUTEX (name) __DECLARE_SEMAPHORE_GENERIC(name,1) -#define DECLARE_MUTEX_LOCKED (name) __DECLARE_SEMAPHORE_GENERIC(name,0) -static inline void sema_init (struct semaphore *sem,int val) { *sem = (struct semaphore )__SEMAPHORE_INITIALIZER (*sem, val); } -static inline void init_MUTEX (struct semaphore *sem) -{ -sema_init (sem,1 ); -} - -static inline void init_MUTEX_LOCKED (struct semaphore *sem) -{ -sema_init (sem,0 ); -} - -extern void __down (struct semaphore *sem,unsigned long flags); -extern int __down_interruptible (struct semaphore *sem,unsigned long flags); -extern void __up (struct semaphore *sem); +extern void __down_sem (struct semaphore *sem,unsigned long flags); +extern int __down_sem_interruptible (struct semaphore *sem,unsigned long flags); +extern void __up_sem (struct semaphore *sem); -static inline void down (struct semaphore *sem) +static inline void down_sem (struct semaphore *sem) {unsigned long flags;
@@ -86,11 +73,11 @@ static inline void down(struct semaphorespin_unlock_irqrestore (&sem->wait_lock, flags); }else { -__down (sem, flags); +__down_sem (sem, flags); } } -static inline int down_interruptible (struct semaphore *sem) +static inline int down_sem_interruptible (struct semaphore *sem) {unsigned long flags;int ret =0 ;
@@ -105,16 +92,16 @@ static inline int down_interruptible(strspin_unlock_irqrestore (&sem->wait_lock, flags); }else { - ret =__down_interruptible (sem, flags); + ret =__down_sem_interruptible (sem, flags); }return ret; }/* -* non-blockingly attempt to down() a semaphore. +* non-blockingly attempt to down_sem() a semaphore. * - returns zero if we acquired it */ -static inline int down_trylock (struct semaphore *sem) +static inline int down_sem_trylock (struct semaphore *sem) {unsigned long flags;int success =0 ;
@@ -132,7 +119,7 @@ static inline int down_trylock(struct sereturn !success; } -static inline void up (struct semaphore *sem) +static inline void up_sem (struct semaphore *sem) {unsigned long flags;
@@ -142,7 +129,7 @@ static inline void up(struct semaphore *spin_lock_irqsave (&sem->wait_lock, flags);if (!list_empty (&sem->wait_list)) -__up (sem); +__up_sem (sem);else sem->counter++;spin_unlock_irqrestore (&sem->wait_lock, flags);
arch/frv/kernel/frv_ksyms.c renamed from warthog/kernels/linux-2.6.15-rc5/arch/frv/kernel/frv_ksyms.c +1 -1
@@ -13,7 +13,7 @@#include <asm/pgalloc.h> #include <asm/irq.h> #include <asm/io.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <asm/checksum.h> #include <asm/hardirq.h> #include <asm/current.h>
arch/frv/kernel/semaphore.c renamed from warthog/kernels/linux-2.6.15-rc5/arch/frv/kernel/semaphore.c +12 -12
@@ -38,12 +38,12 @@ void semtrace(struct semaphore *sem, con* wait for a token to be granted from a semaphore * - entered with lock held and interrupts disabled */ -void __down (struct semaphore *sem,unsigned long flags) +void __down_sem (struct semaphore *sem,unsigned long flags) {struct task_struct *tsk = current;struct sem_waiter waiter; -semtrace (sem,"Entering __down" ); +semtrace (sem,"Entering __down_sem" );/* set up my own style of waitqueue */ waiter.task = tsk;
@@ -65,22 +65,22 @@ void __down(struct semaphore *sem, unsig } tsk->state =TASK_RUNNING ; -semtrace (sem,"Leaving __down" ); +semtrace (sem,"Leaving __down_sem" ); } -EXPORT_SYMBOL (__down); +EXPORT_SYMBOL (__down_sem);/* * interruptibly wait for a token to be granted from a semaphore * - entered with lock held and interrupts disabled */ -int __down_interruptible (struct semaphore *sem,unsigned long flags) +int __down_sem_interruptible (struct semaphore *sem,unsigned long flags) {struct task_struct *tsk = current;struct sem_waiter waiter;int ret; -semtrace (sem,"Entering __down_interruptible" ); +semtrace (sem,"Entering __down_sem_interruptible" );/* set up my own style of waitqueue */ waiter.task = tsk;
@@ -106,7 +106,7 @@ int __down_interruptible(struct semaphor out: tsk->state =TASK_RUNNING ; -semtrace (sem,"Leaving __down_interruptible" ); +semtrace (sem,"Leaving __down_sem_interruptible" );return ret; interrupted:
@@ -123,18 +123,18 @@ int __down_interruptible(struct semaphor goto out; } -EXPORT_SYMBOL (__down_interruptible); +EXPORT_SYMBOL (__down_sem_interruptible);/* * release a single token back to a semaphore * - entered with lock held and interrupts disabled */ -void __up (struct semaphore *sem) +void __up_sem (struct semaphore *sem) {struct task_struct *tsk;struct sem_waiter *waiter; -semtrace (sem,"Entering __up" ); +semtrace (sem,"Entering __up_sem" );/* grant the token to the process at the front of the queue */ waiter = list_entry(sem->wait_list.next, struct sem_waiter, list);
@@ -150,7 +150,7 @@ void __up(struct semaphore *sem)wake_up_process (tsk);put_task_struct (tsk); -semtrace (sem,"Leaving __up" ); +semtrace (sem,"Leaving __up_sem" ); } -EXPORT_SYMBOL (__up); +EXPORT_SYMBOL (__up_sem);
PATCH 5/19 MUTEX: Core kernel changes
In reply to David HowellsThe attached patch modifies the core files of the kernel to use the new mutex functions.
---
warthog>diffstat -p1 mutex-core-2615rc5.diff
kernel/cpu.c | 2 +- kernel/cpuset.c | 2 +- kernel/kexec.c | 2 +- kernel/kthread.c | 4 ++-- kernel/module.c | 2 +- kernel/posix-timers.c | 2 +- kernel/power/power.h | 3 ++- kernel/printk.c | 32 ++++++++++++++++---------------- kernel/profile.c | 2 +- kernel/stop_machine.c | 2 +- lib/reed_solomon/reed_solomon.c | 2 +- mm/slab.c | 2 +- 12 files changed, 29 insertions(+), 28 deletions(-)
kernel/cpu.c renamed from warthog/kernels/linux-2.6.15-rc5/kernel/cpu.c +1 -1
@@ -13,7 +13,7 @@#include <linux/module.h> #include <linux/kthread.h> #include <linux/stop_machine.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> /* This protects CPUs going up and down... */ static DECLARE_MUTEX (cpucontrol);
kernel/cpuset.c renamed from warthog/kernels/linux-2.6.15-rc5/kernel/cpuset.c +1 -1
@@ -52,7 +52,7 @@#include <asm/uaccess.h> #include <asm/atomic.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #define CPUSET_SUPER_MAGIC 0x27e0eb
kernel/kexec.c renamed from warthog/kernels/linux-2.6.15-rc5/kernel/kexec.c +1 -1
@@ -19,12 +19,12 @@#include <linux/syscalls.h> #include <linux/ioport.h> #include <linux/hardirq.h> +#include <linux/semaphore.h> #include <asm/page.h> #include <asm/uaccess.h> #include <asm/io.h> #include <asm/system.h> -#include <asm/semaphore.h> /* Location of the reserved area for the crash kernel */ struct resource crashk_res = {
kernel/kthread.c renamed from warthog/kernels/linux-2.6.15-rc5/kernel/kthread.c +2 -2
@@ -12,7 +12,7 @@#include <linux/unistd.h> #include <linux/file.h> #include <linux/module.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> /* * We dont want to execute off keventd since it might
@@ -169,7 +169,7 @@ int kthread_stop(struct task_struct *k) }EXPORT_SYMBOL (kthread_stop); -int kthread_stop_sem (struct task_struct *k,struct semaphore *s) +int kthread_stop_sem (struct task_struct *k,struct mutex *s) {int ret;
kernel/module.c renamed from warthog/kernels/linux-2.6.15-rc5/kernel/module.c +1 -1
@@ -38,8 +38,8 @@#include <linux/device.h> #include <linux/string.h> #include <linux/sched.h> +#include <linux/semaphore.h> #include <asm/uaccess.h> -#include <asm/semaphore.h> #include <asm/cacheflush.h> #if 0
kernel/posix-timers.c renamed from warthog/kernels/linux-2.6.15-rc5/kernel/posix-timers.c +1 -1
@@ -37,7 +37,7 @@#include <linux/time.h> #include <asm/uaccess.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <linux/list.h> #include <linux/init.h> #include <linux/compiler.h>
kernel/power/power.h renamed from warthog/kernels/linux-2.6.15-rc5/kernel/power/power.h +2 -1
@@ -1,5 +1,6 @@#include <linux/suspend.h> #include <linux/utsname.h> +#include <linux/semaphore.h> /* With SUSPEND_CONSOLE defined suspend looks *really* cool, but we probably do not take enough locks for switching consoles, etc,
@@ -35,7 +36,7 @@ static inline int pm_suspend_disk(void)return -EPERM ; }#endif -extern struct semaphore pm_sem; +extern struct mutex pm_sem;#define power_attr (_name) \ static struct subsys_attribute _name##_attr = { \ .attr = { \
kernel/printk.c renamed from warthog/kernels/linux-2.6.15-rc5/kernel/printk.c +16 -16
@@ -62,11 +62,11 @@ int oops_in_progress;EXPORT_SYMBOL (oops_in_progress);/* -* console_sem protects the console_drivers list, and also +* console_mutex protects the console_drivers list, and also * provides serialisation for access to the entire console * driver system. */ -static DECLARE_MUTEX (console_sem); +static DECLARE_MUTEX (console_mutex);struct console *console_drivers;/* * This is used for debugging the mess that is the VT code by
@@ -81,7 +81,7 @@ static int console_locked;/* * logbuf_lock protects log_buf, log_start, log_end, con_start and logged_chars * It is also used in interesting ways to provide interlocking in -* release_console_sem(). +* release_console_mutex(). */ static DEFINE_SPINLOCK (logbuf_lock);
@@ -391,7 +391,7 @@ static void _call_console_drivers(unsign/* * Call the console drivers, asking them to write out * log_buf[start] to log_buf[end - 1]. -* The console_sem must be held. +* The console_mutex must be held. */ static void call_console_drivers (unsigned long start,unsigned long end) {
@@ -467,7 +467,7 @@ static void zap_locks(void)/* If a crash is occurring, make sure we can't deadlock */ spin_lock_init (&logbuf_lock);/* And make sure that we print immediately */ -init_MUTEX (&console_sem); +init_MUTEX (&console_mutex); }#if defined(CONFIG_PRINTK_TIME )
@@ -497,10 +497,10 @@ __attribute__((weak)) unsigned long long* * This is printk. It can be called from any context. We want it to work. * -* We try to grab the console_sem. If we succeed, it's easy - we log the output and +* We try to grab the console_mutex. If we succeed, it's easy - we log the output and * call the console drivers. If we fail to get the semaphore we place the output -* into the log buffer and return. The current holder of the console_sem will -* notice the new output in release_console_sem() and will send it to the +* into the log buffer and return. The current holder of the console_mutex will +* notice the new output in release_console_mutex() and will send it to the * consoles before releasing the semaphore. * * One effect of this deferred printing is that code which calls printk() and
@@ -540,7 +540,7 @@ asmlinkage int vprintk(const char *fmt,* make sure we can't deadlock */ zap_locks (); -/* This stops the holder of console_sem just where we want him */ +/* This stops the holder of console_mutex just where we want him */ spin_lock_irqsave (&logbuf_lock, flags); printk_cpu =smp_processor_id ();
@@ -615,11 +615,11 @@ asmlinkage int vprintk(const char *fmt,spin_unlock_irqrestore (&logbuf_lock, flags); goto out; } -if (!down_trylock (&console_sem)) { +if (!down_trylock (&console_mutex)) { console_locked =1 ;/* * We own the drivers. We can drop the spinlock and let -* release_console_sem() print the text +* release_console_mutex() print the text */ printk_cpu =UINT_MAX ;spin_unlock_irqrestore (&logbuf_lock, flags);
@@ -710,7 +710,7 @@ void acquire_console_sem(void) {if (in_interrupt ())BUG (); -down (&console_sem); +down (&console_mutex); console_locked =1 ; console_may_schedule =1 ; }
@@ -718,7 +718,7 @@ EXPORT_SYMBOL(acquire_console_sem);int try_acquire_console_sem (void ) { -if (down_trylock (&console_sem)) +if (down_trylock (&console_mutex))return -1 ; console_locked =1 ; console_may_schedule =0 ;
@@ -739,7 +739,7 @@ EXPORT_SYMBOL(is_console_locked);* and the console driver list. * * While the semaphore was held, console output may have been buffered -* by printk(). If this is the case, release_console_sem() emits +* by printk(). If this is the case, release_console_mutex() emits * the output prior to releasing the semaphore. * * If there is output waiting for klogd, we wake it up.
@@ -766,7 +766,7 @@ void release_console_sem(void) } console_locked =0 ; console_may_schedule =0 ; -up (&console_sem); +up (&console_mutex);spin_unlock_irqrestore (&logbuf_lock, flags);if (wake_klogd && !oops_in_progress &&waitqueue_active (&log_wait))wake_up_interruptible (&log_wait);
@@ -804,7 +804,7 @@ void console_unblank(void)* oops_in_progress is set to 1.. */ if (oops_in_progress) { -if (down_trylock (&console_sem) !=0 ) +if (down_trylock (&console_mutex) !=0 )return ; }else acquire_console_sem ();
kernel/profile.c renamed from warthog/kernels/linux-2.6.15-rc5/kernel/profile.c +1 -1
@@ -24,7 +24,7 @@#include <linux/profile.h> #include <linux/highmem.h> #include <asm/sections.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> struct profile_hit {u32 pc, hits;
kernel/stop_machine.c renamed from warthog/kernels/linux-2.6.15-rc5/kernel/stop_machine.c +1 -1
@@ -5,7 +5,7 @@#include <linux/err.h> #include <linux/syscalls.h> #include <asm/atomic.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <asm/uaccess.h> /* Since we effect priority and affinity (both of which are visible
lib/reed_solomon/reed_solomon.c renamed from warthog/kernels/linux-2.6.15-rc5/lib/reed_solomon/reed_solomon.c +1 -1
@@ -44,7 +44,7 @@#include <linux/module.h> #include <linux/rslib.h> #include <linux/slab.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> /* This list holds all currently allocated rs control structures */ static LIST_HEAD (rslist);
mm/slab.c renamed from warthog/kernels/linux-2.6.15-rc5/mm/slab.c +1 -1
@@ -631,7 +631,7 @@ static kmem_cache_t cache_cache = { };/* Guard access to the cache-chain. */ -static struct semaphore cache_chain_sem; +static struct mutex cache_chain_sem;static struct list_head cache_chain;/*
PATCH 6/19 MUTEX: Drivers A-E changes
In reply to David HowellsThe attached patch modifies the files of the drivers/a* thru drivers/e* to use the new mutex functions.
---
warthog>diffstat -p1 mutex-drivers-AtoE-2615rc5.diff
drivers/acpi/ec.c | 2 +- drivers/acpi/osl.c | 10 +++++----- drivers/acpi/video.c | 2 +- drivers/atm/ambassador.h | 2 +- drivers/atm/fore200e.h | 2 +- drivers/atm/idt77252.c | 2 +- drivers/atm/idt77252.h | 2 +- drivers/base/core.c | 2 +- drivers/base/firmware_class.c | 2 +- drivers/base/map.c | 6 +++--- drivers/base/power/power.h | 4 ++-- drivers/base/power/shutdown.c | 2 +- drivers/base/sys.c | 2 +- drivers/block/aoe/aoechr.c | 4 ++-- drivers/block/cryptoloop.c | 2 +- drivers/block/pktcdvd.c | 2 +- drivers/block/sx8.c | 4 ++-- drivers/char/agp/frontend.c | 2 +- drivers/char/drm/drmP.h | 4 ++-- drivers/char/drm/drm_stub.c | 4 ++-- drivers/char/generic_serial.c | 2 +- drivers/char/ipmi/ipmi_devintf.c | 6 +++--- drivers/char/ipmi/ipmi_msghandler.c | 2 +- drivers/char/mbcs.h | 6 +++--- drivers/char/moxa.c | 2 +- drivers/char/rio/rioboot.c | 2 +- drivers/char/rio/riocmd.c | 2 +- drivers/char/rio/rioctrl.c | 2 +- drivers/char/rio/rioinit.c | 2 +- drivers/char/rio/riointr.c | 2 +- drivers/char/rio/rioparam.c | 2 +- drivers/char/rio/rioroute.c | 2 +- drivers/char/rio/riotable.c | 2 +- drivers/char/rio/riotty.c | 2 +- drivers/char/rocket.c | 4 ++-- drivers/char/rocket_int.h | 2 +- drivers/char/ser_a2232.c | 2 +- drivers/char/snsc.c | 4 ++-- drivers/char/snsc.h | 6 +++--- drivers/char/sonypi.c | 2 +- drivers/char/tpm/tpm.h | 4 ++-- drivers/char/tty_io.c | 4 ++-- drivers/char/viotape.c | 20 ++++++++++---------- drivers/char/watchdog/cpu5wdt.c | 2 +- drivers/char/watchdog/pcwd_usb.c | 2 +- drivers/char/watchdog/sc1200wdt.c | 6 +++--- drivers/char/watchdog/scx200_wdt.c | 4 ++-- drivers/char/watchdog/wdt_pci.c | 4 ++-- 48 files changed, 82 insertions(+), 82 deletions(-)
drivers/acpi/ec.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/acpi/ec.c +1 -1
@@ -103,7 +103,7 @@ union acpi_ec {unsigned int expect_event;atomic_t leaving_burst;/* 0 : No, 1 : Yes, 2: abort */ atomic_t pending_gpe; -struct semaphore sem; +struct mutex sem;wait_queue_head_t wait; } burst;
drivers/acpi/osl.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/acpi/osl.c +5 -5
@@ -813,7 +813,7 @@ acpi_status acpi_os_wait_semaphore(acpi_* (a.k.a. 'would block'). */ case 0 : -if (down_trylock (sem)) +if (down_sem_trylock (sem)) status =AE_TIME ;break ;
@@ -822,7 +822,7 @@ acpi_status acpi_os_wait_semaphore(acpi_* ------------------ */ case ACPI_WAIT_FOREVER : -down (sem); +down_sem (sem);break ;/*
@@ -835,10 +835,10 @@ acpi_status acpi_os_wait_semaphore(acpi_int i =0 ;static const int quantum_ms =1000 /HZ ; - ret =down_trylock (sem); + ret =down_sem_trylock (sem);for (i = timeout; (i >0 && ret <0 ); i -= quantum_ms) {schedule_timeout_interruptible (1 ); - ret =down_trylock (sem); + ret =down_sem_trylock (sem); }if (ret !=0 )
@@ -881,7 +881,7 @@ acpi_status acpi_os_signal_semaphore(acpACPI_DEBUG_PRINT ((ACPI_DB_MUTEX ,"Signaling semaphore[%p|%d]\n" , handle, units)); -up (sem); +up_sem (sem);return_ACPI_STATUS (AE_OK ); }
drivers/acpi/video.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/acpi/video.c +1 -1
@@ -123,7 +123,7 @@ struct acpi_video_bus {u8 attached_count;struct acpi_video_bus_cap cap;struct acpi_video_bus_flags flags; -struct semaphore sem; +struct mutex sem;struct list_head video_device_list;struct proc_dir_entry *dir; };
drivers/atm/ambassador.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/atm/ambassador.h +1 -1
@@ -639,7 +639,7 @@ struct amb_dev {amb_txq txq;amb_rxq rxq[NUM_RX_POOLS ]; -struct semaphore vcc_sf; +struct mutex vcc_sf;amb_tx_info txer[NUM_VCS ];struct atm_vcc * rxer[NUM_VCS ];unsigned int tx_avail;
drivers/atm/fore200e.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/atm/fore200e.h +1 -1
@@ -870,7 +870,7 @@ typedef struct fore200e {struct stats * stats;/* last snapshot of the stats */ -struct semaphore rate_sf;/* protects rate reservation ops */ +struct mutex rate_sf;/* protects rate reservation ops */ spinlock_t q_lock;/* protects queue ops */ #ifdef FORE200E_USE_TASKLET struct tasklet_struct tx_tasklet;/* performs tx interrupt work */
drivers/atm/idt77252.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/atm/idt77252.c +1 -1
@@ -47,7 +47,7 @@ static char const rcsid[] =#include <linux/bitops.h> #include <linux/wait.h> #include <linux/jiffies.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <asm/io.h> #include <asm/uaccess.h> #include <asm/atomic.h>
drivers/atm/idt77252.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/atm/idt77252.h +1 -1
@@ -359,7 +359,7 @@ struct idt77252_devunsigned long srambase;/* SAR's sram base address */ void __iomem *fbq[4 ];/* FBQ fill addresses */ -struct semaphore mutex; +struct mutex mutex;spinlock_t cmd_lock;/* for r/w utility/sram */ unsigned long softstat;
drivers/base/core.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/base/core.c +1 -1
@@ -16,7 +16,7 @@#include <linux/slab.h> #include <linux/string.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include "base.h" #include "power/power.h"
drivers/base/firmware_class.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/base/firmware_class.c +1 -1
@@ -14,7 +14,7 @@#include <linux/vmalloc.h> #include <linux/interrupt.h> #include <linux/bitops.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <linux/firmware.h> #include "base.h"
drivers/base/map.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/base/map.c +3 -3
@@ -25,7 +25,7 @@ struct kobj_map {int (*lock)(dev_t ,void *);void *data; } *probes[255 ]; -struct semaphore *sem; +struct mutex *sem; }; int kobj_map(struct kobj_map *domain, dev_t dev, unsigned long range,
@@ -132,7 +132,7 @@ retry:return NULL ; } -struct kobj_map *kobj_map_init (kobj_probe_t *base_probe,struct semaphore *sem) +struct kobj_map *kobj_map_init (kobj_probe_t *base_probe,struct mutex *mutex) {struct kobj_map *p =kmalloc (sizeof (struct kobj_map ),GFP_KERNEL );struct probe *base =kzalloc (sizeof (*base),GFP_KERNEL );
@@ -149,6 +149,6 @@ struct kobj_map *kobj_map_init(kobj_prob base->get = base_probe;for (i =0 ; i <255 ; i++) p->probes[i] = base; - p->sem = sem; + p->sem = mutex;return p; }
drivers/base/power/power.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/base/power/power.h +2 -2
@@ -14,12 +14,12 @@ extern void device_shutdown(void);/* * Used to synchronize global power management operations. */ -extern struct semaphore dpm_sem; +extern struct mutex dpm_sem;/* * Used to serialize changes to the dpm_* lists. */ -extern struct semaphore dpm_list_sem; +extern struct mutex dpm_list_sem;/* * The PM lists.
drivers/base/power/shutdown.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/base/power/shutdown.c +1 -1
@@ -10,7 +10,7 @@#include <linux/config.h> #include <linux/device.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include "power.h"
drivers/base/sys.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/base/sys.c +1 -1
@@ -21,7 +21,7 @@#include <linux/slab.h> #include <linux/string.h> #include <linux/pm.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> extern struct subsystem devices_subsys;
drivers/block/aoe/aoechr.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/block/aoe/aoechr.c +2 -2
@@ -96,7 +96,7 @@ bail: spin_unlock_irqrestore(&emsgs_locspin_unlock_irqrestore (&emsgs_lock, flags);if (nblocked_emsgs_readers) -up (&emsgs_sema); +up_sem (&emsgs_sema); } static ssize_t
@@ -164,7 +164,7 @@ loop:spin_unlock_irqrestore (&emsgs_lock, flags); - n =down_interruptible (&emsgs_sema); + n =down_sem_interruptible (&emsgs_sema);spin_lock_irqsave (&emsgs_lock, flags);
drivers/block/cryptoloop.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/block/cryptoloop.c +1 -1
@@ -26,7 +26,7 @@#include <linux/crypto.h> #include <linux/blkdev.h> #include <linux/loop.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <asm/uaccess.h> MODULE_LICENSE ("GPL" );
drivers/block/pktcdvd.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/block/pktcdvd.c +1 -1
@@ -82,7 +82,7 @@static struct pktcdvd_device *pkt_devs[MAX_WRITERS ];static struct proc_dir_entry *pkt_proc;static int pkt_major; -static struct semaphore ctl_mutex;/* Serialize open/close/setup/teardown */ +static struct mutex ctl_mutex;/* Serialize open/close/setup/teardown */ static mempool_t *psd_pool;
drivers/block/sx8.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/block/sx8.c +2 -2
@@ -28,7 +28,7 @@#include <linux/hdreg.h> #include <linux/dma-mapping.h> #include <asm/io.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <asm/uaccess.h> #if 0
@@ -303,7 +303,7 @@ struct carm_host {struct work_struct fsm_task; -struct semaphore probe_sem; +struct mutex probe_sem; };struct carm_response {
drivers/char/agp/frontend.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/char/agp/frontend.c +1 -1
@@ -1081,7 +1081,7 @@ static struct miscdevice agp_miscdev =int agp_frontend_initialize (void ) {memset (&agp_fe,0 ,sizeof (struct agp_front_data )); -sema_init (&(agp_fe.agp_mutex),1 ); +init_MUTEX (&(agp_fe.agp_mutex));if (misc_register (&agp_miscdev)) { printk(KERN_ERR PFX "unable to get minor: %d\n", AGPGART_MINOR);
drivers/char/drm/drmP.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/char/drm/drmP.h +2 -2
@@ -625,7 +625,7 @@ typedef struct drm_device {/** \name Locks */ /*@{ */ spinlock_t count_lock;/**< For inuse, drm_device::open_count, drm_device::buf_use */ -struct semaphore struct_sem;/**< For others */ +struct mutex struct_sem;/**< For others */ /*@} */ /** \name Usage Counters */
@@ -660,7 +660,7 @@ typedef struct drm_device {/*@{ */ drm_ctx_list_t *ctxlist;/**< Linked list of context handles */ int ctx_count;/**< Number of context handles */ -struct semaphore ctxlist_sem;/**< For ctxlist */ +struct mutex ctxlist_sem;/**< For ctxlist */ drm_map_t **context_sareas;/**< per-context SAREA's */ int max_context;
drivers/char/drm/drm_stub.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/char/drm/drm_stub.c +2 -2
@@ -61,8 +61,8 @@ static int drm_fill_in_dev(drm_device_tspin_lock_init (&dev->count_lock);init_timer (&dev->timer); -sema_init (&dev->struct_sem,1 ); -sema_init (&dev->ctxlist_sem,1 ); +init_MUTEX (&dev->struct_sem); +init_MUTEX (&dev->ctxlist_sem); dev->pdev = pdev;
drivers/char/generic_serial.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/char/generic_serial.c +1 -1
@@ -28,7 +28,7 @@#include <linux/interrupt.h> #include <linux/tty_flip.h> #include <linux/delay.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <asm/uaccess.h> #define DEBUG
drivers/char/ipmi/ipmi_devintf.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/char/ipmi/ipmi_devintf.c +3 -3
@@ -42,7 +42,7 @@#include <linux/slab.h> #include <linux/devfs_fs_kernel.h> #include <linux/ipmi.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <linux/init.h> #include <linux/device.h> #include <linux/compat.h>
@@ -55,7 +55,7 @@ struct ipmi_file_privatestruct file *file;struct fasync_struct *fasync_queue;wait_queue_head_t wait; -struct semaphore recv_sem; +struct mutex recv_sem;int default_retries;unsigned int default_retry_time_ms; };
@@ -141,7 +141,7 @@ static int ipmi_open(struct inode *inodeINIT_LIST_HEAD (&(priv->recv_msgs));init_waitqueue_head (&priv->wait); priv->fasync_queue =NULL ; -sema_init (&(priv->recv_sem),1 ); +init_MUTEX (&(priv->recv_sem));/* Use the low-level defaults. */ priv->default_retries =-1 ;
drivers/char/ipmi/ipmi_msghandler.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/char/ipmi/ipmi_msghandler.c +1 -1
@@ -209,7 +209,7 @@ struct ipmi_smi/* The list of command receivers that are registered for commands on this interface. */ -struct semaphore cmd_rcvrs_lock; +struct mutex cmd_rcvrs_lock;struct list_head cmd_rcvrs;/* Events that were queues because no one was there to receive
drivers/char/mbcs.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/char/mbcs.h +3 -3
@@ -537,9 +537,9 @@ struct mbcs_soft {atomic_t dmawrite_done;atomic_t dmaread_done;atomic_t algo_done; -struct semaphore dmawritelock; -struct semaphore dmareadlock; -struct semaphore algolock; +struct mutex dmawritelock; +struct mutex dmareadlock; +struct mutex algolock; };extern int mbcs_open (struct inode *ip,struct file *fp);
drivers/char/moxa.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/char/moxa.c +1 -1
@@ -216,7 +216,7 @@ static int moxaTimer_on;static struct timer_list moxaTimer;static int moxaEmptyTimer_on[MAX_PORTS ];static struct timer_list moxaEmptyTimer[MAX_PORTS ]; -static struct semaphore moxaBuffSem; +static struct mutex moxaBuffSem;/* * static functions:
drivers/char/rio/rioboot.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/char/rio/rioboot.c +1 -1
@@ -41,7 +41,7 @@ static char *_rioboot_c_sccs_ = "@(#)rio#include <asm/io.h> #include <asm/system.h> #include <asm/string.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <linux/termios.h>
drivers/char/rio/riocmd.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/char/rio/riocmd.c +1 -1
@@ -41,7 +41,7 @@ static char *_riocmd_c_sccs_ = "@(#)rioc#include <asm/io.h> #include <asm/system.h> #include <asm/string.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <linux/termios.h> #include <linux/serial.h>
drivers/char/rio/rioctrl.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/char/rio/rioctrl.c +1 -1
@@ -40,7 +40,7 @@ static char *_rioctrl_c_sccs_ = "@(#)rio#include <asm/io.h> #include <asm/system.h> #include <asm/string.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <asm/uaccess.h> #include <linux/termios.h>
drivers/char/rio/rioinit.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/char/rio/rioinit.c +1 -1
@@ -41,7 +41,7 @@ static char *_rioinit_c_sccs_ = "@(#)rio#include <asm/io.h> #include <asm/system.h> #include <asm/string.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <asm/uaccess.h> #include <linux/termios.h>
drivers/char/rio/riointr.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/char/rio/riointr.c +1 -1
@@ -41,7 +41,7 @@ static char *_riointr_c_sccs_ = "@(#)rio#include <asm/io.h> #include <asm/system.h> #include <asm/string.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <asm/uaccess.h> #include <linux/termios.h>
drivers/char/rio/rioparam.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/char/rio/rioparam.c +1 -1
@@ -41,7 +41,7 @@ static char *_rioparam_c_sccs_ = "@(#)ri#include <asm/io.h> #include <asm/system.h> #include <asm/string.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <asm/uaccess.h> #include <linux/termios.h>
drivers/char/rio/rioroute.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/char/rio/rioroute.c +1 -1
@@ -39,7 +39,7 @@ static char *_rioroute_c_sccs_ = "@(#)ri#include <asm/io.h> #include <asm/system.h> #include <asm/string.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <asm/uaccess.h> #include <linux/termios.h>
drivers/char/rio/riotable.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/char/rio/riotable.c +1 -1
@@ -42,7 +42,7 @@ static char *_riotable_c_sccs_ = "@(#)ri#include <asm/io.h> #include <asm/system.h> #include <asm/string.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <asm/uaccess.h> #include <linux/termios.h>
drivers/char/rio/riotty.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/char/rio/riotty.c +1 -1
@@ -44,7 +44,7 @@ static char *_riotty_c_sccs_ = "@(#)riot#include <asm/io.h> #include <asm/system.h> #include <asm/string.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <asm/uaccess.h> #include <linux/termios.h>
drivers/char/rocket.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/char/rocket.c +2 -2
@@ -93,7 +93,7 @@#include <asm/atomic.h> #include <linux/bitops.h> #include <linux/spinlock.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <linux/init.h> /****** RocketPort includes ******/
@@ -716,7 +716,7 @@ static void init_r_port(int board, int a } }spin_lock_init (&info->slock); -sema_init (&info->write_sem,1 ); +init_MUTEX (&info->write_sem); rp_table[line] = info;if (pci_dev)tty_register_device (rocket_driver, line, &pci_dev->dev);
drivers/char/rocket_int.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/char/rocket_int.h +1 -1
@@ -1171,7 +1171,7 @@ struct r_port {struct wait_queue *close_wait;#endif spinlock_t slock; -struct semaphore write_sem; +struct mutex write_sem; };#define RPORT_MAGIC 0x525001
drivers/char/ser_a2232.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/char/ser_a2232.c +1 -1
@@ -97,7 +97,7 @@#include <asm/amigahw.h> #include <linux/zorro.h> #include <asm/irq.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <linux/delay.h>
drivers/char/snsc.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/char/snsc.c +2 -2
@@ -99,8 +99,8 @@ scdrv_open(struct inode *inode, struct fspin_lock_init (&sd->sd_wlock);init_waitqueue_head (&sd->sd_rq);init_waitqueue_head (&sd->sd_wq); -sema_init (&sd->sd_rbs,1 ); -sema_init (&sd->sd_wbs,1 ); +init_MUTEX (&sd->sd_rbs); +init_MUTEX (&sd->sd_wbs); file->private_data = sd;
drivers/char/snsc.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/char/snsc.h +3 -3
@@ -22,8 +22,8 @@#include <linux/kobject.h> #include <linux/fs.h> #include <linux/cdev.h> +#include <linux/semaphore.h> #include <asm/sn/types.h> -#include <asm/semaphore.h> #define CHUNKSIZE 127
@@ -35,8 +35,8 @@ struct subch_data_s {spinlock_t sd_wlock;/* monitor lock for wsv */ wait_queue_head_t sd_rq;/* wait queue for readers */ wait_queue_head_t sd_wq;/* wait queue for writers */ -struct semaphore sd_rbs;/* semaphore for read buffer */ -struct semaphore sd_wbs;/* semaphore for write buffer */ +struct mutex sd_rbs;/* semaphore for read buffer */ +struct mutex sd_wbs;/* semaphore for write buffer */ char sd_rb[CHUNKSIZE ];/* read buffer */ char sd_wb[CHUNKSIZE ];/* write buffer */
drivers/char/sonypi.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/char/sonypi.c +1 -1
@@ -480,7 +480,7 @@ static struct sonypi_device {u16 evtype_offset;int camera_power;int bluetooth_power; -struct semaphore lock; +struct mutex lock;struct kfifo *fifo;spinlock_t fifo_lock;wait_queue_head_t fifo_proc_list;
drivers/char/tpm/tpm.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/char/tpm/tpm.h +2 -2
@@ -74,11 +74,11 @@ struct tpm_chip {/* Data passed to and from the tpm via the read/write calls */ u8 *data_buffer;atomic_t data_pending; -struct semaphore buffer_mutex; +struct mutex buffer_mutex;struct timer_list user_read_timer;/* user needs to claim result */ struct work_struct work; -struct semaphore tpm_mutex;/* tpm is processing */ +struct mutex tpm_mutex;/* tpm is processing */ struct tpm_vendor_specific *vendor;
drivers/char/tty_io.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/char/tty_io.c +2 -2
@@ -2677,8 +2677,8 @@ static void initialize_tty_struct(structinit_waitqueue_head (&tty->write_wait);init_waitqueue_head (&tty->read_wait);INIT_WORK (&tty->hangup_work, do_tty_hangup, tty); -sema_init (&tty->atomic_read,1 ); -sema_init (&tty->atomic_write,1 ); +init_MUTEX (&tty->atomic_read); +init_MUTEX (&tty->atomic_write);spin_lock_init (&tty->read_lock);INIT_LIST_HEAD (&tty->tty_files);INIT_WORK (&tty->SAK_work,NULL ,NULL );
drivers/char/viotape.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/char/viotape.c +10 -10
@@ -454,12 +454,12 @@ static ssize_t viotap_write(struct file* semaphore */ if (noblock) { -if (down_trylock (&reqSem)) { +if (down_sem_trylock (&reqSem)) { ret = -EWOULDBLOCK ; goto free_op; } }else -down (&reqSem); +down_sem (&reqSem);/* Allocate a DMA buffer */ op->dev = tape_device[devi.devno];
@@ -515,7 +515,7 @@ static ssize_t viotap_write(struct file free_dma:dma_free_coherent (op->dev, count, op->buffer, op->dmaaddr); up_sem: -up (&reqSem); +up_sem (&reqSem); free_op:free_op_struct (op);return ret;
@@ -544,12 +544,12 @@ static ssize_t viotap_read(struct file ** semaphore */ if (noblock) { -if (down_trylock (&reqSem)) { +if (down_sem_trylock (&reqSem)) { ret = -EWOULDBLOCK ; goto free_op; } }else -down (&reqSem); +down_sem (&reqSem);chg_state (devi.devno,VIOT_READING , file);
@@ -595,7 +595,7 @@ static ssize_t viotap_read(struct file * free_dma:dma_free_coherent (op->dev, count, op->buffer, op->dmaaddr); up_sem: -up (&reqSem); +up_sem (&reqSem); free_op:free_op_struct (op);return ret;
@@ -617,7 +617,7 @@ static int viotap_ioctl(struct inode *inget_dev_info (file->f_dentry->d_inode, &devi); -down (&reqSem); +down_sem (&reqSem); ret = -EINVAL ;
@@ -748,7 +748,7 @@ static int viotap_ioctl(struct inode *in/* Operation is complete - grab the error code */ ret =tape_rc_to_errno (op->rc,"get status" , devi.devno);free_op_struct (op); -up (&reqSem); +up_sem (&reqSem); if ((ret == 0) && copy_to_user((void *)arg, &viomtget[devi.devno],
@@ -766,7 +766,7 @@ static int viotap_ioctl(struct inode *in free_op:free_op_struct (op); -up (&reqSem); +up_sem (&reqSem);return ret; }
@@ -918,7 +918,7 @@ static void vioHandleTapeEvent(struct Hvdma_free_coherent (op->dev, op->count, op->buffer, op->dmaaddr);free_op_struct (op); -up (&reqSem); +up_sem (&reqSem); }else { op->rc = tevent->sub_type_result; op->count = tevent->len;
drivers/char/watchdog/cpu5wdt.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/char/watchdog/cpu5wdt.c +1 -1
@@ -57,7 +57,7 @@ static int ticks = 10000;/* some device data */ static struct { - struct semaphore stop; + struct mutex stop; volatile int running; struct timer_list timer; volatile int queue;
drivers/char/watchdog/pcwd_usb.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/char/watchdog/pcwd_usb.c +1 -1
@@ -138,7 +138,7 @@ struct usb_pcwd_private {atomic_t cmd_received;/* true if we received a report after a command */ int exists;/* Wether or not the device exists */ -struct semaphore sem;/* locks this structure */ +struct mutex sem;/* locks this structure */ };static struct usb_pcwd_private *usb_pcwd_device;
drivers/char/watchdog/sc1200wdt.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/char/watchdog/sc1200wdt.c +3 -3
@@ -41,7 +41,7 @@#include <linux/fs.h> #include <linux/pci.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <asm/io.h> #include <asm/uaccess.h>
@@ -74,7 +74,7 @@ static char banner[] __initdata = KERN_Istatic int timeout =1 ;static int io =-1 ;static int io_len =2 ;/* for non plug and play */ -static struct semaphore open_sem; +static struct mutex open_sem;static char expect_close;static spinlock_t sc1200wdt_lock;/* io port access serialisation */
@@ -380,7 +380,7 @@ static int __init sc1200wdt_init(void)printk (banner);spin_lock_init (&sc1200wdt_lock); -sema_init (&open_sem,1 ); +init_MUTEX (&open_sem);#if definedCONFIG_PNP if (isapnp) {
drivers/char/watchdog/scx200_wdt.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/char/watchdog/scx200_wdt.c +2 -2
@@ -48,7 +48,7 @@ module_param(nowayout, int, 0);MODULE_PARM_DESC (nowayout,"Disable watchdog shutdown on close" );static u16 wdto_restart; -static struct semaphore open_semaphore; +static struct mutex open_semaphore;static char expect_close;/* Bits of the WDCNFG register */
@@ -230,7 +230,7 @@ static int __init scx200_wdt_init(void)scx200_wdt_update_margin ();scx200_wdt_disable (); -sema_init (&open_semaphore,1 ); +init_MUTEX (&open_semaphore); r =misc_register (&scx200_wdt_miscdev);if (r) {
drivers/char/watchdog/wdt_pci.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/char/watchdog/wdt_pci.c +2 -2
@@ -74,7 +74,7 @@/* We can only use 1 card due to the /dev/watchdog restriction */ static int dev_count; -static struct semaphore open_sem; +static struct mutex open_sem;static spinlock_t wdtpci_lock;static char expect_close;
@@ -607,7 +607,7 @@ static int __devinit wdtpci_init_one (st goto out_pci; } -sema_init (&open_sem,1 ); +init_MUTEX (&open_sem);spin_lock_init (&wdtpci_lock); irq = dev->irq;
PATCH 7/19 MUTEX: Drivers F-H changes
In reply to David HowellsThe attached patch modifies the files of the drivers/f* thru drivers/h* to use the new mutex functions.
---
warthog>diffstat -p1 mutex-drivers-FtoH-2615rc5.diff
drivers/fc4/fc.c | 8 ++++---- drivers/firmware/dcdbas.c | 2 +- drivers/hwmon/adm1021.c | 2 +- drivers/hwmon/adm1025.c | 2 +- drivers/hwmon/adm1026.c | 4 ++-- drivers/hwmon/adm1031.c | 2 +- drivers/hwmon/adm9240.c | 2 +- drivers/hwmon/asb100.c | 4 ++-- drivers/hwmon/atxp1.c | 2 +- drivers/hwmon/ds1621.c | 2 +- drivers/hwmon/fscher.c | 2 +- drivers/hwmon/fscpos.c | 2 +- drivers/hwmon/gl518sm.c | 2 +- drivers/hwmon/gl520sm.c | 2 +- drivers/hwmon/it87.c | 4 ++-- drivers/hwmon/lm63.c | 2 +- drivers/hwmon/lm75.c | 2 +- drivers/hwmon/lm77.c | 2 +- drivers/hwmon/lm78.c | 4 ++-- drivers/hwmon/lm80.c | 2 +- drivers/hwmon/lm83.c | 2 +- drivers/hwmon/lm85.c | 4 ++-- drivers/hwmon/lm87.c | 2 +- drivers/hwmon/lm90.c | 2 +- drivers/hwmon/lm92.c | 2 +- drivers/hwmon/max1619.c | 2 +- drivers/hwmon/pc87360.c | 4 ++-- drivers/hwmon/sis5595.c | 4 ++-- drivers/hwmon/smsc47b397.c | 4 ++-- drivers/hwmon/smsc47m1.c | 4 ++-- drivers/hwmon/via686a.c | 2 +- drivers/hwmon/w83627ehf.c | 4 ++-- drivers/hwmon/w83627hf.c | 4 ++-- drivers/hwmon/w83781d.c | 4 ++-- drivers/hwmon/w83792d.c | 4 ++-- drivers/hwmon/w83l785ts.c | 2 +- 36 files changed, 52 insertions(+), 52 deletions(-)
drivers/fc4/fc.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/fc4/fc.c +4 -4
@@ -36,7 +36,7 @@#include <asm/pgtable.h> #include <asm/irq.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include "fcp_impl.h" #include <scsi/scsi_host.h>
@@ -106,7 +106,7 @@ fc_channel *fc_channels = NULL;#define LSMAGIC 620829043 typedef struct { /* Must be first */ - struct semaphore sem; + struct mutex sem; int magic; int count; logi *logi;
@@ -119,7 +119,7 @@ typedef struct {#define LSOMAGIC 654907799 typedef struct { /* Must be first */ - struct semaphore sem; + struct mutex sem; int magic; int count; fcp_cmnd *fcmds;
@@ -130,7 +130,7 @@ typedef struct {#define LSEMAGIC 84482456 typedef struct { /* Must be first */ - struct semaphore sem; + struct mutex sem; int magic; int status; struct timer_list timer;
drivers/firmware/dcdbas.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/firmware/dcdbas.c +1 -1
@@ -34,7 +34,7 @@#include <linux/string.h> #include <linux/types.h> #include <asm/io.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include "dcdbas.h"
drivers/hwmon/adm1021.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/hwmon/adm1021.c +1 -1
@@ -92,7 +92,7 @@ struct adm1021_data {struct class_device *class_dev;enum chips type; -struct semaphore update_lock; +struct mutex update_lock;char valid;/* !=0 if following fields are valid */ unsigned long last_updated;/* In jiffies */
drivers/hwmon/adm1025.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/hwmon/adm1025.c +1 -1
@@ -133,7 +133,7 @@ static struct i2c_driver adm1025_driverstruct adm1025_data {struct i2c_client client;struct class_device *class_dev; -struct semaphore update_lock; +struct mutex update_lock;char valid;/* zero until following fields are valid */ unsigned long last_updated;/* in jiffies */
drivers/hwmon/adm1026.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/hwmon/adm1026.c +2 -2
@@ -260,10 +260,10 @@ struct pwm_data {struct adm1026_data {struct i2c_client client;struct class_device *class_dev; -struct semaphore lock; +struct mutex lock;enum chips type; -struct semaphore update_lock; +struct mutex update_lock;int valid;/* !=0 if following fields are valid */ unsigned long last_reading;/* In jiffies */ unsigned long last_config;/* In jiffies */
drivers/hwmon/adm1031.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/hwmon/adm1031.c +1 -1
@@ -70,7 +70,7 @@ typedef u8 auto_chan_table_t[8][2];struct adm1031_data {struct i2c_client client;struct class_device *class_dev; -struct semaphore update_lock; +struct mutex update_lock;int chip_type;char valid;/* !=0 if following fields are valid */ unsigned long last_updated;/* In jiffies */
drivers/hwmon/adm9240.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/hwmon/adm9240.c +1 -1
@@ -150,7 +150,7 @@ struct adm9240_data {enum chips type;struct i2c_client client;struct class_device *class_dev; -struct semaphore update_lock; +struct mutex update_lock;char valid;unsigned long last_updated_measure;unsigned long last_updated_config;
drivers/hwmon/asb100.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/hwmon/asb100.c +2 -2
@@ -182,10 +182,10 @@ static u8 DIV_TO_REG(long val)struct asb100_data {struct i2c_client client;struct class_device *class_dev; -struct semaphore lock; +struct mutex lock;enum chips type; -struct semaphore update_lock; +struct mutex update_lock;unsigned long last_updated;/* In jiffies */ /* array of 2 pointers to subclients */
drivers/hwmon/atxp1.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/hwmon/atxp1.c +1 -1
@@ -60,7 +60,7 @@ static struct i2c_driver atxp1_driver =struct atxp1_data {struct i2c_client client;struct class_device *class_dev; -struct semaphore update_lock; +struct mutex update_lock;unsigned long last_updated;u8 valid;struct {
drivers/hwmon/ds1621.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/hwmon/ds1621.c +1 -1
@@ -72,7 +72,7 @@ MODULE_PARM_DESC(polarity, "Output's polstruct ds1621_data {struct i2c_client client;struct class_device *class_dev; -struct semaphore update_lock; +struct mutex update_lock;char valid;/* !=0 if following fields are valid */ unsigned long last_updated;/* In jiffies */
drivers/hwmon/fscher.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/hwmon/fscher.c +1 -1
@@ -133,7 +133,7 @@ static struct i2c_driver fscher_driver =struct fscher_data {struct i2c_client client;struct class_device *class_dev; -struct semaphore update_lock; +struct mutex update_lock;char valid;/* zero until following fields are valid */ unsigned long last_updated;/* in jiffies */
drivers/hwmon/fscpos.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/hwmon/fscpos.c +1 -1
@@ -114,7 +114,7 @@ static struct i2c_driver fscpos_driver =struct fscpos_data {struct i2c_client client;struct class_device *class_dev; -struct semaphore update_lock; +struct mutex update_lock;char valid;/* 0 until following fields are valid */ unsigned long last_updated;/* In jiffies */
drivers/hwmon/gl518sm.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/hwmon/gl518sm.c +1 -1
@@ -120,7 +120,7 @@ struct gl518_data {struct class_device *class_dev;enum chips type; -struct semaphore update_lock; +struct mutex update_lock;char valid;/* !=0 if following fields are valid */ unsigned long last_updated;/* In jiffies */
drivers/hwmon/gl520sm.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/hwmon/gl520sm.c +1 -1
@@ -121,7 +121,7 @@ static struct i2c_driver gl520_driver =struct gl520_data {struct i2c_client client;struct class_device *class_dev; -struct semaphore update_lock; +struct mutex update_lock;char valid;/* zero until the following fields are valid */ unsigned long last_updated;/* in jiffies */
drivers/hwmon/it87.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/hwmon/it87.c +2 -2
@@ -195,10 +195,10 @@ static int DIV_TO_REG(int val)struct it87_data {struct i2c_client client;struct class_device *class_dev; -struct semaphore lock; +struct mutex lock;enum chips type; -struct semaphore update_lock; +struct mutex update_lock;char valid;/* !=0 if following fields are valid */ unsigned long last_updated;/* In jiffies */
drivers/hwmon/lm63.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/hwmon/lm63.c +1 -1
@@ -153,7 +153,7 @@ static struct i2c_driver lm63_driver = {struct lm63_data {struct i2c_client client;struct class_device *class_dev; -struct semaphore update_lock; +struct mutex update_lock;char valid;/* zero until following fields are valid */ unsigned long last_updated;/* in jiffies */
drivers/hwmon/lm75.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/hwmon/lm75.c +1 -1
@@ -47,7 +47,7 @@ I2C_CLIENT_INSMOD_1(lm75);struct lm75_data {struct i2c_client client;struct class_device *class_dev; -struct semaphore update_lock; +struct mutex update_lock;char valid;/* !=0 if following fields are valid */ unsigned long last_updated;/* In jiffies */ u16 temp_input;/* Register values */
drivers/hwmon/lm77.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/hwmon/lm77.c +1 -1
@@ -51,7 +51,7 @@ I2C_CLIENT_INSMOD_1(lm77);struct lm77_data {struct i2c_client client;struct class_device *class_dev; -struct semaphore update_lock; +struct mutex update_lock;char valid;unsigned long last_updated;/* In jiffies */ int temp_input;/* Temperatures */
drivers/hwmon/lm78.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/hwmon/lm78.c +2 -2
@@ -131,10 +131,10 @@ static inline int TEMP_FROM_REG(s8 val)struct lm78_data {struct i2c_client client;struct class_device *class_dev; -struct semaphore lock; +struct mutex lock;enum chips type; -struct semaphore update_lock; +struct mutex update_lock;char valid;/* !=0 if following fields are valid */ unsigned long last_updated;/* In jiffies */
drivers/hwmon/lm80.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/hwmon/lm80.c +1 -1
@@ -108,7 +108,7 @@ static inline long TEMP_FROM_REG(u16 temstruct lm80_data {struct i2c_client client;struct class_device *class_dev; -struct semaphore update_lock; +struct mutex update_lock;char valid;/* !=0 if following fields are valid */ unsigned long last_updated;/* In jiffies */
drivers/hwmon/lm83.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/hwmon/lm83.c +1 -1
@@ -139,7 +139,7 @@ static struct i2c_driver lm83_driver = {struct lm83_data {struct i2c_client client;struct class_device *class_dev; -struct semaphore update_lock; +struct mutex update_lock;char valid;/* zero until following fields are valid */ unsigned long last_updated;/* in jiffies */
drivers/hwmon/lm85.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/hwmon/lm85.c +2 -2
@@ -331,10 +331,10 @@ struct lm85_autofan {struct lm85_data {struct i2c_client client;struct class_device *class_dev; -struct semaphore lock; +struct mutex lock;enum chips type; -struct semaphore update_lock; +struct mutex update_lock;int valid;/* !=0 if following fields are valid */ unsigned long last_reading;/* In jiffies */ unsigned long last_config;/* In jiffies */
drivers/hwmon/lm87.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/hwmon/lm87.c +1 -1
@@ -176,7 +176,7 @@ static struct i2c_driver lm87_driver = {struct lm87_data {struct i2c_client client;struct class_device *class_dev; -struct semaphore update_lock; +struct mutex update_lock;char valid;/* zero until following fields are valid */ unsigned long last_updated;/* In jiffies */
drivers/hwmon/lm90.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/hwmon/lm90.c +1 -1
@@ -201,7 +201,7 @@ static struct i2c_driver lm90_driver = {struct lm90_data {struct i2c_client client;struct class_device *class_dev; -struct semaphore update_lock; +struct mutex update_lock;char valid;/* zero until following fields are valid */ unsigned long last_updated;/* in jiffies */ int kind;
drivers/hwmon/lm92.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/hwmon/lm92.c +1 -1
@@ -96,7 +96,7 @@ static struct i2c_driver lm92_driver;struct lm92_data {struct i2c_client client;struct class_device *class_dev; -struct semaphore update_lock; +struct mutex update_lock;char valid;/* zero until following fields are valid */ unsigned long last_updated;/* in jiffies */
drivers/hwmon/max1619.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/hwmon/max1619.c +1 -1
@@ -104,7 +104,7 @@ static struct i2c_driver max1619_driverstruct max1619_data {struct i2c_client client;struct class_device *class_dev; -struct semaphore update_lock; +struct mutex update_lock;char valid;/* zero until following fields are valid */ unsigned long last_updated;/* in jiffies */
drivers/hwmon/pc87360.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/hwmon/pc87360.c +2 -2
@@ -183,8 +183,8 @@ static inline u8 PWM_TO_REG(int val, intstruct pc87360_data {struct i2c_client client;struct class_device *class_dev; -struct semaphore lock; -struct semaphore update_lock; +struct mutex lock; +struct mutex update_lock;char valid;/* !=0 if following fields are valid */ unsigned long last_updated;/* In jiffies */
drivers/hwmon/sis5595.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/hwmon/sis5595.c +2 -2
@@ -167,9 +167,9 @@ static inline u8 DIV_TO_REG(int val)struct sis5595_data {struct i2c_client client;struct class_device *class_dev; -struct semaphore lock; +struct mutex lock; -struct semaphore update_lock; +struct mutex update_lock;char valid;/* !=0 if following fields are valid */ unsigned long last_updated;/* In jiffies */ char maxins;/* == 3 if temp enabled, otherwise == 4 */
drivers/hwmon/smsc47b397.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/hwmon/smsc47b397.c +2 -2
@@ -92,9 +92,9 @@ static u8 smsc47b397_reg_temp[] = {0x25,struct smsc47b397_data {struct i2c_client client;struct class_device *class_dev; -struct semaphore lock; +struct mutex lock; -struct semaphore update_lock; +struct mutex update_lock;unsigned long last_updated;/* in jiffies */ int valid;
drivers/hwmon/smsc47m1.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/hwmon/smsc47m1.c +2 -2
@@ -102,9 +102,9 @@ superio_exit(void)struct smsc47m1_data {struct i2c_client client;struct class_device *class_dev; -struct semaphore lock; +struct mutex lock; -struct semaphore update_lock; +struct mutex update_lock;unsigned long last_updated;/* In jiffies */ u8 fan[2 ];/* Register value */
drivers/hwmon/via686a.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/hwmon/via686a.c +1 -1
@@ -296,7 +296,7 @@ static inline long TEMP_FROM_REG10(u16 vstruct via686a_data {struct i2c_client client;struct class_device *class_dev; -struct semaphore update_lock; +struct mutex update_lock;char valid;/* !=0 if following fields are valid */ unsigned long last_updated;/* In jiffies */
drivers/hwmon/w83627ehf.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/hwmon/w83627ehf.c +2 -2
@@ -177,9 +177,9 @@ temp1_to_reg(int temp)struct w83627ehf_data {struct i2c_client client;struct class_device *class_dev; -struct semaphore lock; +struct mutex lock; -struct semaphore update_lock; +struct mutex update_lock;char valid;/* !=0 if following fields are valid */ unsigned long last_updated;/* In jiffies */
drivers/hwmon/w83627hf.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/hwmon/w83627hf.c +2 -2
@@ -285,10 +285,10 @@ static inline u8 DIV_TO_REG(long val)struct w83627hf_data {struct i2c_client client;struct class_device *class_dev; -struct semaphore lock; +struct mutex lock;enum chips type; -struct semaphore update_lock; +struct mutex update_lock;char valid;/* !=0 if following fields are valid */ unsigned long last_updated;/* In jiffies */
drivers/hwmon/w83781d.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/hwmon/w83781d.c +2 -2
@@ -221,10 +221,10 @@ DIV_TO_REG(long val, enum chips type)struct w83781d_data {struct i2c_client client;struct class_device *class_dev; -struct semaphore lock; +struct mutex lock;enum chips type; -struct semaphore update_lock; +struct mutex update_lock;char valid;/* !=0 if following fields are valid */ unsigned long last_updated;/* In jiffies */
drivers/hwmon/w83792d.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/hwmon/w83792d.c +2 -2
@@ -269,10 +269,10 @@ DIV_TO_REG(long val)struct w83792d_data {struct i2c_client client;struct class_device *class_dev; -struct semaphore lock; +struct mutex lock;enum chips type; -struct semaphore update_lock; +struct mutex update_lock;char valid;/* !=0 if following fields are valid */ unsigned long last_updated;/* In jiffies */
drivers/hwmon/w83l785ts.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/hwmon/w83l785ts.c +1 -1
@@ -107,7 +107,7 @@ static struct i2c_driver w83l785ts_drivestruct w83l785ts_data {struct i2c_client client;struct class_device *class_dev; -struct semaphore update_lock; +struct mutex update_lock;char valid;/* zero until following fields are valid */ unsigned long last_updated;/* in jiffies */
PATCH 8/19 MUTEX: Drivers I-K changes
In reply to David HowellsThe attached patch modifies the files of the drivers/i* thru drivers/k* to use the new mutex functions.
---
warthog>diffstat -p1 mutex-drivers-ItoK-2615rc5.diff
drivers/i2c/busses/i2c-ali1535.c | 2 +- drivers/i2c/busses/i2c-amd756-s4882.c | 2 +- drivers/i2c/busses/scx200_acb.c | 2 +- drivers/i2c/chips/eeprom.c | 2 +- drivers/i2c/chips/max6875.c | 4 ++-- drivers/i2c/chips/pcf8591.c | 2 +- drivers/i2c/chips/tps65010.c | 2 +- drivers/ide/ide.c | 4 ++-- drivers/ieee1394/dv1394-private.h | 2 +- drivers/ieee1394/eth1394.c | 2 +- drivers/ieee1394/hosts.h | 2 +- drivers/ieee1394/ieee1394_core.c | 2 +- drivers/ieee1394/ieee1394_core.h | 2 +- drivers/ieee1394/ieee1394_types.h | 2 +- drivers/ieee1394/nodemgr.c | 10 +++++----- drivers/ieee1394/raw1394.c | 8 ++++---- drivers/infiniband/core/device.c | 2 +- drivers/infiniband/core/ucm.c | 2 +- drivers/infiniband/core/user_mad.c | 4 ++-- drivers/infiniband/core/uverbs.h | 4 ++-- drivers/infiniband/hw/mthca/mthca_cmd.c | 10 +++++----- drivers/infiniband/hw/mthca/mthca_dev.h | 10 +++++----- drivers/infiniband/hw/mthca/mthca_memfree.c | 2 +- drivers/infiniband/hw/mthca/mthca_memfree.h | 6 +++--- drivers/infiniband/ulp/ipoib/ipoib.h | 6 +++--- drivers/infiniband/ulp/srp/ib_srp.h | 4 ++-- drivers/input/joystick/db9.c | 2 +- drivers/input/joystick/gamecon.c | 2 +- drivers/input/joystick/iforce/iforce.h | 4 ++-- drivers/input/joystick/turbografx.c | 2 +- drivers/input/keyboard/atkbd.c | 2 +- drivers/input/keyboard/hil_kbd.c | 2 +- drivers/input/misc/hp_sdc_rtc.c | 4 ++-- drivers/input/mouse/hil_ptr.c | 2 +- drivers/input/serio/hp_sdc.c | 4 ++-- drivers/input/serio/hp_sdc_mlc.c | 2 +- drivers/isdn/capi/capi.c | 2 +- 37 files changed, 64 insertions(+), 64 deletions(-)
drivers/i2c/busses/i2c-ali1535.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/i2c/busses/i2c-ali1535.c +1 -1
@@ -63,7 +63,7 @@#include <linux/i2c.h> #include <linux/init.h> #include <asm/io.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> /* ALI1535 SMBus address offsets */
drivers/i2c/busses/i2c-amd756-s4882.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/i2c/busses/i2c-amd756-s4882.c +1 -1
@@ -45,7 +45,7 @@ static struct i2c_adapter *s4882_adapterstatic struct i2c_algorithm *s4882_algo;/* Wrapper access functions for multiplexed SMBus */ -static struct semaphore amd756_lock; +static struct mutex amd756_lock; static s32 amd756_access_virt0(struct i2c_adapter * adap, u16 addr, unsigned short flags, char read_write,
drivers/i2c/busses/scx200_acb.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/i2c/busses/scx200_acb.c +1 -1
@@ -84,7 +84,7 @@ struct scx200_acb_ifacestruct scx200_acb_iface *next;struct i2c_adapter adapter;unsigned base; -struct semaphore sem; +struct mutex sem;/* State machine data */ enum scx200_acb_state state;
drivers/i2c/chips/eeprom.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/i2c/chips/eeprom.c +1 -1
@@ -54,7 +54,7 @@ enum eeprom_nature {/* Each client has this additional data */ struct eeprom_data {struct i2c_client client; -struct semaphore update_lock; +struct mutex update_lock;u8 valid;/* bitfield, bit!=0 if slice is valid */ unsigned long last_updated[8 ];/* In jiffies, 8 slices */ u8 data[EEPROM_SIZE ];/* Register values */
drivers/i2c/chips/max6875.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/i2c/chips/max6875.c +2 -2
@@ -31,7 +31,7 @@#include <linux/module.h> #include <linux/slab.h> #include <linux/i2c.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> /* Do not scan - the MAX6875 access method will write to some EEPROM chips */ static unsigned short normal_i2c[] = {I2C_CLIENT_END };
@@ -54,7 +54,7 @@ I2C_CLIENT_INSMOD_1(max6875);/* Each client has this additional data */ struct max6875_data {struct i2c_client client; -struct semaphore update_lock; +struct mutex update_lock;u32 valid;u8 data[USER_EEPROM_SIZE ];
drivers/i2c/chips/pcf8591.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/i2c/chips/pcf8591.c +1 -1
@@ -74,7 +74,7 @@ MODULE_PARM_DESC(input_mode,struct pcf8591_data {struct i2c_client client; -struct semaphore update_lock; +struct mutex update_lock;u8 control;u8 aout;
drivers/i2c/chips/tps65010.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/i2c/chips/tps65010.c +1 -1
@@ -81,7 +81,7 @@ enum tps_model {struct tps65010 {struct i2c_client client; -struct semaphore lock; +struct mutex lock;int irq;struct work_struct work;struct dentry *file;
drivers/ide/ide.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/ide/ide.c +2 -2
@@ -222,7 +222,7 @@ static void init_hwif_data(ide_hwif_t *h hwif->mwdma_mask =0x80 ;/* disable all mwdma */ hwif->swdma_mask =0x80 ;/* disable all swdma */ -sema_init (&hwif->gendev_rel_sem,0 ); +init_MUTEX_LOCKED (&hwif->gendev_rel_sem);default_hwif_iops (hwif);default_hwif_transport (hwif);
@@ -245,7 +245,7 @@ static void init_hwif_data(ide_hwif_t *h drive->is_flash =0 ; drive->vdma =0 ;INIT_LIST_HEAD (&drive->list); -sema_init (&drive->gendev_rel_sem,0 ); +init_MUTEX_LOCKED (&drive->gendev_rel_sem); } }
drivers/ieee1394/dv1394-private.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/ieee1394/dv1394-private.h +1 -1
@@ -470,7 +470,7 @@ struct video_card {NOTE: if you need both spinlock and sem, take sem first to avoid deadlock! */ -struct semaphore sem; +struct mutex sem;/* people waiting for buffer space, please form a line here... */ wait_queue_head_t waitq;
drivers/ieee1394/eth1394.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/ieee1394/eth1394.c +1 -1
@@ -64,7 +64,7 @@#include <linux/ethtool.h> #include <asm/uaccess.h> #include <asm/delay.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <net/arp.h> #include "csr1212.h"
drivers/ieee1394/hosts.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/ieee1394/hosts.h +1 -1
@@ -7,7 +7,7 @@#include <linux/timer.h> #include <linux/skbuff.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include "ieee1394_types.h" #include "csr.h"
drivers/ieee1394/ieee1394_core.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/ieee1394/ieee1394_core.c +1 -1
@@ -35,7 +35,7 @@#include <linux/suspend.h> #include <asm/byteorder.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include "ieee1394_types.h" #include "ieee1394.h"
drivers/ieee1394/ieee1394_core.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/ieee1394/ieee1394_core.h +1 -1
@@ -5,7 +5,7 @@#include <linux/slab.h> #include <linux/devfs_fs_kernel.h> #include <asm/atomic.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include "hosts.h"
drivers/ieee1394/ieee1394_types.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/ieee1394/ieee1394_types.h +1 -1
@@ -9,7 +9,7 @@#include <linux/spinlock.h> #include <linux/string.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <asm/byteorder.h>
drivers/ieee1394/nodemgr.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/ieee1394/nodemgr.c +5 -5
@@ -1520,8 +1520,8 @@ static int nodemgr_host_thread(void *__hunsigned int generation =0 ;int i; -if (down_interruptible (&hi->reset_sem) || -down_interruptible (&nodemgr_serialize)) { +if (down_sem_interruptible (&hi->reset_sem) || +down_sem_interruptible (&nodemgr_serialize)) {if (try_to_freeze ())continue ;printk ("NodeMgr: received unexpected signal?!\n" );
@@ -1551,7 +1551,7 @@ static int nodemgr_host_thread(void *__h/* If we get a reset before we are done waiting, then * start the the waiting over again */ -while (!down_trylock (&hi->reset_sem)) +while (!down_sem_trylock (&hi->reset_sem)) i =0 ;/* Check the kill_me again */
@@ -1678,7 +1678,7 @@ static void nodemgr_host_reset(struct hpif (hi !=NULL ) {HPSB_VERBOSE ("NodeMgr: Processing host reset for %s" , hi->daemon_name); -up (&hi->reset_sem); +up_sem (&hi->reset_sem); }else HPSB_ERR ("NodeMgr: could not process reset of unused host" );
@@ -1693,7 +1693,7 @@ static void nodemgr_remove_host(struct hif (hi->pid >=0 ) { hi->kill_me =1 ;mb (); -up (&hi->reset_sem); +up_sem (&hi->reset_sem);wait_for_completion (&hi->exited);nodemgr_remove_host_dev (&host->device); }
drivers/ieee1394/raw1394.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/ieee1394/raw1394.c +4 -4
@@ -138,7 +138,7 @@ static void __queue_complete_req(structlist_del (&req->list);list_add_tail (&req->list, &fi->req_complete); -up (&fi->complete_sem); +up_sem (&fi->complete_sem);wake_up_interruptible (&fi->poll_wait_complete); }
@@ -427,11 +427,11 @@ static ssize_t raw1394_read(struct file }if (file->f_flags &O_NONBLOCK ) { -if (down_trylock (&fi->complete_sem)) { +if (down_sem_trylock (&fi->complete_sem)) {return -EAGAIN ; } }else { -if (down_interruptible (&fi->complete_sem)) { +if (down_sem_interruptible (&fi->complete_sem)) {return -ERESTARTSYS ; } }
@@ -2809,7 +2809,7 @@ static int raw1394_release(struct inodespin_unlock_irqrestore (&fi->reqlists_lock, flags);if (!done) -down_interruptible (&fi->complete_sem); +down_sem_interruptible (&fi->complete_sem); }/* Remove any sub-trees left by user space programs */
drivers/infiniband/core/device.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/infiniband/core/device.c +1 -1
@@ -39,7 +39,7 @@#include <linux/slab.h> #include <linux/init.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include "core_priv.h"
drivers/infiniband/core/ucm.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/infiniband/core/ucm.c +1 -1
@@ -60,7 +60,7 @@ struct ib_ucm_device { };struct ib_ucm_file { -struct semaphore mutex; +struct mutex mutex;struct file *filp;struct ib_ucm_device *device;
drivers/infiniband/core/user_mad.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/infiniband/core/user_mad.c +2 -2
@@ -47,7 +47,7 @@#include <linux/kref.h> #include <asm/uaccess.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <rdma/ib_mad.h> #include <rdma/ib_user_mad.h>
@@ -92,7 +92,7 @@ struct ib_umad_port {struct cdev *sm_dev;struct class_device *sm_class_dev; -struct semaphore sm_sem; +struct mutex sm_sem;struct rw_semaphore mutex;struct list_head file_list;
drivers/infiniband/core/uverbs.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/infiniband/core/uverbs.h +2 -2
@@ -88,7 +88,7 @@ struct ib_uverbs_event_file {struct ib_uverbs_file {struct kref ref; -struct semaphore mutex; +struct mutex mutex;struct ib_uverbs_device *device;struct ib_ucontext *ucontext;struct ib_event_handler event_handler;
@@ -131,7 +131,7 @@ struct ib_ucq_object {u32 async_events_reported; }; -extern struct semaphore ib_uverbs_idr_mutex; +extern struct mutex ib_uverbs_idr_mutex;extern struct idr ib_uverbs_pd_idr;extern struct idr ib_uverbs_mr_idr;extern struct idr ib_uverbs_mw_idr;
drivers/infiniband/hw/mthca/mthca_cmd.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/infiniband/hw/mthca/mthca_cmd.c +5 -5
@@ -333,7 +333,7 @@ static int mthca_cmd_wait(struct mthca_dint err =0 ;struct mthca_cmd_context *context; -if (down_interruptible (&dev->cmd.event_sem)) +if (down_sem_interruptible (&dev->cmd.event_sem))return -EINTR ;spin_lock (&dev->cmd.context_lock);
@@ -375,7 +375,7 @@ out: dev->cmd.free_head = context - dev->cmd.context;spin_unlock (&dev->cmd.context_lock); -up (&dev->cmd.event_sem); +up_sem (&dev->cmd.event_sem);return err; }
@@ -438,8 +438,8 @@ static int mthca_cmd_imm(struct mthca_deint mthca_cmd_init (struct mthca_dev *dev) { -sema_init (&dev->cmd.hcr_sem,1 ); -sema_init (&dev->cmd.poll_sem,1 ); +init_MUTEX (&dev->cmd.hcr_sem); +init_MUTEX (&dev->cmd.poll_sem); dev->cmd.use_events =0 ; dev->hcr = ioremap(pci_resource_start(dev->pdev, 0) + MTHCA_HCR_BASE,
@@ -517,7 +517,7 @@ void mthca_cmd_use_polling(struct mthca_ dev->cmd.use_events =0 ;for (i =0 ; i < dev->cmd.max_cmds; ++i) -down (&dev->cmd.event_sem); +down_sem (&dev->cmd.event_sem);kfree (dev->cmd.context);
drivers/infiniband/hw/mthca/mthca_dev.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/infiniband/hw/mthca/mthca_dev.h +5 -5
@@ -43,7 +43,7 @@#include <linux/kernel.h> #include <linux/pci.h> #include <linux/dma-mapping.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include "mthca_provider.h" #include "mthca_doorbell.h"
@@ -110,8 +110,8 @@ enum {struct mthca_cmd {struct pci_pool *pool;int use_events; -struct semaphore hcr_sem; -struct semaphore poll_sem; +struct mutex hcr_sem; +struct mutex poll_sem;struct semaphore event_sem;int max_cmds;spinlock_t context_lock;
@@ -255,7 +255,7 @@ struct mthca_av_table { };struct mthca_mcg_table { -struct semaphore sem; +struct mutex sem;struct mthca_alloc alloc;struct mthca_icm_table *table; };
@@ -300,7 +300,7 @@ struct mthca_dev {u64 ddr_end;MTHCA_DECLARE_DOORBELL_LOCK (doorbell_lock) - struct semaphore cap_mask_mutex; + struct mutex cap_mask_mutex;void __iomem *hcr;void __iomem *kar;
drivers/infiniband/hw/mthca/mthca_memfree.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/infiniband/hw/mthca/mthca_memfree.c +1 -1
@@ -50,7 +50,7 @@ enum { };struct mthca_user_db_table { -struct semaphore mutex; +struct mutex mutex;struct {u64 uvirt;struct scatterlist mem;
drivers/infiniband/hw/mthca/mthca_memfree.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/infiniband/hw/mthca/mthca_memfree.h +3 -3
@@ -40,7 +40,7 @@#include <linux/list.h> #include <linux/pci.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #define MTHCA_ICM_CHUNK_LEN \ ((256 - sizeof (struct list_head) - 2 * sizeof (int)) / \
@@ -64,7 +64,7 @@ struct mthca_icm_table {int num_obj;int obj_size;int lowmem; -struct semaphore mutex; +struct mutex mutex;struct mthca_icm *icm[0 ]; };
@@ -147,7 +147,7 @@ struct mthca_db_table {int max_group1;int min_group2;struct mthca_db_page *page; -struct semaphore mutex; +struct mutex mutex; };enum mthca_db_type {
drivers/infiniband/ulp/ipoib/ipoib.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/infiniband/ulp/ipoib/ipoib.h +3 -3
@@ -49,7 +49,7 @@#include <net/neighbour.h> #include <asm/atomic.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <rdma/ib_verbs.h> #include <rdma/ib_pack.h>
@@ -123,8 +123,8 @@ struct ipoib_dev_priv {unsigned long flags; -struct semaphore mcast_mutex; -struct semaphore vlan_mutex; +struct mutex mcast_mutex; +struct mutex vlan_mutex;struct rb_root path_tree;struct list_head path_list;
drivers/infiniband/ulp/srp/ib_srp.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/infiniband/ulp/srp/ib_srp.h +2 -2
@@ -38,7 +38,7 @@#include <linux/types.h> #include <linux/list.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <scsi/scsi_host.h> #include <scsi/scsi_cmnd.h>
@@ -85,7 +85,7 @@ struct srp_host {struct ib_mr *mr;struct class_device class_dev;struct list_head target_list; -struct semaphore target_mutex; +struct mutex target_mutex;struct completion released;struct list_head list; };
drivers/input/joystick/db9.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/input/joystick/db9.c +1 -1
@@ -111,7 +111,7 @@ struct db9 {struct pardevice *pd;int mode;int used; -struct semaphore sem; +struct mutex sem;char phys[DB9_MAX_DEVICES ][32 ]; };
drivers/input/joystick/gamecon.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/input/joystick/gamecon.c +1 -1
@@ -83,7 +83,7 @@ struct gc {struct timer_list timer;unsigned char pads[GC_MAX +1 ];int used; -struct semaphore sem; +struct mutex sem;char phys[GC_MAX_DEVICES ][32 ]; };
drivers/input/joystick/iforce/iforce.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/input/joystick/iforce/iforce.h +2 -2
@@ -37,7 +37,7 @@#include <linux/serio.h> #include <linux/config.h> #include <linux/circ_buf.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> /* This module provides arbitrary resource management routines. * I use it to manage the device's memory.
@@ -146,7 +146,7 @@ struct iforce {wait_queue_head_t wait;struct resource device_memory;struct iforce_core_effect core_effects[FF_EFFECTS_MAX ]; -struct semaphore mem_mutex; +struct mutex mem_mutex; };/* Get hi and low bytes of a 16-bits int */
drivers/input/joystick/turbografx.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/input/joystick/turbografx.c +1 -1
@@ -86,7 +86,7 @@ static struct tgfx {char phys[TGFX_MAX_DEVICES ][32 ];int sticks;int used; -struct semaphore sem; +struct mutex sem; } *tgfx_base[TGFX_MAX_PORTS ];/*
drivers/input/keyboard/atkbd.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/input/keyboard/atkbd.c +1 -1
@@ -216,7 +216,7 @@ struct atkbd {unsigned long time;struct work_struct event_work; -struct semaphore event_sem; +struct mutex event_sem;unsigned long event_mask; };
drivers/input/keyboard/hil_kbd.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/input/keyboard/hil_kbd.c +1 -1
@@ -80,7 +80,7 @@ struct hil_kbd {char rnm[HIL_KBD_MAX_LENGTH +1 ];/* RNM record + NULL term. */ /* Something to sleep around with. */ -struct semaphore sem; +struct mutex sem; };/* Process a complete packet after transfer from the HIL */
drivers/input/misc/hp_sdc_rtc.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/input/misc/hp_sdc_rtc.c +2 -2
@@ -52,7 +52,7 @@ MODULE_LICENSE("Dual BSD/GPL");static unsigned long epoch =2000 ; -static struct semaphore i8042tregs; +static struct mutex i8042tregs;static hp_sdc_irqhook hp_sdc_rtc_isr;
@@ -85,7 +85,7 @@ static void hp_sdc_rtc_isr (int irq, voistatic int hp_sdc_rtc_do_read_bbrtc (struct rtc_time *rtctm) { -struct semaphore tsem; +struct mutex tsem;hp_sdc_transaction t;uint8_t tseq[91 ];int i;
drivers/input/mouse/hil_ptr.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/input/mouse/hil_ptr.c +1 -1
@@ -73,7 +73,7 @@ struct hil_ptr {unsigned int btnmap[7 ];/* Something to sleep around with. */ -struct semaphore sem; +struct mutex sem; };/* Process a complete packet after transfer from the HIL */
drivers/input/serio/hp_sdc.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/input/serio/hp_sdc.c +2 -2
@@ -777,7 +777,7 @@ static int __init hp_sdc_init(void)char *errstr;hp_sdc_transaction t_sync;uint8_t ts_sync[6 ]; -struct semaphore s_sync; +struct mutex s_sync;rwlock_init (&hp_sdc.lock);rwlock_init (&hp_sdc.ibf_lock);
@@ -919,7 +919,7 @@ static int __init hp_sdc_register(void) {hp_sdc_transaction tq_init;uint8_t tq_init_seq[5 ]; -struct semaphore tq_init_sem; +struct mutex tq_init_sem;#if defined(__mc68000__)mm_segment_t fs;unsigned char i;
drivers/input/serio/hp_sdc_mlc.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/input/serio/hp_sdc_mlc.c +1 -1
@@ -40,7 +40,7 @@#include <linux/module.h> #include <linux/init.h> #include <linux/string.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #define PREFIX "HP SDC MLC: "
drivers/isdn/capi/capi.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/isdn/capi/capi.c +1 -1
@@ -138,7 +138,7 @@ struct capidev {struct capincci *nccis; -struct semaphore ncci_list_sem; +struct mutex ncci_list_sem; };/* -------- global variables ---------------------------------------- */
PATCH 9/19 MUTEX: Drivers L-M changes
In reply to David HowellsThe attached patch modifies the files of the drivers/l* thru drivers/m* to use the new mutex functions.
---
warthog>diffstat -p1 mutex-drivers-LtoM-2615rc5.diff
drivers/macintosh/adb.c | 2 +- drivers/macintosh/mediabay.c | 2 +- drivers/macintosh/therm_windtunnel.c | 2 +- drivers/md/dm-raid1.c | 10 +++++----- drivers/md/dm.c | 2 +- drivers/md/kcopyd.c | 2 +- drivers/media/dvb/b2c2/flexcop-common.h | 2 +- drivers/media/dvb/b2c2/flexcop-i2c.c | 2 +- drivers/media/dvb/bt8xx/bt878.h | 2 +- drivers/media/dvb/bt8xx/dst.c | 2 +- drivers/media/dvb/bt8xx/dst_common.h | 2 +- drivers/media/dvb/bt8xx/dvb-bt8xx.h | 2 +- drivers/media/dvb/cinergyT2/cinergyT2.c | 2 +- drivers/media/dvb/dvb-core/dmxdev.c | 4 ++-- drivers/media/dvb/dvb-core/dmxdev.h | 6 +++--- drivers/media/dvb/dvb-core/dvb_demux.c | 2 +- drivers/media/dvb/dvb-core/dvb_demux.h | 4 ++-- drivers/media/dvb/dvb-core/dvb_frontend.c | 4 ++-- drivers/media/dvb/dvb-core/dvb_frontend.h | 2 +- drivers/media/dvb/dvb-core/dvb_net.c | 2 +- drivers/media/dvb/dvb-usb/dvb-usb-init.c | 4 ++-- drivers/media/dvb/dvb-usb/dvb-usb.h | 4 ++-- drivers/media/dvb/frontends/bcm3510.c | 4 ++-- drivers/media/dvb/ttpci/av7110.c | 8 ++++---- drivers/media/dvb/ttpci/av7110.h | 6 +++--- drivers/media/dvb/ttpci/budget.h | 2 +- drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c | 10 +++++----- drivers/media/dvb/ttusb-dec/ttusb_dec.c | 10 +++++----- drivers/media/radio/miropcm20-rds-core.c | 4 ++-- drivers/media/radio/radio-aimslab.c | 4 ++-- drivers/media/radio/radio-aztech.c | 2 +- drivers/media/radio/radio-maestro.c | 4 ++-- drivers/media/radio/radio-maxiradio.c | 4 ++-- drivers/media/radio/radio-sf16fmi.c | 4 ++-- drivers/media/radio/radio-sf16fmr2.c | 4 ++-- drivers/media/radio/radio-typhoon.c | 2 +- drivers/media/radio/radio-zoltrix.c | 2 +- drivers/media/video/arv.c | 4 ++-- drivers/media/video/bttvp.h | 4 ++-- drivers/media/video/bw-qcam.c | 2 +- drivers/media/video/bw-qcam.h | 2 +- drivers/media/video/c-qcam.c | 4 ++-- drivers/media/video/cpia.c | 2 +- drivers/media/video/cpia.h | 4 ++-- drivers/media/video/cx88/cx88.h | 2 +- drivers/media/video/em28xx/em28xx.h | 2 +- drivers/media/video/ir-kbd-i2c.c | 2 +- drivers/media/video/meye.h | 2 +- drivers/media/video/msp3400.c | 2 +- drivers/media/video/planb.c | 2 +- drivers/media/video/planb.h | 2 +- drivers/media/video/pms.c | 2 +- drivers/media/video/saa5246a.c | 2 +- drivers/media/video/saa5249.c | 2 +- drivers/media/video/saa7134/saa7134.h | 4 ++-- drivers/media/video/tvmixer.c | 2 +- drivers/media/video/videodev.c | 2 +- drivers/media/video/vino.c | 4 ++-- drivers/media/video/zoran.h | 2 +- drivers/message/fusion/mptbase.h | 4 ++-- drivers/message/fusion/mptctl.c | 2 +- drivers/mfd/ucb1x00-core.c | 4 ++-- drivers/mfd/ucb1x00-ts.c | 2 +- drivers/mmc/mmc_queue.h | 2 +- drivers/mtd/devices/blkmtd.c | 2 +- drivers/mtd/devices/block2mtd.c | 2 +- drivers/mtd/mtd_blkdevs.c | 4 ++-- drivers/mtd/mtdblock.c | 2 +- 68 files changed, 108 insertions(+), 108 deletions(-)
drivers/macintosh/adb.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/macintosh/adb.c +1 -1
@@ -39,7 +39,7 @@#include <linux/devfs_fs_kernel.h> #include <asm/uaccess.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #ifdef CONFIG_PPC #include <asm/prom.h> #endif
drivers/macintosh/mediabay.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/macintosh/mediabay.c +1 -1
@@ -78,7 +78,7 @@ struct media_bay_info {int index;int cached_gpio;int sleeping; -struct semaphore lock; +struct mutex lock;#ifdef CONFIG_BLK_DEV_IDE void __iomem *cd_base;int cd_index;
drivers/macintosh/therm_windtunnel.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/macintosh/therm_windtunnel.c +1 -1
@@ -64,7 +64,7 @@ static struct {struct completion completion;pid_t poll_task; -struct semaphore lock; +struct mutex lock;struct of_device *of_dev;struct i2c_client *thermostat;
drivers/md/dm.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/md/dm.c +1 -1
@@ -58,7 +58,7 @@ union map_info *dm_get_mapinfo(struct bistruct mapped_device {struct rw_semaphore io_lock; -struct semaphore suspend_lock; +struct mutex suspend_lock;rwlock_t map_lock;atomic_t holders;
drivers/md/dm-raid1.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/md/dm-raid1.c +5 -5
@@ -358,7 +358,7 @@ static void rh_update_states(struct regi rh->log->type->clear_region (rh->log, reg->key); rh->log->type->complete_resync_work (rh->log, reg->key,1 );dispatch_bios (rh->ms, ®->delayed_bios); -up (&rh->recovery_count); +up_sem (&rh->recovery_count);mempool_free (reg, rh->region_pool); }
@@ -468,9 +468,9 @@ static int __rh_recovery_prepare(structstatic void rh_recovery_prepare (struct region_hash *rh) { -while (!down_trylock (&rh->recovery_count)) +while (!down_sem_trylock (&rh->recovery_count))if (__rh_recovery_prepare (rh) <=0 ) { -up (&rh->recovery_count); +up_sem (&rh->recovery_count);break ; } }
@@ -526,7 +526,7 @@ static void rh_stop_recovery(struct regi/* wait for any recovering regions */ for (i =0 ; i <MAX_RECOVERY ; i++) -down (&rh->recovery_count); +down_sem (&rh->recovery_count); }static void rh_start_recovery (struct region_hash *rh)
@@ -534,7 +534,7 @@ static void rh_start_recovery(struct regint i;for (i =0 ; i <MAX_RECOVERY ; i++) -up (&rh->recovery_count); +up_sem (&rh->recovery_count);wake (); }
drivers/md/kcopyd.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/md/kcopyd.c +1 -1
@@ -191,7 +191,7 @@ struct kcopyd_job {* These fields are only used if the job has been split * into more manageable parts. */ -struct semaphore lock; +struct mutex lock;atomic_t sub_jobs;sector_t progress; };
drivers/media/dvb/b2c2/flexcop-common.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/media/dvb/b2c2/flexcop-common.h +1 -1
@@ -73,7 +73,7 @@ struct flexcop_device {int (*fe_sleep) (struct dvb_frontend *);struct i2c_adapter i2c_adap; -struct semaphore i2c_sem; +struct mutex i2c_sem;struct module *owner;
drivers/media/dvb/b2c2/flexcop-i2c.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/media/dvb/b2c2/flexcop-i2c.c +1 -1
@@ -180,7 +180,7 @@ int flexcop_i2c_init(struct flexcop_devi {int ret; -sema_init (&fc->i2c_sem,1 ); +init_MUTEX (&fc->i2c_sem);memset (&fc->i2c_adap,0 ,sizeof (struct i2c_adapter ));strncpy (fc->i2c_adap.name,"B2C2 FlexCop device" ,I2C_NAME_SIZE );
drivers/media/dvb/bt8xx/bt878.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/media/dvb/bt8xx/bt878.h +1 -1
@@ -91,7 +91,7 @@extern int bt878_num;struct bt878 { -struct semaphore gpio_lock; +struct mutex gpio_lock;unsigned int nr;unsigned int bttv_nr;struct i2c_adapter *adapter;
drivers/media/dvb/bt8xx/dst.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/media/dvb/bt8xx/dst.c +1 -1
@@ -910,7 +910,7 @@ static int dst_get_device_id(struct dst_static int dst_probe (struct dst_state *state) { -sema_init (&state->dst_mutex,1 ); +init_MUTEX (&state->dst_mutex);if ((rdc_8820_reset (state)) <0 ) {dprintk (verbose,DST_ERROR ,1 ,"RDC 8820 RESET Failed." );return -1 ;
drivers/media/dvb/bt8xx/dst_common.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/media/dvb/bt8xx/dst_common.h +1 -1
@@ -121,7 +121,7 @@ struct dst_state {u8 vendor[8 ];u8 board_info[8 ]; -struct semaphore dst_mutex; +struct mutex dst_mutex; };struct dst_types {
drivers/media/dvb/bt8xx/dvb-bt8xx.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/media/dvb/bt8xx/dvb-bt8xx.h +1 -1
@@ -38,7 +38,7 @@#include "lgdt330x.h" struct dvb_bt8xx_card { -struct semaphore lock; +struct mutex lock;int nfeeds;char card_name[32 ];struct dvb_adapter dvb_adapter;
drivers/media/dvb/cinergyT2/cinergyT2.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/media/dvb/cinergyT2/cinergyT2.c +1 -1
@@ -116,7 +116,7 @@ static struct dvb_frontend_info cinergytstruct cinergyt2 {struct dvb_demux demux;struct usb_device *udev; -struct semaphore sem; +struct mutex sem;struct dvb_adapter adapter;struct dvb_device *fedev;struct dmxdev dmxdev;
drivers/media/dvb/dvb-core/dmxdev.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/media/dvb/dvb-core/dmxdev.c +2 -2
@@ -701,7 +701,7 @@ static int dvb_demux_open(struct inode * } dmxdevfilter=&dmxdev->filter[i]; -sema_init (&dmxdevfilter->mutex,1 ); +init_MUTEX (&dmxdevfilter->mutex); dmxdevfilter->dvbdev=dmxdev->dvbdev; file->private_data=dmxdevfilter;
@@ -1113,7 +1113,7 @@ dvb_dmxdev_init(struct dmxdev *dmxdev, sreturn -ENOMEM ; } -sema_init (&dmxdev->mutex,1 ); +init_MUTEX (&dmxdev->mutex);spin_lock_init (&dmxdev->lock);for (i=0 ; i<dmxdev->filternum; i++) { dmxdev->filter[i].dev=dmxdev;
drivers/media/dvb/dvb-core/dmxdev.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/media/dvb/dvb-core/dmxdev.h +3 -3
@@ -30,7 +30,7 @@#include <linux/wait.h> #include <linux/fs.h> #include <linux/string.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <linux/dvb/dmx.h>
@@ -83,7 +83,7 @@ struct dmxdev_filter {struct dmxdev *dev;struct dmxdev_buffer buffer; -struct semaphore mutex; +struct mutex mutex;/* only for sections */ struct timer_list timer;
@@ -117,7 +117,7 @@ struct dmxdev {struct dmxdev_buffer dvr_buffer;#define DVR_BUFFER_SIZE (10*188*1024) -struct semaphore mutex; +struct mutex mutex;spinlock_t lock; };
drivers/media/dvb/dvb-core/dvb_demux.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/media/dvb/dvb-core/dvb_demux.c +1 -1
@@ -1215,7 +1215,7 @@ int dvb_dmx_init(struct dvb_demux *dvbde dmx->disconnect_frontend = dvbdmx_disconnect_frontend; dmx->get_pes_pids = dvbdmx_get_pes_pids; -sema_init (&dvbdemux->mutex,1 ); +init_MUTEX (&dvbdemux->mutex);spin_lock_init (&dvbdemux->lock);return 0 ;
drivers/media/dvb/dvb-core/dvb_demux.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/media/dvb/dvb-core/dvb_demux.h +2 -2
@@ -26,7 +26,7 @@#include <linux/time.h> #include <linux/timer.h> #include <linux/spinlock.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include "demux.h"
@@ -125,7 +125,7 @@ struct dvb_demux {u8 tsbuf[204 ];int tsbufp; -struct semaphore mutex; +struct mutex mutex;spinlock_t lock; };
drivers/media/dvb/dvb-core/dvb_frontend.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/media/dvb/dvb-core/dvb_frontend.c +2 -2
@@ -37,7 +37,7 @@#include <linux/suspend.h> #include <linux/jiffies.h> #include <asm/processor.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include "dvb_frontend.h" #include "dvbdev.h"
@@ -95,7 +95,7 @@ struct dvb_frontend_private {struct dvb_device *dvbdev;struct dvb_frontend_parameters parameters;struct dvb_fe_events events; -struct semaphore sem; +struct mutex sem;struct list_head list_head;wait_queue_head_t wait_queue;pid_t thread_pid;
drivers/media/dvb/dvb-core/dvb_frontend.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/media/dvb/dvb-core/dvb_frontend.h +1 -1
@@ -86,7 +86,7 @@ struct dvb_fe_events {int eventr;int overflow;wait_queue_head_t wait_queue; -struct semaphore sem; +struct mutex sem; };struct dvb_frontend {
drivers/media/dvb/dvb-core/dvb_net.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/media/dvb/dvb-core/dvb_net.c +1 -1
@@ -152,7 +152,7 @@ struct dvb_net_priv {int ule_sndu_remain;/* Nr. of bytes still required for current ULE SNDU. */ unsigned long ts_count;/* Current ts cell counter. */ -struct semaphore mutex; +struct mutex mutex; };
drivers/media/dvb/dvb-usb/dvb-usb.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/media/dvb/dvb-usb/dvb-usb.h +2 -2
@@ -276,10 +276,10 @@ struct dvb_usb_device {int pid_filtering;/* locking */ -struct semaphore usb_sem; +struct mutex usb_sem;/* i2c */ -struct semaphore i2c_sem; +struct mutex i2c_sem;struct i2c_adapter i2c_adap;/* tuner programming information */
drivers/media/dvb/dvb-usb/dvb-usb-init.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/media/dvb/dvb-usb/dvb-usb-init.c +2 -2
@@ -42,8 +42,8 @@ static int dvb_usb_init(struct dvb_usb_d {int ret =0 ; -sema_init (&d->usb_sem,1 ); -sema_init (&d->i2c_sem,1 ); +init_MUTEX (&d->usb_sem); +init_MUTEX (&d->i2c_sem); d->state =DVB_USB_STATE_INIT ;
drivers/media/dvb/frontends/bcm3510.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/media/dvb/frontends/bcm3510.c +2 -2
@@ -52,7 +52,7 @@ struct bcm3510_state {struct dvb_frontend frontend;/* demodulator private data */ -struct semaphore hab_sem; +struct mutex hab_sem; u8 firmware_loaded:1;unsigned long next_status_check;
@@ -797,7 +797,7 @@ struct dvb_frontend* bcm3510_attach(cons state->frontend.ops = &state->ops; state->frontend.demodulator_priv = state; -sema_init (&state->hab_sem,1 ); +init_MUTEX (&state->hab_sem);if ((ret =bcm3510_readB (state,0xe0 ,&v)) <0 ) goto error;
drivers/media/dvb/ttpci/av7110.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/media/dvb/ttpci/av7110.c +4 -4
@@ -54,7 +54,7 @@#include <linux/i2c.h> #include <asm/system.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <linux/dvb/frontend.h>
@@ -2650,16 +2650,16 @@ static int av7110_attach(struct saa7146_tasklet_init (&av7110->debi_tasklet, debiirq, (unsigned long ) av7110);tasklet_init (&av7110->gpio_tasklet, gpioirq, (unsigned long ) av7110); -sema_init (&av7110->pid_mutex,1 ); +init_SEMA (&av7110->pid_mutex);/* locks for data transfers from/to AV7110 */ spin_lock_init (&av7110->debilock); -sema_init (&av7110->dcomlock,1 ); +init_MUTEX (&av7110->dcomlock); av7110->debitype =-1 ;/* default OSD window */ av7110->osdwin =1 ; -sema_init (&av7110->osd_sema,1 ); +init_MUTEX (&av7110->osd_sema);/* ARM "watchdog" */ init_waitqueue_head (&av7110->arm_wait);
drivers/media/dvb/ttpci/av7110.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/media/dvb/ttpci/av7110.h +3 -3
@@ -126,7 +126,7 @@ struct av7110 {/* DEBI and polled command interface */ spinlock_t debilock; -struct semaphore dcomlock; +struct mutex dcomlock;volatile int debitype;volatile int debilen;
@@ -145,7 +145,7 @@ struct av7110 {int osdwin;/* currently active window */ u16 osdbpp[8 ]; -struct semaphore osd_sema; +struct mutex osd_sema;/* CA */
@@ -171,7 +171,7 @@ struct av7110 {struct tasklet_struct vpe_tasklet;int fe_synced; -struct semaphore pid_mutex; +struct mutex pid_mutex;int video_blank;struct video_status videostate;
drivers/media/dvb/ttpci/budget.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/media/dvb/ttpci/budget.h +1 -1
@@ -51,7 +51,7 @@ struct budget {struct dmx_frontend mem_frontend;int fe_synced; -struct semaphore pid_mutex; +struct mutex pid_mutex;int ci_present;int video_port;
drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c +5 -5
@@ -19,7 +19,7 @@#include <linux/time.h> #include <linux/errno.h> #include <linux/jiffies.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include "dvb_frontend.h" #include "dmxdev.h"
@@ -83,8 +83,8 @@ struct ttusb {struct dvb_net dvbnet;/* and one for USB access. */ -struct semaphore semi2c; -struct semaphore semusb; +struct mutex semi2c; +struct mutex semusb;struct dvb_adapter adapter;struct usb_device *dev;
@@ -1497,8 +1497,8 @@ static int ttusb_probe(struct usb_interf ttusb->dev = udev; ttusb->c =0 ; ttusb->mux_state =0 ; -sema_init (&ttusb->semi2c,0 ); -sema_init (&ttusb->semusb,1 ); +init_MUTEX_LOCKED (&ttusb->semi2c); +init_MUTEX (&ttusb->semusb);ttusb_setup_interfaces (ttusb);
drivers/media/dvb/ttusb-dec/ttusb_dec.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/media/dvb/ttusb-dec/ttusb_dec.c +5 -5
@@ -20,7 +20,7 @@* */ -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <linux/list.h> #include <linux/module.h> #include <linux/moduleparam.h>
@@ -115,7 +115,7 @@ struct ttusb_dec {unsigned int out_pipe;unsigned int irq_pipe;enum ttusb_dec_interface interface; -struct semaphore usb_sem; +struct mutex usb_sem;void *irq_buffer;struct urb *irq_urb;
@@ -124,7 +124,7 @@ struct ttusb_dec {dma_addr_t iso_dma_handle;struct urb *iso_urb[ISO_BUF_COUNT ];int iso_stream_count; -struct semaphore iso_sem; +struct mutex iso_sem;u8 packet[MAX_PVA_LENGTH +4 ];enum ttusb_dec_packet_type packet_type;
@@ -1230,8 +1230,8 @@ static int ttusb_dec_init_usb(struct ttu {dprintk ("%s\n" , __FUNCTION__); -sema_init (&dec->usb_sem,1 ); -sema_init (&dec->iso_sem,1 ); +init_MUTEX (&dec->usb_sem); +init_MUTEX (&dec->iso_sem); dec->command_pipe =usb_sndbulkpipe (dec->udev,COMMAND_PIPE ); dec->result_pipe =usb_rcvbulkpipe (dec->udev,RESULT_PIPE );
drivers/media/radio/miropcm20-rds-core.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/media/radio/miropcm20-rds-core.c +2 -2
@@ -18,14 +18,14 @@#include <linux/string.h> #include <linux/init.h> #include <linux/slab.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <asm/io.h> #include "../../../sound/oss/aci.h" #include "miropcm20-rds-core.h" #define DEBUG 0 -static struct semaphore aci_rds_sem; +static struct mutex aci_rds_sem;#define RDS_DATASHIFT 2/* Bit 2 */ #define RDS_DATAMASK (1 << RDS_DATASHIFT)
drivers/media/radio/radio-aimslab.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/media/radio/radio-aimslab.c +2 -2
@@ -35,7 +35,7 @@#include <asm/uaccess.h> /* copy to/from user */ #include <linux/videodev.h> /* kernel radio structs */ #include <linux/config.h> /* CONFIG_RADIO_RTRACK_PORT */ -#include <asm/semaphore.h> /* Lock for the I/O */ +#include <linux/semaphore.h> /* Lock for the I/O */ #ifndef CONFIG_RADIO_RTRACK_PORT #define CONFIG_RADIO_RTRACK_PORT -1
@@ -43,7 +43,7 @@static int io =CONFIG_RADIO_RTRACK_PORT ;static int radio_nr =-1 ; -static struct semaphore lock; +static struct mutex lock;struct rt_device {
drivers/media/radio/radio-aztech.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/media/radio/radio-aztech.c +1 -1
@@ -42,7 +42,7 @@static int io =CONFIG_RADIO_AZTECH_PORT ;static int radio_nr =-1 ;static int radio_wait_time =1000 ; -static struct semaphore lock; +static struct mutex lock;struct az_device {
drivers/media/radio/radio-maestro.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/media/radio/radio-maestro.c +2 -2
@@ -23,7 +23,7 @@#include <linux/sched.h> #include <asm/io.h> #include <asm/uaccess.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <linux/pci.h> #include <linux/videodev.h>
@@ -90,7 +90,7 @@ static struct radio_device muted,/* VIDEO_AUDIO_MUTE */ stereo,/* VIDEO_TUNER_STEREO_ON */ tuned;/* signal strength (0 or 0xffff) */ -struct semaphore lock; +struct mutex lock; } radio_unit = {0, 0, 0, 0, };static __u32 radio_bits_get (struct radio_device *dev)
drivers/media/radio/radio-maxiradio.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/media/radio/radio-maxiradio.c +2 -2
@@ -37,7 +37,7 @@#include <linux/sched.h> #include <asm/io.h> #include <asm/uaccess.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <linux/pci.h> #include <linux/videodev.h>
@@ -100,7 +100,7 @@ static struct radio_deviceunsigned long freq; -struct semaphore lock; +struct mutex lock; } radio_unit = {0, 0, 0, 0, };
drivers/media/radio/radio-sf16fmi.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/media/radio/radio-sf16fmi.c +2 -2
@@ -24,7 +24,7 @@#include <linux/isapnp.h> #include <asm/io.h> /* outb, outb_p */ #include <asm/uaccess.h> /* copy to/from user */ -#include <asm/semaphore.h> +#include <linux/semaphore.h> struct fmi_device {
@@ -37,7 +37,7 @@ struct fmi_devicestatic int io =-1 ;static int radio_nr =-1 ;static struct pnp_dev *dev =NULL ; -static struct semaphore lock; +static struct mutex lock;/* freq is in 1/16 kHz to internal number, hw precision is 50 kHz */ /* It is only useful to give freq in intervall of 800 (=0.05Mhz),
drivers/media/radio/radio-sf16fmr2.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/media/radio/radio-sf16fmr2.c +2 -2
@@ -19,9 +19,9 @@#include <asm/io.h> /* outb, outb_p */ #include <asm/uaccess.h> /* copy to/from user */ #include <linux/videodev.h> /* kernel radio structs */ -#include <asm/semaphore.h> +#include <linux/semaphore.h> -static struct semaphore lock; +static struct mutex lock;#undef DEBUG//#define DEBUG 1
drivers/media/radio/radio-typhoon.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/media/radio/radio-typhoon.c +1 -1
@@ -59,7 +59,7 @@ struct typhoon_device {int muted;unsigned long curfreq;unsigned long mutefreq; -struct semaphore lock; +struct mutex lock; };static void typhoon_setvol_generic (struct typhoon_device *dev,int vol);
drivers/media/radio/radio-zoltrix.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/media/radio/radio-zoltrix.c +1 -1
@@ -48,7 +48,7 @@ struct zol_device {unsigned long curfreq;int muted;unsigned int stereo; -struct semaphore lock; +struct mutex lock; };static int zol_setvol (struct zol_device *dev,int vol)
drivers/media/video/arv.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/media/video/arv.c +2 -2
@@ -32,7 +32,7 @@#include <linux/sched.h> #include <linux/videodev.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <asm/uaccess.h> #include <asm/m32r.h> #include <asm/io.h>
@@ -117,7 +117,7 @@ struct ar_device {int width, height;int frame_bytes, line_bytes;wait_queue_head_t wait; -struct semaphore lock; +struct mutex lock; };static int video_nr =-1 ;/* video device number (first free) */
drivers/media/video/bttvp.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/media/video/bttvp.h +2 -2
@@ -303,9 +303,9 @@ struct bttv {/* locking */ spinlock_t s_lock; -struct semaphore lock; +struct mutex lock;int resources; -struct semaphore reslock; +struct mutex reslock;#ifdef VIDIOC_G_PRIORITY struct v4l2_prio_state prio;#endif
drivers/media/video/bw-qcam.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/media/video/bw-qcam.c +1 -1
@@ -73,7 +73,7 @@ OTHER DEALINGS IN THE SOFTWARE.#include <linux/parport.h> #include <linux/sched.h> #include <linux/videodev.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <asm/uaccess.h> #include "bw-qcam.h"
drivers/media/video/bw-qcam.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/media/video/bw-qcam.h +1 -1
@@ -55,7 +55,7 @@ struct qcam_device {struct video_device vdev;struct pardevice *pdev;struct parport *pport; -struct semaphore lock; +struct mutex lock;int width, height;int bpp;int mode;
drivers/media/video/cpia.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/media/video/cpia.c +1 -1
@@ -39,7 +39,7 @@#include <linux/pagemap.h> #include <linux/delay.h> #include <asm/io.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #ifdef CONFIG_KMOD #include <linux/kmod.h>
drivers/media/video/cpia.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/media/video/cpia.h +2 -2
@@ -246,7 +246,7 @@ enum v4l_camstates {struct cam_data {struct list_head cam_data_list; -struct semaphore busy_lock;/* guard against SMP multithreading */ +struct mutex busy_lock;/* guard against SMP multithreading */ struct cpia_camera_ops *ops;/* lowlevel driver operations */ void *lowlevel_data;/* private data for lowlevel driver */ u8 *raw_image;/* buffer for raw image data */
@@ -261,7 +261,7 @@ struct cam_data {u8 mainsFreq;/* for flicker control */ /* proc interface */ -struct semaphore param_lock;/* params lock for this camera */ +struct mutex param_lock;/* params lock for this camera */ struct cam_params params;/* camera settings */ struct proc_dir_entry *proc_entry;/* /proc/cpia/videoX */
drivers/media/video/c-qcam.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/media/video/c-qcam.c +2 -2
@@ -34,7 +34,7 @@#include <linux/parport.h> #include <linux/sched.h> #include <linux/videodev.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <asm/uaccess.h> struct qcam_device {
@@ -47,7 +47,7 @@ struct qcam_device {int contrast, brightness, whitebal;int top, left;unsigned int bidirectional; -struct semaphore lock; +struct mutex lock; };/* cameras maximum */
drivers/media/video/cx88/cx88.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/media/video/cx88/cx88.h +1 -1
@@ -297,7 +297,7 @@ struct cx88_core {/* IR remote control state */ struct cx88_IR *ir; -struct semaphore lock; +struct mutex lock;/* various v4l controls */ u32 freq;
drivers/media/video/em28xx/em28xx.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/media/video/em28xx/em28xx.h +1 -1
@@ -254,7 +254,7 @@ struct em28xx {enum em28xx_stream_state stream;enum em28xx_io_method io;/* locks */ -struct semaphore lock, fileop_lock; +struct mutex mutex, mutex_lock;spinlock_t queue_lock;struct list_head inqueue, outqueue;wait_queue_head_t open, wait_frame, wait_stream;
drivers/media/video/ir-kbd-i2c.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/media/video/ir-kbd-i2c.c +1 -1
@@ -39,7 +39,7 @@#include <linux/slab.h> #include <linux/i2c.h> #include <linux/workqueue.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <media/ir-common.h> #include <media/ir-kbd-i2c.h>
drivers/media/video/meye.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/media/video/meye.h +1 -1
@@ -301,7 +301,7 @@ struct meye {/* list of buffers */ struct meye_grab_buffer grab_buffer[MEYE_MAX_BUFNBRS ];int vma_use_count[MEYE_MAX_BUFNBRS ];/* mmap count */ -struct semaphore lock;/* semaphore for open/mmap... */ +struct mutex lock;/* semaphore for open/mmap... */ struct kfifo *grabq;/* queue for buffers to be grabbed */ spinlock_t grabq_lock;/* lock protecting the queue */ struct kfifo *doneq;/* queue for grabbed buffers */
drivers/media/video/msp3400.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/media/video/msp3400.c +1 -1
@@ -50,7 +50,7 @@#include <linux/smp_lock.h> #include <linux/kthread.h> #include <linux/suspend.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <asm/pgtable.h> #include <media/audiochip.h>
drivers/media/video/planb.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/media/video/planb.c +1 -1
@@ -48,7 +48,7 @@#include <asm/pgtable.h> #include <asm/page.h> #include <asm/irq.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include "planb.h" #include "saa7196.h"
drivers/media/video/planb.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/media/video/planb.h +1 -1
@@ -174,7 +174,7 @@ struct planb {int user;unsigned int tab_size;int maxlines; -struct semaphore lock; +struct mutex lock;unsigned int irq;/* interrupt number */ volatile unsigned int intr_mask;
drivers/media/video/pms.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/media/video/pms.c +1 -1
@@ -44,7 +44,7 @@ struct pms_devicestruct video_picture picture;int height;int width; -struct semaphore lock; +struct mutex lock; };struct i2c_info
drivers/media/video/saa5246a.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/media/video/saa5246a.c +1 -1
@@ -57,7 +57,7 @@ struct saa5246a_deviceu8 pgbuf[NUM_DAUS ][VTX_VIRTUALSIZE ];int is_searching[NUM_DAUS ];struct i2c_client *client; -struct semaphore lock; +struct mutex lock; };static struct video_device saa_template;/* Declared near bottom */
drivers/media/video/saa5249.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/media/video/saa5249.c +1 -1
@@ -105,7 +105,7 @@ struct saa5249_deviceint disp_mode;int virtual_mode;struct i2c_client *client; -struct semaphore lock; +struct mutex lock; };
drivers/media/video/saa7134/saa7134.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/media/video/saa7134/saa7134.h +2 -2
@@ -358,7 +358,7 @@ struct saa7134_fh {/* dmasound dsp status */ struct saa7134_dmasound { -struct semaphore lock; +struct mutex lock;int minor_mixer;int minor_dsp;unsigned int users_dsp;
@@ -422,7 +422,7 @@ struct saa7134_mpeg_ops {/* global device status */ struct saa7134_dev {struct list_head devlist; -struct semaphore lock; +struct mutex lock;spinlock_t slock;#ifdef VIDIOC_G_PRIORITY struct v4l2_prio_state prio;
drivers/media/video/tvmixer.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/media/video/tvmixer.c +1 -1
@@ -16,8 +16,8 @@#include <linux/kdev_t.h> #include <linux/sound.h> #include <linux/soundcard.h> +#include <linux/semaphore.h> -#include <asm/semaphore.h> #include <asm/uaccess.h>
drivers/media/video/videodev.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/media/video/videodev.c +1 -1
@@ -29,7 +29,7 @@#include <linux/devfs_fs_kernel.h> #include <asm/uaccess.h> #include <asm/system.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <linux/videodev.h>
drivers/media/video/vino.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/media/video/vino.c +2 -2
@@ -245,7 +245,7 @@ struct vino_framebuffer_queue {struct vino_framebuffer *buffer[VINO_FRAMEBUFFER_COUNT_MAX ];spinlock_t queue_lock; -struct semaphore queue_sem; +struct mutex queue_sem;wait_queue_head_t frame_wait_queue; };
@@ -283,7 +283,7 @@ struct vino_channel_settings {/* the driver is currently processing the queue */ int capturing; -struct semaphore sem; +struct mutex sem;spinlock_t capture_lock;unsigned int users;
drivers/media/video/zoran.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/media/video/zoran.h +1 -1
@@ -395,7 +395,7 @@ struct zoran {struct videocodec *codec;/* video codec */ struct videocodec *vfe;/* video front end */ -struct semaphore resource_lock;/* prevent evil stuff */ +struct mutex resource_lock;/* prevent evil stuff */ u8 initialized;/* flag if zoran has been correctly initalized */ int user;/* number of current users */
drivers/message/fusion/mptbase.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/message/fusion/mptbase.h +2 -2
@@ -417,7 +417,7 @@ typedef struct _MPT_IOCTL {u8 status;/* current command status */ u8 reset;/* 1 if bus reset allowed */ u8 target;/* target for reset */ -struct semaphore sem_ioc; +struct mutex sem_ioc; }MPT_IOCTL ;#define MPT_SAS_MGMT_STATUS_RF_VALID 0x02/* The Reply Frame is VALID */
@@ -425,7 +425,7 @@ typedef struct _MPT_IOCTL {#define MPT_SAS_MGMT_STATUS_TM_FAILED 0x40/* User TM request failed */ typedef struct _MPT_SAS_MGMT { - struct semaphore mutex; + struct mutex mutex; struct completion done; u8 reply[MPT_DEFAULT_FRAME_SIZE]; /* reply frame data */ u8 status; /* current command status */
drivers/message/fusion/mptctl.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/message/fusion/mptctl.c +1 -1
@@ -2745,7 +2745,7 @@ mptctl_probe(struct pci_dev *pdev, constmemset (mem,0 , sz); ioc->ioctl = (MPT_IOCTL *) mem; ioc->ioctl->ioc = ioc; -sema_init (&ioc->ioctl->sem_ioc,1 ); +init_MUTEX (&ioc->ioctl->sem_ioc);return 0 ; out_fail:
drivers/mfd/ucb1x00-core.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/mfd/ucb1x00-core.c +2 -2
@@ -135,7 +135,7 @@ unsigned int ucb1x00_io_read(struct ucb1*/ void ucb1x00_adc_enable (struct ucb1x00 *ucb) { -down (&ucb->adc_sem); +down_sem (&ucb->adc_sem); ucb->adc_cr |=UCB_ADC_ENA ;
@@ -193,7 +193,7 @@ void ucb1x00_adc_disable(struct ucb1x00ucb1x00_reg_write (ucb,UCB_ADC_CR , ucb->adc_cr);ucb1x00_disable (ucb); -up (&ucb->adc_sem); +up_sem (&ucb->adc_sem); }/*
drivers/mfd/ucb1x00-ts.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/mfd/ucb1x00-ts.c +1 -1
@@ -35,7 +35,7 @@#include <linux/delay.h> #include <asm/dma.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <asm/arch/collie.h> #include <asm/mach-types.h>
drivers/mmc/mmc_queue.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/mmc/mmc_queue.h +1 -1
@@ -8,7 +8,7 @@ struct mmc_queue {struct mmc_card *card;struct completion thread_complete;wait_queue_head_t thread_wq; -struct semaphore thread_sem; +struct mutex thread_sem;unsigned int flags;struct request *req;int (*prep_fn)(struct mmc_queue *,struct request *);
drivers/mtd/devices/blkmtd.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/mtd/devices/blkmtd.c +1 -1
@@ -46,7 +46,7 @@ struct blkmtd_dev {struct list_head list;struct block_device *blkdev;struct mtd_info mtd_info; -struct semaphore wrbuf_mutex; +struct mutex wrbuf_mutex; };
drivers/mtd/devices/block2mtd.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/mtd/devices/block2mtd.c +1 -1
@@ -31,7 +31,7 @@ struct block2mtd_dev {struct list_head list;struct block_device *blkdev;struct mtd_info mtd; -struct semaphore write_mutex; +struct mutex write_mutex; };
drivers/mtd/mtd_blkdevs.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/mtd/mtd_blkdevs.c +2 -2
@@ -19,12 +19,12 @@#include <linux/spinlock.h> #include <linux/hdreg.h> #include <linux/init.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <asm/uaccess.h> static LIST_HEAD (blktrans_majors); -extern struct semaphore mtd_table_mutex; +extern struct mutex mtd_table_mutex;extern struct mtd_info *mtd_table[];struct mtd_blkcore_priv {
drivers/mtd/mtdblock.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/mtd/mtdblock.c +1 -1
@@ -23,7 +23,7 @@ static struct mtdblk_dev { struct mtd_info *mtd; int count; - struct semaphore cache_sem; + struct mutex cache_sem; unsigned char *cache_data; unsigned long cache_offset; unsigned int cache_size;
PATCH 10/19 MUTEX: Drivers N-P changes
In reply to David HowellsThe attached patch modifies the files of the drivers/n* thru drivers/p* to use the new mutex functions.
---
warthog>diffstat -p1 mutex-drivers-NtoP-2615rc5.diff
drivers/net/3c527.c | 4 ++-- drivers/net/cassini.h | 2 +- drivers/net/chelsio/common.h | 2 +- drivers/net/hamradio/6pack.c | 4 ++-- drivers/net/hamradio/mkiss.c | 2 +- drivers/net/ibmveth.c | 2 +- drivers/net/irda/sir-dev.h | 2 +- drivers/net/irda/vlsi_ir.h | 2 +- drivers/net/plip.c | 4 ++-- drivers/net/ppp_async.c | 2 +- drivers/net/ppp_synctty.c | 4 ++-- drivers/net/sungem.h | 2 +- drivers/net/wan/cosa.c | 2 +- drivers/net/wireless/airo.c | 4 ++-- drivers/net/wireless/hostap/hostap_wlan.h | 2 +- drivers/net/wireless/ipw2100.c | 4 ++-- drivers/net/wireless/ipw2100.h | 4 ++-- drivers/net/wireless/ipw2200.h | 2 +- drivers/net/wireless/prism54/isl_ioctl.c | 4 ++-- drivers/net/wireless/prism54/islpci_dev.c | 4 ++-- drivers/net/wireless/prism54/islpci_dev.h | 8 ++++---- drivers/oprofile/event_buffer.h | 4 ++-- drivers/oprofile/oprof.c | 2 +- drivers/pci/hotplug/acpiphp.h | 2 +- drivers/pci/hotplug/acpiphp_glue.c | 2 +- drivers/pci/hotplug/cpci_hotplug_core.c | 4 ++-- drivers/pci/hotplug/cpqphp.h | 2 +- drivers/pci/hotplug/cpqphp_ctrl.c | 6 +++--- drivers/pci/hotplug/ibmphp_hpc.c | 6 +++--- drivers/pci/hotplug/pciehp.h | 2 +- drivers/pci/hotplug/pciehp_ctrl.c | 4 ++-- drivers/pci/hotplug/rpadlpar_core.c | 2 +- drivers/pci/hotplug/rpaphp_core.c | 2 +- drivers/pci/hotplug/shpchp.h | 2 +- drivers/pci/hotplug/shpchp_ctrl.c | 4 ++-- drivers/pcmcia/soc_common.h | 2 +- drivers/pnp/interface.c | 2 +- 37 files changed, 57 insertions(+), 57 deletions(-)
drivers/net/3c527.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/net/3c527.c +2 -2
@@ -104,7 +104,7 @@ DRV_NAME ".c:v" DRV_VERSION " " DRV_RELD#include <linux/completion.h> #include <linux/bitops.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <asm/uaccess.h> #include <asm/system.h> #include <asm/io.h>
@@ -182,7 +182,7 @@ struct mc32_localu16 rx_ring_tail;/* index to rx de-queue end */ -struct semaphore cmd_mutex;/* Serialises issuing of execute commands */ +struct mutex cmd_mutex;/* Serialises issuing of execute commands */ struct completion execution_cmd;/* Card has completed an execute command */ struct completion xceiver_cmd;/* Card has completed a tx or rx command */ };
drivers/net/cassini.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/net/cassini.h +1 -1
@@ -4284,7 +4284,7 @@ struct cas {* (ie. not power managed) */ int hw_running;int opened; -struct semaphore pm_sem;/* open/close/suspend/resume */ +struct mutex pm_sem;/* open/close/suspend/resume */ struct cas_init_block *init_block;struct cas_tx_desc *init_txds[MAX_TX_RINGS ];
drivers/net/chelsio/common.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/net/chelsio/common.h +1 -1
@@ -213,7 +213,7 @@ struct adapter {struct work_struct stats_update_task;struct timer_list stats_update_timer; -struct semaphore mib_mutex; +struct mutex mib_mutex;spinlock_t tpi_lock;spinlock_t work_lock;/* guards async operations */
drivers/net/hamradio/6pack.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/net/hamradio/6pack.c +2 -2
@@ -34,7 +34,7 @@#include <linux/init.h> #include <linux/ip.h> #include <linux/tcp.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <asm/atomic.h> #define SIXPACK_VERSION "Revision: 0.3.0"
@@ -124,7 +124,7 @@ struct sixpack {struct timer_list tx_t;struct timer_list resync_t;atomic_t refcnt; -struct semaphore dead_sem; +struct mutex dead_sem;spinlock_t lock; };
drivers/net/hamradio/mkiss.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/net/hamradio/mkiss.c +1 -1
@@ -85,7 +85,7 @@ struct mkiss {#define CRC_MODE_SMACK_TEST 4atomic_t refcnt; -struct semaphore dead_sem; +struct mutex dead_sem; };/*---------------------------------------------------------------------------*/
drivers/net/ibmveth.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/net/ibmveth.c +1 -1
@@ -48,7 +48,7 @@#include <linux/mm.h> #include <linux/ethtool.h> #include <linux/proc_fs.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <asm/hvcall.h> #include <asm/atomic.h> #include <asm/iommu.h>
drivers/net/irda/sir-dev.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/net/irda/sir-dev.h +1 -1
@@ -30,7 +30,7 @@ struct irda_request { };struct sir_fsm { -struct semaphore sem; +struct mutex sem;struct irda_request rq;unsigned state, substate;int param;
drivers/net/irda/vlsi_ir.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/net/irda/vlsi_ir.h +1 -1
@@ -761,7 +761,7 @@ typedef struct vlsi_irda_dev {struct timeval last_rx;spinlock_t lock; -struct semaphore sem; +struct mutex sem;u8 resume_ok;struct proc_dir_entry *proc_entry;
drivers/net/plip.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/net/plip.c +2 -2
@@ -116,7 +116,7 @@ static const char version[] = "NET3 PLIP#include <asm/system.h> #include <asm/irq.h> #include <asm/byteorder.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> /* Maximum number of devices to support. */ #define PLIP_MAX 8
@@ -229,7 +229,7 @@ struct net_local { struct hh_cache *hh);spinlock_t lock;atomic_t kill_timer; -struct semaphore killed_timer_sem; +struct mutex killed_timer_sem; };static inline void enable_parport_interrupts (struct net_device *dev)
drivers/net/ppp_async.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/net/ppp_async.c +1 -1
@@ -66,7 +66,7 @@ struct asyncppp {struct tasklet_struct tsk;atomic_t refcnt; -struct semaphore dead_sem; +struct mutex dead_sem;struct ppp_channel chan;/* interface to generic ppp layer */ unsigned char obuf[OBUFSIZE ]; };
drivers/net/ppp_synctty.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/net/ppp_synctty.c +2 -2
@@ -44,7 +44,7 @@#include <linux/spinlock.h> #include <linux/init.h> #include <asm/uaccess.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #define PPP_VERSION "2.4.2"
@@ -70,7 +70,7 @@ struct syncppp {struct tasklet_struct tsk;atomic_t refcnt; -struct semaphore dead_sem; +struct mutex dead_sem;struct ppp_channel chan;/* interface to generic ppp layer */ };
drivers/net/sungem.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/net/sungem.h +1 -1
@@ -988,7 +988,7 @@ struct gem {/* cell enable count, protected by lock */ int cell_enabled; -struct semaphore pm_sem; +struct mutex pm_sem;u32 msg_enable;u32 status;
drivers/net/wan/cosa.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/net/wan/cosa.c +1 -1
@@ -131,7 +131,7 @@ struct channel_data {int (*tx_done)(struct channel_data *channel,int size);/* Character device parts */ -struct semaphore rsem, wsem; +struct mutex rsem, wsem;char *rxdata;int rxsize;wait_queue_head_t txwaitq, rxwaitq;
drivers/net/wireless/airo.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/net/wireless/airo.c +2 -2
@@ -1176,7 +1176,7 @@ struct airo_info {unsigned short *flash;tdsRssiEntry *rssi;struct task_struct *task; -struct semaphore sem; +struct mutex sem;pid_t thr_pid;wait_queue_head_t thr_wait;struct completion thr_exited;
@@ -2718,7 +2718,7 @@ static struct net_device *_init_airo_car } ai->dev = dev;spin_lock_init (&ai->aux_lock); -sema_init (&ai->sem,1 ); +init_MUTEX (&ai->sem); ai->config.len =0 ; ai->pci = pci;init_waitqueue_head (&ai->thr_wait);
drivers/net/wireless/hostap/hostap_wlan.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/net/wireless/hostap/hostap_wlan.h +1 -1
@@ -637,7 +637,7 @@ struct local_info {* when removing entries from the list. * TX and RX paths can use read lock. */ spinlock_t cmdlock, baplock, lock; -struct semaphore rid_bap_sem; +struct mutex rid_bap_sem;u16 infofid;/* MAC buffer id for info frame */ /* txfid, intransmitfid, next_txtid, and next_alloc are protected by * txfidlock */
drivers/net/wireless/ipw2100.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/net/wireless/ipw2100.c +2 -2
@@ -6413,8 +6413,8 @@ static struct net_device *ipw2100_alloc_strcpy (priv->nick,"ipw2100" );spin_lock_init (&priv->low_lock); -sema_init (&priv->action_sem,1 ); -sema_init (&priv->adapter_sem,1 ); +init_MUTEX (&priv->action_sem); +init_MUTEX (&priv->adapter_sem);init_waitqueue_head (&priv->wait_command_queue);
drivers/net/wireless/ipw2100.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/net/wireless/ipw2100.h +2 -2
@@ -588,8 +588,8 @@ struct ipw2100_priv {int inta_other;spinlock_t low_lock; -struct semaphore action_sem; -struct semaphore adapter_sem; +struct mutex action_sem; +struct mutex adapter_sem;wait_queue_head_t wait_command_queue; };
drivers/net/wireless/ipw2200.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/net/wireless/ipw2200.h +1 -1
@@ -1120,7 +1120,7 @@ struct ipw_priv {struct ieee80211_device *ieee;spinlock_t lock; -struct semaphore sem; +struct mutex sem;/* basic pci-network driver stuff */ struct pci_dev *pci_dev;
drivers/net/wireless/prism54/isl_ioctl.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/net/wireless/prism54/isl_ioctl.c +2 -2
@@ -1255,7 +1255,7 @@ prism54_set_raw(struct net_device *ndev,void prism54_acl_init (struct islpci_acl *acl) { -sema_init (&acl->sem,1 ); +init_MUTEX (&acl->sem);INIT_LIST_HEAD (&acl->mac_list); acl->size =0 ; acl->policy =MAC_POLICY_OPEN ;
@@ -1686,7 +1686,7 @@ void prism54_wpa_ie_init(islpci_private *priv) {INIT_LIST_HEAD (&priv->bss_wpa_list); -sema_init (&priv->wpa_sem,1 ); +init_MUTEX (&priv->wpa_sem); }void
drivers/net/wireless/prism54/islpci_dev.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/net/wireless/prism54/islpci_dev.c +2 -2
@@ -850,10 +850,10 @@ islpci_setup(struct pci_dev *pdev)init_waitqueue_head (&priv->reset_done);/* init the queue read locks, process wait counter */ -sema_init (&priv->mgmt_sem,1 ); +init_MUTEX (&priv->mgmt_sem); priv->mgmt_received =NULL ;init_waitqueue_head (&priv->mgmt_wqueue); -sema_init (&priv->stats_sem,1 ); +init_MUTEX (&priv->stats_sem);spin_lock_init (&priv->slock);/* init state machine with off#1 state */
drivers/net/wireless/prism54/islpci_dev.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/net/wireless/prism54/islpci_dev.h +4 -4
@@ -55,7 +55,7 @@ struct islpci_acl {enum {MAC_POLICY_OPEN =0 ,MAC_POLICY_ACCEPT =1 ,MAC_POLICY_REJECT =2 } policy;struct list_head mac_list;/* a list of mac_entry */ int size;/* size of queue */ -struct semaphore sem;/* accessed in ioctls and trap_work */ +struct mutex sem;/* accessed in ioctls and trap_work */ };struct islpci_membuf {
@@ -88,7 +88,7 @@ typedef struct {/* Take care of the wireless stats */ struct work_struct stats_work; -struct semaphore stats_sem; +struct mutex stats_sem;/* remember when we last updated the stats */ unsigned long stats_timestamp;/* The first is accessed under semaphore locking.
@@ -165,7 +165,7 @@ typedef struct {wait_queue_head_t reset_done;/* used by islpci_mgt_transaction */ -struct semaphore mgmt_sem;/* serialize access to mailbox and wqueue */ +struct mutex mgmt_sem;/* serialize access to mailbox and wqueue */ struct islpci_mgmtframe *mgmt_received;/* mbox for incoming frame */ wait_queue_head_t mgmt_wqueue;/* waitqueue for mbox */
@@ -178,7 +178,7 @@ typedef struct {int wpa;/* WPA mode enabled */ struct list_head bss_wpa_list;int num_bss_wpa; -struct semaphore wpa_sem; +struct mutex wpa_sem;struct work_struct reset_task;int reset_task_pending;
drivers/oprofile/event_buffer.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/oprofile/event_buffer.h +2 -2
@@ -11,7 +11,7 @@#define EVENT_BUFFER_H #include <linux/types.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> int alloc_event_buffer (void );
@@ -46,6 +46,6 @@ extern struct file_operations event_buff/* mutex between sync_cpu_buffers() and the * file reading code. */ -extern struct semaphore buffer_sem; +extern struct mutex buffer_sem;#endif /* EVENT_BUFFER_H */
drivers/oprofile/oprof.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/oprofile/oprof.c +1 -1
@@ -12,7 +12,7 @@#include <linux/init.h> #include <linux/oprofile.h> #include <linux/moduleparam.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include "oprof.h" #include "event_buffer.h"
drivers/pci/hotplug/acpiphp_glue.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/pci/hotplug/acpiphp_glue.c +1 -1
@@ -46,7 +46,7 @@#include <linux/kernel.h> #include <linux/pci.h> #include <linux/smp_lock.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include "../pci.h" #include "pci_hotplug.h"
drivers/pci/hotplug/acpiphp.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/pci/hotplug/acpiphp.h +1 -1
@@ -118,7 +118,7 @@ struct acpiphp_slot {struct acpiphp_bridge *bridge;/* parent */ struct list_head funcs;/* one slot may have different objects (i.e. for each function) */ -struct semaphore crit_sect; +struct mutex crit_sect;u32 id;/* slot id (serial #) for hotplug core */ u8 device;/* pci device# */
drivers/pci/hotplug/cpci_hotplug_core.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/pci/hotplug/cpci_hotplug_core.c +2 -2
@@ -60,8 +60,8 @@ static int slots;static atomic_t extracting;int cpci_debug;static struct cpci_hp_controller *controller; -static struct semaphore event_semaphore;/* mutex for process loop (up if something to process) */ -static struct semaphore thread_exit;/* guard ensure thread has exited before calling it quits */ +static struct mutex event_semaphore;/* mutex for process loop (up if something to process) */ +static struct mutex thread_exit;/* guard ensure thread has exited before calling it quits */ static int thread_finished =1 ;static int enable_slot (struct hotplug_slot *slot);
drivers/pci/hotplug/cpqphp_ctrl.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/pci/hotplug/cpqphp_ctrl.c +3 -3
@@ -45,13 +45,13 @@ static int configure_new_function(struct u8 behind_bridge, struct resource_lists *resources);static void interrupt_event_handler (struct controller *ctrl); -static struct semaphore event_semaphore;/* mutex for process loop (up if something to process) */ -static struct semaphore event_exit;/* guard ensure thread has exited before calling it quits */ +static struct mutex event_semaphore;/* mutex for process loop (up if something to process) */ +static struct mutex event_exit;/* guard ensure thread has exited before calling it quits */ static int event_finished;static unsigned long pushbutton_pending;/* = 0 */ /* things needed for the long_delay function */ -static struct semaphore delay_sem; +static struct mutex delay_sem;static wait_queue_head_t delay_wait;/* delay is in jiffies to wait for */
drivers/pci/hotplug/cpqphp.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/pci/hotplug/cpqphp.h +1 -1
@@ -286,7 +286,7 @@ struct event_info {struct controller {struct controller *next;u32 ctrl_int_comp; -struct semaphore crit_sect;/* critical section semaphore */ +struct mutex crit_sect;/* critical section semaphore */ void __iomem *hpc_reg;/* cookie for our pci controller location */ struct pci_resource *mem_head;struct pci_resource *p_mem_head;
drivers/pci/hotplug/ibmphp_hpc.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/pci/hotplug/ibmphp_hpc.c +3 -3
@@ -101,10 +101,10 @@ static int to_debug = FALSE;//---------------------------------------------------------------------------- static int ibmphp_shutdown;static int tid_poll; -static struct semaphore sem_hpcaccess;// lock access to HPC -static struct semaphore semOperations;// lock all operations and +static struct mutex sem_hpcaccess;// lock access to HPC +static struct mutex semOperations;// lock all operations and // access to data structures -static struct semaphore sem_exit;// make sure polling thread goes away +static struct mutex sem_exit;// make sure polling thread goes away //---------------------------------------------------------------------------- // local function prototypes //----------------------------------------------------------------------------
drivers/pci/hotplug/pciehp_ctrl.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/pci/hotplug/pciehp_ctrl.c +2 -2
@@ -37,8 +37,8 @@static void interrupt_event_handler (struct controller *ctrl); -static struct semaphore event_semaphore;/* mutex for process loop (up if something to process) */ -static struct semaphore event_exit;/* guard ensure thread has exited before calling it quits */ +static struct mutex event_semaphore;/* mutex for process loop (up if something to process) */ +static struct mutex event_exit;/* guard ensure thread has exited before calling it quits */ static int event_finished;static unsigned long pushbutton_pending;/* = 0 */ static unsigned long surprise_rm_pending;/* = 0 */
drivers/pci/hotplug/pciehp.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/pci/hotplug/pciehp.h +1 -1
@@ -95,7 +95,7 @@ struct php_ctlr_state_s {#define MAX_EVENTS 10struct controller {struct controller *next; -struct semaphore crit_sect;/* critical section semaphore */ +struct mutex crit_sect;/* critical section semaphore */ struct php_ctlr_state_s *hpc_ctlr_handle;/* HPC controller handle */ int num_slots;/* Number of slots on ctlr */ int slot_num_inc;/* 1 or -1 */
drivers/pci/hotplug/rpadlpar_core.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/pci/hotplug/rpadlpar_core.c +1 -1
@@ -19,7 +19,7 @@#include <linux/string.h> #include <asm/pci-bridge.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <asm/rtas.h> #include <asm/vio.h>
drivers/pci/hotplug/rpaphp_core.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/pci/hotplug/rpaphp_core.c +1 -1
@@ -40,7 +40,7 @@#include "pci_hotplug.h" int debug; -static struct semaphore rpaphp_sem; +static struct mutex rpaphp_sem;LIST_HEAD (rpaphp_slot_head);int num_slots;
drivers/pci/hotplug/shpchp_ctrl.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/pci/hotplug/shpchp_ctrl.c +2 -2
@@ -37,8 +37,8 @@static void interrupt_event_handler (struct controller *ctrl); -static struct semaphore event_semaphore;/* mutex for process loop (up if something to process) */ -static struct semaphore event_exit;/* guard ensure thread has exited before calling it quits */ +static struct mutex event_semaphore;/* mutex for process loop (up if something to process) */ +static struct mutex event_exit;/* guard ensure thread has exited before calling it quits */ static int event_finished;static unsigned long pushbutton_pending;/* = 0 */
drivers/pci/hotplug/shpchp.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/pci/hotplug/shpchp.h +1 -1
@@ -79,7 +79,7 @@ struct event_info {struct controller {struct controller *next; -struct semaphore crit_sect;/* critical section semaphore */ +struct mutex crit_sect;/* critical section semaphore */ struct php_ctlr_state_s *hpc_ctlr_handle;/* HPC controller handle */ int num_slots;/* Number of slots on ctlr */ int slot_num_inc;/* 1 or -1 */
drivers/pcmcia/soc_common.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/pcmcia/soc_common.h +1 -1
@@ -133,7 +133,7 @@ extern void soc_common_pcmcia_get_timingextern struct list_head soc_pcmcia_sockets; -extern struct semaphore soc_pcmcia_sockets_lock; +extern struct mutex soc_pcmcia_sockets_lock;extern int soc_common_drv_pcmcia_probe (struct device *dev,struct pcmcia_low_level *ops,int first,int nr);extern int soc_common_drv_pcmcia_remove (struct device *dev);
drivers/pnp/interface.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/pnp/interface.c +1 -1
@@ -305,7 +305,7 @@ static ssize_t pnp_show_current_resourcereturn ret; } -extern struct semaphore pnp_res_mutex; +extern struct mutex pnp_res_mutex;static ssize_t pnp_set_current_resources (struct device * dmdev,struct device_attribute *attr,const char * ubuf,size_t count)
PATCH 11/19 MUTEX: Drivers Q-S changes
In reply to David HowellsThe attached patch modifies the files of the drivers/q* thru drivers/s* to use the new mutex functions.
---
warthog>diffstat -p1 mutex-drivers-QtoS-2615rc5.diff
drivers/s390/char/sclp_cpi.c | 16 ++++++++-------- drivers/s390/char/vmcp.h | 4 ++-- drivers/s390/cio/ccwgroup.c | 2 +- drivers/s390/cio/qdio.c | 2 +- drivers/s390/cio/qdio.h | 2 +- drivers/s390/net/ctctty.c | 2 +- drivers/s390/net/qeth_main.c | 2 +- drivers/s390/s390mach.c | 6 +++--- drivers/s390/scsi/zfcp_aux.c | 2 +- drivers/s390/scsi/zfcp_def.h | 4 ++-- drivers/s390/scsi/zfcp_erp.c | 12 ++++++------ drivers/sbus/char/vfc.h | 2 +- drivers/scsi/3w-9xxx.h | 2 +- drivers/scsi/3w-xxxx.h | 2 +- drivers/scsi/aacraid/aachba.c | 2 +- drivers/scsi/aacraid/aacraid.h | 4 ++-- drivers/scsi/aacraid/commctrl.c | 2 +- drivers/scsi/aacraid/comminit.c | 2 +- drivers/scsi/aacraid/commsup.c | 2 +- drivers/scsi/aacraid/dpcsup.c | 2 +- drivers/scsi/aacraid/linit.c | 2 +- drivers/scsi/aacraid/rkt.c | 2 +- drivers/scsi/aacraid/rx.c | 2 +- drivers/scsi/aacraid/sa.c | 2 +- drivers/scsi/aha152x.c | 8 ++++---- drivers/scsi/aic7xxx/aic79xx_osm.h | 2 +- drivers/scsi/aic7xxx/aic7xxx_osm.h | 2 +- drivers/scsi/ch.c | 2 +- drivers/scsi/dpt/dpti_i2o.h | 2 +- drivers/scsi/iscsi_tcp.h | 2 +- drivers/scsi/libata-core.c | 2 +- drivers/scsi/megaraid.h | 2 +- drivers/scsi/megaraid/mega_common.h | 2 +- drivers/scsi/megaraid/megaraid_ioctl.h | 2 +- drivers/scsi/megaraid/megaraid_mbox.c | 2 +- drivers/scsi/megaraid/megaraid_mbox.h | 2 +- drivers/scsi/megaraid/megaraid_mm.c | 6 +++--- drivers/scsi/megaraid/megaraid_sas.c | 6 +++--- drivers/scsi/megaraid/megaraid_sas.h | 2 +- drivers/scsi/osst.h | 2 +- drivers/scsi/qla2xxx/qla_def.h | 8 ++++---- drivers/scsi/qla2xxx/qla_gbl.h | 2 +- drivers/scsi/qla2xxx/qla_mbx.c | 2 +- drivers/scsi/qla2xxx/qla_os.c | 2 +- drivers/scsi/scsi_scan.c | 2 +- drivers/scsi/scsi_transport_spi.c | 2 +- drivers/scsi/st.h | 2 +- drivers/serial/crisv10.c | 2 +- drivers/serial/mcfserial.c | 2 +- drivers/serial/pmac_zilog.c | 2 +- 50 files changed, 77 insertions(+), 77 deletions(-)
drivers/s390/char/sclp_cpi.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/s390/char/sclp_cpi.c +8 -8
@@ -16,7 +16,7 @@#include <linux/err.h> #include <linux/slab.h> #include <asm/ebcdic.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include "sclp.h" #include "sclp_rw.h"
@@ -115,10 +115,10 @@ cpi_check_parms(void)static void cpi_callback (struct sclp_req *req,void *data) { -struct semaphore *sem; +struct completion *cpl; - sem = (struct semaphore *) data; -up (sem); + cpl = data; +complete (cpl); } static struct sclp_req *
@@ -185,7 +185,7 @@ cpi_free_req(struct sclp_req *req)static int __init cpi_module_init (void ) { -struct semaphore sem; +struct completion cpl;struct sclp_req *req;int rc;
@@ -215,8 +215,8 @@ cpi_module_init(void) }/* Prepare semaphore */ -sema_init (&sem,0 ); - req->callback_data = &sem; +init_completion (&cpl); + req->callback_data = &cpl;/* Add request to sclp queue */ rc =sclp_add_request (req);if (rc) {
@@ -226,7 +226,7 @@ cpi_module_init(void)return rc; }/* make "insmod" sleep until callback arrives */ -down (&sem); +wait_for_completion (&cpl); rc = ((struct cpi_sccb *) req->sccb)->header.response_code;if (rc !=0x0020 ) {
drivers/s390/char/vmcp.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/s390/char/vmcp.h +2 -2
@@ -12,7 +12,7 @@* The idea of this driver is based on cpint from Neale Ferguson */ -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <linux/ioctl.h> #define VMCP_GETCODE _IOR(0x10, 1, int)
@@ -26,5 +26,5 @@ struct vmcp_session {int resp_code;/* As we use copy_from/to_user, which might * * sleep and cannot use a spinlock */ -struct semaphore mutex; +struct mutex mutex; };
drivers/s390/cio/ccwgroup.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/s390/cio/ccwgroup.c +1 -1
@@ -17,7 +17,7 @@#include <linux/ctype.h> #include <linux/dcache.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <asm/ccwdev.h> #include <asm/ccwgroup.h>
drivers/s390/cio/qdio.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/s390/cio/qdio.c +1 -1
@@ -42,7 +42,7 @@#include <asm/ccwdev.h> #include <asm/io.h> #include <asm/atomic.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <asm/timex.h> #include <asm/debug.h>
drivers/s390/cio/qdio.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/s390/cio/qdio.h +1 -1
@@ -645,6 +645,6 @@ struct qdio_irq {struct qdr *qdr;struct qdio_q *input_qs[QDIO_MAX_QUEUES_PER_IRQ ];struct qdio_q *output_qs[QDIO_MAX_QUEUES_PER_IRQ ]; - struct semaphore setting_up_sema; + struct mutex setting_up_sema; };#endif
drivers/s390/net/ctctty.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/s390/net/ctctty.c +1 -1
@@ -65,7 +65,7 @@ typedef struct {struct tty_struct *tty;/* Pointer to corresponding tty */ wait_queue_head_t open_wait;wait_queue_head_t close_wait; -struct semaphore write_sem; +struct mutex write_sem;struct tasklet_struct tasklet;struct timer_list stoptimer; } ctc_tty_info;
drivers/s390/net/qeth_main.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/s390/net/qeth_main.c +1 -1
@@ -63,7 +63,7 @@#include <asm/io.h> #include <asm/qeth.h> #include <asm/timex.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <asm/uaccess.h> #include "qeth.h"
drivers/s390/s390mach.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/s390/s390mach.c +3 -3
@@ -21,7 +21,7 @@#define DBG printk// #define DBG(args,...) do {} while (0); -static struct semaphore m_sem; +static struct mutex m_sem;extern int css_process_crw (int );extern int chsc_process_crw (void );
@@ -51,9 +51,9 @@ s390_collect_crw_info(void *param) {struct crw crw;int ccode, ret, slow; -struct semaphore *sem; +struct mutex *sem; - sem = (struct semaphore *)param; + sem = param;/* Set a nice name. */ daemonize ("kmcheck" ); repeat:
drivers/s390/scsi/zfcp_aux.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/s390/scsi/zfcp_aux.c +1 -1
@@ -233,7 +233,7 @@ zfcp_module_init(void) ZFCP_CFDC_DEV_MAJOR, zfcp_cfdc_misc.minor);/* Initialise proc semaphores */ -sema_init (&zfcp_data.config_sema,1 ); +init_MUTEX (&zfcp_data.config_sema,1 );/* initialise configuration rw lock */ rwlock_init (&zfcp_data.config_lock);
drivers/s390/scsi/zfcp_def.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/s390/scsi/zfcp_def.h +2 -2
@@ -1065,13 +1065,13 @@ struct zfcp_data {rwlock_t status_read_lock;/* for status read thread */ struct list_head status_read_receive_head;struct list_head status_read_send_head; -struct semaphore status_read_sema; +struct mutex status_read_sema;wait_queue_head_t status_read_thread_wqh;u32 adapters;/* # of adapters in list */ rwlock_t config_lock;/* serialises changes to adapter/port/unit lists */ -struct semaphore config_sema;/* serialises configuration +struct mutex config_sema;/* serialises configuration changes */ atomic_t loglevel;/* current loglevel */ char init_busid[BUS_ID_SIZE ];
drivers/s390/scsi/zfcp_erp.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/s390/scsi/zfcp_erp.c +6 -6
@@ -830,7 +830,7 @@ zfcp_erp_action_ready(struct zfcp_erp_acdebug_event (adapter->erp_dbf,4 , &erp_action->action,sizeof (int ));zfcp_erp_action_to_ready (erp_action); -up (&adapter->erp_ready_sem); +up_sem (&adapter->erp_ready_sem); }/*
@@ -1107,7 +1107,7 @@ zfcp_erp_thread_kill(struct zfcp_adapterint retval =0 ;atomic_set_mask (ZFCP_STATUS_ADAPTER_ERP_THREAD_KILL , &adapter->status); -up (&adapter->erp_ready_sem); +up_sem (&adapter->erp_ready_sem);wait_event (adapter->erp_thread_wqh, !atomic_test_mask(ZFCP_STATUS_ADAPTER_ERP_THREAD_UP,
@@ -1165,7 +1165,7 @@ zfcp_erp_thread(void *data)* no action in 'ready' queue to be processed and * thread is not to be killed */ -down_interruptible (&adapter->erp_ready_sem); +down_sem_interruptible (&adapter->erp_ready_sem);debug_text_event (adapter->erp_dbf,5 ,"a_th_woken" ); }
@@ -2318,7 +2318,7 @@ zfcp_erp_adapter_strategy_open_fsf_xconf* _must_ be the one belonging to the 'exchange config * data' request. */ -down (&adapter->erp_ready_sem); +down_sem (&adapter->erp_ready_sem);if (erp_action->status &ZFCP_STATUS_ERP_TIMEDOUT ) { ZFCP_LOG_INFO("error: exchange of configuration data " "for adapter %s timed out\n",
@@ -2374,7 +2374,7 @@ zfcp_erp_adapter_strategy_open_fsf_xport }debug_text_event (adapter->erp_dbf,6 ,"a_xport_ok" ); -down (&adapter->erp_ready_sem); +down_sem (&adapter->erp_ready_sem);if (erp_action->status &ZFCP_STATUS_ERP_TIMEDOUT ) { ZFCP_LOG_INFO("error: exchange of port data " "for adapter %s timed out\n",
@@ -3351,7 +3351,7 @@ zfcp_erp_action_enqueue(int action,/* finally put it into 'ready' queue and kick erp thread */ list_add (&erp_action->list, &adapter->erp_ready_head); -up (&adapter->erp_ready_sem); +up_sem (&adapter->erp_ready_sem); retval =0 ; out:return retval;
drivers/sbus/char/vfc.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/sbus/char/vfc.h +1 -1
@@ -128,7 +128,7 @@ struct vfc_dev {volatile struct vfc_regs *regs;struct vfc_regs *phys_regs;unsigned int control_reg; -struct semaphore device_lock_sem; +struct mutex device_lock_sem;int instance;int busy;unsigned long which_io;
drivers/scsi/3w-9xxx.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/scsi/3w-9xxx.h +1 -1
@@ -672,7 +672,7 @@ typedef struct TAG_TW_Device_Extension {u32 ioctl_msec;int chrdev_request_id;wait_queue_head_t ioctl_wqueue; -struct semaphore ioctl_sem; +struct mutex ioctl_sem;char aen_clobber;unsigned short working_srl;unsigned short working_branch;
drivers/scsi/3w-xxxx.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/scsi/3w-xxxx.h +1 -1
@@ -420,7 +420,7 @@ typedef struct TAG_TW_Device_Extension {u32 max_sector_count;u32 aen_count;struct Scsi_Host *host; -struct semaphore ioctl_sem; +struct mutex ioctl_sem;unsigned short aen_queue[TW_Q_LENGTH ];unsigned char aen_head;unsigned char aen_tail;
drivers/scsi/aacraid/aachba.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/scsi/aacraid/aachba.c +1 -1
@@ -32,7 +32,7 @@#include <linux/slab.h> #include <linux/completion.h> #include <linux/blkdev.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <asm/uaccess.h> #include <scsi/scsi.h>
drivers/scsi/aacraid/aacraid.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/scsi/aacraid/aacraid.h +2 -2
@@ -735,7 +735,7 @@ struct aac_fib_context {u32 unique;// unique value representing this context ulong jiffies;// used for cleanup - dmb changed to ulong struct list_head next;// used to link context's into a linked list -struct semaphore wait_sem;// this is used to wait for the next fib to arrive. +struct mutex wait_sem;// this is used to wait for the next fib to arrive. int wait;// Set to true when thread is in WaitForSingleObject unsigned long count;// total number of FIBs on FibList struct list_head fib_list;// this holds fibs and their attachd hw_fibs
@@ -804,7 +804,7 @@ struct fib {* This is the event the sendfib routine will wait on if the * caller did not pass one and this is synch io. */ -struct semaphore event_wait; +struct mutex event_wait;spinlock_t event_lock;u32 done;/* gets set to 1 when fib is complete */
drivers/scsi/aacraid/commctrl.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/scsi/aacraid/commctrl.c +1 -1
@@ -38,7 +38,7 @@#include <linux/completion.h> #include <linux/dma-mapping.h> #include <linux/blkdev.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <asm/uaccess.h> #include "aacraid.h"
drivers/scsi/aacraid/comminit.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/scsi/aacraid/comminit.c +1 -1
@@ -40,7 +40,7 @@#include <linux/completion.h> #include <linux/mm.h> #include <scsi/scsi_host.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include "aacraid.h"
drivers/scsi/aacraid/commsup.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/scsi/aacraid/commsup.c +1 -1
@@ -40,7 +40,7 @@#include <linux/blkdev.h> #include <scsi/scsi_host.h> #include <scsi/scsi_device.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <asm/delay.h> #include "aacraid.h"
drivers/scsi/aacraid/dpcsup.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/scsi/aacraid/dpcsup.c +1 -1
@@ -38,7 +38,7 @@#include <linux/slab.h> #include <linux/completion.h> #include <linux/blkdev.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include "aacraid.h"
drivers/scsi/aacraid/linit.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/scsi/aacraid/linit.c +1 -1
@@ -49,7 +49,7 @@#include <linux/ioctl32.h> #include <linux/delay.h> #include <linux/smp_lock.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <scsi/scsi.h> #include <scsi/scsi_cmnd.h>
drivers/scsi/aacraid/rkt.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/scsi/aacraid/rkt.c +1 -1
@@ -40,7 +40,7 @@#include <linux/completion.h> #include <linux/time.h> #include <linux/interrupt.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <scsi/scsi_host.h>
drivers/scsi/aacraid/rx.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/scsi/aacraid/rx.c +1 -1
@@ -40,7 +40,7 @@#include <linux/completion.h> #include <linux/time.h> #include <linux/interrupt.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <scsi/scsi_host.h>
drivers/scsi/aacraid/sa.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/scsi/aacraid/sa.c +1 -1
@@ -40,7 +40,7 @@#include <linux/completion.h> #include <linux/time.h> #include <linux/interrupt.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <scsi/scsi_host.h>
drivers/scsi/aha152x.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/scsi/aha152x.c +4 -4
@@ -253,7 +253,7 @@#include <linux/isapnp.h> #include <linux/spinlock.h> #include <linux/workqueue.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <scsi/scsicam.h> #include "scsi.h"
@@ -549,7 +549,7 @@ struct aha152x_hostdata {*/ struct aha152x_scdata {Scsi_Cmnd *next;/* next sc in queue */ -struct semaphore *sem;/* semaphore to block on */ +struct mutex *sem;/* semaphore to block on */ };
@@ -978,7 +978,7 @@ static int setup_expected_interrupts(str/* * Queue a command and setup interrupts for a free bus. */ -static int aha152x_internal_queue (Scsi_Cmnd *SCpnt,struct semaphore *sem,int phase,void (*done)(Scsi_Cmnd *)) +static int aha152x_internal_queue (Scsi_Cmnd *SCpnt,struct mutex *sem,int phase,void (*done)(Scsi_Cmnd *)) {struct Scsi_Host *shpnt = SCpnt->device->host;unsigned long flags;
@@ -1142,7 +1142,7 @@ static int aha152x_abort(Scsi_Cmnd *SCpnstatic void timer_expired (unsigned long p) {Scsi_Cmnd *SCp = (Scsi_Cmnd *)p; -struct semaphore *sem =SCSEM (SCp); +struct mutex *sem =SCSEM (SCp);struct Scsi_Host *shpnt = SCp->device->host;unsigned long flags;
drivers/scsi/aic7xxx/aic79xx_osm.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/scsi/aic7xxx/aic79xx_osm.h +1 -1
@@ -390,7 +390,7 @@ struct ahd_platform_data {spinlock_t spin_lock;u_int qfrozen;struct timer_list reset_timer; -struct semaphore eh_sem; +struct mutex eh_sem;struct Scsi_Host *host;/* pointer to scsi host */ #define AHD_LINUX_NOIRQ ((uint32_t)~0)uint32_t irq;/* IRQ for this adapter */
drivers/scsi/aic7xxx/aic7xxx_osm.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/scsi/aic7xxx/aic7xxx_osm.h +1 -1
@@ -394,7 +394,7 @@ struct ahc_platform_data {spinlock_t spin_lock;u_int qfrozen;struct timer_list reset_timer; -struct semaphore eh_sem; +struct mutex eh_sem;struct Scsi_Host *host;/* pointer to scsi host */ #define AHC_LINUX_NOIRQ ((uint32_t)~0)uint32_t irq;/* IRQ for this adapter */
drivers/scsi/ch.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/scsi/ch.c +1 -1
@@ -112,7 +112,7 @@ typedef struct {u_int counts[CH_TYPES ];u_int unit_attention;u_int voltags; -struct semaphore lock; +struct mutex lock; } scsi_changer;static LIST_HEAD (ch_devlist);
drivers/scsi/dpt/dpti_i2o.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/scsi/dpt/dpti_i2o.h +1 -1
@@ -21,7 +21,7 @@#include <linux/i2o-dev.h> -#include <asm/semaphore.h> /* Needed for MUTEX init macros */ +#include <linux/semaphore.h> /* Needed for MUTEX init macros */ #include <linux/version.h> #include <linux/config.h> #include <linux/notifier.h>
drivers/scsi/iscsi_tcp.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/scsi/iscsi_tcp.h +1 -1
@@ -157,7 +157,7 @@ struct iscsi_conn {struct kfifo *mgmtqueue;/* mgmt (control) xmit queue */ struct kfifo *xmitqueue;/* data-path cmd queue */ struct work_struct xmitwork;/* per-conn. xmit workqueue */ -struct semaphore xmitsema;/* serializes connection xmit, +struct mutex xmitsema;/* serializes connection xmit, * access to kfifos: * * xmitqueue, writequeue, * * immqueue, mgmtqueue */
drivers/scsi/libata-core.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/scsi/libata-core.c +1 -1
@@ -56,7 +56,7 @@#include <scsi/scsi_host.h> #include <linux/libata.h> #include <asm/io.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <asm/byteorder.h> #include "libata.h"
drivers/scsi/megaraid/mega_common.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/scsi/megaraid/mega_common.h +1 -1
@@ -27,7 +27,7 @@#include <linux/list.h> #include <linux/moduleparam.h> #include <linux/dma-mapping.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <scsi/scsi.h> #include <scsi/scsi_cmnd.h> #include <scsi/scsi_device.h>
drivers/scsi/megaraid/megaraid_ioctl.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/scsi/megaraid/megaraid_ioctl.h +1 -1
@@ -18,7 +18,7 @@#define _MEGARAID_IOCTL_H_#include <linux/types.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include "mbox_defs.h"
drivers/scsi/megaraid/megaraid_mbox.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/scsi/megaraid/megaraid_mbox.c +1 -1
@@ -3870,7 +3870,7 @@ megaraid_sysfs_alloc_resources(adapter_tmegaraid_sysfs_free_resources (adapter); } -sema_init (&raid_dev->sysfs_sem,1 ); +init_MUTEX (&raid_dev->sysfs_sem);init_waitqueue_head (&raid_dev->sysfs_wait_q);
drivers/scsi/megaraid/megaraid_mbox.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/scsi/megaraid/megaraid_mbox.h +1 -1
@@ -205,7 +205,7 @@ typedef struct {int hw_error;int fast_load;uint8_t channel_class; -struct semaphore sysfs_sem; +struct mutex sysfs_sem;uioc_t *sysfs_uioc;mbox64_t *sysfs_mbox64;caddr_t sysfs_buffer;
drivers/scsi/megaraid/megaraid_mm.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/scsi/megaraid/megaraid_mm.c +3 -3
@@ -571,14 +571,14 @@ mraid_mm_alloc_kioc(mraid_mmadp_t *adp)struct list_head * head;unsigned long flags; -down (&adp->kioc_semaphore); +down_sem (&adp->kioc_semaphore);spin_lock_irqsave (&adp->kioc_pool_lock, flags); head = &adp->kioc_pool;if (list_empty (head)) { -up (&adp->kioc_semaphore); +up_sem (&adp->kioc_semaphore);spin_unlock_irqrestore (&adp->kioc_pool_lock, flags);con_log (CL_ANN , ("megaraid cmm: kioc list empty!\n" ));
@@ -645,7 +645,7 @@ mraid_mm_dealloc_kioc(mraid_mmadp_t *adpspin_unlock_irqrestore (&adp->kioc_pool_lock, flags);/* increment the free kioc count */ -up (&adp->kioc_semaphore); +up_sem (&adp->kioc_semaphore);return ; }
drivers/scsi/megaraid/megaraid_sas.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/scsi/megaraid/megaraid_sas.c +3 -3
@@ -2100,7 +2100,7 @@ megasas_probe_one(struct pci_dev *pdev,spin_lock_init (&instance->cmd_pool_lock);spin_lock_init (&instance->instance_lock); -sema_init (&instance->aen_mutex,1 ); +init_MUTEX (&instance->aen_mutex);sema_init (&instance->ioctl_sem,MEGASAS_INT_CMDS );/*
@@ -2579,12 +2579,12 @@ static int megasas_mgmt_ioctl_fw(struct/* * We will allow only MEGASAS_INT_CMDS number of parallel ioctl cmds */ -if (down_interruptible (&instance->ioctl_sem)) { +if (down_sem_interruptible (&instance->ioctl_sem)) { error = -ERESTARTSYS ; goto out_kfree_ioc; } error =megasas_mgmt_fw_ioctl (instance, user_ioc, ioc); -up (&instance->ioctl_sem); +up_sem (&instance->ioctl_sem); out_kfree_ioc:kfree (ioc);
drivers/scsi/megaraid/megaraid_sas.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/scsi/megaraid/megaraid_sas.h +1 -1
@@ -1042,7 +1042,7 @@ struct megasas_instance {struct megasas_evt_detail *evt_detail;dma_addr_t evt_detail_h;struct megasas_cmd *aen_cmd; -struct semaphore aen_mutex; +struct mutex aen_mutex;struct semaphore ioctl_sem;struct Scsi_Host *host;
drivers/scsi/megaraid.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/scsi/megaraid.h +1 -1
@@ -889,7 +889,7 @@ typedef struct {scb_t int_scb;Scsi_Cmnd int_scmd; -struct semaphore int_mtx;/* To synchronize the internal +struct mutex int_mtx;/* To synchronize the internal commands */ struct completion int_waitq;/* wait queue for internal cmds */
drivers/scsi/osst.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/scsi/osst.h +1 -1
@@ -532,7 +532,7 @@ struct osst_tape {struct scsi_driver *driver;unsigned capacity;struct scsi_device *device; -struct semaphore lock;/* for serialization */ +struct mutex lock;/* for serialization */ struct completion wait;/* for SCSI commands */ struct osst_buffer * buffer;
drivers/scsi/qla2xxx/qla_def.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/scsi/qla2xxx/qla_def.h +4 -4
@@ -22,7 +22,7 @@#include <linux/completion.h> #include <linux/interrupt.h> #include <linux/workqueue.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <scsi/scsi.h> #include <scsi/scsi_host.h>
@@ -2370,7 +2370,7 @@ typedef struct scsi_qla_host {int dpc_should_die;struct completion dpc_inited;struct completion dpc_exited; -struct semaphore *dpc_wait; +struct mutex *dpc_wait;uint8_t dpc_active;/* DPC routine is active */ /* Timeout timers. */
@@ -2410,8 +2410,8 @@ typedef struct scsi_qla_host {spinlock_t mbx_reg_lock;/* Mbx Cmd Register Lock */ -struct semaphore mbx_cmd_sem;/* Serialialize mbx access */ -struct semaphore mbx_intr_sem;/* Used for completion notification */ +struct mutex mbx_cmd_sem;/* Serialialize mbx access */ +struct mutex mbx_intr_sem;/* Used for completion notification */ uint32_t mbx_flags;#define MBX_IN_PROGRESS BIT_0
drivers/scsi/qla2xxx/qla_gbl.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/scsi/qla2xxx/qla_gbl.h +1 -1
@@ -74,7 +74,7 @@ extern void qla2x00_mark_all_devices_losextern void qla2x00_blink_led (scsi_qla_host_t *); -extern int qla2x00_down_timeout (struct semaphore *,unsigned long ); +extern int qla2x00_down_timeout (struct mutex *,unsigned long );/* * Global Function Prototypes in qla_iocb.c source file.
drivers/scsi/qla2xxx/qla_mbx.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/scsi/qla2xxx/qla_mbx.c +1 -1
@@ -12,7 +12,7 @@static void qla2x00_mbx_sem_timeout (unsigned long data) { -struct semaphore *sem_ptr = (struct semaphore *)data; +struct mutex *sem_ptr = (struct mutex *)data; DEBUG11(printk("qla2x00_sem_timeout: entered.\n");)
drivers/scsi/qla2xxx/qla_os.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/scsi/qla2xxx/qla_os.c +1 -1
@@ -2468,7 +2468,7 @@ qla2x00_timer(scsi_qla_host_t *ha)/* XXX(hch): crude hack to emulate a down_timeout() */ int -qla2x00_down_timeout (struct semaphore *sema,unsigned long timeout) +qla2x00_down_timeout (struct mutex *sema,unsigned long timeout) {const unsigned int step =100 ;/* msecs */ unsigned int iterations =jiffies_to_msecs (timeout)/100 ;
drivers/scsi/scsi_scan.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/scsi/scsi_scan.c +1 -1
@@ -30,7 +30,7 @@#include <linux/moduleparam.h> #include <linux/init.h> #include <linux/blkdev.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <scsi/scsi.h> #include <scsi/scsi_device.h>
drivers/scsi/scsi_transport_spi.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/scsi/scsi_transport_spi.c +1 -1
@@ -23,7 +23,7 @@#include <linux/module.h> #include <linux/workqueue.h> #include <linux/blkdev.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <scsi/scsi.h> #include "scsi_priv.h" #include <scsi/scsi_device.h>
drivers/scsi/st.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/scsi/st.h +1 -1
@@ -87,7 +87,7 @@ struct st_partstat {struct scsi_tape {struct scsi_driver *driver;struct scsi_device *device; -struct semaphore lock;/* For serialization */ +struct mutex lock;/* For serialization */ struct completion wait;/* For SCSI commands */ struct st_buffer *buffer;
drivers/serial/crisv10.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/serial/crisv10.c +1 -1
@@ -1318,7 +1318,7 @@ static unsigned char *tmp_buf;#ifdef DECLARE_MUTEX static DECLARE_MUTEX (tmp_buf_sem);#else -static struct semaphore tmp_buf_sem =MUTEX ; +static struct mutex tmp_buf_sem =MUTEX ;#endif /* Calculate the chartime depending on baudrate, numbor of bits etc. */
drivers/serial/mcfserial.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/serial/mcfserial.c +1 -1
@@ -40,7 +40,7 @@#include <asm/io.h> #include <asm/irq.h> #include <asm/system.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <asm/delay.h> #include <asm/coldfire.h> #include <asm/mcfsim.h>
drivers/serial/pmac_zilog.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/serial/pmac_zilog.c +1 -1
@@ -68,7 +68,7 @@#include <asm/pmac_feature.h> #include <asm/dbdma.h> #include <asm/macio.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #if defined (CONFIG_SERIAL_PMACZILOG_CONSOLE ) && defined(CONFIG_MAGIC_SYSRQ )#define SUPPORT_SYSRQ
PATCH 12/19 MUTEX: Drivers T-Z changes
In reply to David HowellsThe attached patch modifies the files of the drivers/t* thru drivers/z* to use the new mutex functions.
---
warthog>diffstat -p1 mutex-drivers-TtoZ-2615rc5.diff
drivers/usb/atm/cxacru.c | 2 +- drivers/usb/atm/usbatm.h | 4 ++-- drivers/usb/class/usb-midi.c | 2 +- drivers/usb/class/usblp.c | 2 +- drivers/usb/core/hcd.h | 2 +- drivers/usb/core/hub.c | 2 +- drivers/usb/gadget/inode.c | 2 +- drivers/usb/gadget/serial.c | 8 ++++---- drivers/usb/image/mdc800.c | 2 +- drivers/usb/image/microtek.h | 2 +- drivers/usb/media/dabusb.h | 2 +- drivers/usb/media/ov511.c | 2 +- drivers/usb/media/ov511.h | 10 +++++----- drivers/usb/media/pwc/pwc.h | 4 ++-- drivers/usb/media/se401.h | 2 +- drivers/usb/media/sn9c102.h | 4 ++-- drivers/usb/media/stv680.h | 2 +- drivers/usb/media/usbvideo.h | 4 ++-- drivers/usb/media/vicam.c | 2 +- drivers/usb/media/w9968cf.h | 4 ++-- drivers/usb/misc/auerswald.c | 6 +++--- drivers/usb/misc/idmouse.c | 2 +- drivers/usb/misc/ldusb.c | 2 +- drivers/usb/misc/legousbtower.c | 2 +- drivers/usb/misc/rio500.c | 2 +- drivers/usb/misc/sisusbvga/sisusb.h | 2 +- drivers/usb/misc/sisusbvga/sisusb_con.c | 2 +- drivers/usb/misc/usbtest.c | 2 +- drivers/usb/mon/mon_text.c | 2 +- drivers/usb/mon/usb_mon.h | 2 +- drivers/usb/net/kaweth.c | 2 +- drivers/usb/serial/io_ti.c | 6 +++--- drivers/usb/serial/ti_usb_3410_5052.c | 6 +++--- drivers/usb/storage/usb.h | 4 ++-- drivers/video/pxafb.h | 2 +- drivers/video/sa1100fb.h | 2 +- drivers/w1/w1.h | 4 ++-- 37 files changed, 57 insertions(+), 57 deletions(-)
drivers/usb/atm/cxacru.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/usb/atm/cxacru.c +1 -1
@@ -160,7 +160,7 @@ struct cxacru_data {struct work_struct poll_work;/* contol handles */ -struct semaphore cm_serialize; +struct mutex cm_serialize;u8 *rcv_buf;u8 *snd_buf;struct urb *rcv_urb;
drivers/usb/atm/usbatm.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/usb/atm/usbatm.h +2 -2
@@ -30,7 +30,7 @@#define VERBOSE_DEBUG */ -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <linux/atm.h> #include <linux/atmdev.h> #include <linux/completion.h>
@@ -157,7 +157,7 @@ struct usbatm_data {********************************/ struct kref refcount; -struct semaphore serialize; +struct mutex serialize;/* heavy init */ int thread_pid;
drivers/usb/class/usblp.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/usb/class/usblp.c +1 -1
@@ -128,7 +128,7 @@ MFG:HEWLETT-PACKARD;MDL:DESKJET 970C;CMDstruct usblp {struct usb_device *dev;/* USB device */ -struct semaphore sem;/* locks this struct, especially "dev" */ +struct mutex sem;/* locks this struct, especially "dev" */ char *writebuf;/* write transfer_buffer */ char *readbuf;/* read transfer_buffer */ char *statusbuf;/* status transfer_buffer */
drivers/usb/class/usb-midi.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/usb/class/usb-midi.c +1 -1
@@ -37,7 +37,7 @@#include <linux/poll.h> #include <linux/sound.h> #include <linux/init.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include "usb-midi.h"
drivers/usb/core/hcd.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/usb/core/hcd.h +1 -1
@@ -364,7 +364,7 @@ extern void usb_set_device_state(struct/* exported only within usbcore */ extern struct list_head usb_bus_list; -extern struct semaphore usb_bus_list_lock; +extern struct mutex usb_bus_list_lock;extern wait_queue_head_t usb_kill_urb_queue;extern struct usb_bus *usb_bus_get (struct usb_bus *bus);
drivers/usb/core/hub.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/usb/core/hub.c +1 -1
@@ -23,7 +23,7 @@#include <linux/usbdevice_fs.h> #include <linux/kthread.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <asm/uaccess.h> #include <asm/byteorder.h>
drivers/usb/gadget/inode.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/usb/gadget/inode.c +1 -1
@@ -193,7 +193,7 @@ enum ep_state { };struct ep_data { -struct semaphore lock; +struct mutex lock;enum ep_state state;atomic_t count;struct dev_data *dev;
drivers/usb/gadget/serial.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/usb/gadget/serial.c +4 -4
@@ -333,7 +333,7 @@ static const char *EP_IN_NAME;static const char *EP_OUT_NAME ;static const char *EP_NOTIFY_NAME ; -static struct semaphore gs_open_close_sem[GS_NUM_PORTS ]; +static struct mutex gs_open_close_sem[GS_NUM_PORTS ];static unsigned int read_q_size =GS_DEFAULT_READ_Q_SIZE ;static unsigned int write_q_size =GS_DEFAULT_WRITE_Q_SIZE ;
@@ -674,7 +674,7 @@ static int __init gs_module_init(void)tty_set_operations (gs_tty_driver, &gs_tty_ops);for (i=0 ; i <GS_NUM_PORTS ; i++) -sema_init (&gs_open_close_sem[i],1 ); +init_MUTEX (&gs_open_close_sem[i]); retval =tty_register_driver (gs_tty_driver);if (retval) {
@@ -714,7 +714,7 @@ static int gs_open(struct tty_struct *ttstruct gs_port *port;struct gs_dev *dev;struct gs_buf *buf; -struct semaphore *sem; +struct mutex *sem;int ret; port_num = tty->index;
@@ -850,7 +850,7 @@ static void gs_close(struct tty_struct * {unsigned long flags;struct gs_port *port = tty->driver_data; -struct semaphore *sem; +struct mutex *sem;if (port ==NULL ) {printk (KERN_ERR "gs_close: NULL port pointer\n" );
drivers/usb/image/mdc800.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/usb/image/mdc800.c +1 -1
@@ -169,7 +169,7 @@ struct mdc800_dataint out_count;// Bytes in the buffer int open;// Camera device open ? -struct semaphore io_lock;// IO -lock +struct mutex io_lock;// IO -lock char in [8 ];// Command Input Buffer int in_count;
drivers/usb/image/microtek.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/usb/image/microtek.h +1 -1
@@ -39,7 +39,7 @@ struct mts_desc {u8 ep_image;struct Scsi_Host * host; -struct semaphore lock; +struct mutex lock;struct urb *urb;struct mts_transfer_context context;
drivers/usb/media/dabusb.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/usb/media/dabusb.h +1 -1
@@ -18,7 +18,7 @@ typedef enum { _stopped=0, _started } dr typedef struct { - struct semaphore mutex; + struct mutex mutex; struct usb_device *usbdev; wait_queue_head_t wait; wait_queue_head_t remove_ok;
drivers/usb/media/ov511.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/usb/media/ov511.c +1 -1
@@ -42,7 +42,7 @@#include <linux/slab.h> #include <linux/ctype.h> #include <linux/pagemap.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <asm/processor.h> #include <linux/mm.h> #include <linux/device.h>
drivers/usb/media/ov511.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/usb/media/ov511.h +5 -5
@@ -435,7 +435,7 @@ struct usb_ov511 {int led_policy;/* LED: off|on|auto; OV511+ only */ -struct semaphore lock;/* Serializes user-accessible operations */ +struct mutex lock;/* Serializes user-accessible operations */ int user;/* user count for exclusive use */ int streaming;/* Are we streaming Isochronous? */
@@ -473,11 +473,11 @@ struct usb_ov511 {int packet_size;/* Frame size per isoc desc */ int packet_numbering;/* Is ISO frame numbering enabled? */ -struct semaphore param_lock;/* params lock for this camera */ +struct mutex param_lock;/* params lock for this camera */ /* Framebuffer/sbuf management */ int buf_state; -struct semaphore buf_lock; +struct mutex buf_lock;struct ov51x_decomp_ops *decomp_ops;
@@ -494,12 +494,12 @@ struct usb_ov511 {int pal;/* Device is designed for PAL resolution */ /* I2C interface */ -struct semaphore i2c_lock;/* Protect I2C controller regs */ +struct mutex i2c_lock;/* Protect I2C controller regs */ unsigned char primary_i2c_slave;/* I2C write id of sensor */ /* Control transaction stuff */ unsigned char *cbuf;/* Buffer for payload */ -struct semaphore cbuf_lock; +struct mutex cbuf_lock; };/* Used to represent a list of values and their respective symbolic names */
drivers/usb/media/pwc/pwc.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/usb/media/pwc/pwc.h +2 -2
@@ -32,7 +32,7 @@#include <linux/videodev.h> #include <linux/wait.h> #include <linux/smp_lock.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <asm/errno.h> #include "pwc-uncompress.h"
@@ -204,7 +204,7 @@ struct pwc_deviceint image_read_pos;/* In case we read data in pieces, keep track of were we are in the imagebuffer */ int image_used[MAX_IMAGES ];/* For MCAPTURE and SYNC */ -struct semaphore modlock;/* to prevent races in video_open(), etc */ +struct mutex modlock;/* to prevent races in video_open(), etc */ spinlock_t ptrlock;/* for manipulating the buffer pointers */ /*** motorized pan/tilt feature */
drivers/usb/media/se401.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/usb/media/se401.h +1 -1
@@ -189,7 +189,7 @@ struct usb_se401 {int maxframesize;int cframesize;/* current framesize */ -struct semaphore lock; +struct mutex lock;int user;/* user count for exclusive use */ int removed;/* device disconnected */
drivers/usb/media/sn9c102.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/usb/media/sn9c102.h +2 -2
@@ -32,7 +32,7 @@#include <linux/types.h> #include <linux/param.h> #include <linux/rwsem.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include "sn9c102_sensor.h"
@@ -148,7 +148,7 @@ struct sn9c102_device {enum sn9c102_dev_state state;u8 users; -struct semaphore dev_sem, fileop_sem; +struct mutex dev_sem, fileop_sem;spinlock_t queue_lock;wait_queue_head_t open, wait_frame, wait_stream; };
drivers/usb/media/stv680.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/usb/media/stv680.h +1 -1
@@ -118,7 +118,7 @@ struct usb_stv {int origGain;int origMode;/* original camera mode */ -struct semaphore lock;/* to lock the structure */ +struct mutex lock;/* to lock the structure */ int user;/* user count for exclusive use */ int removed;/* device disconnected */ int streaming;/* Are we streaming video? */
drivers/usb/media/usbvideo.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/usb/media/usbvideo.h +2 -2
@@ -213,7 +213,7 @@ struct uvd {unsigned long flags;/* FLAGS_USBVIDEO_xxx */ unsigned long paletteBits;/* Which palettes we accept? */ unsigned short defaultPalette;/* What palette to use for read() */ -struct semaphore lock; +struct mutex lock;int user;/* user count for exclusive use */ videosize_t videosize;/* Current setting */
@@ -272,7 +272,7 @@ struct usbvideo {int num_cameras;/* As allocated */ struct usb_driver usbdrv;/* Interface to the USB stack */ char drvName[80 ];/* Driver name */ -struct semaphore lock;/* Mutex protecting camera structures */ +struct mutex lock;/* Mutex protecting camera structures */ struct usbvideo_cb cb;/* Table of callbacks (virtual methods) */ struct video_device vdt;/* Video device template */ struct uvd *cam;/* Array of camera structures */
drivers/usb/media/vicam.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/usb/media/vicam.c +1 -1
@@ -407,7 +407,7 @@ struct vicam_camera {struct usb_device *udev;// usb device /* guard against simultaneous accesses to the camera */ -struct semaphore cam_lock; +struct mutex cam_lock;int is_initialized;u8 open_count;
drivers/usb/media/w9968cf.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/usb/media/w9968cf.h +2 -2
@@ -32,7 +32,7 @@#include <linux/param.h> #include <linux/types.h> #include <linux/rwsem.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <media/ovcamchip.h>
@@ -278,7 +278,7 @@ struct w9968cf_device {struct i2c_client * sensor_client;/* Locks */ -struct semaphore dev_sem,/* for probe, disconnect,open and close */ +struct mutex dev_sem,/* for probe, disconnect,open and close */ fileop_sem;/* for read and ioctl */ spinlock_t urb_lock,/* for submit_urb() and unlink_urb() */ flist_lock;/* for requested frame list accesses */
drivers/usb/misc/auerswald.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/usb/misc/auerswald.c +3 -3
@@ -232,7 +232,7 @@ typedef struct auerscon/* USB device context */ typedef struct { - struct semaphore mutex; /* protection in user context */ + struct mutex mutex; /* protection in user context */ char name[20]; /* name of the /dev/usb entry */ unsigned int dtindex; /* index in the device table */ struct usb_device * usbdev; /* USB device handle */
@@ -253,12 +253,12 @@ typedef struct/* character device context */ typedef struct { - struct semaphore mutex; /* protection in user context */ + struct mutex mutex; /* protection in user context */ pauerswald_t auerdev; /* context pointer of assigned device */ auerbufctl_t bufctl; /* controls the buffer chain */ auerscon_t scontext; /* service context */ wait_queue_head_t readwait; /* for synchronous reading */ - struct semaphore readmutex; /* protection against multiple reads */ + struct mutex readmutex; /* protection against multiple reads */ pauerbuf_t readbuf; /* buffer held for partial reading */ unsigned int readoffset; /* current offset in readbuf */ unsigned int removed; /* is != 0 if device is removed */
drivers/usb/misc/idmouse.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/usb/misc/idmouse.c +1 -1
@@ -81,7 +81,7 @@ struct usb_idmouse {int open;/* if the port is open or not */ int present;/* if the device is not disconnected */ -struct semaphore sem;/* locks this structure */ +struct mutex sem;/* locks this structure */ };
drivers/usb/misc/ldusb.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/usb/misc/ldusb.c +1 -1
@@ -136,7 +136,7 @@ MODULE_PARM_DESC(min_interrupt_out_inter/* Structure to hold all of our device specific stuff */ struct ld_usb { -struct semaphore sem;/* locks this structure */ +struct mutex sem;/* locks this structure */ struct usb_interface * intf;/* save off the usb interface pointer */ int open_count;/* number of times this port has been opened */
drivers/usb/misc/legousbtower.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/usb/misc/legousbtower.c +1 -1
@@ -205,7 +205,7 @@ MODULE_DEVICE_TABLE (usb, tower_table);/* Structure to hold all of our device specific stuff */ struct lego_usb_tower { -struct semaphore sem;/* locks this structure */ +struct mutex sem;/* locks this structure */ struct usb_device * udev;/* save off the usb device pointer */ unsigned char minor;/* the starting minor number for this device */
drivers/usb/misc/rio500.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/usb/misc/rio500.c +1 -1
@@ -69,7 +69,7 @@ struct rio_usb_data {char *obuf, *ibuf;/* transfer buffers */ char bulk_in_ep, bulk_out_ep;/* Endpoint assignments */ wait_queue_head_t wait_q;/* for timeouts */ -struct semaphore lock;/* general race avoidance */ +struct mutex lock;/* general race avoidance */ };static struct rio_usb_data rio_instance;
drivers/usb/misc/sisusbvga/sisusb_con.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/usb/misc/sisusbvga/sisusb_con.c +1 -1
@@ -102,7 +102,7 @@ static struct sisusb_usb_data *mysisusbs/* Forward declaration */ static const struct consw sisusb_con; -extern struct semaphore disconnect_sem; +extern struct mutex disconnect_sem;static inline void sisusbcon_memsetw (u16 *s,u16 c,unsigned int count)
drivers/usb/misc/sisusbvga/sisusb.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/usb/misc/sisusbvga/sisusb.h +1 -1
@@ -124,7 +124,7 @@ struct sisusb_usb_data {struct usb_interface *interface;struct kref kref;wait_queue_head_t wait_q;/* for syncind and timeouts */ -struct semaphore lock;/* general race avoidance */ +struct mutex lock;/* general race avoidance */ unsigned int ifnum;/* interface number of the USB device */ int minor;/* minor (for logging clarity) */ int isopen;/* !=0 if open */
drivers/usb/misc/usbtest.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/usb/misc/usbtest.c +1 -1
@@ -65,7 +65,7 @@ struct usbtest_dev {int in_iso_pipe;int out_iso_pipe;struct usb_endpoint_descriptor *iso_in, *iso_out; -struct semaphore sem; +struct mutex sem;#define TBUF_SIZE 256u8 *buf;
drivers/usb/mon/mon_text.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/usb/mon/mon_text.c +1 -1
@@ -54,7 +54,7 @@ struct mon_reader_text {wait_queue_head_t wait;int printf_size;char *printf_buf; -struct semaphore printf_lock; +struct mutex printf_lock;char slab_name[SLAB_NAME_SZ ]; };
drivers/usb/mon/usb_mon.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/usb/mon/usb_mon.h +1 -1
@@ -49,7 +49,7 @@ void mon_reader_del(struct mon_bus *mbus*/ extern char mon_dmapeek (unsigned char *dst,dma_addr_t dma_addr,int len); -extern struct semaphore mon_lock; +extern struct mutex mon_lock;extern struct file_operations mon_fops_text;extern struct file_operations mon_fops_stat;
drivers/usb/net/kaweth.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/usb/net/kaweth.c +1 -1
@@ -60,7 +60,7 @@#include <linux/dma-mapping.h> #include <linux/wait.h> #include <asm/uaccess.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <asm/byteorder.h> #undef DEBUG
drivers/usb/serial/io_ti.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/usb/serial/io_ti.c +3 -3
@@ -38,7 +38,7 @@#include <linux/serial.h> #include <linux/ioctl.h> #include <asm/uaccess.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <linux/usb.h> #include "usb-serial.h"
@@ -134,7 +134,7 @@ struct edgeport_serial {struct product_info product_info;u8 TI_I2C_Type;// Type of I2C in UMP u8 TiReadI2C;// Set to TRUE if we have read the I2c in Boot Mode -struct semaphore es_sem; +struct mutex es_sem;int num_ports_open;struct usb_serial *serial; };
@@ -2739,7 +2739,7 @@ static int edge_startup (struct usb_serireturn -ENOMEM ; }memset (edge_serial,0 ,sizeof (struct edgeport_serial )); -sema_init (&edge_serial->es_sem,1 ); +init_MUTEX (&edge_serial->es_sem); edge_serial->serial = serial;usb_set_serial_data (serial, edge_serial);
drivers/usb/serial/ti_usb_3410_5052.c renamed from warthog/kernels/linux-2.6.15-rc5/drivers/usb/serial/ti_usb_3410_5052.c +3 -3
@@ -82,7 +82,7 @@#include <linux/serial.h> #include <linux/circ_buf.h> #include <asm/uaccess.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <linux/usb.h> #include "usb-serial.h"
@@ -140,7 +140,7 @@ struct ti_port { };struct ti_device { -struct semaphore td_open_close_sem; +struct mutex td_open_close_sem;int td_open_port_count;struct usb_serial *td_serial;int td_is_3410;
@@ -425,7 +425,7 @@ static int ti_startup(struct usb_serialreturn -ENOMEM ; }memset (tdev,0 ,sizeof (struct ti_device )); -sema_init (&tdev->td_open_close_sem,1 ); +init_MUTEX (&tdev->td_open_close_sem); tdev->td_serial = serial;usb_set_serial_data (serial, tdev);
drivers/usb/storage/usb.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/usb/storage/usb.h +2 -2
@@ -130,7 +130,7 @@ struct us_data {* It's important to note: * (o) you must hold dev_semaphore to change pusb_dev */ -struct semaphore dev_semaphore;/* protect pusb_dev */ +struct mutex dev_semaphore;/* protect pusb_dev */ struct usb_device *pusb_dev;/* this usb_device */ struct usb_interface *pusb_intf;/* this interface */ struct us_unusual_dev *unusual_dev;/* device-filter entry */
@@ -171,7 +171,7 @@ struct us_data {dma_addr_t iobuf_dma;/* mutual exclusion and synchronization structures */ -struct semaphore sema;/* to sleep thread on */ +struct mutex sema;/* to sleep thread on */ struct completion notify;/* thread begin/end */ wait_queue_head_t delay_wait;/* wait during scan, reset */
drivers/video/pxafb.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/video/pxafb.h +1 -1
@@ -87,7 +87,7 @@ struct pxafb_info {volatile u_char state;volatile u_char task_state; -struct semaphore ctrlr_sem; +struct mutex ctrlr_sem;wait_queue_head_t ctrlr_wait;struct work_struct task;
drivers/video/sa1100fb.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/video/sa1100fb.h +1 -1
@@ -100,7 +100,7 @@ struct sa1100fb_info {volatile u_char state;volatile u_char task_state; -struct semaphore ctrlr_sem; +struct mutex ctrlr_sem;wait_queue_head_t ctrlr_wait;struct work_struct task;
drivers/w1/w1.h renamed from warthog/kernels/linux-2.6.15-rc5/drivers/w1/w1.h +2 -2
@@ -44,7 +44,7 @@ struct w1_reg_num#include <net/sock.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include "w1_family.h"
@@ -173,7 +173,7 @@ struct w1_masterlong flags;pid_t kpid; -struct semaphore mutex; +struct mutex mutex;struct device_driver *driver;struct device dev;
PATCH 13/19 MUTEX: Filesystem changes
In reply to David HowellsThe attached patch modifies the filesystem files to use the new mutex functions.
---
warthog>diffstat -p1 mutex-fs-2615rc5.diff
fs/9p/trans_fd.c | 4 ++-- fs/9p/trans_sock.c | 8 ++++---- fs/9p/transport.h | 4 ++-- fs/9p/v9fs.h | 2 +- fs/affs/affs.h | 6 +++--- fs/autofs4/autofs_i.h | 2 +- fs/block_dev.c | 4 ++-- fs/cifs/cifsglob.h | 8 ++++---- fs/cramfs/inode.c | 2 +- fs/dquot.c | 2 +- fs/eventpoll.c | 4 ++-- fs/fuse/dev.c | 10 +++++----- fs/fuse/fuse_i.h | 2 +- fs/hfs/btree.h | 2 +- fs/hfs/hfs_fs.h | 4 ++-- fs/hfsplus/hfsplus_fs.h | 4 ++-- fs/hpfs/hpfs_fn.h | 6 +++--- fs/inode.c | 4 ++-- fs/inotify.c | 4 ++-- fs/isofs/compress.c | 2 +- fs/jffs/inode-v23.c | 2 +- fs/jffs/intrep.c | 2 +- fs/jffs/jffs_fm.h | 2 +- fs/jfs/jfs_dmap.h | 2 +- fs/jfs/jfs_imap.h | 4 ++-- fs/jfs/jfs_incore.h | 2 +- fs/jfs/jfs_logmgr.h | 2 +- fs/libfs.c | 2 +- fs/lockd/svc.c | 7 ++++--- fs/locks.c | 2 +- fs/nfs/idmap.c | 4 ++-- fs/ntfs/inode.h | 6 +++--- fs/ntfs/ntfs.h | 2 +- fs/partitions/devfs.c | 4 ++-- fs/reiserfs/journal.c | 8 ++++---- fs/reiserfs/xattr.c | 2 +- fs/seq_file.c | 2 +- fs/super.c | 8 ++++---- fs/sysfs/file.c | 4 ++-- fs/xfs/linux-2.6/mutex.h | 8 ++++---- fs/xfs/linux-2.6/sema.h | 2 +- fs/xfs/linux-2.6/xfs_buf.h | 4 ++-- 42 files changed, 83 insertions(+), 82 deletions(-)
fs/9p/trans_fd.c renamed from warthog/kernels/linux-2.6.15-rc5/fs/9p/trans_fd.c +2 -2
@@ -106,8 +106,8 @@ v9fs_fd_init(struct v9fs_session_info *vreturn -ENOPROTOOPT ; } -sema_init (&trans->writelock,1 ); -sema_init (&trans->readlock,1 ); +init_MUTEX (&trans->writelock); +init_MUTEX (&trans->readlock); ts =kmalloc (sizeof (struct v9fs_trans_fd ),GFP_KERNEL );
fs/9p/transport.h renamed from warthog/kernels/linux-2.6.15-rc5/fs/9p/transport.h +2 -2
@@ -31,8 +31,8 @@ enum v9fs_transport_status {struct v9fs_transport {enum v9fs_transport_status status; -struct semaphore writelock; -struct semaphore readlock; +struct mutex writelock; +struct mutex readlock;void *priv;int (*init) (struct v9fs_session_info *,const char *,char *);
fs/9p/trans_sock.c renamed from warthog/kernels/linux-2.6.15-rc5/fs/9p/trans_sock.c +4 -4
@@ -154,8 +154,8 @@ v9fs_tcp_init(struct v9fs_session_info *struct v9fs_trans_sock *ts =NULL ;struct v9fs_transport *trans = v9ses->transport; -sema_init (&trans->writelock,1 ); -sema_init (&trans->readlock,1 ); +init_MUTEX (&trans->writelock); +init_MUTEX (&trans->readlock); ts =kmalloc (sizeof (struct v9fs_trans_sock ),GFP_KERNEL );
@@ -225,8 +225,8 @@ v9fs_unix_init(struct v9fs_session_info trans->priv = ts; ts->s =NULL ; -sema_init (&trans->writelock,1 ); -sema_init (&trans->readlock,1 ); +init_MUTEX (&trans->writelock); +init_MUTEX (&trans->readlock); sun_server.sun_family =PF_UNIX ;strcpy (sun_server.sun_path, dev_name);
fs/9p/v9fs.h renamed from warthog/kernels/linux-2.6.15-rc5/fs/9p/v9fs.h +1 -1
@@ -28,7 +28,7 @@*/ struct v9fs_idpool { -struct semaphore lock; +struct mutex lock;struct idr pool; };
fs/affs/affs.h renamed from warthog/kernels/linux-2.6.15-rc5/fs/affs/affs.h +3 -3
@@ -50,8 +50,8 @@ struct affs_ext_key {*/ struct affs_inode_info {u32 i_opencnt; -struct semaphore i_link_lock;/* Protects internal inode access. */ -struct semaphore i_ext_lock;/* Protects internal inode access. */ +struct mutex i_link_lock;/* Protects internal inode access. */ +struct mutex i_ext_lock;/* Protects internal inode access. */ #define i_hash_lock i_ext_locku32 i_blkcnt;/* block count */ u32 i_extcnt;/* extended block count */
@@ -99,7 +99,7 @@ struct affs_sb_info {gid_t s_gid;/* gid to override */ umode_t s_mode;/* mode to override */ struct buffer_head *s_root_bh;/* Cached root block. */ -struct semaphore s_bmlock;/* Protects bitmap access. */ +struct mutex s_bmlock;/* Protects bitmap access. */ struct affs_bm_info *s_bitmap;/* Bitmap infos. */ u32 s_bmap_count;/* # of bitmap blocks. */ u32 s_bmap_bits;/* # of bits in one bitmap blocks */
fs/autofs4/autofs_i.h renamed from warthog/kernels/linux-2.6.15-rc5/fs/autofs4/autofs_i.h +1 -1
@@ -102,7 +102,7 @@ struct autofs_sb_info {int reghost_enabled;int needs_reghost;struct super_block *sb; -struct semaphore wq_sem; +struct mutex wq_sem;spinlock_t fs_lock;struct autofs_wait_queue *queues;/* Wait queue pointer */ };
fs/block_dev.c renamed from warthog/kernels/linux-2.6.15-rc5/fs/block_dev.c +2 -2
@@ -265,8 +265,8 @@ static void init_once(void * foo, kmem_c SLAB_CTOR_CONSTRUCTOR) {memset (bdev,0 ,sizeof (*bdev)); -sema_init (&bdev->bd_sem,1 ); -sema_init (&bdev->bd_mount_sem,1 ); +init_MUTEX (&bdev->bd_sem); +init_MUTEX (&bdev->bd_mount_sem);INIT_LIST_HEAD (&bdev->bd_inodes);INIT_LIST_HEAD (&bdev->bd_list);inode_init_once (&ei->vfs_inode);
fs/cifs/cifsglob.h renamed from warthog/kernels/linux-2.6.15-rc5/fs/cifs/cifsglob.h +4 -4
@@ -135,7 +135,7 @@ struct TCP_Server_Info {atomic_t num_waiters;/* blocked waiting to get in sendrecv */ #endif enum statusEnum tcpStatus;/* what we think the status is */ -struct semaphore tcpSem; +struct mutex tcpSem;struct task_struct *tsk;char server_GUID[16 ];char secMode;
@@ -178,7 +178,7 @@ struct cifsUidInfo {*/ struct cifsSesInfo {struct list_head cifsSessionList; -struct semaphore sesSem; +struct mutex sesSem;struct cifsUidInfo *uidInfo;/* pointer to user info */ struct TCP_Server_Info *server;/* pointer to server info */ atomic_t inUse;/* # of mounts (tree connections) on this ses */
@@ -207,7 +207,7 @@ struct cifsSesInfo {struct cifsTconInfo {struct list_head cifsConnectionList;struct list_head openFileList; -struct semaphore tconSem; +struct mutex tconSem;struct cifsSesInfo *ses;/* pointer to session associated with */ char treeName[MAX_TREE_SIZE +1 ];/* UNC name of resource (in ASCII not UTF) */ char *nativeFileSystem;
@@ -300,7 +300,7 @@ struct cifsFileInfo { unsigned closePend:1; /* file is marked to close */ unsigned invalidHandle:1; /* file closed via session abend */atomic_t wrtPending;/* handle in use - defer close */ -struct semaphore fh_sem;/* prevents reopen race after dead ses*/ +struct mutex fh_sem;/* prevents reopen race after dead ses*/ char * search_resume_name;/* BB removeme BB */ unsigned int resume_name_length;/* BB removeme - field renamed and moved BB */ struct cifs_search_info srch_inf;
fs/cramfs/inode.c renamed from warthog/kernels/linux-2.6.15-rc5/fs/cramfs/inode.c +1 -1
@@ -22,7 +22,7 @@#include <linux/cramfs_fs_sb.h> #include <linux/buffer_head.h> #include <linux/vfs.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <asm/uaccess.h>
fs/dquot.c renamed from warthog/kernels/linux-2.6.15-rc5/fs/dquot.c +1 -1
@@ -575,7 +575,7 @@ static struct dquot *get_empty_dquot(strreturn NODQUOT ;memset ((caddr_t )dquot,0 ,sizeof (struct dquot )); -sema_init (&dquot->dq_lock,1 ); +init_MUTEX (&dquot->dq_lock);INIT_LIST_HEAD (&dquot->dq_free);INIT_LIST_HEAD (&dquot->dq_inuse);INIT_HLIST_NODE (&dquot->dq_hash);
fs/eventpoll.c renamed from warthog/kernels/linux-2.6.15-rc5/fs/eventpoll.c +2 -2
@@ -39,7 +39,7 @@#include <asm/io.h> #include <asm/mman.h> #include <asm/atomic.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> /*
@@ -274,7 +274,7 @@ static struct super_block *eventpollfs_g/* * This semaphore is used to serialize ep_free() and eventpoll_release_file(). */ -static struct semaphore epsem; +static struct mutex epsem;/* Safe wake up implementation */ static struct poll_safewake psw;
fs/fuse/dev.c renamed from warthog/kernels/linux-2.6.15-rc5/fs/fuse/dev.c +5 -5
@@ -110,7 +110,7 @@ struct fuse_req *fuse_get_request(structsigset_t oldset;block_sigs (&oldset); - intr =down_interruptible (&fc->outstanding_sem); + intr =down_sem_interruptible (&fc->outstanding_sem);restore_sigs (&oldset);return intr ?NULL :do_get_request (fc); }
@@ -127,7 +127,7 @@ static void fuse_putback_request(structif (fc->outstanding_debt) fc->outstanding_debt--;else -up (&fc->outstanding_sem); +up_sem (&fc->outstanding_sem);spin_unlock (&fuse_lock); }
@@ -180,10 +180,10 @@ static void request_end(struct fuse_conn/* After INIT reply is received other requests can go out. So do (FUSE_MAX_OUTSTANDING - 1) number of -up()s on outstanding_sem. The last up() is done in +up_sem()s on outstanding_sem. The last up() is done in fuse_putback_request() */ for (i =1 ; i <FUSE_MAX_OUTSTANDING ; i++) -up (&fc->outstanding_sem); +up_sem (&fc->outstanding_sem); }else if (req->in.h.opcode ==FUSE_RELEASE && req->inode ==NULL ) {/* Special case for failed iget in CREATE */ u64 nodeid = req->in.h.nodeid;
@@ -296,7 +296,7 @@ static void queue_request(struct fuse_coprocessing the RELEASE requests. However for efficiency do it without blocking, so if down() would block, just increase the debt instead */ -if (down_trylock (&fc->outstanding_sem)) +if (down_sem_trylock (&fc->outstanding_sem)) fc->outstanding_debt++; }list_add_tail (&req->list, &fc->pending);
fs/fuse/fuse_i.h renamed from warthog/kernels/linux-2.6.15-rc5/fs/fuse/fuse_i.h +1 -1
@@ -13,7 +13,7 @@#include <linux/spinlock.h> #include <linux/mm.h> #include <linux/backing-dev.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> /** Max number of pages that can be used in a single read request */ #define FUSE_MAX_PAGES_PER_REQ 32
fs/hfs/btree.h renamed from warthog/kernels/linux-2.6.15-rc5/fs/hfs/btree.h +1 -1
@@ -33,7 +33,7 @@ struct hfs_btree {unsigned int depth;//unsigned int map1_size, map_size; -struct semaphore tree_lock; +struct mutex tree_lock;unsigned int pages_per_bnode;spinlock_t hash_lock;
fs/hfs/hfs_fs.h renamed from warthog/kernels/linux-2.6.15-rc5/fs/hfs/hfs_fs.h +2 -2
@@ -56,7 +56,7 @@ struct hfs_inode_info {struct list_head open_dir_list;struct inode *rsrc_inode; -struct semaphore extents_lock; +struct mutex extents_lock;u16 alloc_blocks, clump_blocks;sector_t fs_blocks;
@@ -142,7 +142,7 @@ struct hfs_sb_info {struct nls_table *nls_io, *nls_disk; -struct semaphore bitmap_lock; +struct mutex bitmap_lock;unsigned long flags;
fs/hfsplus/hfsplus_fs.h renamed from warthog/kernels/linux-2.6.15-rc5/fs/hfsplus/hfsplus_fs.h +2 -2
@@ -61,7 +61,7 @@ struct hfs_btree {unsigned int depth;//unsigned int map1_size, map_size; -struct semaphore tree_lock; +struct mutex tree_lock;unsigned int pages_per_bnode;spinlock_t hash_lock;
@@ -155,7 +155,7 @@ struct hfsplus_sb_info {struct hfsplus_inode_info { -struct semaphore extents_lock; +struct mutex extents_lock;u32 clump_blocks, alloc_blocks;sector_t fs_blocks;/* Allocation extents from catalog record or volume header */
fs/hpfs/hpfs_fn.h renamed from warthog/kernels/linux-2.6.15-rc5/fs/hpfs/hpfs_fn.h +3 -3
@@ -57,8 +57,8 @@ struct hpfs_inode_info { unsigned i_ea_uid : 1; /* file's uid is stored in ea */ unsigned i_ea_gid : 1; /* file's gid is stored in ea */ unsigned i_dirty : 1; -struct semaphore i_sem; -struct semaphore i_parent; +struct mutex i_sem; +struct mutex i_parent;loff_t **i_rddir_off;struct inode vfs_inode; };
@@ -88,7 +88,7 @@ struct hpfs_sb_info {unsigned *sb_bmp_dir;/* main bitmap directory */ unsigned sb_c_bitmap;/* current bitmap */ unsigned sb_max_fwd_alloc;/* max forwad allocation */ -struct semaphore hpfs_creation_de;/* when creating dirents, nobody else +struct mutex hpfs_creation_de;/* when creating dirents, nobody else can alloc blocks */ /*unsigned sb_mounting : 1;*/ int sb_timeshift;
fs/inode.c renamed from warthog/kernels/linux-2.6.15-rc5/fs/inode.c +2 -2
@@ -192,7 +192,7 @@ void inode_init_once(struct inode *inodeINIT_HLIST_NODE (&inode->i_hash);INIT_LIST_HEAD (&inode->i_dentry);INIT_LIST_HEAD (&inode->i_devices); -sema_init (&inode->i_sem,1 ); +init_MUTEX (&inode->i_sem);init_rwsem (&inode->i_alloc_sem);INIT_RADIX_TREE (&inode->i_data.page_tree,GFP_ATOMIC );rwlock_init (&inode->i_data.tree_lock);
@@ -205,7 +205,7 @@ void inode_init_once(struct inode *inodei_size_ordered_init (inode);#ifdef CONFIG_INOTIFY INIT_LIST_HEAD (&inode->inotify_watches); -sema_init (&inode->inotify_sem,1 ); +init_MUTEX (&inode->inotify_sem);#endif }
fs/inotify.c renamed from warthog/kernels/linux-2.6.15-rc5/fs/inotify.c +2 -2
@@ -83,7 +83,7 @@ int inotify_max_queued_events;struct inotify_device {wait_queue_head_t wq;/* wait queue for i/o */ struct idr idr;/* idr mapping wd -> watch */ -struct semaphore sem;/* protects this bad boy */ +struct mutex sem;/* protects this bad boy */ struct list_head events;/* list of queued events */ struct list_head watches;/* list of watches */ atomic_t count;/* reference count */
@@ -903,7 +903,7 @@ asmlinkage long sys_inotify_init(void)INIT_LIST_HEAD (&dev->events);INIT_LIST_HEAD (&dev->watches);init_waitqueue_head (&dev->wq); -sema_init (&dev->sem,1 ); +init_MUTEX (&dev->sem); dev->event_count =0 ; dev->queue_size =0 ; dev->max_events = inotify_max_queued_events;
fs/isofs/compress.c renamed from warthog/kernels/linux-2.6.15-rc5/fs/isofs/compress.c +1 -1
@@ -34,7 +34,7 @@ static char zisofs_sink_page[PAGE_CACHE_* allocation; this avoids failures at block-decompression time. */ static void *zisofs_zlib_workspace; -static struct semaphore zisofs_zlib_semaphore; +static struct mutex zisofs_zlib_semaphore;/* * When decompressing, we typically obtain more than one page
fs/jffs/inode-v23.c renamed from warthog/kernels/linux-2.6.15-rc5/fs/jffs/inode-v23.c +1 -1
@@ -42,7 +42,7 @@#include <linux/quotaops.h> #include <linux/highmem.h> #include <linux/vfs.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <asm/byteorder.h> #include <asm/uaccess.h>
fs/jffs/intrep.c renamed from warthog/kernels/linux-2.6.15-rc5/fs/jffs/intrep.c +1 -1
@@ -62,7 +62,7 @@#include <linux/fs.h> #include <linux/stat.h> #include <linux/pagemap.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <asm/byteorder.h> #include <linux/smp_lock.h> #include <linux/time.h>
fs/jffs/jffs_fm.h renamed from warthog/kernels/linux-2.6.15-rc5/fs/jffs/jffs_fm.h +1 -1
@@ -97,7 +97,7 @@ struct jffs_fmcontrolstruct jffs_fm *tail;struct jffs_fm *head_extra;struct jffs_fm *tail_extra; -struct semaphore biglock; +struct mutex biglock; };/* Notice the two members head_extra and tail_extra in the jffs_control
fs/jfs/jfs_dmap.h renamed from warthog/kernels/linux-2.6.15-rc5/fs/jfs/jfs_dmap.h +1 -1
@@ -243,7 +243,7 @@ struct dbmap {struct bmap {struct dbmap db_bmap;/* on-disk aggregate map descriptor */ struct inode *db_ipbmap;/* ptr to aggregate map incore inode */ -struct semaphore db_bmaplock;/* aggregate map lock */ +struct mutex db_bmaplock;/* aggregate map lock */ atomic_t db_active[MAXAG ];/* count of active, open files in AG */ u32 *db_DBmap; };
fs/jfs/jfs_imap.h renamed from warthog/kernels/linux-2.6.15-rc5/fs/jfs/jfs_imap.h +2 -2
@@ -140,8 +140,8 @@ struct dinomap {struct inomap {struct dinomap im_imap;/* 4096: inode allocation control */ struct inode *im_ipimap;/* 4: ptr to inode for imap */ -struct semaphore im_freelock;/* 4: iag free list lock */ -struct semaphore im_aglock[MAXAG ];/* 512: per AG locks */ +struct mutex im_freelock;/* 4: iag free list lock */ +struct mutex im_aglock[MAXAG ];/* 512: per AG locks */ u32 *im_DBGdimap;atomic_t im_numinos;/* num of backed inodes */ atomic_t im_numfree;/* num of free backed inodes */
fs/jfs/jfs_incore.h renamed from warthog/kernels/linux-2.6.15-rc5/fs/jfs/jfs_incore.h +1 -1
@@ -67,7 +67,7 @@ struct jfs_inode_info {* dirty inodes may be committed while a new transaction on the * inode is blocked in txBegin or TxBeginAnon */ -struct semaphore commit_sem; +struct mutex commit_sem;/* xattr_sem allows us to access the xattrs without taking i_sem */ struct rw_semaphore xattr_sem;lid_t xtlid;/* lid of xtree lock on directory */
fs/jfs/jfs_logmgr.h renamed from warthog/kernels/linux-2.6.15-rc5/fs/jfs/jfs_logmgr.h +1 -1
@@ -389,7 +389,7 @@ struct jfs_log {int eor;/* 4: eor of last record in eol page */ struct lbuf *bp;/* 4: current log page buffer */ -struct semaphore loglock;/* 4: log write serialization lock */ +struct mutex loglock;/* 4: log write serialization lock */ /* syncpt */ int nextsync;/* 4: bytes to write before next syncpt */
fs/libfs.c renamed from warthog/kernels/linux-2.6.15-rc5/fs/libfs.c +1 -1
@@ -529,7 +529,7 @@ struct simple_attr {char set_buf[24 ];void *data;const char *fmt;/* format for read operation */ -struct semaphore sem;/* protects access to these buffers */ +struct mutex sem;/* protects access to these buffers */ };/* simple_attr_open is called by an actual attribute open file operation
fs/lockd/svc.c renamed from warthog/kernels/linux-2.6.15-rc5/fs/lockd/svc.c +4 -3
@@ -49,7 +49,7 @@ static pid_t nlmsvc_pid;int nlmsvc_grace_period;unsigned long nlmsvc_timeout; -static DECLARE_MUTEX_LOCKED (lockd_start); +static DECLARE_COMPLETION (lockd_start);static DECLARE_WAIT_QUEUE_HEAD (lockd_exit);/*
@@ -112,7 +112,7 @@ lockd(struct svc_rqst *rqstp)* Let our maker know we're running. */ nlmsvc_pid = current->pid; -up (&lockd_start); +complete (&lockd_start);daemonize ("lockd" );
@@ -257,13 +257,14 @@ lockd_up(void)/* * Create the kernel thread and wait for it to start. */ +init_completion (&lockd_start); error =svc_create_thread (lockd, serv);if (error) {printk (KERN_WARNING "lockd_up: create thread failed, error=%d\n" , error); goto destroy_and_out; } -down (&lockd_start); +wait_for_completion (&lockd_start);/* * Note: svc_serv structures have an initial use count of 1,
fs/locks.c renamed from warthog/kernels/linux-2.6.15-rc5/fs/locks.c +1 -1
@@ -125,8 +125,8 @@#include <linux/syscalls.h> #include <linux/time.h> #include <linux/rcupdate.h> +#include <linux/semaphore.h> -#include <asm/semaphore.h> #include <asm/uaccess.h> #define IS_POSIX (fl) (fl->fl_flags & FL_POSIX)
fs/nfs/idmap.c renamed from warthog/kernels/linux-2.6.15-rc5/fs/nfs/idmap.c +2 -2
@@ -70,8 +70,8 @@ struct idmap {struct dentry *idmap_dentry;wait_queue_head_t idmap_wq;struct idmap_msg idmap_im; -struct semaphore idmap_lock;/* Serializes upcalls */ -struct semaphore idmap_im_lock;/* Protects the hashtable */ +struct mutex idmap_lock;/* Serializes upcalls */ +struct mutex idmap_im_lock;/* Protects the hashtable */ struct idmap_hashtable idmap_user_hash;struct idmap_hashtable idmap_group_hash; };
fs/ntfs/inode.h renamed from warthog/kernels/linux-2.6.15-rc5/fs/ntfs/inode.h +3 -3
@@ -28,8 +28,8 @@#include <linux/fs.h> #include <linux/seq_file.h> #include <linux/list.h> +#include <linux/semaphore.h> #include <asm/atomic.h> -#include <asm/semaphore.h> #include "layout.h" #include "volume.h"
@@ -81,7 +81,7 @@ struct _ntfs_inode {* The following fields are only valid for real inodes and extent * inodes. */ -struct semaphore mrec_lock;/* Lock for serializing access to the +struct mutex mrec_lock;/* Lock for serializing access to the mft record belonging to this inode. */ struct page *page;/* The page containing the mft record of the inode. This should only be touched by the
@@ -119,7 +119,7 @@ struct _ntfs_inode {u8 block_clusters;/* Number of clusters per cb. */ } compressed; } itype; -struct semaphore extent_lock;/* Lock for accessing/modifying the +struct mutex extent_lock;/* Lock for accessing/modifying the below . */ s32 nr_extents;/* For a base mft record, the number of attached extent inodes (0 if none), for extent records and for fake
fs/ntfs/ntfs.h renamed from warthog/kernels/linux-2.6.15-rc5/fs/ntfs/ntfs.h +1 -1
@@ -91,7 +91,7 @@ extern void free_compression_buffers(voi/* From fs/ntfs/super.c */ #define default_upcase_len 0x10000 -extern struct semaphore ntfs_lock; +extern struct mutex ntfs_lock; typedef struct { int val;
fs/partitions/devfs.c renamed from warthog/kernels/linux-2.6.15-rc5/fs/partitions/devfs.c +2 -2
@@ -6,14 +6,14 @@#include <linux/vmalloc.h> #include <linux/genhd.h> #include <linux/bitops.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> struct unique_numspace {u32 num_free;/* Num free in bits */ u32 length;/* Array length in bytes */ unsigned long *bits; -struct semaphore mutex; +struct mutex mutex; };static DECLARE_MUTEX (numspace_mutex);
fs/reiserfs/journal.c renamed from warthog/kernels/linux-2.6.15-rc5/fs/reiserfs/journal.c +4 -4
@@ -39,7 +39,7 @@#include <asm/system.h> #include <linux/time.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <linux/vmalloc.h> #include <linux/reiserfs_fs.h>
@@ -2473,7 +2473,7 @@ static struct reiserfs_journal_list *allINIT_LIST_HEAD (&jl->j_working_list);INIT_LIST_HEAD (&jl->j_tail_bh_list);INIT_LIST_HEAD (&jl->j_bh_list); -sema_init (&jl->j_commit_lock,1 ); +init_MUTEX (&jl->j_commit_lock);SB_JOURNAL (s)->j_num_lists++;get_journal_list (jl);return jl;
@@ -2744,8 +2744,8 @@ int journal_init(struct super_block *p_s journal->j_last =NULL ; journal->j_first =NULL ;init_waitqueue_head (&(journal->j_join_wait)); -sema_init (&journal->j_lock,1 ); -sema_init (&journal->j_flush_sem,1 ); +init_MUTEX (&journal->j_lock); +init_MUTEX (&journal->j_flush_sem); journal->j_trans_id =10 ; journal->j_mount_id =10 ;
fs/reiserfs/xattr.c renamed from warthog/kernels/linux-2.6.15-rc5/fs/reiserfs/xattr.c +1 -1
@@ -43,7 +43,7 @@#include <asm/checksum.h> #include <linux/smp_lock.h> #include <linux/stat.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #define FL_READONLY 128#define FL_DIR_SEM_HELD 256
fs/seq_file.c renamed from warthog/kernels/linux-2.6.15-rc5/fs/seq_file.c +1 -1
@@ -37,7 +37,7 @@ int seq_open(struct file *file, struct s file->private_data = p; }memset (p,0 ,sizeof (*p)); -sema_init (&p->sem,1 ); +init_MUTEX (&p->sem); p->op = op;/*
fs/super.c renamed from warthog/kernels/linux-2.6.15-rc5/fs/super.c +4 -4
@@ -72,13 +72,13 @@ static struct super_block *alloc_super(vINIT_HLIST_HEAD (&s->s_anon);INIT_LIST_HEAD (&s->s_inodes);init_rwsem (&s->s_umount); -sema_init (&s->s_lock,1 ); +init_MUTEX (&s->s_lock);down_write (&s->s_umount); s->s_count =S_BIAS ;atomic_set (&s->s_active,1 ); -sema_init (&s->s_vfs_rename_sem,1 ); -sema_init (&s->s_dquot.dqio_sem,1 ); -sema_init (&s->s_dquot.dqonoff_sem,1 ); +init_MUTEX (&s->s_vfs_rename_sem); +init_MUTEX (&s->s_dquot.dqio_sem); +init_MUTEX (&s->s_dquot.dqonoff_sem);init_rwsem (&s->s_dquot.dqptr_sem);init_waitqueue_head (&s->s_wait_unfrozen); s->s_maxbytes =MAX_NON_LFS ;
fs/sysfs/file.c renamed from warthog/kernels/linux-2.6.15-rc5/fs/sysfs/file.c +2 -2
@@ -7,7 +7,7 @@#include <linux/kobject.h> #include <linux/namei.h> #include <asm/uaccess.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include "sysfs.h"
@@ -55,7 +55,7 @@ struct sysfs_buffer {loff_t pos;char * page;struct sysfs_ops * ops; -struct semaphore sem; +struct mutex sem;int needs_read_fill; };
fs/xfs/linux-2.6/mutex.h renamed from warthog/kernels/linux-2.6.15-rc5/fs/xfs/linux-2.6/mutex.h +4 -4
@@ -19,7 +19,7 @@#define __XFS_SUPPORT_MUTEX_H__#include <linux/spinlock.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> /* * Map the mutex'es from IRIX to Linux semaphores.
@@ -28,10 +28,10 @@* callers. */ #define MUTEX_DEFAULT 0x0 -typedef struct semaphore mutex_t ; +typedef struct mutex mutex_t ; -#define mutex_init (lock, type, name) sema_init(lock, 1) -#define mutex_destroy (lock) sema_init(lock, -99) +#define mutex_init (lock, type, name) init_MUTEX(lock) +#define mutex_destroy (lock) do {} while(0)#define mutex_lock (lock, num) down(lock)#define mutex_trylock (lock) (down_trylock(lock) ? 0 : 1)#define mutex_unlock (lock) up(lock)
fs/xfs/linux-2.6/sema.h renamed from warthog/kernels/linux-2.6.15-rc5/fs/xfs/linux-2.6/sema.h +1 -1
@@ -21,7 +21,7 @@#include <linux/time.h> #include <linux/wait.h> #include <asm/atomic.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> /* * sema_t structure just maps to struct semaphore in Linux kernel.
fs/xfs/linux-2.6/xfs_buf.h renamed from warthog/kernels/linux-2.6.15-rc5/fs/xfs/linux-2.6/xfs_buf.h +2 -2
@@ -114,7 +114,7 @@ typedef int (*page_buf_bdstrat_t)(struct#define PB_PAGES 2 typedef struct xfs_buf { - struct semaphore pb_sema; /* semaphore for lockables */ + struct mutex pb_sema; /* semaphore for lockables */ unsigned long pb_queuetime; /* time buffer was queued */ atomic_t pb_pin_count; /* pin count */ wait_queue_head_t pb_waiters; /* unpin waiters */
@@ -134,7 +134,7 @@ typedef struct xfs_buf {page_buf_iodone_t pb_iodone;/* I/O completion function */ page_buf_relse_t pb_relse;/* releasing function */ page_buf_bdstrat_t pb_strat;/* pre-write function */ -struct semaphore pb_iodonesema;/* Semaphore for I/O waiters */ +struct mutex pb_iodonesema;/* Semaphore for I/O waiters */ void *pb_fspriv;void *pb_fspriv2;void *pb_fspriv3;
PATCH 14/19 MUTEX: First set of include changes
In reply to David HowellsThe attached patch modifies the first half of the include files to use the new mutex functions.
---
warthog>diffstat -p1 mutex-include-1-2615rc5.diff
include/linux/agpgart.h | 2 +- include/linux/audit.h | 2 +- include/linux/backlight.h | 2 +- include/linux/cpu.h | 2 +- include/linux/cpufreq.h | 2 +- include/linux/devfs_fs_kernel.h | 2 +- include/linux/device.h | 6 +++--- include/linux/ext3_fs_i.h | 2 +- include/linux/fs.h | 17 +++++++++-------- include/linux/gameport.h | 2 +- include/linux/generic_serial.h | 2 +- include/linux/hil_mlc.h | 8 ++++---- include/linux/hp_sdc.h | 2 +- include/linux/i2c.h | 6 +++--- include/linux/i2o.h | 8 ++++---- include/linux/ide.h | 10 +++++----- include/linux/if_pppox.h | 2 +- include/linux/input.h | 2 +- include/linux/isdn.h | 4 ++-- include/linux/jbd.h | 6 +++--- include/linux/jffs2_fs_i.h | 4 ++-- include/linux/jffs2_fs_sb.h | 6 +++--- include/linux/kernelcapi.h | 2 +- include/linux/kobj_map.h | 4 ++-- include/linux/kthread.h | 5 +++-- include/linux/lcd.h | 2 +- include/linux/libps2.h | 2 +- include/linux/lockd/lockd.h | 4 ++-- include/linux/loop.h | 6 +++--- include/linux/lp.h | 4 ++-- include/linux/memory.h | 5 ++--- include/linux/msdos_fs.h | 2 +- include/linux/mtd/blktrans.h | 4 ++-- include/linux/mtd/doc2000.h | 4 ++-- include/linux/nbd.h | 2 +- include/linux/ncp_fs_i.h | 2 +- include/linux/ncp_fs_sb.h | 4 ++-- include/linux/netfilter/nfnetlink.h | 2 +- include/linux/parport.h | 4 ++-- include/linux/quota.h | 7 ++++--- include/linux/raid/md.h | 2 +- include/linux/raid/md_k.h | 2 +- include/linux/reiserfs_fs_sb.h | 6 +++--- include/linux/rtnetlink.h | 2 +- 44 files changed, 89 insertions(+), 87 deletions(-)
include/linux/agpgart.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/agpgart.h +1 -1
@@ -201,7 +201,7 @@ struct agp_file_private { };struct agp_front_data { -struct semaphore agp_mutex; +struct mutex agp_mutex;struct agp_controller *current_controller;struct agp_controller *controllers;struct agp_file_private *file_priv_list;
include/linux/audit.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/audit.h +1 -1
@@ -283,7 +283,7 @@ extern void audit_send_reply(int pi int done, int multi, void *payload, int size);extern void audit_log_lost (const char *message); -extern struct semaphore audit_netlink_sem; +extern struct mutex audit_netlink_sem;#else #define audit_log (c,g,t,f,...) do { ; } while (0)#define audit_log_start (c,g,t) ({ NULL; })
include/linux/backlight.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/backlight.h +1 -1
@@ -39,7 +39,7 @@ struct backlight_device {/* This protects the 'props' field. If 'props' is NULL, the driver that registered this device has been unloaded, and if class_get_devdata() points to something in the body of that driver, it is also invalid. */ -struct semaphore sem; +struct mutex sem;/* If this is NULL, the backing module is unloaded */ struct backlight_properties *props;/* The framebuffer notifier block */
include/linux/cpufreq.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/cpufreq.h +1 -1
@@ -82,7 +82,7 @@ struct cpufreq_policy {unsigned int policy;/* see above */ struct cpufreq_governor *governor;/* see below */ -struct semaphore lock;/* CPU ->setpolicy or ->target may +struct mutex lock;/* CPU ->setpolicy or ->target may only be called once a time */ struct work_struct update;/* if update_policy() needs to be
include/linux/cpu.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/cpu.h +1 -1
@@ -23,7 +23,7 @@#include <linux/node.h> #include <linux/compiler.h> #include <linux/cpumask.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> struct cpu {int node_id;/* The node which contains the CPU */
include/linux/devfs_fs_kernel.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/devfs_fs_kernel.h +1 -1
@@ -6,7 +6,7 @@#include <linux/spinlock.h> #include <linux/types.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #define DEVFS_SUPER_MAGIC 0x1373
include/linux/device.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/device.h +3 -3
@@ -19,7 +19,7 @@#include <linux/types.h> #include <linux/module.h> #include <linux/pm.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <asm/atomic.h> #define DEVICE_NAME_SIZE 50
@@ -146,7 +146,7 @@ struct class {struct subsystem subsys;struct list_head children;struct list_head interfaces; -struct semaphore sem;/* locks both the children and interfaces lists */ +struct mutex sem;/* locks both the children and interfaces lists */ struct class_attribute * class_attrs;struct class_device_attribute * class_dev_attrs;
@@ -310,7 +310,7 @@ struct device {char bus_id[BUS_ID_SIZE ];/* position on parent bus */ struct device_attribute uevent_attr; -struct semaphore sem;/* semaphore to synchronize calls to +struct mutex sem;/* semaphore to synchronize calls to * its driver. */
include/linux/ext3_fs_i.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/ext3_fs_i.h +1 -1
@@ -131,7 +131,7 @@ struct ext3_inode_info {* during recovery. Hence we must fix the get_block-vs-truncate race * by other means, so we have truncate_sem. */ -struct semaphore truncate_sem; +struct mutex truncate_sem;struct inode vfs_inode; };
include/linux/fs.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/fs.h +9 -8
@@ -10,6 +10,7 @@#include <linux/limits.h> #include <linux/ioctl.h> #include <linux/rcuref.h> +#include <linux/semaphore.h> /* * It's silly to have NR_OPEN bigger than NR_FILE, but you can change
@@ -220,9 +221,9 @@ extern int dir_notify_enable;#include <linux/prio_tree.h> #include <linux/init.h> #include <linux/sched.h> +#include <linux/semaphore.h> #include <asm/atomic.h> -#include <asm/semaphore.h> #include <asm/byteorder.h> struct iovec ;
@@ -368,8 +369,8 @@ struct block_device {dev_t bd_dev;/* not a kdev_t - it's a search key */ struct inode * bd_inode;/* will die */ int bd_openers; -struct semaphore bd_sem;/* open/close mutex */ -struct semaphore bd_mount_sem;/* mount mutex */ +struct mutex bd_sem;/* open/close mutex */ +struct mutex bd_mount_sem;/* mount mutex */ struct list_head bd_inodes;void * bd_holder;int bd_holders;
@@ -453,7 +454,7 @@ struct inode {unsigned long i_blocks;unsigned short i_bytes;spinlock_t i_lock;/* i_blocks, i_bytes, maybe i_size */ -struct semaphore i_sem; +struct mutex i_sem;struct rw_semaphore i_alloc_sem;struct inode_operations *i_op;struct file_operations *i_fop;/* former ->i_op->default_file_ops */
@@ -480,7 +481,7 @@ struct inode {#ifdef CONFIG_INOTIFY struct list_head inotify_watches;/* watches on this inode */ -struct semaphore inotify_sem;/* protects the watches list */ +struct mutex inotify_sem;/* protects the watches list */ #endif unsigned long i_state;
@@ -790,7 +791,7 @@ struct super_block {unsigned long s_magic;struct dentry *s_root;struct rw_semaphore s_umount; -struct semaphore s_lock; +struct mutex s_lock;int s_count;int s_syncing;int s_need_sync_fs;
@@ -819,7 +820,7 @@ struct super_block {* The next field is for VFS *only*. No filesystems have any business * even looking at it. You had been warned. */ -struct semaphore s_vfs_rename_sem;/* Kludge */ +struct mutex s_vfs_rename_sem;/* Kludge */ /* Granuality of c/m/atime in ns. Cannot be worse than a second */
@@ -1496,7 +1497,7 @@ extern void destroy_inode(struct inode *extern struct inode *new_inode (struct super_block *);extern int remove_suid (struct dentry *);extern void remove_dquot_ref (struct super_block *,int ,struct list_head *); -extern struct semaphore iprune_sem; +extern struct mutex iprune_sem;extern void __insert_inode_hash (struct inode *,unsigned long hashval);extern void remove_inode_hash (struct inode *);
include/linux/gameport.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/gameport.h +1 -1
@@ -40,7 +40,7 @@ struct gameport {struct gameport *parent, *child;struct gameport_driver *drv; -struct semaphore drv_sem;/* protects serio->drv so attributes can pin driver */ +struct mutex drv_sem;/* protects serio->drv so attributes can pin driver */ struct device dev;unsigned int registered;/* port has been fully registered with driver core */
include/linux/generic_serial.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/generic_serial.h +1 -1
@@ -34,7 +34,7 @@ struct gs_port {int xmit_head;int xmit_tail;int xmit_cnt; -struct semaphore port_write_sem; +struct mutex port_write_sem;int flags;wait_queue_head_t open_wait;wait_queue_head_t close_wait;
include/linux/hil_mlc.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/hil_mlc.h +4 -4
@@ -34,7 +34,7 @@#include <linux/hil.h> #include <linux/time.h> #include <linux/interrupt.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <linux/serio.h> #include <linux/list.h>
@@ -133,14 +133,14 @@ struct hil_mlc {int istarted, ostarted;hil_mlc_cts *cts; -struct semaphore csem;/* Raised when loop idle */ +struct mutex csem;/* Raised when loop idle */ hil_mlc_out *out; -struct semaphore osem;/* Raised when outpacket dispatched */ +struct mutex osem;/* Raised when outpacket dispatched */ hil_packet opacket;hil_mlc_in *in; -struct semaphore isem;/* Raised when a packet arrives */ +struct mutex isem;/* Raised when a packet arrives */ hil_packet ipacket[16 ];hil_packet imatch;int icount;
include/linux/hp_sdc.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/hp_sdc.h +1 -1
@@ -68,7 +68,7 @@ typedef struct {uint8_t *seq;/* commands/data for the transaction */ union {hp_sdc_irqhook *irqhook;/* Callback, isr or tasklet context */ -struct semaphore *semaphore;/* Semaphore to sleep on. */ +struct mutex *semaphore;/* Semaphore to sleep on. */ } act; } hp_sdc_transaction;int hp_sdc_enqueue_transaction (hp_sdc_transaction *this);
include/linux/i2c.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/i2c.h +3 -3
@@ -32,7 +32,7 @@#include <linux/mod_devicetable.h> #include <linux/device.h> /* for struct device */ #include <linux/sched.h> /* for completion */ -#include <asm/semaphore.h> +#include <linux/semaphore.h> /* --- For i2c-isa ---------------------------------------------------- */
@@ -222,8 +222,8 @@ struct i2c_adapter {int (*client_unregister)(struct i2c_client *);/* data fields that are valid for all devices */ -struct semaphore bus_lock; -struct semaphore clist_lock; +struct mutex bus_lock; +struct mutex clist_lock;int timeout;int retries;
include/linux/i2o.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/i2o.h +4 -4
@@ -30,9 +30,9 @@#include <linux/string.h> #include <linux/slab.h> #include <linux/workqueue.h> /* work_struct */ +#include <linux/semaphore.h> #include <asm/io.h> -#include <asm/semaphore.h> /* Needed for MUTEX init macros */ /* message queue empty */ #define I2O_QUEUE_EMPTY 0xffffffff
@@ -69,7 +69,7 @@ struct i2o_device {struct device device; -struct semaphore lock;/* device lock */ +struct mutex lock;/* device lock */ };/*
@@ -117,7 +117,7 @@ struct i2o_driver {void (*notify_device_add) (struct i2o_device *);void (*notify_device_remove) (struct i2o_device *); -struct semaphore lock; +struct mutex lock; };/*
@@ -181,7 +181,7 @@ struct i2o_controller {struct i2o_dma hrt;/* HW Resource Table */ i2o_lct *lct;/* Logical Config Table */ struct i2o_dma dlct;/* Temp LCT */ -struct semaphore lct_lock;/* Lock for LCT updates */ +struct mutex lct_lock;/* Lock for LCT updates */ struct i2o_dma status_block;/* IOP status block */ struct i2o_io base;/* controller messaging unit */
include/linux/ide.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/ide.h +5 -5
@@ -18,10 +18,10 @@#include <linux/bio.h> #include <linux/device.h> #include <linux/pci.h> +#include <linux/semaphore.h> #include <asm/byteorder.h> #include <asm/system.h> #include <asm/io.h> -#include <asm/semaphore.h> /* * This is the multiple IDE interface driver, as evolved from hd.c.
@@ -759,7 +759,7 @@ typedef struct ide_drive_s {int crc_count;/* crc counter to reduce drive speed */ struct list_head list;struct device gendev; -struct semaphore gendev_rel_sem;/* to deal with device release() */ +struct mutex gendev_rel_sem;/* to deal with device release() */ } ide_drive_t;#define to_ide_device (dev)container_of(dev, ide_drive_t, gendev)
@@ -915,7 +915,7 @@ typedef struct hwif_s { unsigned sg_mapped : 1; /* sg_table and sg_nents are ready */struct device gendev; -struct semaphore gendev_rel_sem;/* To deal with device release() */ +struct mutex gendev_rel_sem;/* To deal with device release() */ void *hwif_data;/* extra hwif data */
@@ -1000,7 +1000,7 @@ typedef struct ide_settings_s {struct ide_settings_s *next; } ide_settings_t; -extern struct semaphore ide_setting_sem; +extern struct mutex ide_setting_sem;extern int ide_add_setting (ide_drive_t *drive,const char *name,int rw,int read_ioctl,int write_ioctl,int data_type,int min,int max,int mul_factor,int div_factor,void *data,ide_procset_t *set);extern ide_settings_t *ide_find_setting_by_name (ide_drive_t *drive,char *name);extern int ide_read_setting (ide_drive_t *t,ide_settings_t *setting);
@@ -1458,7 +1458,7 @@ extern const ide_pio_timings_t ide_pio_textern spinlock_t ide_lock; -extern struct semaphore ide_cfg_sem; +extern struct mutex ide_cfg_sem;/* * Structure locking: *
include/linux/if_pppox.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/if_pppox.h +1 -1
@@ -24,7 +24,7 @@#include <linux/if_ether.h> #include <linux/if.h> #include <linux/netdevice.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <linux/ppp_channel.h> #endif /* __KERNEL__ */
include/linux/input.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/input.h +1 -1
@@ -888,7 +888,7 @@ struct input_dev {struct input_handle *grab; -struct semaphore sem;/* serializes open and close operations */ +struct mutex sem;/* serializes open and close operations */ unsigned int users;struct class_device cdev;
include/linux/isdn.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/isdn.h +2 -2
@@ -515,7 +515,7 @@ typedef struct modem_info {struct termios normal_termios;/* For saving termios structs */ struct termios callout_termios;wait_queue_head_t open_wait, close_wait; -struct semaphore write_sem; +struct mutex write_sem;spinlock_t readlock; } modem_info;
@@ -625,7 +625,7 @@ typedef struct isdn_devt {int v110emu[ISDN_MAX_CHANNELS ];/* V.110 emulator-mode 0=none */ atomic_t v110use[ISDN_MAX_CHANNELS ];/* Usage-Semaphore for stream */ isdn_v110_stream *v110[ISDN_MAX_CHANNELS ];/* V.110 private data */ -struct semaphore sem;/* serialize list access*/ +struct mutex sem;/* serialize list access*/ unsigned long global_features; } isdn_dev;
include/linux/jbd.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/jbd.h +3 -3
@@ -27,7 +27,7 @@#include <linux/journal-head.h> #include <linux/stddef.h> #include <linux/bit_spinlock.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #endif #define journal_oom_retry 1
@@ -644,7 +644,7 @@ struct journal_sint j_barrier_count;/* The barrier lock itself */ -struct semaphore j_barrier; +struct mutex j_barrier;/* * Transactions: The current running transaction...
@@ -686,7 +686,7 @@ struct journal_swait_queue_head_t j_wait_updates;/* Semaphore for locking against concurrent checkpoints */ -struct semaphore j_checkpoint_sem; +struct mutex j_checkpoint_sem;/* * Journal head: identifies the first unused block in the journal.
include/linux/jffs2_fs_i.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/jffs2_fs_i.h +2 -2
@@ -5,7 +5,7 @@#include <linux/version.h> #include <linux/rbtree.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> struct jffs2_inode_info {/* We need an internal semaphore similar to inode->i_sem.
@@ -14,7 +14,7 @@ struct jffs2_inode_info {before letting GC proceed. Or we'd have to put ugliness into the GC code so it didn't attempt to obtain the i_sem for the inode(s) which are already locked */ -struct semaphore sem; +struct mutex sem;/* The highest (datanode) version number used for this ino */ uint32_t highest_version;
include/linux/jffs2_fs_sb.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/jffs2_fs_sb.h +3 -3
@@ -7,7 +7,7 @@#include <linux/spinlock.h> #include <linux/workqueue.h> #include <linux/completion.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <linux/timer.h> #include <linux/wait.h> #include <linux/list.h>
@@ -35,7 +35,7 @@ struct jffs2_sb_info {struct completion gc_thread_start;/* GC thread start completion */ struct completion gc_thread_exit;/* GC thread exit completion port */ -struct semaphore alloc_sem;/* Used to protect all the following +struct mutex alloc_sem;/* Used to protect all the following fields, and also to protect against out-of-order writing of nodes. And GC. */ uint32_t cleanmarker_size;/* Size of an _inline_ CLEANMARKER
@@ -93,7 +93,7 @@ struct jffs2_sb_info {/* Sem to allow jffs2_garbage_collect_deletion_dirent to drop the erase_completion_lock while it's holding a pointer to an obsoleted node. I don't like this. Alternatives welcomed. */ -struct semaphore erase_free_sem; +struct mutex erase_free_sem;uint32_t wbuf_pagesize;/* 0 for NOR and other flashes with no wbuf */
include/linux/kernelcapi.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/kernelcapi.h +1 -1
@@ -62,7 +62,7 @@ struct capi20_appl {unsigned long nrecvdatapkt;unsigned long nsentctlpkt;unsigned long nsentdatapkt; -struct semaphore recv_sem; +struct mutex recv_sem;struct sk_buff_head recv_queue;struct work_struct recv_work;int release_in_progress;
include/linux/kobj_map.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/kobj_map.h +2 -2
@@ -1,6 +1,6 @@#ifdef __KERNEL__ -#include <asm/semaphore.h> +#include <linux/semaphore.h> typedef struct kobject *kobj_probe_t (dev_t ,int *,void *);struct kobj_map ;
@@ -9,6 +9,6 @@ int kobj_map(struct kobj_map *, dev_t, u kobj_probe_t *, int (*)(dev_t, void *), void *);void kobj_unmap (struct kobj_map *,dev_t ,unsigned long );struct kobject *kobj_lookup (struct kobj_map *,dev_t ,int *); -struct kobj_map *kobj_map_init (kobj_probe_t *,struct semaphore *); +struct kobj_map *kobj_map_init (kobj_probe_t *,struct mutex *);#endif
include/linux/kthread.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/kthread.h +3 -2
@@ -3,6 +3,7 @@/* Simple interface for creating and stopping kernel threads without mess. */ #include <linux/err.h> #include <linux/sched.h> +#include <linux/semaphore.h> /** * kthread_create: create a kthread.
@@ -72,14 +73,14 @@ int kthread_stop(struct task_struct *k);/** * kthread_stop_sem: stop a thread created by kthread_create(). * @k: thread created by kthread_create(). -* @s: semaphore that @k waits on while idle. +* @s: mutex that @k waits on while idle. * * Does essentially the same thing as kthread_stop() above, but wakes * @k by calling up(@s). * * Returns the result of threadfn(), or -EINTR if wake_up_process() * was never called. */ -int kthread_stop_sem (struct task_struct *k,struct semaphore *s); +int kthread_stop_sem (struct task_struct *k,struct mutex *s);/** * kthread_should_stop: should this kthread return now?
include/linux/lcd.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/lcd.h +1 -1
@@ -38,7 +38,7 @@ struct lcd_device {/* This protects the 'props' field. If 'props' is NULL, the driver that registered this device has been unloaded, and if class_get_devdata() points to something in the body of that driver, it is also invalid. */ -struct semaphore sem; +struct mutex sem;/* If this is NULL, the backing module is unloaded */ struct lcd_properties *props;/* The framebuffer notifier block */
include/linux/libps2.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/libps2.h +1 -1
@@ -28,7 +28,7 @@ struct ps2dev {struct serio *serio;/* Ensures that only one command is executing at a time */ -struct semaphore cmd_sem; +struct mutex cmd_sem;/* Used to signal completion from interrupt handler */ wait_queue_head_t wait;
include/linux/lockd/lockd.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/lockd/lockd.h +2 -2
@@ -53,7 +53,7 @@ struct nlm_host {u32 h_nsmstate;/* true remote NSM state */ u32 h_pidcount;/* Pseudopids */ atomic_t h_count;/* reference count */ -struct semaphore h_sema;/* mutex for pmap binding */ +struct mutex h_sema;/* mutex for pmap binding */ unsigned long h_nextrebind;/* next portmap call */ unsigned long h_expires;/* eligible for GC */ struct list_head h_lockowners;/* Lockowners for the client */
@@ -99,7 +99,7 @@ struct nlm_file {struct nlm_block * f_blocks;/* blocked locks */ unsigned int f_locks;/* guesstimate # of locks */ unsigned int f_count;/* reference count */ -struct semaphore f_sema;/* avoid concurrent access */ +struct mutex f_sema;/* avoid concurrent access */ int f_hash;/* hash of f_handle */ };
include/linux/loop.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/loop.h +3 -3
@@ -58,9 +58,9 @@ struct loop_device {struct bio *lo_bio;struct bio *lo_biotail;int lo_state; -struct semaphore lo_sem; -struct semaphore lo_ctl_mutex; -struct semaphore lo_bh_mutex; +struct mutex lo_sem; +struct mutex lo_ctl_mutex; +struct mutex lo_bh_mutex;int lo_pending;request_queue_t *lo_queue;
include/linux/lp.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/lp.h +2 -2
@@ -99,7 +99,7 @@#ifdef __KERNEL__#include <linux/wait.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> /* Magic numbers for defining port-device mappings */ #define LP_PARPORT_UNSPEC -4
@@ -145,7 +145,7 @@ struct lp_struct {#endif wait_queue_head_t waitq;unsigned int last_error; -struct semaphore port_mutex; +struct mutex port_mutex;wait_queue_head_t dataq;long timeout;unsigned int best_mode;
include/linux/memory.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/memory.h +2 -3
@@ -18,8 +18,7 @@#include <linux/sysdev.h> #include <linux/node.h> #include <linux/compiler.h> - -#include <asm/semaphore.h> +#include <linux/semaphore.h> struct memory_block {unsigned long phys_index;
@@ -30,7 +29,7 @@ struct memory_block {* created long after the critical areas during * initialization. */ -struct semaphore state_sem; +struct mutex state_sem;int phys_device;/* to which fru does this belong? */ void *hw;/* optional pointer to fw/hw data */ int (*phys_callback)(struct memory_block *);
include/linux/msdos_fs.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/msdos_fs.h +1 -1
@@ -226,7 +226,7 @@ struct msdos_sb_info {unsigned long max_cluster;/* maximum cluster number */ unsigned long root_cluster;/* first cluster of the root directory */ unsigned long fsinfo_sector;/* sector number of FAT32 fsinfo */ -struct semaphore fat_lock; +struct mutex fat_lock;unsigned int prev_free;/* previously allocated cluster number */ unsigned int free_clusters;/* -1 if undefined */ struct fat_mount_options options;
include/linux/mtd/blktrans.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/mtd/blktrans.h +2 -2
@@ -10,7 +10,7 @@#ifndef __MTD_TRANS_H__#define __MTD_TRANS_H__ -#include <asm/semaphore.h> +#include <linux/semaphore.h> struct hd_geometry ;struct mtd_info ;
@@ -22,7 +22,7 @@ struct mtd_blktrans_dev {struct mtd_blktrans_ops *tr;struct list_head list;struct mtd_info *mtd; -struct semaphore sem; +struct mutex sem;int devnum;int blksize;unsigned long size;
include/linux/mtd/doc2000.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/mtd/doc2000.h +2 -2
@@ -15,7 +15,7 @@#define __MTD_DOC2000_H__#include <linux/mtd/mtd.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #define DoC_Sig1 0#define DoC_Sig2 1
@@ -187,7 +187,7 @@ struct DiskOnChip {int numchips;struct Nand *chips;struct mtd_info *nextdoc; -struct semaphore lock; +struct mutex lock; };int doc_decode_ecc (unsigned char sector[512 ],unsigned char ecc1[6 ]);
include/linux/nbd.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/nbd.h +1 -1
@@ -49,7 +49,7 @@ struct nbd_device {int magic;spinlock_t queue_lock;struct list_head queue_head;/* Requests are added here... */ -struct semaphore tx_lock; +struct mutex tx_lock;struct gendisk *disk;int blksize;u64 bytesize;
include/linux/ncp_fs_i.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/ncp_fs_i.h +1 -1
@@ -19,7 +19,7 @@ struct ncp_inode_info {__le32 DosDirNum;__u8 volNumber;__le32 nwattr; -struct semaphore open_sem; +struct mutex open_sem;atomic_t opened;int access;int flags;
include/linux/ncp_fs_sb.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/ncp_fs_sb.h +2 -2
@@ -51,7 +51,7 @@ struct ncp_server {receive replies */ int lock;/* To prevent mismatch in protocols. */ -struct semaphore sem; +struct mutex sem;int current_size;/* for packet preparation */ int has_subfunction;
@@ -96,7 +96,7 @@ struct ncp_server {struct {struct work_struct tq;/* STREAM/DGRAM: data/error ready */ struct ncp_request_reply * creq;/* STREAM/DGRAM: awaiting reply from this request */ -struct semaphore creq_sem;/* DGRAM only: lock accesses to rcv.creq */ +struct mutex creq_sem;/* DGRAM only: lock accesses to rcv.creq */ unsigned int state;/* STREAM only: receiver state */ struct {
include/linux/netfilter/nfnetlink.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/netfilter/nfnetlink.h +1 -1
@@ -129,7 +129,7 @@ extern void __nfa_fill(struct sk_buff *s ({if (skb_tailroom (skb) < (int )NFA_SPACE (attrlen)) goto nfattr_failure; \ __nfa_fill(skb, attrtype, attrlen, data); }) -extern struct semaphore nfnl_sem; +extern struct mutex nfnl_sem;#define nfnl_shlock () down(&nfnl_sem)#define nfnl_shlock_nowait () down_trylock(&nfnl_sem)
include/linux/parport.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/parport.h +2 -2
@@ -101,9 +101,9 @@ typedef enum {#include <linux/proc_fs.h> #include <linux/spinlock.h> #include <linux/wait.h> +#include <linux/semaphore.h> #include <asm/system.h> #include <asm/ptrace.h> -#include <asm/semaphore.h> /* Define this later. */ struct parport ;
@@ -254,7 +254,7 @@ enum ieee1284_phase {struct ieee1284_info {int mode;volatile enum ieee1284_phase phase; -struct semaphore irq; +struct mutex irq; };/* A parallel port */
include/linux/quota.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/quota.h +4 -3
@@ -38,6 +38,7 @@#include <linux/errno.h> #include <linux/types.h> #include <linux/spinlock.h> +#include <linux/semaphore.h> #define __DQUOT_VERSION__ "dquot_6.5.1"#define __DQUOT_NUM_VERSION__ 6*10000+5*100+1
@@ -215,7 +216,7 @@ struct dquot {struct list_head dq_inuse;/* List of all quotas */ struct list_head dq_free;/* Free list element */ struct list_head dq_dirty;/* List of dirty dquots */ -struct semaphore dq_lock;/* dquot IO lock */ +struct mutex dq_lock;/* dquot IO lock */ atomic_t dq_count;/* Use count */ wait_queue_head_t dq_wait_unused;/* Wait queue for dquot to become unused */ struct super_block *dq_sb;/* superblock this applies to */
@@ -285,8 +286,8 @@ struct quota_format_type {struct quota_info {unsigned int flags;/* Flags for diskquotas on this device */ -struct semaphore dqio_sem;/* lock device while I/O in progress */ -struct semaphore dqonoff_sem;/* Serialize quotaon & quotaoff */ +struct mutex dqio_sem;/* lock device while I/O in progress */ +struct mutex dqonoff_sem;/* Serialize quotaon & quotaoff */ struct rw_semaphore dqptr_sem;/* serialize ops using quota_info struct, pointers from inode to dquots */ struct inode *files[MAXQUOTAS ];/* inodes of quotafiles */ struct mem_dqinfo info[MAXQUOTAS ];/* Information for each quota type */
include/linux/raid/md.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/raid/md.h +1 -1
@@ -19,7 +19,7 @@#define _MD_H#include <linux/blkdev.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <linux/major.h> #include <linux/ioctl.h> #include <linux/types.h>
include/linux/raid/md_k.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/raid/md_k.h +1 -1
@@ -204,7 +204,7 @@ struct mddev_sunsigned long recovery;int in_sync;/* know to not need resync */ -struct semaphore reconfig_sem; +struct mutex reconfig_sem;atomic_t active;int changed;/* true if we might need to reread partition info */
include/linux/reiserfs_fs_sb.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/reiserfs_fs_sb.h +3 -3
@@ -152,7 +152,7 @@ struct reiserfs_journal_list {atomic_t j_nonzerolen;atomic_t j_commit_left;atomic_t j_older_commits_done;/* all commits older than this on disk */ -struct semaphore j_commit_lock; +struct mutex j_commit_lock;unsigned long j_trans_id;time_t j_timestamp;struct reiserfs_list_bitmap *j_list_bitmap;
@@ -194,8 +194,8 @@ struct reiserfs_journal {struct buffer_head *j_header_bh;time_t j_trans_start_time;/* time this transaction started */ -struct semaphore j_lock; -struct semaphore j_flush_sem; +struct mutex j_lock; +struct mutex j_flush_sem;wait_queue_head_t j_join_wait;/* wait for current transaction to finish before starting new one */ atomic_t j_jlock;/* lock for j_join_wait */ int j_list_bitmap_index;/* number of next list bitmap to use */
include/linux/rtnetlink.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/rtnetlink.h +1 -1
@@ -1032,7 +1032,7 @@ __rta_reserve(struct sk_buff *skb, int aextern void rtmsg_ifinfo (int type,struct net_device *dev,unsigned change); -extern struct semaphore rtnl_sem; +extern struct mutex rtnl_sem;#define rtnl_shlock () down(&rtnl_sem)#define rtnl_shlock_nowait () down_trylock(&rtnl_sem)
PATCH 15/19 MUTEX: Second set of include changes
In reply to David HowellsThe attached patch modifies the second half of the include files to use the new mutex functions.
---
warthog>diffstat -p1 mutex-include-2-2615rc5.diff
include/linux/sched.h | 2 +- include/linux/seq_file.h | 4 ++-- include/linux/serial_core.h | 2 +- include/linux/serio.h | 2 +- include/linux/smb_fs_sb.h | 2 +- include/linux/sunrpc/svcsock.h | 2 +- include/linux/syscalls.h | 2 +- include/linux/tty.h | 12 ++++++------ include/linux/udf_fs_sb.h | 4 ++-- include/linux/uinput.h | 2 +- include/linux/usb.h | 2 +- include/linux/videodev2.h | 2 +- include/linux/vt_kern.h | 2 +- include/media/saa7146.h | 6 +++--- include/media/video-buf-dvb.h | 2 +- include/media/video-buf.h | 2 +- include/net/af_unix.h | 2 +- include/net/bluetooth/hci_core.h | 2 +- include/net/xfrm.h | 2 +- include/pcmcia/ss.h | 2 +- include/scsi/scsi_host.h | 2 +- include/scsi/scsi_transport_spi.h | 2 +- 22 files changed, 31 insertions(+), 31 deletions(-)
include/linux/sched.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/sched.h +1 -1
@@ -17,7 +17,7 @@#include <linux/nodemask.h> #include <asm/system.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <asm/page.h> #include <asm/ptrace.h> #include <asm/mmu.h>
include/linux/seq_file.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/seq_file.h +2 -2
@@ -4,7 +4,7 @@#include <linux/types.h> #include <linux/string.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> struct seq_operations ;struct file ;
@@ -19,7 +19,7 @@ struct seq_file {size_t count;loff_t index;loff_t version; -struct semaphore sem; +struct mutex sem;struct seq_operations *op;void *private; };
include/linux/serial_core.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/serial_core.h +1 -1
@@ -281,7 +281,7 @@ struct uart_state {struct uart_info *info;struct uart_port *port; -struct semaphore sem; +struct mutex sem; };#define UART_XMIT_SIZE PAGE_SIZE
include/linux/serio.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/serio.h +1 -1
@@ -42,7 +42,7 @@ struct serio {struct serio *parent, *child;struct serio_driver *drv;/* accessed from interrupt, must be protected by serio->lock and serio->sem */ -struct semaphore drv_sem;/* protects serio->drv so attributes can pin driver */ +struct mutex drv_sem;/* protects serio->drv so attributes can pin driver */ struct device dev;unsigned int registered;/* port has been fully registered with driver core */
include/linux/smb_fs_sb.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/smb_fs_sb.h +1 -1
@@ -59,7 +59,7 @@ struct smb_sb_info {struct smb_conn_opt opt;wait_queue_head_t conn_wq;int conn_complete; -struct semaphore sem; +struct mutex sem;unsigned char header[SMB_HEADER_LEN +20 *2 +2 ];u32 header_len;
include/linux/sunrpc/svcsock.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/sunrpc/svcsock.h +1 -1
@@ -36,7 +36,7 @@ struct svc_sock {struct list_head sk_deferred;/* deferred requests that need to * be revisted */ -struct semaphore sk_sem;/* to serialize sending data */ +struct mutex sk_sem;/* to serialize sending data */ int (*sk_recvfrom)(struct svc_rqst *rqstp);int (*sk_sendto)(struct svc_rqst *rqstp);
include/linux/syscalls.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/syscalls.h +1 -1
@@ -57,7 +57,7 @@ struct mq_attr;#include <linux/capability.h> #include <linux/list.h> #include <linux/sem.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <asm/siginfo.h> #include <asm/signal.h> #include <linux/quota.h>
include/linux/tty.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/tty.h +6 -6
@@ -123,7 +123,7 @@ extern struct screen_info screen_info;struct tty_flip_buffer {struct work_struct work; -struct semaphore pty_sem; +struct mutex pty_sem;char *char_buf_ptr;unsigned char *flag_buf_ptr;int count;
@@ -245,7 +245,7 @@ struct tty_struct {struct tty_driver *driver;int index;struct tty_ldisc ldisc; -struct semaphore termios_sem; +struct mutex termios_sem;struct termios *termios, *termios_locked;char name[64 ];int pgrp;
@@ -290,8 +290,8 @@ struct tty_struct {int canon_data;unsigned long canon_head;unsigned int canon_column; -struct semaphore atomic_read; -struct semaphore atomic_write; +struct mutex atomic_read; +struct mutex atomic_write;unsigned char *write_buf;int write_cnt;spinlock_t read_lock;
@@ -378,8 +378,8 @@ extern void tty_ldisc_put(int);extern void tty_wakeup (struct tty_struct *tty);extern void tty_ldisc_flush (struct tty_struct *tty); -struct semaphore ; -extern struct semaphore tty_sem; +struct mutex ; +extern struct mutex tty_sem;/* n_tty.c */ extern struct tty_ldisc tty_ldisc_N_TTY;
include/linux/udf_fs_sb.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/udf_fs_sb.h +2 -2
@@ -18,7 +18,7 @@#ifndef _UDF_FS_SB_H#define _UDF_FS_SB_H 1 -#include <asm/semaphore.h> +#include <linux/semaphore.h> #pragma pack(1)
@@ -116,7 +116,7 @@ struct udf_sb_info/* VAT inode */ struct inode *s_vat; - struct semaphore s_alloc_sem; + struct mutex s_alloc_sem; };#endif /* _UDF_FS_SB_H */
include/linux/uinput.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/uinput.h +1 -1
@@ -51,7 +51,7 @@ struct uinput_request {struct uinput_device {struct input_dev *dev; -struct semaphore sem; +struct mutex sem;enum uinput_state state;wait_queue_head_t waitq;unsigned char ready;
include/linux/usb.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/usb.h +1 -1
@@ -329,7 +329,7 @@ struct usb_device {struct usb_tt *tt;/* low/full speed dev, highspeed hub */ int ttport;/* device port on that tt hub */ -struct semaphore serialize; +struct mutex serialize;unsigned int toggle[2 ];/* one bit for each endpoint * ([0] = IN, [1] = OUT) */
include/linux/videodev2.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/videodev2.h +1 -1
@@ -80,7 +80,7 @@ struct video_device/* for videodev.c intenal usage -- please don't touch */ int users;/* video_exclusive_{open|close} ... */ -struct semaphore lock;/* ... helper function uses these */ +struct mutex lock;/* ... helper function uses these */ char devfs_name[64 ];/* devfs */ struct class_device class_dev;/* sysfs */ };
include/linux/vt_kern.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/vt_kern.h +1 -1
@@ -81,6 +81,6 @@ void reset_vc(struct vc_data *vc);#define CON_BUF_SIZE (CONFIG_BASE_SMALL ? 256 : PAGE_SIZE)extern char con_buf[CON_BUF_SIZE ]; -extern struct semaphore con_buf_sem; +extern struct mutex con_buf_sem;#endif /* _VT_KERN_H */
include/media/saa7146.h renamed from warthog/kernels/linux-2.6.15-rc5/include/media/saa7146.h +3 -3
@@ -112,7 +112,7 @@ struct saa7146_dev/* different device locks */ spinlock_t slock; -struct semaphore lock; +struct mutex lock;unsigned char __iomem *mem;/* pointer to mapped IO memory */ int revision;/* chip revision; needed for bug-workarounds*/
@@ -133,7 +133,7 @@ struct saa7146_devvoid (*vv_callback)(struct saa7146_dev *dev,unsigned long status);/* i2c-stuff */ -struct semaphore i2c_lock; +struct mutex i2c_lock;u32 i2c_bitrate;struct saa7146_dma d_i2c;/* pointer to i2c memory */ wait_queue_head_t i2c_wq;
@@ -150,7 +150,7 @@ int saa7146_i2c_transfer(struct saa7146_/* from saa7146_core.c */ extern struct list_head saa7146_devices; -extern struct semaphore saa7146_devices_lock; +extern struct mutex saa7146_devices_lock;int saa7146_register_extension (struct saa7146_extension *);int saa7146_unregister_extension (struct saa7146_extension *);struct saa7146_format *format_by_fourcc (struct saa7146_dev *dev,int fourcc);
include/media/video-buf-dvb.h renamed from warthog/kernels/linux-2.6.15-rc5/include/media/video-buf-dvb.h +1 -1
@@ -11,7 +11,7 @@ struct videobuf_dvb {struct videobuf_queue dvbq;/* video-buf-dvb state info */ -struct semaphore lock; +struct mutex lock;struct task_struct *thread;int nfeeds;
include/media/video-buf.h renamed from warthog/kernels/linux-2.6.15-rc5/include/media/video-buf.h +1 -1
@@ -177,7 +177,7 @@ struct videobuf_queue_ops { };struct videobuf_queue { -struct semaphore lock; +struct mutex lock;spinlock_t *irqlock;struct pci_dev *pci;
include/net/af_unix.h renamed from warthog/kernels/linux-2.6.15-rc5/include/net/af_unix.h +1 -1
@@ -71,7 +71,7 @@ struct unix_sock {struct unix_address *addr;struct dentry *dentry;struct vfsmount *mnt; -struct semaphore readsem; +struct mutex readsem;struct sock *peer;struct sock *other;struct sock *gc_tree;
include/net/bluetooth/hci_core.h renamed from warthog/kernels/linux-2.6.15-rc5/include/net/bluetooth/hci_core.h +1 -1
@@ -106,7 +106,7 @@ struct hci_dev {struct sk_buff *sent_cmd; -struct semaphore req_lock; +struct mutex req_lock;wait_queue_head_t req_wait_q;__u32 req_status;__u32 req_result;
include/net/xfrm.h renamed from warthog/kernels/linux-2.6.15-rc5/include/net/xfrm.h +1 -1
@@ -19,7 +19,7 @@#define XFRM_ALIGN8 (len) (((len) + 7) & ~7) -extern struct semaphore xfrm_cfg_sem; +extern struct mutex xfrm_cfg_sem;/* Organization of SPD aka "XFRM rules" ------------------------------------
include/pcmcia/ss.h renamed from warthog/kernels/linux-2.6.15-rc5/include/pcmcia/ss.h +1 -1
@@ -243,7 +243,7 @@ struct pcmcia_socket {#endif /* state thread */ -struct semaphore skt_sem;/* protects socket h/w state */ +struct mutex skt_sem;/* protects socket h/w state */ struct task_struct *thread;struct completion thread_done;
include/scsi/scsi_host.h renamed from warthog/kernels/linux-2.6.15-rc5/include/scsi/scsi_host.h +1 -1
@@ -464,7 +464,7 @@ struct Scsi_Host {spinlock_t default_lock;spinlock_t *host_lock; -struct semaphore scan_mutex;/* serialize scanning activity */ +struct mutex scan_mutex;/* serialize scanning activity */ struct list_head eh_cmd_q;struct task_struct * ehandler;/* Error recovery thread. */
include/scsi/scsi_transport_spi.h renamed from warthog/kernels/linux-2.6.15-rc5/include/scsi/scsi_transport_spi.h +1 -1
@@ -51,7 +51,7 @@ struct spi_transport_attrs {unsigned int support_qas;/* supports quick arbitration and selection */ /* Private Fields */ unsigned int dv_pending:1; /* Internal flag */ -struct semaphore dv_sem;/* semaphore to serialise dv */ +struct mutex dv_sem;/* semaphore to serialise dv */ };enum spi_signal_type {
PATCH 16/19 MUTEX: IPC changes
In reply to David HowellsThe attached patch modifies the IPC files to use the new mutex functions.
---
warthog>diffstat -p1 mutex-ipc-2615rc5.diff
ipc/compat.c | 2 +- ipc/util.c | 2 +- ipc/util.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
ipc/compat.c renamed from warthog/kernels/linux-2.6.15-rc5/ipc/compat.c +1 -1
@@ -29,8 +29,8 @@#include <linux/shm.h> #include <linux/slab.h> #include <linux/syscalls.h> +#include <linux/semaphore.h> -#include <asm/semaphore.h> #include <asm/uaccess.h> #include "util.h"
ipc/util.c renamed from warthog/kernels/linux-2.6.15-rc5/ipc/util.c +1 -1
@@ -67,7 +67,7 @@ __initcall(ipc_init);void __init ipc_init_ids (struct ipc_ids * ids,int size) {int i; -sema_init (&ids->sem,1 ); +init_MUTEX (&ids->sem);if (size >IPCMNI ) size =IPCMNI ;
ipc/util.h renamed from warthog/kernels/linux-2.6.15-rc5/ipc/util.h +1 -1
@@ -25,7 +25,7 @@ struct ipc_ids {int max_id;unsigned short seq;unsigned short seq_max; -struct semaphore sem; +struct mutex sem;struct ipc_id_ary nullentry;struct ipc_id_ary * entries; };
PATCH 17/19 MUTEX: Networking changes
In reply to David HowellsThe attached patch modifies the networking files to use the new mutex functions.
---
warthog>diffstat -p1 mutex-net-2615rc5.diff
net/atm/resources.h | 2 +- net/bridge/netfilter/ebtables.c | 12 ++++++------ net/core/flow.c | 2 +- net/dccp/proto.c | 2 +- net/ipv4/ipcomp.c | 2 +- net/ipv4/netfilter/arp_tables.c | 2 +- net/ipv4/netfilter/ip_tables.c | 2 +- net/ipv6/ipcomp6.c | 2 +- net/ipv6/netfilter/ip6_tables.c | 2 +- net/sunrpc/sched.c | 2 -- net/sunrpc/svcsock.c | 2 +- 11 files changed, 15 insertions(+), 17 deletions(-)
net/atm/resources.h renamed from warthog/kernels/linux-2.6.15-rc5/net/atm/resources.h +1 -1
@@ -11,7 +11,7 @@extern struct list_head atm_devs; -extern struct semaphore atm_dev_mutex; +extern struct mutex atm_dev_mutex;int atm_dev_ioctl (unsigned int cmd,void __user *arg);
net/bridge/netfilter/ebtables.c renamed from warthog/kernels/linux-2.6.15-rc5/net/bridge/netfilter/ebtables.c +6 -6
@@ -296,7 +296,7 @@ letscontinue:/* If it succeeds, returns element and locks mutex */ static inline void *find_inlist_lock_noload (struct list_head *head,const char *name,int *error, -struct semaphore *mutex) +struct mutx *mutex) {void *ret;
@@ -317,7 +317,7 @@ find_inlist_lock_noload(struct list_head#else static void *find_inlist_lock (struct list_head *head,const char *name,const char *prefix, -int *error,struct semaphore *mutex) +int *error,struct mutex *mutex) {void *ret;
@@ -331,25 +331,25 @@ find_inlist_lock(struct list_head *head,#endif static inline struct ebt_table * -find_table_lock (const char *name,int *error,struct semaphore *mutex) +find_table_lock (const char *name,int *error,struct mutex *mutex) {return find_inlist_lock (&ebt_tables, name,"ebtable_" , error, mutex); }static inline struct ebt_match * -find_match_lock (const char *name,int *error,struct semaphore *mutex) +find_match_lock (const char *name,int *error,struct mutex *mutex) {return find_inlist_lock (&ebt_matches, name,"ebt_" , error, mutex); }static inline struct ebt_watcher * -find_watcher_lock (const char *name,int *error,struct semaphore *mutex) +find_watcher_lock (const char *name,int *error,struct mutex *mutex) {return find_inlist_lock (&ebt_watchers, name,"ebt_" , error, mutex); }static inline struct ebt_target * -find_target_lock (const char *name,int *error,struct semaphore *mutex) +find_target_lock (const char *name,int *error,struct mutex *mutex) {return find_inlist_lock (&ebt_targets, name,"ebt_" , error, mutex); }
net/core/flow.c renamed from warthog/kernels/linux-2.6.15-rc5/net/core/flow.c +1 -1
@@ -20,9 +20,9 @@#include <linux/notifier.h> #include <linux/cpu.h> #include <linux/cpumask.h> +#include <linux/semaphore.h> #include <net/flow.h> #include <asm/atomic.h> -#include <asm/semaphore.h> struct flow_cache_entry {struct flow_cache_entry *next;
net/dccp/proto.c renamed from warthog/kernels/linux-2.6.15-rc5/net/dccp/proto.c +1 -1
@@ -29,7 +29,7 @@#include <net/sock.h> #include <net/xfrm.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <linux/spinlock.h> #include <linux/timer.h> #include <linux/delay.h>
net/ipv4/ipcomp.c renamed from warthog/kernels/linux-2.6.15-rc5/net/ipv4/ipcomp.c +1 -1
@@ -16,7 +16,7 @@#include <linux/config.h> #include <linux/module.h> #include <asm/scatterlist.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <linux/crypto.h> #include <linux/pfkeyv2.h> #include <linux/percpu.h>
net/ipv4/netfilter/arp_tables.c renamed from warthog/kernels/linux-2.6.15-rc5/net/ipv4/netfilter/arp_tables.c +1 -1
@@ -19,9 +19,9 @@#include <linux/proc_fs.h> #include <linux/module.h> #include <linux/init.h> +#include <linux/semaphore.h> #include <asm/uaccess.h> -#include <asm/semaphore.h> #include <linux/netfilter_arp/arp_tables.h>
net/ipv4/netfilter/ip_tables.c renamed from warthog/kernels/linux-2.6.15-rc5/net/ipv4/netfilter/ip_tables.c +1 -1
@@ -24,7 +24,7 @@#include <linux/icmp.h> #include <net/ip.h> #include <asm/uaccess.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <linux/proc_fs.h> #include <linux/err.h> #include <linux/cpumask.h>
net/ipv6/ipcomp6.c renamed from warthog/kernels/linux-2.6.15-rc5/net/ipv6/ipcomp6.c +1 -1
@@ -36,7 +36,7 @@#include <net/xfrm.h> #include <net/ipcomp.h> #include <asm/scatterlist.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <linux/crypto.h> #include <linux/pfkeyv2.h> #include <linux/random.h>
net/ipv6/netfilter/ip6_tables.c renamed from warthog/kernels/linux-2.6.15-rc5/net/ipv6/netfilter/ip6_tables.c +1 -1
@@ -25,7 +25,7 @@#include <linux/icmpv6.h> #include <net/ipv6.h> #include <asm/uaccess.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <linux/proc_fs.h> #include <linux/cpumask.h>
net/sunrpc/sched.c renamed from warthog/kernels/linux-2.6.15-rc5/net/sunrpc/sched.c +0 -2
@@ -971,8 +971,6 @@ void rpc_killall_tasks(struct rpc_clnt *spin_unlock (&rpc_sched_lock); } -static DECLARE_MUTEX_LOCKED (rpciod_running); -static void rpciod_killall (void ) {unsigned long flags;
net/sunrpc/svcsock.c renamed from warthog/kernels/linux-2.6.15-rc5/net/sunrpc/svcsock.c +1 -1
@@ -1351,7 +1351,7 @@ svc_setup_socket(struct svc_serv *serv, svsk->sk_lastrecv =get_seconds ();INIT_LIST_HEAD (&svsk->sk_deferred);INIT_LIST_HEAD (&svsk->sk_ready); -sema_init (&svsk->sk_sem,1 ); +init_MUTEX (&svsk->sk_sem);/* Initialize the socket */ if (sock->type ==SOCK_DGRAM )
PATCH 18/19 MUTEX: Security changes
In reply to David HowellsThe attached patch modifies the security files to use the new mutex functions.
---
warthog>diffstat -p1 mutex-security-2615rc5.diff
security/selinux/hooks.c | 2 +- security/selinux/selinuxfs.c | 2 +- security/selinux/ss/conditional.c | 2 +- security/selinux/ss/services.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
security/selinux/hooks.c renamed from warthog/kernels/linux-2.6.15-rc5/security/selinux/hooks.c +1 -1
@@ -50,7 +50,7 @@#include <net/ip.h> /* for sysctl_local_port_range[] */ #include <net/tcp.h> /* struct or_callable used in sock_rcv_skb */ #include <asm/uaccess.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <asm/ioctls.h> #include <linux/bitops.h> #include <linux/interrupt.h>
security/selinux/selinuxfs.c renamed from warthog/kernels/linux-2.6.15-rc5/security/selinux/selinuxfs.c +1 -1
@@ -22,7 +22,7 @@#include <linux/seq_file.h> #include <linux/percpu.h> #include <asm/uaccess.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> /* selinuxfs pseudo filesystem for exporting the security policy API. Based on the proc code and the fs/nfsd/nfsctl.c code. */
security/selinux/ss/conditional.c renamed from warthog/kernels/linux-2.6.15-rc5/security/selinux/ss/conditional.c +1 -1
@@ -11,7 +11,7 @@#include <linux/errno.h> #include <linux/string.h> #include <linux/spinlock.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <linux/slab.h> #include "security.h"
security/selinux/ss/services.c renamed from warthog/kernels/linux-2.6.15-rc5/security/selinux/ss/services.c +1 -1
@@ -27,7 +27,7 @@#include <linux/in.h> #include <linux/sched.h> #include <linux/audit.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include "flask.h" #include "avc.h" #include "avc_ss.h"
PATCH 19/19 MUTEX: Sound changes
In reply to David HowellsThe attached patch modifies the sound files to use the new mutex functions.
---
warthog>diffstat -p1 mutex-sound-2615rc5.diff
include/sound/ac97_codec.h | 4 ++-- include/sound/ad1848.h | 2 +- include/sound/ak4531_codec.h | 2 +- include/sound/core.h | 4 ++-- include/sound/cs4231.h | 4 ++-- include/sound/cs46xx.h | 2 +- include/sound/emu10k1.h | 4 ++-- include/sound/emux_synth.h | 2 +- include/sound/gus.h | 6 +++--- include/sound/hwdep.h | 2 +- include/sound/i2c.h | 2 +- include/sound/info.h | 2 +- include/sound/mixer_oss.h | 2 +- include/sound/opl3.h | 2 +- include/sound/pcm.h | 2 +- include/sound/pcm_oss.h | 2 +- include/sound/rawmidi.h | 4 ++-- include/sound/sb16_csp.h | 2 +- include/sound/seq_instr.h | 2 +- include/sound/soundfont.h | 2 +- include/sound/util_mem.h | 2 +- include/sound/vx_core.h | 2 +- sound/arm/aaci.h | 2 +- sound/arm/pxa2xx-ac97.c | 2 +- sound/arm/sa11xx-uda1341.c | 2 +- sound/core/memalloc.c | 2 +- sound/core/seq/seq_clientmgr.h | 2 +- sound/core/seq/seq_device.c | 2 +- sound/core/seq/seq_midi.c | 2 +- sound/core/seq/seq_queue.h | 2 +- sound/core/timer.c | 2 +- sound/drivers/opl4/opl4_local.h | 2 +- sound/oss/ac97_codec.c | 2 +- sound/oss/aci.c | 4 ++-- sound/oss/ad1889.h | 2 +- sound/oss/ali5455.c | 2 +- sound/oss/au1000.c | 4 ++-- sound/oss/au1550_ac97.c | 4 ++-- sound/oss/btaudio.c | 2 +- sound/oss/cmpci.c | 2 +- sound/oss/cs4281/cs4281m.c | 6 +++--- sound/oss/cs46xx.c | 6 +++--- sound/oss/dmasound/dmasound_awacs.c | 2 +- sound/oss/emu10k1/hwaccess.h | 2 +- sound/oss/es1370.c | 4 ++-- sound/oss/es1371.c | 4 ++-- sound/oss/esssolo1.c | 2 +- sound/oss/forte.c | 2 +- sound/oss/hal2.c | 2 +- sound/oss/i810_audio.c | 2 +- sound/oss/ite8172.c | 2 +- sound/oss/maestro.c | 2 +- sound/oss/maestro3.c | 2 +- sound/oss/nec_vrc5477.c | 2 +- sound/oss/rme96xx.c | 2 +- sound/oss/sonicvibes.c | 2 +- sound/oss/swarm_cs4297a.c | 6 +++--- sound/oss/trident.c | 4 ++-- sound/oss/via82cxxx_audio.c | 6 +++--- sound/oss/vwsnd.c | 8 ++++---- sound/oss/ymfpci.h | 2 +- sound/pci/atiixp.c | 2 +- sound/pci/atiixp_modem.c | 2 +- sound/pci/cmipci.c | 2 +- sound/pci/ens1370.c | 2 +- sound/pci/es1968.c | 2 +- sound/pci/hda/hda_codec.h | 4 ++-- sound/pci/hda/hda_intel.c | 2 +- sound/pci/hda/patch_analog.c | 2 +- sound/pci/ice1712/ice1712.h | 6 +++--- sound/pci/korg1212/korg1212.c | 2 +- sound/pci/mixart/mixart.h | 6 +++--- sound/pci/nm256/nm256.c | 2 +- sound/sparc/cs4231.c | 4 ++-- sound/usb/usx2y/usbusx2y.h | 2 +- 75 files changed, 105 insertions(+), 105 deletions(-)
include/sound/ac97_codec.h renamed from warthog/kernels/linux-2.6.15-rc5/include/sound/ac97_codec.h +2 -2
@@ -486,8 +486,8 @@ struct _snd_ac97 {snd_info_entry_t *proc_regs;unsigned short subsystem_vendor;unsigned short subsystem_device; -struct semaphore reg_mutex; -struct semaphore page_mutex;/* mutex for AD18xx multi-codecs and paging (2.3) */ +struct mutex reg_mutex; +struct mutex page_mutex;/* mutex for AD18xx multi-codecs and paging (2.3) */ unsigned short num;/* number of codec: 0 = primary, 1 = secondary */ unsigned short addr;/* physical address of codec [0-3] */ unsigned int id;/* identification of codec */
include/sound/ad1848.h renamed from warthog/kernels/linux-2.6.15-rc5/include/sound/ad1848.h +1 -1
@@ -149,7 +149,7 @@ struct _snd_ad1848 {int thinkpad_flag;/* Thinkpad CS4248 needs some extra help */ spinlock_t reg_lock; -struct semaphore open_mutex; +struct mutex open_mutex; };typedef struct _snd_ad1848 ad1848_t ;
include/sound/ak4531_codec.h renamed from warthog/kernels/linux-2.6.15-rc5/include/sound/ak4531_codec.h +1 -1
@@ -72,7 +72,7 @@ struct _snd_ak4531 {void (*private_free) (ak4531_t *ak4531);/* --- */ unsigned char regs[0x20 ]; -struct semaphore reg_mutex; +struct mutex reg_mutex; };int snd_ak4531_mixer (snd_card_t * card,ak4531_t * _ak4531,ak4531_t ** rak4531);
include/sound/core.h renamed from warthog/kernels/linux-2.6.15-rc5/include/sound/core.h +2 -2
@@ -23,7 +23,7 @@*/ #include <linux/sched.h> /* wake_up() */ -#include <asm/semaphore.h> /* struct semaphore */ +#include <linux/semaphore.h> /* struct mutex */ #include <linux/rwsem.h> /* struct rw_semaphore */ #include <linux/workqueue.h> /* struct workqueue_struct */ #include <linux/pm.h> /* pm_message_t */
@@ -176,7 +176,7 @@ struct _snd_card {int (*pm_resume)(snd_card_t *card);void *pm_private_data;unsigned int power_state;/* power state */ -struct semaphore power_lock;/* power lock */ +struct mutex power_lock;/* power lock */ wait_queue_head_t power_sleep;#endif
include/sound/cs4231.h renamed from warthog/kernels/linux-2.6.15-rc5/include/sound/cs4231.h +2 -2
@@ -287,8 +287,8 @@ struct _snd_cs4231 {#endif spinlock_t reg_lock; -struct semaphore mce_mutex; -struct semaphore open_mutex; +struct mutex mce_mutex; +struct mutex open_mutex;int (*rate_constraint) (snd_pcm_runtime_t *runtime);void (*set_playback_format) (cs4231_t *chip,snd_pcm_hw_params_t *hw_params,unsigned char pdfr);
include/sound/cs46xx.h renamed from warthog/kernels/linux-2.6.15-rc5/include/sound/cs46xx.h +1 -1
@@ -1712,7 +1712,7 @@ struct _snd_cs46xx {int current_gpio;#endif #ifdef CONFIG_SND_CS46XX_NEW_DSP -struct semaphore spos_mutex; +struct mutex spos_mutex;dsp_spos_instance_t * dsp_spos_instance;
include/sound/emu10k1.h renamed from warthog/kernels/linux-2.6.15-rc5/include/sound/emu10k1.h +2 -2
@@ -1024,7 +1024,7 @@ typedef struct {int gpr_size;/* size of allocated GPR controls */ int gpr_count;/* count of used kcontrols */ struct list_head gpr_ctl;/* GPR controls */ -struct semaphore lock; +struct mutex lock;snd_emu10k1_fx8010_pcm_t pcm[8 ];spinlock_t irq_lock;snd_emu10k1_fx8010_irq_t *irq_handlers;
@@ -1118,7 +1118,7 @@ struct _snd_emu10k1 {spinlock_t reg_lock;spinlock_t emu_lock;spinlock_t voice_lock; -struct semaphore ptb_lock; +struct mutex ptb_lock;emu10k1_voice_t voices[NUM_G ];emu10k1_voice_t p16v_voices[4 ];
include/sound/emux_synth.h renamed from warthog/kernels/linux-2.6.15-rc5/include/sound/emux_synth.h +1 -1
@@ -112,7 +112,7 @@ struct snd_emux {snd_emux_voice_t *voices;/* Voices (EMU 'channel') */ int use_time;/* allocation counter */ spinlock_t voice_lock;/* Lock for voice access */ -struct semaphore register_mutex; +struct mutex register_mutex;int client;/* For the sequencer client */ int ports[SNDRV_EMUX_MAX_PORTS ];/* The ports for this device */ snd_emux_port_t *portptrs[SNDRV_EMUX_MAX_PORTS ];
include/sound/gus.h renamed from warthog/kernels/linux-2.6.15-rc5/include/sound/gus.h +3 -3
@@ -210,7 +210,7 @@ typedef struct _snd_gf1_mem {snd_gf1_bank_info_t banks_16[4 ];snd_gf1_mem_block_t *first;snd_gf1_mem_block_t *last; -struct semaphore memory_mutex; +struct mutex memory_mutex; } snd_gf1_mem_t; typedef struct snd_gf1_dma_block {
@@ -468,8 +468,8 @@ struct _snd_gus_card {spinlock_t dma_lock;spinlock_t pcm_volume_level_lock;spinlock_t uart_cmd_lock; -struct semaphore dma_mutex; -struct semaphore register_mutex; +struct mutex dma_mutex; +struct mutex register_mutex; };/* I/O functions for GF1/InterWave chip - gus_io.c */
include/sound/hwdep.h renamed from warthog/kernels/linux-2.6.15-rc5/include/sound/hwdep.h +1 -1
@@ -62,7 +62,7 @@ struct _snd_hwdep {void *private_data;void (*private_free) (snd_hwdep_t *hwdep); -struct semaphore open_mutex; +struct mutex open_mutex;int used;unsigned int dsp_loaded; unsigned int exclusive: 1;
include/sound/i2c.h renamed from warthog/kernels/linux-2.6.15-rc5/include/sound/i2c.h +1 -1
@@ -58,7 +58,7 @@ struct _snd_i2c_bus {snd_card_t *card;/* card which I2C belongs to */ char name[32 ];/* some useful label */ -struct semaphore lock_mutex; +struct mutex lock_mutex;snd_i2c_bus_t *master;/* master bus when SCK/SCL is shared */ struct list_head buses;/* master: slave buses sharing SCK/SCL, slave: link list */
include/sound/info.h renamed from warthog/kernels/linux-2.6.15-rc5/include/sound/info.h +1 -1
@@ -86,7 +86,7 @@ struct snd_info_entry {void *private_data;void (*private_free)(snd_info_entry_t *entry);struct proc_dir_entry *p; -struct semaphore access; +struct mutex access; };extern int snd_info_check_reserved_words (const char *str);
include/sound/mixer_oss.h renamed from warthog/kernels/linux-2.6.15-rc5/include/sound/mixer_oss.h +1 -1
@@ -59,7 +59,7 @@ struct _snd_oss_mixer {snd_mixer_oss_put_recsrce_t put_recsrc;void *private_data_recsrc;void (*private_free_recsrc)(snd_mixer_oss_t *mixer); -struct semaphore reg_mutex; +struct mutex reg_mutex;snd_info_entry_t *proc_entry;int oss_dev_alloc;/* --- */
include/sound/opl3.h renamed from warthog/kernels/linux-2.6.15-rc5/include/sound/opl3.h +1 -1
@@ -312,7 +312,7 @@ struct snd_opl3 {int sys_timer_status;/* system timer run status */ spinlock_t sys_timer_lock;/* Lock for system timer access */ #endif -struct semaphore access_mutex;/* locking */ +struct mutex access_mutex;/* locking */ };/* opl3.c */
include/sound/pcm.h renamed from warthog/kernels/linux-2.6.15-rc5/include/sound/pcm.h +1 -1
@@ -445,7 +445,7 @@ struct _snd_pcm {char id[64 ];char name[80 ];snd_pcm_str_t streams[2 ]; -struct semaphore open_mutex; +struct mutex open_mutex;wait_queue_head_t open_wait;void *private_data;void (*private_free) (snd_pcm_t *pcm);
include/sound/pcm_oss.h renamed from warthog/kernels/linux-2.6.15-rc5/include/sound/pcm_oss.h +1 -1
@@ -76,7 +76,7 @@ typedef struct _snd_pcm_oss_substream {typedef struct _snd_pcm_oss_stream {snd_pcm_oss_setup_t *setup_list;/* setup list */ -struct semaphore setup_mutex; +struct mutex setup_mutex;snd_info_entry_t *proc_entry; }snd_pcm_oss_stream_t ;
include/sound/rawmidi.h renamed from warthog/kernels/linux-2.6.15-rc5/include/sound/rawmidi.h +2 -2
@@ -26,7 +26,7 @@#include <linux/interrupt.h> #include <linux/spinlock.h> #include <linux/wait.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #if defined(CONFIG_SND_SEQUENCER ) || defined(CONFIG_SND_SEQUENCER_MODULE )#include "seq_device.h"
@@ -136,7 +136,7 @@ struct _snd_rawmidi {void *private_data;void (*private_free) (snd_rawmidi_t *rmidi); -struct semaphore open_mutex; +struct mutex open_mutex;wait_queue_head_t open_wait;snd_info_entry_t *dev;
include/sound/sb16_csp.h renamed from warthog/kernels/linux-2.6.15-rc5/include/sound/sb16_csp.h +1 -1
@@ -158,7 +158,7 @@ struct snd_sb_csp {snd_kcontrol_t *qsound_switch;snd_kcontrol_t *qsound_space; -struct semaphore access_mutex;/* locking */ +struct mutex access_mutex;/* locking */ };int snd_sb_csp_new (sb_t *chip,int device,snd_hwdep_t ** rhwdep);
include/sound/seq_instr.h renamed from warthog/kernels/linux-2.6.15-rc5/include/sound/seq_instr.h +1 -1
@@ -66,7 +66,7 @@ typedef struct {spinlock_t lock;spinlock_t ops_lock; -struct semaphore ops_mutex; +struct mutex ops_mutex;unsigned long ops_flags; } snd_seq_kinstr_list_t;
include/sound/soundfont.h renamed from warthog/kernels/linux-2.6.15-rc5/include/sound/soundfont.h +1 -1
@@ -96,7 +96,7 @@ typedef struct snd_sf_list {int sample_locked;/* locked time for sample */ snd_sf_callback_t callback;/* callback functions */ int presets_locked; -struct semaphore presets_mutex; +struct mutex presets_mutex;spinlock_t lock;snd_util_memhdr_t *memhdr; } snd_sf_list_t;
include/sound/util_mem.h renamed from warthog/kernels/linux-2.6.15-rc5/include/sound/util_mem.h +1 -1
@@ -44,7 +44,7 @@ struct snd_util_memhdr {int nblocks;/* # of allocated blocks */ snd_util_unit_t used;/* used memory size */ int block_extra_size;/* extra data size of chunk */ -struct semaphore block_mutex;/* lock */ +struct mutex block_mutex;/* lock */ };/*
include/sound/vx_core.h renamed from warthog/kernels/linux-2.6.15-rc5/include/sound/vx_core.h +1 -1
@@ -207,7 +207,7 @@ struct snd_vx_core {int audio_monitor[4 ];/* playback hw-monitor level */ unsigned char audio_monitor_active[4 ];/* playback hw-monitor mute/unmute */ -struct semaphore mixer_mutex; +struct mutex mixer_mutex;const struct firmware *firmware[4 ];/* loaded firmware data */ };
sound/arm/aaci.h renamed from warthog/kernels/linux-2.6.15-rc5/sound/arm/aaci.h +1 -1
@@ -227,7 +227,7 @@ struct aaci {unsigned int fifosize;/* AC'97 */ -struct semaphore ac97_sem; +struct mutex ac97_sem;ac97_bus_t *ac97_bus;u32 maincr;
sound/arm/pxa2xx-ac97.c renamed from warthog/kernels/linux-2.6.15-rc5/sound/arm/pxa2xx-ac97.c +1 -1
@@ -17,6 +17,7 @@#include <linux/interrupt.h> #include <linux/wait.h> #include <linux/delay.h> +#include <linux/semaphore.h> #include <sound/driver.h> #include <sound/core.h>
@@ -25,7 +26,6 @@#include <sound/initval.h> #include <asm/irq.h> -#include <asm/semaphore.h> #include <asm/hardware.h> #include <asm/arch/pxa-regs.h> #include <asm/arch/audio.h>
sound/arm/sa11xx-uda1341.c renamed from warthog/kernels/linux-2.6.15-rc5/sound/arm/sa11xx-uda1341.c +1 -1
@@ -79,7 +79,7 @@#include <asm/dma.h> #ifdef CONFIG_H3600_HAL -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <asm/uaccess.h> #include <asm/arch/h3600_hal.h> #endif
sound/core/memalloc.c renamed from warthog/kernels/linux-2.6.15-rc5/sound/core/memalloc.c +1 -1
@@ -31,7 +31,7 @@#include <asm/uaccess.h> #include <linux/dma-mapping.h> #include <linux/moduleparam.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <sound/memalloc.h> #ifdef CONFIG_SBUS #include <asm/sbus.h>
sound/core/seq/seq_clientmgr.h renamed from warthog/kernels/linux-2.6.15-rc5/sound/core/seq/seq_clientmgr.h +1 -1
@@ -61,7 +61,7 @@ struct _snd_seq_client {int num_ports;/* number of ports */ struct list_head ports_list_head;rwlock_t ports_lock; -struct semaphore ports_mutex; +struct mutex ports_mutex;int convert32;/* convert 32->64bit */ /* output pool */
sound/core/seq/seq_device.c renamed from warthog/kernels/linux-2.6.15-rc5/sound/core/seq/seq_device.c +1 -1
@@ -74,7 +74,7 @@ struct ops_list {struct list_head dev_list;/* list of devices */ int num_devices;/* number of associated devices */ int num_init_devices;/* number of initialized devices */ -struct semaphore reg_mutex; +struct mutex reg_mutex;struct list_head list;/* next driver */ };
sound/core/seq/seq_midi.c renamed from warthog/kernels/linux-2.6.15-rc5/sound/core/seq/seq_midi.c +1 -1
@@ -32,7 +32,7 @@ Possible options for midisynth module:#include <linux/errno.h> #include <linux/string.h> #include <linux/moduleparam.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <sound/core.h> #include <sound/rawmidi.h> #include <sound/seq_kernel.h>
sound/core/seq/seq_queue.h renamed from warthog/kernels/linux-2.6.15-rc5/sound/core/seq/seq_queue.h +1 -1
@@ -54,7 +54,7 @@ struct _snd_seq_queue {/* clients which uses this queue (bitmap) */ DECLARE_BITMAP (clients_bitmap,SNDRV_SEQ_MAX_CLIENTS );unsigned int clients;/* users of this queue */ -struct semaphore timer_mutex; +struct mutex timer_mutex;snd_use_lock_t use_lock; };
sound/core/timer.c renamed from warthog/kernels/linux-2.6.15-rc5/sound/core/timer.c +1 -1
@@ -70,7 +70,7 @@ typedef struct {struct timespec tstamp;/* trigger tstamp */ wait_queue_head_t qchange_sleep;struct fasync_struct *fasync; -struct semaphore tread_sem; +struct mutex tread_sem; } snd_timer_user_t;/* list of timers */
sound/drivers/opl4/opl4_local.h renamed from warthog/kernels/linux-2.6.15-rc5/sound/drivers/opl4/opl4_local.h +1 -1
@@ -182,7 +182,7 @@ struct opl4 {snd_info_entry_t *proc_entry;int memory_access;#endif -struct semaphore access_mutex; +struct mutex access_mutex;#if defined(CONFIG_SND_SEQUENCER ) || defined(CONFIG_SND_SEQUENCER_MODULE )int used;
sound/oss/ac97_codec.c renamed from warthog/kernels/linux-2.6.15-rc5/sound/oss/ac97_codec.c +1 -1
@@ -54,8 +54,8 @@#include <linux/delay.h> #include <linux/pci.h> #include <linux/ac97_codec.h> +#include <linux/semaphore.h> #include <asm/uaccess.h> -#include <asm/semaphore.h> #define CODEC_ID_BUFSZ 14
sound/oss/aci.c renamed from warthog/kernels/linux-2.6.15-rc5/sound/oss/aci.c +2 -2
@@ -56,7 +56,7 @@#include <linux/module.h> #include <linux/proc_fs.h> #include <linux/slab.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <asm/io.h> #include <asm/uaccess.h> #include "sound_config.h"
@@ -79,7 +79,7 @@ static int aci_micpreamp=3; /* microphon* checked with ACI versions prior to 0xb0 */ static int mixer_device; -static struct semaphore aci_sem; +static struct mutex aci_sem;#ifdef MODULE static int reset;
sound/oss/ad1889.h renamed from warthog/kernels/linux-2.6.15-rc5/sound/oss/ad1889.h +1 -1
@@ -100,7 +100,7 @@ typedef struct ad1889_state {unsigned int subdivision; } dmabuf; -struct semaphore sem; +struct mutex sem; } ad1889_state_t; typedef struct ad1889_dev {
sound/oss/ali5455.c renamed from warthog/kernels/linux-2.6.15-rc5/sound/oss/ali5455.c +1 -1
@@ -234,7 +234,7 @@ struct ali_state {struct ali_card *card;/* Card info */ /* single open lock mechanism, only used for recording */ -struct semaphore open_sem; +struct mutex open_sem;wait_queue_head_t open_wait;/* file mode */
sound/oss/au1000.c renamed from warthog/kernels/linux-2.6.15-rc5/sound/oss/au1000.c +2 -2
@@ -120,8 +120,8 @@ struct au1000_state {int no_vra;// do not use VRA spinlock_t lock; -struct semaphore open_sem; -struct semaphore sem; +struct mutex open_sem; +struct mutex sem;mode_t open_mode;wait_queue_head_t open_wait;
sound/oss/au1550_ac97.c renamed from warthog/kernels/linux-2.6.15-rc5/sound/oss/au1550_ac97.c +2 -2
@@ -90,8 +90,8 @@ static struct au1550_state {int no_vra;/* do not use VRA */ spinlock_t lock; -struct semaphore open_sem; -struct semaphore sem; +struct mutex open_sem; +struct mutex sem;mode_t open_mode;wait_queue_head_t open_wait;
sound/oss/btaudio.c renamed from warthog/kernels/linux-2.6.15-rc5/sound/oss/btaudio.c +1 -1
@@ -108,7 +108,7 @@ struct btaudio {/* locking */ int users; -struct semaphore lock; +struct mutex lock;/* risc instructions */ unsigned int risc_size;
sound/oss/cmpci.c renamed from warthog/kernels/linux-2.6.15-rc5/sound/oss/cmpci.c +1 -1
@@ -392,7 +392,7 @@ struct cm_state {unsigned char fmt, enable;spinlock_t lock; -struct semaphore open_sem; +struct mutex open_sem;mode_t open_mode;wait_queue_head_t open_wait;
sound/oss/cs4281/cs4281m.c renamed from warthog/kernels/linux-2.6.15-rc5/sound/oss/cs4281/cs4281m.c +3 -3
@@ -245,9 +245,9 @@ struct cs4281_state {void *tmpbuff;// tmp buffer for sample conversions unsigned ena;spinlock_t lock; -struct semaphore open_sem; -struct semaphore open_sem_adc; -struct semaphore open_sem_dac; +struct mutex open_sem; +struct mutex open_sem_adc; +struct mutex open_sem_dac;mode_t open_mode;wait_queue_head_t open_wait;wait_queue_head_t open_wait_adc;
sound/oss/cs46xx.c renamed from warthog/kernels/linux-2.6.15-rc5/sound/oss/cs46xx.c +3 -3
@@ -238,7 +238,7 @@ struct cs_state {struct cs_card *card;/* Card info */ /* single open lock mechanism, only used for recording */ -struct semaphore open_sem; +struct mutex open_sem;wait_queue_head_t open_wait;/* file mode */
@@ -297,7 +297,7 @@ struct cs_state {unsigned subdivision; } dmabuf;/* Guard against mmap/write/read races */ -struct semaphore sem; +struct mutex sem; };struct cs_card {
@@ -375,7 +375,7 @@ struct cs_card {unsigned char ibuf[CS_MIDIINBUF ];unsigned char obuf[CS_MIDIOUTBUF ];mode_t open_mode; -struct semaphore open_sem; +struct mutex open_sem; } midi;struct cs46xx_pm pm; };
sound/oss/dmasound/dmasound_awacs.c renamed from warthog/kernels/linux-2.6.15-rc5/sound/oss/dmasound/dmasound_awacs.c +1 -1
@@ -80,7 +80,7 @@#include <linux/kmod.h> #include <linux/interrupt.h> #include <linux/input.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #ifdef CONFIG_ADB_CUDA #include <linux/cuda.h> #endif
sound/oss/emu10k1/hwaccess.h renamed from warthog/kernels/linux-2.6.15-rc5/sound/oss/emu10k1/hwaccess.h +1 -1
@@ -181,7 +181,7 @@ struct emu10k1_cardstruct emu10k1_mpuout *mpuout;struct emu10k1_mpuin *mpuin; -struct semaphore open_sem; +struct mutex open_sem;mode_t open_mode;wait_queue_head_t open_wait;
sound/oss/es1370.c renamed from warthog/kernels/linux-2.6.15-rc5/sound/oss/es1370.c +2 -2
@@ -346,7 +346,7 @@ struct es1370_state {unsigned sctrl;spinlock_t lock; -struct semaphore open_sem; +struct mutex open_sem;mode_t open_mode;wait_queue_head_t open_wait;
@@ -393,7 +393,7 @@ struct es1370_state {struct gameport *gameport;#endif -struct semaphore sem; +struct mutex sem; };/* --------------------------------------------------------------------- */
sound/oss/es1371.c renamed from warthog/kernels/linux-2.6.15-rc5/sound/oss/es1371.c +2 -2
@@ -419,7 +419,7 @@ struct es1371_state {unsigned dac1rate, dac2rate, adcrate;spinlock_t lock; -struct semaphore open_sem; +struct mutex open_sem;mode_t open_mode;wait_queue_head_t open_wait;
@@ -462,7 +462,7 @@ struct es1371_state {struct gameport *gameport;#endif -struct semaphore sem; +struct mutex sem; };/* --------------------------------------------------------------------- */
sound/oss/esssolo1.c renamed from warthog/kernels/linux-2.6.15-rc5/sound/oss/esssolo1.c +1 -1
@@ -191,7 +191,7 @@ struct solo1_state {unsigned ena;spinlock_t lock; -struct semaphore open_sem; +struct mutex open_sem;mode_t open_mode;wait_queue_head_t open_wait;
sound/oss/forte.c renamed from warthog/kernels/linux-2.6.15-rc5/sound/oss/forte.c +1 -1
@@ -185,7 +185,7 @@ struct forte_chip {unsigned long iobase;int irq; -struct semaphore open_sem;/* Device access */ +struct mutex open_sem;/* Device access */ spinlock_t lock;/* State */ spinlock_t ac97_lock;
sound/oss/hal2.c renamed from warthog/kernels/linux-2.6.15-rc5/sound/oss/hal2.c +1 -1
@@ -92,7 +92,7 @@ struct hal2_codec {wait_queue_head_t dma_wait;spinlock_t lock; -struct semaphore sem; +struct mutex sem;int usecount;/* recording and playback are * independent */
sound/oss/i810_audio.c renamed from warthog/kernels/linux-2.6.15-rc5/sound/oss/i810_audio.c +1 -1
@@ -330,7 +330,7 @@ struct i810_state {struct i810_card *card;/* Card info */ /* single open lock mechanism, only used for recording */ -struct semaphore open_sem; +struct mutex open_sem;wait_queue_head_t open_wait;/* file mode */
sound/oss/ite8172.c renamed from warthog/kernels/linux-2.6.15-rc5/sound/oss/ite8172.c +1 -1
@@ -304,7 +304,7 @@ struct it8172_state {unsigned dacrate, adcrate;spinlock_t lock; -struct semaphore open_sem; +struct mutex open_sem;mode_t open_mode;wait_queue_head_t open_wait;
sound/oss/maestro3.c renamed from warthog/kernels/linux-2.6.15-rc5/sound/oss/maestro3.c +1 -1
@@ -205,7 +205,7 @@ struct m3_state {when irqhandler uses s->lock and m3_assp_read uses card->lock ? */ -struct semaphore open_sem; +struct mutex open_sem;wait_queue_head_t open_wait;mode_t open_mode;
sound/oss/maestro.c renamed from warthog/kernels/linux-2.6.15-rc5/sound/oss/maestro.c +1 -1
@@ -401,7 +401,7 @@ struct ess_state {/* this locks around the oss state in the driver */ spinlock_t lock;/* only let 1 be opening at a time */ -struct semaphore open_sem; +struct mutex open_sem;wait_queue_head_t open_wait;mode_t open_mode;
sound/oss/nec_vrc5477.c renamed from warthog/kernels/linux-2.6.15-rc5/sound/oss/nec_vrc5477.c +1 -1
@@ -198,7 +198,7 @@ struct vrc5477_ac97_state {unsigned short extended_status;spinlock_t lock; -struct semaphore open_sem; +struct mutex open_sem;mode_t open_mode;wait_queue_head_t open_wait;
sound/oss/rme96xx.c renamed from warthog/kernels/linux-2.6.15-rc5/sound/oss/rme96xx.c +1 -1
@@ -326,7 +326,7 @@ typedef struct _rme96xx_info {/* waiting and locking */ wait_queue_head_t wait; -struct semaphore open_sem; +struct mutex open_sem;wait_queue_head_t open_wait; } dma[RME96xx_MAX_DEVS];
sound/oss/sonicvibes.c renamed from warthog/kernels/linux-2.6.15-rc5/sound/oss/sonicvibes.c +1 -1
@@ -328,7 +328,7 @@ struct sv_state {unsigned char fmt, enable;spinlock_t lock; -struct semaphore open_sem; +struct mutex open_sem;mode_t open_mode;wait_queue_head_t open_wait;
sound/oss/swarm_cs4297a.c renamed from warthog/kernels/linux-2.6.15-rc5/sound/oss/swarm_cs4297a.c +3 -3
@@ -291,9 +291,9 @@ struct cs4297a_state { unsigned conversion:1; // conversion from 16 to 8 bit in progressunsigned ena;spinlock_t lock; -struct semaphore open_sem; -struct semaphore open_sem_adc; -struct semaphore open_sem_dac; +struct mutex open_sem; +struct mutex open_sem_adc; +struct mutex open_sem_dac;mode_t open_mode;wait_queue_head_t open_wait;wait_queue_head_t open_wait_adc;
sound/oss/trident.c renamed from warthog/kernels/linux-2.6.15-rc5/sound/oss/trident.c +2 -2
@@ -351,7 +351,7 @@ struct trident_state {unsigned chans_num;unsigned long fmt_flag;/* Guard against mmap/write/read races */ -struct semaphore sem; +struct mutex sem; };
@@ -404,7 +404,7 @@ struct trident_card {struct trident_card *next;/* single open lock mechanism, only used for recording */ -struct semaphore open_sem; +struct mutex open_sem;/* The trident has a certain amount of cross channel interaction so we use a single per card lock */
sound/oss/via82cxxx_audio.c renamed from warthog/kernels/linux-2.6.15-rc5/sound/oss/via82cxxx_audio.c +3 -3
@@ -36,9 +36,9 @@#include <linux/ioport.h> #include <linux/delay.h> #include <linux/dma-mapping.h> +#include <linux/semaphore.h> #include <asm/io.h> #include <asm/uaccess.h> -#include <asm/semaphore.h> #include "sound_config.h" #include "dev_table.h" #include "mpu401.h"
@@ -311,8 +311,8 @@ struct via_info {int mixer_vol;/* 8233/35 volume - not yet implemented */ -struct semaphore syscall_sem; -struct semaphore open_sem; +struct mutex syscall_sem; +struct mutex open_sem;/* The 8233/8235 have 4 DX audio channels, two record and one six channel out. We bind ch_in to DX 1, ch_out to multichannel
sound/oss/vwsnd.c renamed from warthog/kernels/linux-2.6.15-rc5/sound/oss/vwsnd.c +4 -4
@@ -148,7 +148,7 @@#include <linux/smp_lock.h> #include <linux/wait.h> #include <linux/interrupt.h> -#include <asm/semaphore.h> +#include <linux/semaphore.h> #include <asm/mach-visws/cobalt.h> #include "sound_config.h"
@@ -1507,9 +1507,9 @@ typedef struct vwsnd_dev {int audio_minor;/* minor number of audio device */ int mixer_minor;/* minor number of mixer device */ -struct semaphore open_sema; -struct semaphore io_sema; -struct semaphore mix_sema; +struct mutex open_sema; +struct mutex io_sema; +struct mutex mix_sema;mode_t open_mode;wait_queue_head_t open_wait;
sound/oss/ymfpci.h renamed from warthog/kernels/linux-2.6.15-rc5/sound/oss/ymfpci.h +1 -1
@@ -279,7 +279,7 @@ struct ymf_unit {/* soundcore stuff */ int dev_audio; -struct semaphore open_sem; +struct mutex open_sem;struct list_head ymf_devs;struct list_head states;/* List of states for this unit */
sound/pci/atiixp.c renamed from warthog/kernels/linux-2.6.15-rc5/sound/pci/atiixp.c +1 -1
@@ -280,7 +280,7 @@ struct snd_atiixp {unsigned int codec_not_ready_bits;/* for codec detection */ int spdif_over_aclink;/* passed from the module option */ -struct semaphore open_mutex;/* playback open mutex */ +struct mutex open_mutex;/* playback open mutex */ };
sound/pci/atiixp_modem.c renamed from warthog/kernels/linux-2.6.15-rc5/sound/pci/atiixp_modem.c +1 -1
@@ -258,7 +258,7 @@ struct snd_atiixp {unsigned int codec_not_ready_bits;/* for codec detection */ int spdif_over_aclink;/* passed from the module option */ -struct semaphore open_mutex;/* playback open mutex */ +struct mutex open_mutex;/* playback open mutex */ };
sound/pci/cmipci.c renamed from warthog/kernels/linux-2.6.15-rc5/sound/pci/cmipci.c +1 -1
@@ -440,7 +440,7 @@ struct snd_stru_cmipci {snd_pcm_hardware_t *hw_info[3 ];/* for playbacks */ int opened[2 ];/* open mode */ -struct semaphore open_mutex; +struct mutex open_mutex; unsigned int mixer_insensitive: 1;snd_kcontrol_t *mixer_res_ctl[CM_SAVED_MIXERS ];
sound/pci/ens1370.c renamed from warthog/kernels/linux-2.6.15-rc5/sound/pci/ens1370.c +1 -1
@@ -364,7 +364,7 @@ typedef struct _snd_ensoniq ensoniq_t;struct _snd_ensoniq {spinlock_t reg_lock; -struct semaphore src_mutex; +struct mutex src_mutex;int irq;
sound/pci/es1968.c renamed from warthog/kernels/linux-2.6.15-rc5/sound/pci/es1968.c +1 -1
@@ -573,7 +573,7 @@ struct snd_es1968 {u16 maestro_map[32 ];int bobclient;/* active timer instancs */ int bob_freq;/* timer frequency */ -struct semaphore memory_mutex;/* memory lock */ +struct mutex memory_mutex;/* memory lock */ /* APU states */ unsigned char apu[NR_APUS ];
sound/pci/hda/hda_codec.h renamed from warthog/kernels/linux-2.6.15-rc5/sound/pci/hda/hda_codec.h +2 -2
@@ -432,7 +432,7 @@ struct hda_bus {struct list_head codec_list;struct hda_codec *caddr_tbl[HDA_MAX_CODEC_ADDRESS +1 ];/* caddr -> codec */ -struct semaphore cmd_mutex; +struct mutex cmd_mutex;/* unsolicited event queue */ struct hda_bus_unsolicited *unsol;
@@ -547,7 +547,7 @@ struct hda_codec {int num_amp_entries;struct hda_amp_info amp_info[128 ];/* big enough? */ -struct semaphore spdif_mutex; +struct mutex spdif_mutex;unsigned int spdif_status;/* IEC958 status bits */ unsigned short spdif_ctls;/* SPDIF control bits */ unsigned int spdif_in_enable;/* SPDIF input enable? */
sound/pci/hda/hda_intel.c renamed from warthog/kernels/linux-2.6.15-rc5/sound/pci/hda/hda_intel.c +1 -1
@@ -298,7 +298,7 @@ struct snd_azx {/* locks */ spinlock_t reg_lock; -struct semaphore open_mutex; +struct mutex open_mutex;/* streams (x num_streams) */ azx_dev_t *azx_dev;
sound/pci/hda/patch_analog.c renamed from warthog/kernels/linux-2.6.15-rc5/sound/pci/hda/patch_analog.c +1 -1
@@ -58,7 +58,7 @@ struct ad198x_spec {/* PCM information */ struct hda_pcm pcm_rec[2 ];/* used in alc_build_pcms() */ -struct semaphore amp_mutex;/* PCM volume/mute control mutex */ +struct mutex amp_mutex;/* PCM volume/mute control mutex */ unsigned int spdif_route; };
sound/pci/ice1712/ice1712.h renamed from warthog/kernels/linux-2.6.15-rc5/sound/pci/ice1712/ice1712.h +3 -3
@@ -334,7 +334,7 @@ struct _snd_ice1712 {unsigned int num_total_adcs;/* total ADCs */ unsigned int cur_rate;/* current rate */ -struct semaphore open_mutex; +struct mutex open_mutex;snd_pcm_substream_t *pcm_reserved[4 ];snd_pcm_hw_constraint_list_t *hw_rates;/* card-specific rate constraints */
@@ -342,7 +342,7 @@ struct _snd_ice1712 {akm4xxx_t *akm;struct snd_ice1712_spdif spdif; -struct semaphore i2c_mutex;/* I2C mutex for ICE1724 registers */ +struct mutex i2c_mutex;/* I2C mutex for ICE1724 registers */ snd_i2c_bus_t *i2c;/* I2C bus */ snd_i2c_device_t *cs8427;/* CS8427 I2C device */ unsigned int cs8427_timeout;/* CS8427 reset timeout in HZ/100 */
@@ -360,7 +360,7 @@ struct _snd_ice1712 {void (*set_pro_rate)(ice1712_t *ice,unsigned int rate);void (*i2s_mclk_changed)(ice1712_t *ice); } gpio; -struct semaphore gpio_mutex; +struct mutex gpio_mutex;/* other board-specific data */ union {
sound/pci/korg1212/korg1212.c renamed from warthog/kernels/linux-2.6.15-rc5/sound/pci/korg1212/korg1212.c +1 -1
@@ -324,7 +324,7 @@ struct _snd_korg1212 {int irq;spinlock_t lock; -struct semaphore open_mutex; +struct mutex open_mutex;struct timer_list timer;/* timer callback for checking ack of stop request */ int stop_pending_cnt;/* counter for stop pending check */
sound/pci/mixart/mixart.h renamed from warthog/kernels/linux-2.6.15-rc5/sound/pci/mixart/mixart.h +3 -3
@@ -107,9 +107,9 @@ struct snd_mixart_mgr {spinlock_t lock;/* interrupt spinlock */ spinlock_t msg_lock;/* mailbox spinlock */ -struct semaphore msg_mutex;/* mutex for blocking_requests */ +struct mutex msg_mutex;/* mutex for blocking_requests */ -struct semaphore setup_mutex;/* mutex used in hw_params, open and close */ +struct mutex setup_mutex;/* mutex used in hw_params, open and close */ /* hardware interface */ unsigned int dsp_loaded;/* bit flags of loaded dsp indices */
@@ -122,7 +122,7 @@ struct snd_mixart_mgr {int sample_rate;int ref_count_rate; -struct semaphore mixer_mutex;/* mutex for mixer */ +struct mutex mixer_mutex;/* mutex for mixer */ };
sound/pci/nm256/nm256.c renamed from warthog/kernels/linux-2.6.15-rc5/sound/pci/nm256/nm256.c +1 -1
@@ -242,7 +242,7 @@ struct snd_nm256 {int irq_acks;irqreturn_t (*interrupt)(int ,void *,struct pt_regs *);int badintrcount;/* counter to check bogus interrupts */ -struct semaphore irq_mutex; +struct mutex irq_mutex;nm256_stream_t streams[2 ];
sound/sparc/cs4231.c renamed from warthog/kernels/linux-2.6.15-rc5/sound/sparc/cs4231.c +2 -2
@@ -116,8 +116,8 @@ struct snd_cs4231 {unsigned char image[32 ];/* registers image */ int mce_bit;int calibrate_mute; -struct semaphore mce_mutex; -struct semaphore open_mutex; +struct mutex mce_mutex; +struct mutex open_mutex;union {#ifdef SBUS_SUPPORT
sound/usb/usx2y/usbusx2y.h renamed from warthog/kernels/linux-2.6.15-rc5/sound/usb/usx2y/usbusx2y.h +1 -1
@@ -35,7 +35,7 @@ typedef struct {unsigned int rate, format;int chip_status; -struct semaphore prepare_mutex; +struct mutex prepare_mutex;us428ctls_sharedmem_t *us428ctls_sharedmem;int wait_iso_frame;wait_queue_head_t us428ctls_wait_queue_head;
Quoted 11 lines · David Howells
The attached patch introduces a simple mutex implementation as an alternative to the usual semaphore implementation where simple mutex functionality is all that is required.
This is useful in two ways:
(1) A number of archs only provide very simple atomic instructions (such as XCHG on i386, TAS on M68K, SWAP on FRV) which aren't sufficient to implement full semaphore support directly. Instead spinlocks must be employed to implement fuller functionality.
We have atomic_cmpxchg. Can you use that for a sufficient generic implementation?
Signature · 3 lines
SUSE Labs, Novell Inc. Send instant messages to your online friends http://au.messenger.yahoo.com
Quoted 2 lines · Nick Piggin
We have
atomic_cmpxchg. Can you use that for a sufficient generic implementation?
No. CMPXCHG/CAS is not as available as XCHG, and it's also unnecessary.
David
Quoted 6 lines · David Howells
Quoted 2 lines · Nick Piggin
We have
atomic_cmpxchg. Can you use that for a sufficient generic implementation?No. CMPXCHG/CAS is not as available as XCHG, and it's also unnecessary.
take a look at the PREEMPT_RT implementation of mutexes: it uses cmpxchg(), and thus both the down() and the up() fastpath is lockless! (And that is a mutex type that does alot more things, as it supports priority inheritance.)
architectures which dont have cmpxchg can use a spinlock just fine.
Ingo
Quoted 5 lines · Ingo Molnar
Quoted 5 lines
Quoted 2 lines · Nick Piggin
We have
atomic_cmpxchg. Can you use that for a sufficient generic implementation?
Quoted 8 lines
Quoted 1 line
No. CMPXCHG/CAS is not as available as XCHG, and it's also unnecessary.
take a look at the
PREEMPT_RTimplementation of mutexes: it usescmpxchg(), and thus both thedown()and theup()fastpath is lockless! (And that is a mutex type that does alot more things, as it supports priority inheritance.)architectures which dont have cmpxchg can use a spinlock just fine.
the cost of a spinlock-based generic_cmpxchg could be significantly reduced by adding a generic_cmpxchg() variant that also includes a 'spinlock pointer' parameter.
Architectures that do not have the instruction, can use the specified spinlock to do the cmpxchg. This means that there wont be one single global spinlock to emulate cmpxchg, but the mutex's own spinlock can be used for it.
Architectures that have the cmpxchg instruction would simply ignore the parameter, and would incur no overhead.
Ingo
Quoted 21 lines · Ingo Molnar
Quoted 5 lines · Ingo Molnar
Quoted 5 lines
Quoted 2 lines · Nick Piggin
We have
atomic_cmpxchg. Can you use that for a sufficient generic implementation?Quoted 8 lines
Quoted 1 line
No. CMPXCHG/CAS is not as available as XCHG, and it's also unnecessary.
take a look at the
PREEMPT_RTimplementation of mutexes: it usescmpxchg(), and thus both thedown()and theup()fastpath is lockless! (And that is a mutex type that does alot more things, as it supports priority inheritance.)architectures which dont have cmpxchg can use a spinlock just fine.
the cost of a spinlock-based
generic_cmpxchgcould be significantly reduced by adding ageneric_cmpxchg()variant that also includes a 'spinlock pointer' parameter.
Quoted 7 lines
Architectures that do not have the instruction, can use the specified spinlock to do the cmpxchg. This means that there wont be one single global spinlock to emulate cmpxchg, but the mutex's own spinlock can be used for it.
Architectures that have the cmpxchg instruction would simply ignore the parameter, and would incur no overhead.
an additional twist: we could add generic_cmpxchg_lock(), which would return the spinlock locked if the cmpxchg fails. (this is what we want to do anyway) This way architectures that dont have CMPXCHG would take the spinlock unconditionally and do the cmp-xchg emulation, while the other architectures would take it only if the cmpxchg fails.
Ingo
Oliver Neukum
maintainerAm Dienstag, 13. Dezember 2005 11:34 schrieb Ingo Molnar:
Quoted 8 lines
the cost of a spinlock-based
generic_cmpxchgcould be significantly reduced by adding ageneric_cmpxchg()variant that also includes a 'spinlock pointer' parameter.Architectures that do not have the instruction, can use the specified spinlock to do the cmpxchg. This means that there wont be one single global spinlock to emulate cmpxchg, but the mutex's own spinlock can be used for it.
Can't you use the pointer as a hash input?
Regards
Oliver
Quoted 5 lines · Oliver Neukum
Quoted 3 lines
spinlock to do the cmpxchg. This means that there wont be one single global spinlock to emulate cmpxchg, but the mutex's own spinlock can be used for it.
Can't you use the pointer as a hash input?
Some platforms already do this for certain sets of operations like atomic_t. The downside however is that you no longer control the lock contention or cache line bouncing. It becomes a question of luck rather than science as to how well it scales.
Quoted 7 lines · Alan Cox
Quoted 1 line · Oliver Neukum
Can't you use the pointer as a hash input?
Some platforms already do this for certain sets of operations like
atomic_t. The downside however is that you no longer control the lock contention or cache line bouncing. It becomes a question of luck rather than science as to how well it scales.
s/luck/statistics/
You can always increase the size of the hash table if you encounter scaling problems.
Quoted 6 lines · Matthew Wilcox
Quoted 4 lines
Some platforms already do this for certain sets of operations like
atomic_t. The downside however is that you no longer control the lock contention or cache line bouncing. It becomes a question of luck rather than science as to how well it scales.s/luck/statistics/
Unfortunately not always. Statistical probability models generally assume that samples are independent, as does just growing the hash table. If there are correlations then how those correlations and the hash function interact isn't simple statistics so growing the hash might not work as well as would be hoped.
A second problem with the hash is it makes priority inversions entertaining and unpredictable when using Ingo's -rt work. That isn't a big problem with the atomic_t stuff in the parisc tree because atomic_t is effectively the top of the lock ordering for the system.
Growing the hash while it may improve the behaviour isn't going to work as well as embedding the lock in the object.
Alan
Oliver Neukum
maintainerAm Dienstag, 13. Dezember 2005 14:09 schrieb Alan Cox:
Quoted 11 lines · Oliver Neukum
Quoted 5 lines
Quoted 3 lines
spinlock to do the cmpxchg. This means that there wont be one single global spinlock to emulate cmpxchg, but the mutex's own spinlock can be used for it.
Can't you use the pointer as a hash input?
Some platforms already do this for certain sets of operations like
atomic_t. The downside however is that you no longer control the lock contention or cache line bouncing. It becomes a question of luck rather than science as to how well it scales.
On the other hand you don't control cache eviction either, do you?
Regards
Oliver
Quoted 9 lines · David Howells
Quoted 2 lines · Nick Piggin
We have
atomic_cmpxchg. Can you use that for a sufficient generic implementation?No. CMPXCHG/CAS is not as available as XCHG, and it's also unnecessary.
atomic_cmpxchg should be available on all platforms.
While it may be strictly unnecessary, if it can be used to avoid having a crappy default implementation that requires it to be reimplemented in all architectures then that would be a good thing.
Any arguments about bad scalability or RT behaviour of the hashed spinlock emulation atomic_t implementations are silly because they are used by all atomic_ operations. It is an arch implementation detail that generic code should not have to worry about.
Signature · 3 lines
SUSE Labs, Novell Inc. Send instant messages to your online friends http://au.messenger.yahoo.com
Quoted 1 line · Nick Piggin
atomic_cmpxchgshould be available on all platforms.
Two points:
(1) If it's using spinlocks, then it's pointless to use atomic_cmpxchg.
(2) atomic_t is a 32-bit type, and on a 64-bit platform I will want a 64-bit type so that I can stick the owner address in there (I've got a second variant not yet released).
David
Quoted 10 lines · David Howells
Quoted 1 line · Nick Piggin
atomic_cmpxchgshould be available on all platforms.Two points:
(1) If it's using spinlocks, then it's pointless to use
atomic_cmpxchg.
Why?
Quoted 4 lines
(2)
atomic_tis a 32-bit type, and on a 64-bit platform I will want a 64-bit type so that I can stick the owner address in there (I've got a second variant not yet released).
I'm sure you could use a seperate field as it would be a debug option, right?
But atomic longs are coming along and it is probably feasable to do 64-bit atomic_cmpxchg on all 64-bit word architectures if you really needed that.
Send instant messages to your online friends http://au.messenger.yahoo.com
Quoted 4 lines · Nick Piggin
Quoted 2 lines
(1) If it's using spinlocks, then it's pointless to use
atomic_cmpxchg.Why?
Because you're going to end up with loops around the cmpxchg bit in certain places, and if you do, then you've effectively got this:
spin_lock_irqsave(mutexlock, flags);
do {
new = calc_state(orig, oldstate);
spin_lock_irqsave(atomiclock, flags2);
oldstate = __cmpxchg(&mutex->count, orig, new)
spin_unlock_irqrestore(atomiclock, flags2);
} while (oldstate != orig);
spin_unlock_irqrestore(mutexlock, flags);which is very bad. You _should_ have:
spin_lock_irqsave(mutexlock, flags); oldstate = mutex->count; mutex->count = modify_state(mutex->count); spin_unlock_irqrestore(mutexlock, flags);
instead.
No. If you have XCHG/TAS/BSET/SWAP, but not CMPXCHG/CAS then you can do a lot better by not pretending that cmpxchg exists. That way the fast paths don't have to take any spinlocks at all.
And if you've got LLD/SCD or LDARX/STDCX or similar then you can probably do better than CMPXCHG also.
If you want an illustration, then consider this:
#define __mutex_trylock(mutex) \
({ \
int oldstate; \
\
asm volatile("swap%I0 %M0,%1" \
: "+m"(mutex->state), "=r"(oldstate) \
: "1"(1) \
: "memory"); \
\
oldstate == 0; \
})
static inline int down_trylock(struct mutex *mutex)
{
if (likely(__mutex_trylock(mutex))) {
/* success */
return 0;
}
/* failure */
return 1;
}
void fastcall __sched down(struct mutex *mutex)
{
if (down_trylock(mutex) == 1)
__down(mutex);
}
EXPORT_SYMBOL(down);On FRV, this can be made to map to:
setlos 0x1,gr4 ori gr4,0,gr5 swap @(gr8,gr0),gr5 subicc gr5,0,gr0,icc0 beqlr icc0,0x2 <-- probable-rated conditional return sethi.p 0xc01c,gr14 setlo 0x9df0,gr14 jmpl @(gr14,gr0)
That's an out-of-line fast path of _5_ instructions. Attempting to emulate CMPXCHG requires a lot more. On FRV, the case is alleviated somewhat since it doesn't yet provide spinlocks and support SMP, but you'd be very hard pressed to squeeze it down to just five instructions.
Quoted 7 lines
Quoted 4 lines
(2)
atomic_tis a 32-bit type, and on a 64-bit platform I will want a 64-bit type so that I can stick the owner address in there (I've got a second variant not yet released).I'm sure you could use a seperate field as it would be a debug option, right?
True. Ingo suggested this, and it seems reasonable. OTOH, shrinking the count by 4 bytes would allow the whole structure to shrink by 8 on a 64-bit platform with a 4-byte spinlock, which would be even better.
Quoted 3 lines
But atomic longs are coming along and it is probably feasable to do 64-bit
atomic_cmpxchgon all 64-bit word architectures if you really needed that.
That would be fine; except they don't yet exist. The way I'd do it is to provide a default __mutex_cmpxchg() that the arch can override if it wants to.
Quoted 1 line
Send instant messages to your online friends http://au.messenger.yahoo.com
No thanks.
David
Quoted 12 lines · David Howells
Quoted 4 lines · Nick Piggin
Quoted 2 lines
(1) If it's using spinlocks, then it's pointless to use
atomic_cmpxchg.Why?
Because you're going to end up with loops around the cmpxchg bit in certain places, and if you do, then you've effectively got this:
Quoted 6 lines
spin_lock_irqsave(mutexlock, flags);
do {
new = calc_state(orig, oldstate);
spin_lock_irqsave(atomiclock, flags2);
oldstate = __cmpxchg(&mutex->count, orig, new)
spin_unlock_irqrestore(atomiclock, flags2);+> } while (oldstate != orig);
Quoted 10 lines
spin_unlock_irqrestore(mutexlock, flags);which is very bad. You _should_ have:
spin_lock_irqsave(mutexlock, flags); oldstate = mutex->count; mutex->count = modify_state(mutex->count); spin_unlock_irqrestore(mutexlock, flags);instead.
I was under the impression that with cmpxchg, you don't need the mutex lock. If you do then sure, cmpxchg doesn't buy you anything (even if the arch does natively support it).
Quoted 52 lines
No. If you have XCHG/TAS/BSET/SWAP, but not CMPXCHG/CAS then you can do a lot better by not pretending that cmpxchg exists. That way the fast paths don't have to take any spinlocks at all.
And if you've got LLD/SCD or LDARX/STDCX or similar then you can probably do better than CMPXCHG also.
If you want an illustration, then consider this:
#define __mutex_trylock(mutex) \ ({ \ int oldstate; \ \ asm volatile("swap%I0 %M0,%1" \ : "+m"(mutex->state), "=r"(oldstate) \ : "1"(1) \ : "memory"); \ \ oldstate == 0; \ }) static inline int down_trylock(struct mutex *mutex) { if (likely(__mutex_trylock(mutex))) { /* success */ return 0; } /* failure */ return 1; } void fastcall __sched down(struct mutex *mutex) { if (down_trylock(mutex) == 1) __down(mutex); } EXPORT_SYMBOL(down);On FRV, this can be made to map to:
setlos 0x1,gr4 ori gr4,0,gr5 swap @(gr8,gr0),gr5 subicc gr5,0,gr0,icc0 beqlr icc0,0x2 <-- probable-rated conditional return sethi.p 0xc01c,gr14 setlo 0x9df0,gr14 jmpl @(gr14,gr0)
Quoted 5 lines
That's an out-of-line fast path of _5_ instructions. Attempting to emulate CMPXCHG requires a lot more. On FRV, the case is alleviated somewhat since it doesn't yet provide spinlocks and support SMP, but you'd be very hard pressed to squeeze it down to just five instructions.
I think all of about parisc and sparc32 "emulate" cmpxchg with spinlocks. For architectures like i386, x86_64, ppc, ia64, etc. the cmpxchg will give good code.
Then if FRV was still unhappy, then you could override the mutex in that architecture. This just seemed better to me than having a crappy simple implementation that *everyone* will want to override (and I see FRV overrides it as well, I don't see how you can complain about that).
But I guess that's moot if you can't to do a lockless version using cmpxchg.
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
(2)
atomic_tis a 32-bit type, and on a 64-bit platform I will want a 64-bit type so that I can stick the owner address in there (I've got a second variant not yet released).
Quoted 8 lines
Quoted 2 lines
I'm sure you could use a seperate field as it would be a debug option, right?
True. Ingo suggested this, and it seems reasonable. OTOH, shrinking the count by 4 bytes would allow the whole structure to shrink by 8 on a 64-bit platform with a 4-byte spinlock, which would be even better.
I'm sure you'd manage. spinlocks can get pretty large with debugging on too.
Signature · 3 lines
SUSE Labs, Novell Inc. Send instant messages to your online friends http://au.messenger.yahoo.com
Quoted 3 lines · Nick Piggin
I was under the impression that with cmpxchg, you don't need the mutex lock. If you do then sure, cmpxchg doesn't buy you anything (even if the arch does natively support it).
Consider the slow path...
Imagine the mutex has three states: 0 (unset), 1 (held), 3 (contention).
MUTEX PROCESS A PROCESS B PROCESS C ====== ============== ============== ============== 1,B,- 1,B,- -->mutex_lock() 1,B,- cmpxchg(0,1) [failed] 1,B,- -->__mutex_lock() 1,B,- -->mutex_unlock() 1,B,- cmpxchg(1,0) [success] 0,-,- <--mutex_unlock() 0,-,- spin_lock 0,-,A cmpxchg(0,1) [success] 1,A,A spin_unlock 1,A,- <--__mutex_lock() 1,A,- <--mutex_lock()
Or:
MUTEX PROCESS A PROCESS B PROCESS C ====== ============== ============== ============== 1,B,- 1,B,- -->mutex_lock() 1,B,- cmpxchg(0,1) [failed] 1,B,- -->__mutex_lock() 1,B,- spin_lock 1,B,A cmpxchg(0,1) [failed] 1,B,A -->mutex_unlock() 1,B,A cmpxchg(1,0) [success] 0,-,A <--mutex_unlock() 0,-,A cmpxchg(1,3) [failed] 0,-,A cmpxchg(0,1) [success] 1,A,A spin_unlock 1,A,- <--__mutex_lock() 1,A,- <--mutex_lock()
Or:
MUTEX PROCESS A PROCESS B PROCESS C ====== ============== ============== ============== 1,B,- 1,B,- -->mutex_lock() 1,B,- cmpxchg(0,1) [failed] 1,B,- -->__mutex_lock() 1,B,- spin_lock 1,B,A cmpxchg(0,1) [failed] 1,B,A -->mutex_unlock() 1,B,A cmpxchg(1,0) [success] 0,-,A <--mutex_unlock() 0,-,A cmpxchg(1,3) [failed] 0,-,A -->mutex_lock() 0,-,A cmpxchg(0,1) [success] 1,C,A <--mutex_lock() 1,C,A cmpxchg(0,1) [failed] 1,C,A cmpxchg(1,3) [success] 3,A,A spin_unlock 3,A,- <--__mutex_lock() 3,A,- <--mutex_lock()
See how many cmpxchgs you may end up doing? Now imagine that cmpxchg() is implemented as:
spin_lock_irqsave(&common_lock[N], flags); actual = *state; if (actual == old) *state = new; spin_unlock_irqrestore(&common_lock[N], flags);
Now my point about using LL/SC is that:
1,C,A cmpxchg(0,1) [failed] 1,C,A cmpxchg(1,3) [success] 3,C,A ...
Can be turned into:
1,C,A x = LL() 1,C,A x |= 2; 1,C,A SC(3) [success] 3,C,A ...
On x86 you could use:
1,C,A LOCK OR (2) 3,C,A ...
instead.
Now, contention isn't very likely, so using CMPXCHG _may_ be good enough _if_ you have it. But if you have to emulate it by using spinlocks, you're far better off just wrapping the entire thing in spinlocks and not pretending use atomic ops to access the counter; unless, of course, you have somthing that can do a 1-bit XCHG or better...
MUTEX PROCESS A PROCESS B PROCESS C ====== ============== ============== ============== 0,-,- -->mutex_lock() 0,-,- xchg(1) == 0 1,B,- <--mutex_lock() 1,B,- 1,B,- -->mutex_lock() 1,B,- xchg(1) == 1 1,B,- -->__mutex_lock() 1,B,- -->mutex_unlock() 1,B,B spin_lock 1,B,B set(0) 0,-,B spin_unlock 0,-,- <--mutex_unlock() 0,-,- spin_lock 0,-,A xchg(1) == 0 1,A,A spin_unlock 1,A,- <--__mutex_lock() 1,A,- <--mutex_lock()
mutex_unlock() should get the spinlock here before modifying the count, because if there's anything on the queue, it should wake up the first waiter rather than clearing the count.
David
Quoted 3 lines · David Howells
See how many cmpxchgs you may end up doing? Now imagine that
cmpxchg()is implemented as:
Yes, 2 architectures do this and they would probably want to optimise it.
Quoted 24 lines
spin_lock_irqsave(&common_lock[N], flags); actual = *state; if (actual == old) *state = new; spin_unlock_irqrestore(&common_lock[N], flags);Now my point about using LL/SC is that:
1,C,A cmpxchg(0,1) [failed] 1,C,A cmpxchg(1,3) [success] 3,C,A ...Can be turned into:
1,C,A x = LL() 1,C,A x |= 2; 1,C,A SC(3) [success] 3,C,A ...On x86 you could use:
1,C,A LOCK OR (2) 3,C,A ...
Quoted 6 lines
instead.
Now, contention isn't very likely, so using CMPXCHG _may_ be good enough _if_ you have it. But if you have to emulate it by using spinlocks, you're far better off just wrapping the entire thing in spinlocks and not pretending use atomic ops to access the counter; unless, of course, you have somthing that
Yes, the architecture code knows whether or not it implements atomic ops with spinlocks, so that architecture is in the position to decide to override the mutex implementation. *generic* code shouldn't worry about that, it should use the interfaces available, and if that isn't optimal on some architecture then that architecture can override it.
It is not even clear that any ll/sc based architectures would need to override an atomic_cmpxchg variant at all because you can assume an unlocked fastpath and not do the additional initial load to prime the cmpxchg.
So I don't know why you're so worried about sparc32 and parisc while preferring to introduce a worse default implementation that even your frv architecture wants to override...?
However: considering everyone and their dog has already implemented their own semaphore, the best mutex default I guess is to probably use that as you say.
So: disregard my suggestion :P
Send instant messages to your online friends http://au.messenger.yahoo.com
Quoted 5 lines · Nick Piggin
Yes, the architecture code knows whether or not it implements atomic ops with spinlocks, so that architecture is in the position to decide to override the mutex implementation. *generic* code shouldn't worry about that, it should use the interfaces available, and if that isn't optimal on some architecture then that architecture can override it.
However, a number of generic templates can be provided if it makes things easier for the arches because all they need to is:
[arch/wibble/Kconfig]
config MUTEX_TYPE_FOO
bool
default y
[include/asm-wibble/system.h]
#define __mutex_foo_this() { ... }
#define __mutex_foo_that() { ... }The unconditional two-state exchange I think will be a useful template for a number of archs that don't have anything more advanced than XCHG/TAS/BSET/SWAP.
Quoted 2 lines
It is not even clear that any ll/sc based architectures would need to override an
atomic_cmpxchgvariant at all because you can assume an unlocked fastpath
That's irrelevant. Any arch that has LL/SC almost certainly emulates CMPXCHG with LL/SC.
Quoted 1 line
and not do the additional initial load to prime the cmpxchg.
Two points:
(1) LL/SC does not require an additional initial load.
(2) CMPXCHG does an implicit load; how else can it compare?
LL/SC can never be worse than CMPXCHG, if only because you're very unlikely to have both, but it can be better.
David
Quoted 7 lines · David Howells
Quoted 2 lines
It is not even clear that any ll/sc based architectures would need to override an
atomic_cmpxchgvariant at all because you can assume an unlocked fastpathThat's irrelevant. Any arch that has LL/SC almost certainly emulates CMPXCHG with LL/SC.
It is not irrelevant because many architectures that would care are ll/sc based and many others have a native cmpxchg ie. cmpxchg wouldn't be a bad choice for default.
Quoted 8 lines
Quoted 2 lines
and not do the additional initial load to prime the cmpxchg.
Two points:
(1) LL/SC does not require an additional initial load.
?? I was only talking about cmpxchg
Quoted 2 lines
(2) CMPXCHG does an implicit load; how else can it compare?
Read Russell's posts. He points out that most usages of cmpxchg will require an additional load compared with an llsc in order to find the value to work on.
cmpxchg(lock, UNLOCKED, LOCKED)
does not (although it may still require an extra branch).
Signature · 3 lines
SUSE Labs, Novell Inc. Send instant messages to your online friends http://au.messenger.yahoo.com
Quoted 3 lines · Nick Piggin
So I don't know why you're so worried about sparc32 and parisc while preferring to introduce a worse default implementation that even your frv architecture wants to override...?
I now think the base default should be a wrapper around the counting semaphores, because that is the easiest path (they already exist) and it's also the fastest path on some platforms.
But I want to be able to override the implementation on such as FRV because I can do a better mutex than a counting semaphore there as I only have SWAP available as an atomic op.
However, I would like to make the unconditional-exchange mutex a template that can be overridden so that other archs can use it with one Kconfig option and a few #defines in asm/system.h.
David
Quoted 53 lines · David Howells
The attached patch introduces a simple mutex implementation as an alternative to the usual semaphore implementation where simple mutex functionality is all that is required.
This is useful in two ways:
(1) A number of archs only provide very simple atomic instructions (such as XCHG on i386, TAS on M68K, SWAP on FRV) which aren't sufficient to implement full semaphore support directly. Instead spinlocks must be employed to implement fuller functionality.
(2) This makes it obvious in what way the semaphore is being used: whether it's being used as a mutex or being used as a counter.
This patch set does the following:
(1) Provides a simple
xchg()based semaphore as a default for all architectures that don't wish to override it and provide their own.Overriding is possible by setting
CONFIG_ARCH_IMPLEMENTS_MUTEXand supplyingasm/mutex.hPartial overriding is possible by #defining
mutex_grab(),mutex_release()andis_mutex_locked()to perform the appropriate optimised functions.(2) Provides
linux/mutex.has a common include for gaining access to mutex semaphores.(3) Provides
linux/semaphore.has a common include for gaining access to all the different types of semaphore that may be used from within the kernel.(4) Renames down*() to down_sem*() and
up()toup_sem()for the traditional semaphores, and removes init_MUTEX*() and DECLARE_MUTEX*() fromasm/semaphore.h(5) Redirects the following to apply to the new mutexes rather than the traditional semaphores:
down()
down_trylock()
down_interruptible()
up()
init_MUTEX()
init_MUTEX_LOCKED()
DECLARE_MUTEX()
DECLARE_MUTEX_LOCKED()On the basis that most usages of semaphores are as mutexes, this makes sense for in most cases it's just then a matter of changing the type from struct semaphore to struct mutex. In some cases,
sema_init()has to be changed to init_MUTEX*() also.
Quoted 4 lines
(6) Generally include
linux/semaphore.hin place ofasm/semaphore.h.(7) Provides a debugging config option
CONFIG_DEBUG_MUTEX_OWNERby which the mutex owner can be tracked and by which over-upping can be detected.
Maybe I'm not understanding all this, but...
I'd have thought that the way to do this is to simply reimplement down(), up(), down_trylock(), etc using the new xchg-based code and to then hunt down those few parts of the kernel which actually use the old semaphore's counting feature and convert them to use down_sem(), up_sem(), etc. And rename all the old semaphore code: s/down/down_sem/etc.
So after such a transformation, this new "mutex" thingy would not exist.
Quoted 1 line
include/linux/mutex.h | 32 +++++++
But it does.
Quoted 1 line
+#define
mutex_grab(mutex)(xchg(&(mutex)->state, 1)== 0)
mutex_trylock(), please.
Quoted 1 line
+#define
is_mutex_locked(mutex)((mutex)->state)
Let's keep the namespace consistent. mutex_is_locked().
include/linux/mutex-simple.h line 127
Quoted 3 lines
include/linux/mutex-simple.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/mutex-simple.h +3
-0+static inline void down (struct mutex *mutex) +{ +if (mutex_grab (mutex)) {
likely()
Quoted 6 lines
include/linux/mutex-simple.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/mutex-simple.h +6
-0+#ifdef CONFIG_DEBUG_MUTEX_OWNER + mutex->__owner = current; +#endif + } +else { +__down (mutex);
include/linux/mutex-simple.h line 143
Quoted 10 lines
include/linux/mutex-simple.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/mutex-simple.h +10
-0+ } +} + +/* +* sleep interruptibly until we get the mutex +* - return 0 if successful, -EINTR if interrupted +*/ +static inline int down_interruptible (struct mutex *mutex) +{ +if (mutex_grab (mutex)) {
likely()
include/linux/mutex-simple.h line 159
Quoted 3 lines
include/linux/mutex-simple.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/mutex-simple.h +3
-0+static inline int down_trylock (struct mutex *mutex) +{ +if (mutex_grab (mutex)) {
etc.
You could just put likely() into mutex_trylock(). err, mutex_grab().
Quoted 11 lines
include/linux/mutex-simple.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/mutex-simple.h +11
-0+/* +* release the mutex +*/ +static inline void up (struct mutex *mutex) +{ +unsigned long flags; + +#ifdef CONFIG_DEBUG_MUTEX_OWNER +if (mutex->__owner != current) +__up_bad (mutex); + mutex->__owner =NULL ;
include/linux/mutex-simple.h line 191
Quoted 10 lines
include/linux/mutex-simple.h renamed from warthog/kernels/linux-2.6.15-rc5/include/linux/mutex-simple.h +10
-0+#endif + +/* must prevent a race */ +spin_lock_irqsave (&mutex->wait_lock, flags); +if (!list_empty (&mutex->wait_list)) +__up (mutex); +else +mutex_release (mutex); +spin_unlock_irqrestore (&mutex->wait_lock, flags); +}
This is too large to inline.
It's also significantly slower than the existing up()?
Quoted 6 lines · Andrew Morton
I'd have thought that the way to do this is to simply reimplement
down(),up(),down_trylock(), etc using the new xchg-based code and to then hunt down those few parts of the kernel which actually use the old semaphore's counting feature and convert them to usedown_sem(),up_sem(), etc. And rename all the old semaphore code:
s/down/down_sem/etc.
even better than that, why not use the solution that we've implemented for the -rt patchset, more than a year ago?
the solution i took was this:
- i did not touch the 'struct semaphore' namespace, but introduced a 'struct compat_semaphore'.
- i introduced a 'type-sensitive' macro wrapper that switches down() (and the other APIs) to either to the assembly variant (if the variable's type is struct compat_semaphore), or switches it to the new generic mutex (if the type is struct semaphore), at build-time. There is no runtime overhead due to this build-time-switching.
- for many months we worked with upstream maintainers to convert dozens of mutex users over to struct completion, where this was appropriate.
all this simplified the 'compatibility conversion' to the patch below. No other non-generic changes are needed.
Ingo
----
convert the remaining users of 'full Linux semaphore semantics' over to compat_semaphore.
drivers/acpi/osl.c | 12 ++++++------ drivers/ieee1394/ieee1394_types.h | 2 +- drivers/ieee1394/nodemgr.c | 2 +- drivers/ieee1394/raw1394-private.h | 2 +- drivers/media/dvb/dvb-core/dvb_frontend.c | 2 +- drivers/media/dvb/dvb-core/dvb_frontend.h | 2 +- drivers/net/3c527.c | 2 +- drivers/net/hamradio/6pack.c | 2 +- drivers/net/hamradio/mkiss.c | 2 +- drivers/net/plip.c | 5 ++++- drivers/net/ppp_async.c | 2 +- drivers/net/ppp_synctty.c | 2 +- drivers/pci/hotplug/cpci_hotplug_core.c | 4 ++-- drivers/pci/hotplug/cpqphp_ctrl.c | 4 ++-- drivers/pci/hotplug/ibmphp_hpc.c | 2 +- drivers/pci/hotplug/pciehp_ctrl.c | 4 ++-- drivers/pci/hotplug/shpchp_ctrl.c | 4 ++-- drivers/scsi/aacraid/aacraid.h | 4 ++-- drivers/scsi/aic7xxx/aic79xx_osm.h | 2 +- drivers/scsi/aic7xxx/aic7xxx_osm.h | 2 +- drivers/scsi/qla2xxx/qla_def.h | 2 +- drivers/usb/storage/usb.h | 2 +- fs/xfs/linux-2.6/mutex.h | 2 +- fs/xfs/linux-2.6/sema.h | 2 +- fs/xfs/linux-2.6/xfs_buf.h | 4 ++-- include/linux/jffs2_fs_i.h | 10 +++++++++- include/linux/jffs2_fs_sb.h | 6 +++--- include/linux/parport.h | 2 +- include/pcmcia/ss.h | 2 +- include/scsi/scsi_transport_spi.h | 2 +- 30 files changed, 54 insertions(+), 43 deletions(-)
drivers/acpi/osl.c +6 -6
@@ -728,14 +728,14 @@ void acpi_os_delete_lock(acpi_handle hanacpi_status acpi_os_create_semaphore (u32 max_units,u32 initial_units,acpi_handle * handle) { -struct semaphore *sem =NULL ; +struct compat_semaphore *sem =NULL ;ACPI_FUNCTION_TRACE ("os_create_semaphore" ); - sem =acpi_os_allocate (sizeof (struct semaphore )); + sem =acpi_os_allocate (sizeof (struct compat_semaphore ));if (!sem)return_ACPI_STATUS (AE_NO_MEMORY ); -memset (sem,0 ,sizeof (struct semaphore )); +memset (sem,0 ,sizeof (struct compat_semaphore ));sema_init (sem, initial_units);
@@ -758,7 +758,7 @@ EXPORT_SYMBOL(acpi_os_create_semaphore);acpi_status acpi_os_delete_semaphore (acpi_handle handle) { -struct semaphore *sem = (struct semaphore *)handle; +struct compat_semaphore *sem = (struct compat_semaphore *)handle;ACPI_FUNCTION_TRACE ("os_delete_semaphore" );
@@ -787,7 +787,7 @@ EXPORT_SYMBOL(acpi_os_delete_semaphore);acpi_status acpi_os_wait_semaphore (acpi_handle handle,u32 units,u16 timeout) {acpi_status status =AE_OK ; -struct semaphore *sem = (struct semaphore *)handle; +struct compat_semaphore *sem = (struct compat_semaphore *)handle;int ret =0 ;ACPI_FUNCTION_TRACE ("os_wait_semaphore" );
@@ -868,7 +868,7 @@ EXPORT_SYMBOL(acpi_os_wait_semaphore);*/ acpi_status acpi_os_signal_semaphore (acpi_handle handle,u32 units) { -struct semaphore *sem = (struct semaphore *)handle; +struct compat_semaphore *sem = (struct compat_semaphore *)handle;ACPI_FUNCTION_TRACE ("os_signal_semaphore" );
drivers/ieee1394/ieee1394_types.h +1 -1
@@ -19,7 +19,7 @@ struct hpsb_tlabel_pool {spinlock_t lock;u8 next;u32 allocations; -struct semaphore count; +struct compat_semaphore count; };#define HPSB_TPOOL_INIT (_tp) \
drivers/ieee1394/nodemgr.c +1 -1
@@ -114,7 +114,7 @@ struct host_info {struct hpsb_host *host;struct list_head list;struct completion exited; -struct semaphore reset_sem; +struct compat_semaphore reset_sem;int pid;char daemon_name[15 ];int kill_me;
drivers/ieee1394/raw1394-private.h +1 -1
@@ -29,7 +29,7 @@ struct file_info {struct list_head req_pending;struct list_head req_complete; -struct semaphore complete_sem; +struct compat_semaphore complete_sem;spinlock_t reqlists_lock;wait_queue_head_t poll_wait_complete;
drivers/media/dvb/dvb-core/dvb_frontend.c +1 -1
@@ -95,7 +95,7 @@ struct dvb_frontend_private {struct dvb_device *dvbdev;struct dvb_frontend_parameters parameters;struct dvb_fe_events events; -struct semaphore sem; +struct compat_semaphore sem;struct list_head list_head;wait_queue_head_t wait_queue;pid_t thread_pid;
drivers/media/dvb/dvb-core/dvb_frontend.h +1 -1
@@ -86,7 +86,7 @@ struct dvb_fe_events {int eventr;int overflow;wait_queue_head_t wait_queue; -struct semaphore sem; +struct compat_semaphore sem; };struct dvb_frontend {
drivers/net/3c527.c +1 -1
@@ -182,7 +182,7 @@ struct mc32_localu16 rx_ring_tail;/* index to rx de-queue end */ -struct semaphore cmd_mutex;/* Serialises issuing of execute commands */ +struct compat_semaphore cmd_mutex;/* Serialises issuing of execute commands */ struct completion execution_cmd;/* Card has completed an execute command */ struct completion xceiver_cmd;/* Card has completed a tx or rx command */ };
drivers/net/hamradio/6pack.c +1 -1
@@ -124,7 +124,7 @@ struct sixpack {struct timer_list tx_t;struct timer_list resync_t;atomic_t refcnt; -struct semaphore dead_sem; +struct compat_semaphore dead_sem;spinlock_t lock; };
drivers/net/hamradio/mkiss.c +1 -1
@@ -85,7 +85,7 @@ struct mkiss {#define CRC_MODE_SMACK_TEST 4atomic_t refcnt; -struct semaphore dead_sem; +struct compat_semaphore dead_sem; };/*---------------------------------------------------------------------------*/
drivers/net/plip.c +4 -1
@@ -229,7 +229,10 @@ struct net_local { struct hh_cache *hh);spinlock_t lock;atomic_t kill_timer; -struct semaphore killed_timer_sem; +/* +* PREEMPT_RT: this isnt a mutex, it should be struct completion. +*/ +struct compat_semaphore killed_timer_sem; };static inline void enable_parport_interrupts (struct net_device *dev)
drivers/net/ppp_async.c +1 -1
@@ -66,7 +66,7 @@ struct asyncppp {struct tasklet_struct tsk;atomic_t refcnt; -struct semaphore dead_sem; +struct compat_semaphore dead_sem;struct ppp_channel chan;/* interface to generic ppp layer */ unsigned char obuf[OBUFSIZE ]; };
drivers/net/ppp_synctty.c +1 -1
@@ -70,7 +70,7 @@ struct syncppp {struct tasklet_struct tsk;atomic_t refcnt; -struct semaphore dead_sem; +struct compat_semaphore dead_sem;struct ppp_channel chan;/* interface to generic ppp layer */ };
drivers/pci/hotplug/cpci_hotplug_core.c +2 -2
@@ -60,8 +60,8 @@ static int slots;static atomic_t extracting;int cpci_debug;static struct cpci_hp_controller *controller; -static struct semaphore event_semaphore;/* mutex for process loop (up if something to process) */ -static struct semaphore thread_exit;/* guard ensure thread has exited before calling it quits */ +static struct compat_semaphore event_semaphore;/* mutex for process loop (up if something to process) */ +static struct compat_semaphore thread_exit;/* guard ensure thread has exited before calling it quits */ static int thread_finished =1 ;static int enable_slot (struct hotplug_slot *slot);
drivers/pci/hotplug/cpqphp_ctrl.c +2 -2
@@ -45,8 +45,8 @@ static int configure_new_function(struct u8 behind_bridge, struct resource_lists *resources);static void interrupt_event_handler (struct controller *ctrl); -static struct semaphore event_semaphore;/* mutex for process loop (up if something to process) */ -static struct semaphore event_exit;/* guard ensure thread has exited before calling it quits */ +static struct compat_semaphore event_semaphore;/* mutex for process loop (up if something to process) */ +static struct compat_semaphore event_exit;/* guard ensure thread has exited before calling it quits */ static int event_finished;static unsigned long pushbutton_pending;/* = 0 */
drivers/pci/hotplug/ibmphp_hpc.c +1 -1
@@ -104,7 +104,7 @@ static int tid_poll;static struct semaphore sem_hpcaccess;// lock access to HPC static struct semaphore semOperations;// lock all operations and // access to data structures -static struct semaphore sem_exit;// make sure polling thread goes away +static struct compat_semaphore sem_exit;// make sure polling thread goes away //---------------------------------------------------------------------------- // local function prototypes //----------------------------------------------------------------------------
drivers/pci/hotplug/pciehp_ctrl.c +2 -2
@@ -37,8 +37,8 @@static void interrupt_event_handler (struct controller *ctrl); -static struct semaphore event_semaphore;/* mutex for process loop (up if something to process) */ -static struct semaphore event_exit;/* guard ensure thread has exited before calling it quits */ +static struct compat_semaphore event_semaphore;/* mutex for process loop (up if something to process) */ +static struct compat_semaphore event_exit;/* guard ensure thread has exited before calling it quits */ static int event_finished;static unsigned long pushbutton_pending;/* = 0 */ static unsigned long surprise_rm_pending;/* = 0 */
drivers/pci/hotplug/shpchp_ctrl.c +2 -2
@@ -37,8 +37,8 @@static void interrupt_event_handler (struct controller *ctrl); -static struct semaphore event_semaphore;/* mutex for process loop (up if something to process) */ -static struct semaphore event_exit;/* guard ensure thread has exited before calling it quits */ +static struct compat_semaphore event_semaphore;/* mutex for process loop (up if something to process) */ +static struct compat_semaphore event_exit;/* guard ensure thread has exited before calling it quits */ static int event_finished;static unsigned long pushbutton_pending;/* = 0 */
drivers/scsi/aacraid/aacraid.h +2 -2
@@ -735,7 +735,7 @@ struct aac_fib_context {u32 unique;// unique value representing this context ulong jiffies;// used for cleanup - dmb changed to ulong struct list_head next;// used to link context's into a linked list -struct semaphore wait_sem;// this is used to wait for the next fib to arrive. +struct compat_semaphore wait_sem;// this is used to wait for the next fib to arrive. int wait;// Set to true when thread is in WaitForSingleObject unsigned long count;// total number of FIBs on FibList struct list_head fib_list;// this holds fibs and their attachd hw_fibs
@@ -804,7 +804,7 @@ struct fib {* This is the event the sendfib routine will wait on if the * caller did not pass one and this is synch io. */ -struct semaphore event_wait; +struct compat_semaphore event_wait;spinlock_t event_lock;u32 done;/* gets set to 1 when fib is complete */
drivers/scsi/aic7xxx/aic79xx_osm.h +1 -1
@@ -390,7 +390,7 @@ struct ahd_platform_data {spinlock_t spin_lock;u_int qfrozen;struct timer_list reset_timer; -struct semaphore eh_sem; +struct compat_semaphore eh_sem;struct Scsi_Host *host;/* pointer to scsi host */ #define AHD_LINUX_NOIRQ ((uint32_t)~0)uint32_t irq;/* IRQ for this adapter */
drivers/scsi/aic7xxx/aic7xxx_osm.h +1 -1
@@ -394,7 +394,7 @@ struct ahc_platform_data {spinlock_t spin_lock;u_int qfrozen;struct timer_list reset_timer; -struct semaphore eh_sem; +struct compat_semaphore eh_sem;struct Scsi_Host *host;/* pointer to scsi host */ #define AHC_LINUX_NOIRQ ((uint32_t)~0)uint32_t irq;/* IRQ for this adapter */
drivers/scsi/qla2xxx/qla_def.h +1 -1
@@ -2411,7 +2411,7 @@ typedef struct scsi_qla_host {spinlock_t mbx_reg_lock;/* Mbx Cmd Register Lock */ struct semaphore mbx_cmd_sem;/* Serialialize mbx access */ -struct semaphore mbx_intr_sem;/* Used for completion notification */ +struct compat_semaphore mbx_intr_sem;/* Used for completion notification */ uint32_t mbx_flags;#define MBX_IN_PROGRESS BIT_0
drivers/usb/storage/usb.h +1 -1
@@ -171,7 +171,7 @@ struct us_data {dma_addr_t iobuf_dma;/* mutual exclusion and synchronization structures */ -struct semaphore sema;/* to sleep thread on */ +struct compat_semaphore sema;/* to sleep thread on */ struct completion notify;/* thread begin/end */ wait_queue_head_t delay_wait;/* wait during scan, reset */
fs/xfs/linux-2.6/mutex.h +1 -1
@@ -28,7 +28,7 @@* callers. */ #define MUTEX_DEFAULT 0x0 -typedef struct semaphore mutex_t ; +typedef struct compat_semaphore mutex_t ;#define mutex_init (lock, type, name) sema_init(lock, 1)#define mutex_destroy (lock) sema_init(lock, -99)
fs/xfs/linux-2.6/sema.h +1 -1
@@ -27,7 +27,7 @@* sema_t structure just maps to struct semaphore in Linux kernel. */ -typedef struct semaphore sema_t ; +typedef struct compat_semaphore sema_t ;#define init_sema (sp, val, c, d) sema_init(sp, val)#define initsema (sp, val) sema_init(sp, val)
fs/xfs/linux-2.6/xfs_buf.h +2 -2
@@ -114,7 +114,7 @@ typedef int (*page_buf_bdstrat_t)(struct#define PB_PAGES 2 typedef struct xfs_buf { - struct semaphore pb_sema; /* semaphore for lockables */ + struct compat_semaphore pb_sema; /* semaphore for lockables */ unsigned long pb_queuetime; /* time buffer was queued */ atomic_t pb_pin_count; /* pin count */ wait_queue_head_t pb_waiters; /* unpin waiters */
@@ -134,7 +134,7 @@ typedef struct xfs_buf {page_buf_iodone_t pb_iodone;/* I/O completion function */ page_buf_relse_t pb_relse;/* releasing function */ page_buf_bdstrat_t pb_strat;/* pre-write function */ -struct semaphore pb_iodonesema;/* Semaphore for I/O waiters */ +struct compat_semaphore pb_iodonesema;/* Semaphore for I/O waiters */ void *pb_fspriv;void *pb_fspriv2;void *pb_fspriv3;
include/linux/jffs2_fs_i.h +9 -1
@@ -14,7 +14,15 @@ struct jffs2_inode_info {before letting GC proceed. Or we'd have to put ugliness into the GC code so it didn't attempt to obtain the i_sem for the inode(s) which are already locked */ -struct semaphore sem; +/* +* (On PREEMPT_RT: while use of ei->sem is mostly mutex-alike, the +* SLAB cache keeps the semaphore locked, which breaks the strict +* "owner must exist" properties of rt_mutexes. Fix it the easy +* way: by going to a compat_semaphore. But the real fix would be +* to cache inodes in an unlocked state and lock them when +* allocating a new inode.) +*/ +struct compat_semaphore sem;/* The highest (datanode) version number used for this ino */ uint32_t highest_version;
include/linux/jffs2_fs_sb.h +3 -3
@@ -35,7 +35,7 @@ struct jffs2_sb_info {struct completion gc_thread_start;/* GC thread start completion */ struct completion gc_thread_exit;/* GC thread exit completion port */ -struct semaphore alloc_sem;/* Used to protect all the following +struct compat_semaphore alloc_sem;/* Used to protect all the following fields, and also to protect against out-of-order writing of nodes. And GC. */ uint32_t cleanmarker_size;/* Size of an _inline_ CLEANMARKER
@@ -93,7 +93,7 @@ struct jffs2_sb_info {/* Sem to allow jffs2_garbage_collect_deletion_dirent to drop the erase_completion_lock while it's holding a pointer to an obsoleted node. I don't like this. Alternatives welcomed. */ -struct semaphore erase_free_sem; +struct compat_semaphore erase_free_sem;uint32_t wbuf_pagesize;/* 0 for NOR and other flashes with no wbuf */
@@ -104,7 +104,7 @@ struct jffs2_sb_info {uint32_t wbuf_len;struct jffs2_inodirty *wbuf_inodes; -struct rw_semaphore wbuf_sem;/* Protects the write buffer */ +struct compat_rw_semaphore wbuf_sem;/* Protects the write buffer */ /* Information about out-of-band area usage... */ struct nand_oobinfo *oobinfo;
include/linux/parport.h +1 -1
@@ -254,7 +254,7 @@ enum ieee1284_phase {struct ieee1284_info {int mode;volatile enum ieee1284_phase phase; -struct semaphore irq; +struct compat_semaphore irq; };/* A parallel port */
include/pcmcia/ss.h +1 -1
@@ -243,7 +243,7 @@ struct pcmcia_socket {#endif /* state thread */ -struct semaphore skt_sem;/* protects socket h/w state */ +struct compat_semaphore skt_sem;/* protects socket h/w state */ struct task_struct *thread;struct completion thread_done;
include/scsi/scsi_transport_spi.h +1 -1
@@ -51,7 +51,7 @@ struct spi_transport_attrs {unsigned int support_qas;/* supports quick arbitration and selection */ /* Private Fields */ unsigned int dv_pending:1; /* Internal flag */ -struct semaphore dv_sem;/* semaphore to serialise dv */ +struct compat_semaphore dv_sem;/* semaphore to serialise dv */ };enum spi_signal_type {
Quoted 5 lines
- i introduced a 'type-sensitive' macro wrapper that switches
down()(and the other APIs) to either to the assembly variant (if the variable's type is structcompat_semaphore), or switches it to the new generic mutex (if the type is struct semaphore), at build-time. There is no runtime overhead due to this build-time-switching.
Didn't that drop compatibility with 2.95? The necessary builtins are only in 3.x.
Not that I'm not in favour - I would like to use C99 everywhere and it would get of the ugly spinlock workaround for i386 and x86-64 doesn't support earlier compilers anyways - but others might not agree.
-Andi
Quoted 7 lines · Andi Kleen
Quoted 6 lines
- i introduced a 'type-sensitive' macro wrapper that switches
down()(and the other APIs) to either to the assembly variant (if the variable's type is structcompat_semaphore), or switches it to the new generic mutex (if the type is struct semaphore), at build-time. There is no runtime overhead due to this build-time-switching.
Quoted 8 lines
Didn't that drop compatibility with 2.95? The necessary builtins are only in 3.x.
Not that I'm not in favour - I would like to use C99 everywhere and it would get of the ugly spinlock workaround for i386 and x86-64 doesn't support earlier compilers anyways - but others might not agree.
2.95.x is basically buggered at present. There's one scsi driver which doesn't compile due to weird __VA_ARGS__ tricks and the rather useful scsi/sd.c is currently getting an ICE. None of the new SAS code compiles, due to extensive use of anonymous unions. The V4L guys are very good at exploiting the gcc-2.95.x macro expansion bug (_why_ does each driver need to implement its own debug macros?) and various people keep on sneaking in anonymous unions.
It's time to give up on it and just drink more coffee or play more tetris or something, I'm afraid.
Quoted 2 lines
It's time to give up on it and just drink more coffee or play more tetris or something, I'm afraid.
Or start using icecream (http://wiki.kde.org/icecream)
Anyways cool. Gratulations. Can you please apply the following patch then?
Remove -Wdeclaration-after-statement
Now that gcc 2.95 is not supported anymore it's ok to use C99 style mixed declarations everywhere.
Makefile +0 -3
@@ -535,9 +535,6 @@ include $(srctree)/arch/$(ARCH)/Makefile NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include) CHECKFLAGS += $(NOSTDINC_FLAGS) -# warn about C99 declaration after statement -CFLAGS += $(call cc-option,-Wdeclaration-after-statement,) - # disable pointer signedness warnings in gcc 4.0 CFLAGS += $(call cc-option,-Wno-pointer-sign,)
Quoted 4 lines · Andi Kleen
Can you please apply the following patch then?
Remove -Wdeclaration-after-statement
OK.
Thus far I have this:
From: Andrew Morton <[email protected]>
There's one scsi driver which doesn't compile due to weird __VA_ARGS__ tricks and the rather useful scsi/sd.c is currently getting an ICE. None of the new SAS code compiles, due to extensive use of anonymous unions. The V4L guys are very good at exploiting the gcc-2.95.x macro expansion bug (_why_ does each driver need to implement its own debug macros?) and various people keep on sneaking in anonymous unions.
Plus anonymous unions are rather useful.
---
dev/null | 29 ----------------------------- include/linux/compiler.h | 2 -- init/main.c | 7 +------ 3 files changed, 1 insertion(+), 37 deletions(-)
init/main.c renamed from init/main.c~abandon-gcc-295x +1 -6
@@ -58,11 +58,6 @@* This is one of the first .c files built. Error out early * if we have compiler trouble.. */ -#if __GNUC__ ==2 && __GNUC_MINOR__ ==96 -#ifdef CONFIG_FRAME_POINTER -#error This compiler cannot compile correctly with frame pointers enabled -#endif -#endif #ifdef CONFIG_X86_LOCAL_APIC #include <asm/smp.h>
@@ -74,7 +69,7 @@* To avoid associated bogus bug reports, we flatly refuse to compile * with a gcc that is known to be too old from the very beginning. */ -#if __GNUC__ <2 || (__GNUC__ ==2 && __GNUC_MINOR__ <95 ) +#if __GNUC__ <3 #error Sorry, your GCC is too old. It builds incorrect kernels.#endif
include/linux/compiler-gcc2.h deleted +0 -29
@@ -1,29 +0,0 @@ -/* Never include this file directly. Include <linux/compiler.h> instead. */ - -/* These definitions are for GCC v2.x. */ - -/* Somewhere in the middle of the GCC 2.96 development cycle, we implemented -a mechanism by which the user can annotate likely branch directions and -expect the blocks to be reordered appropriately. Define __builtin_expect -to nothing for earlier compilers. */ -#include <linux/compiler-gcc.h> - -#if __GNUC_MINOR__ <96 -# define __builtin_expect (x, expected_value) (x) -#endif - -#define __attribute_used__ __attribute__((__unused__)) - -/* -* The attribute `pure' is not implemented in GCC versions earlier -* than 2.96. -*/ -#if __GNUC_MINOR__ >=96 -# define __attribute_pure__ __attribute__((pure)) -# define __attribute_const__ __attribute__((__const__)) -#endif - -/* GCC 2.95.x/2.96 recognize __va_copy, but not va_copy. Actually later GCC's -* define both va_copy and __va_copy, but the latter may go away, so limit this -* to this header */ -#define va_copy __va_copy
include/linux/compiler.h renamed from include/linux/compiler.h~abandon-gcc-295x +0 -2
@@ -42,8 +42,6 @@ extern void __chk_io_ptr(void __iomem *)# include <linux/compiler-gcc4.h> #elif __GNUC__ ==3 # include <linux/compiler-gcc3.h> -#elif __GNUC__ ==2 -# include <linux/compiler-gcc2.h> #else # error Sorry, your compiler is too old/not recognized.#endif
_