From d65cbe5418ed4beaf45df235945099404fe4e847 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Wed, 20 Apr 2005 17:12:41 -0700 Subject: [PATCH] --- yaml --- r: 342 b: refs/heads/master c: 489ec5f5d59b306e4ccc505eac417526adedb438 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/Makefile | 2 +- trunk/drivers/scsi/aic7xxx/aic7xxx_osm.c | 5 ++- trunk/include/asm-sparc64/spinlock.h | 48 +++++++++++++++--------- 4 files changed, 36 insertions(+), 21 deletions(-) diff --git a/[refs] b/[refs] index 7fb5c30cca88..1a130997ab3c 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 858eaca169ed5e7b1b14eebb889323e75a02af0e +refs/heads/master: 489ec5f5d59b306e4ccc505eac417526adedb438 diff --git a/trunk/Makefile b/trunk/Makefile index 8da3a306d0c0..8e5f9bbdf4de 100644 --- a/trunk/Makefile +++ b/trunk/Makefile @@ -1,7 +1,7 @@ VERSION = 2 PATCHLEVEL = 6 SUBLEVEL = 12 -EXTRAVERSION =-rc3 +EXTRAVERSION =-rc2 NAME=Woozy Numbat # *DOCUMENTATION* diff --git a/trunk/drivers/scsi/aic7xxx/aic7xxx_osm.c b/trunk/drivers/scsi/aic7xxx/aic7xxx_osm.c index e60f9338e44a..d74b99dab7ec 100644 --- a/trunk/drivers/scsi/aic7xxx/aic7xxx_osm.c +++ b/trunk/drivers/scsi/aic7xxx/aic7xxx_osm.c @@ -3605,8 +3605,9 @@ ahc_linux_init(void) ahc_linux_transport_template = spi_attach_transport(&ahc_linux_transport_functions); if (!ahc_linux_transport_template) return -ENODEV; - if (ahc_linux_detect(&aic7xxx_driver_template)) - return 0; + int rc = ahc_linux_detect(&aic7xxx_driver_template); + if (rc) + return rc; spi_release_transport(ahc_linux_transport_template); ahc_linux_exit(); return -ENODEV; diff --git a/trunk/include/asm-sparc64/spinlock.h b/trunk/include/asm-sparc64/spinlock.h index 11efa474865b..d1f91a4f24ae 100644 --- a/trunk/include/asm-sparc64/spinlock.h +++ b/trunk/include/asm-sparc64/spinlock.h @@ -31,15 +31,20 @@ #ifndef CONFIG_DEBUG_SPINLOCK -typedef unsigned char spinlock_t; -#define SPIN_LOCK_UNLOCKED 0 +typedef struct { + volatile unsigned char lock; +#ifdef CONFIG_PREEMPT + unsigned int break_lock; +#endif +} spinlock_t; +#define SPIN_LOCK_UNLOCKED (spinlock_t) {0,} -#define spin_lock_init(lock) (*((unsigned char *)(lock)) = 0) -#define spin_is_locked(lock) (*((volatile unsigned char *)(lock)) != 0) +#define spin_lock_init(lp) do { *(lp)= SPIN_LOCK_UNLOCKED; } while(0) +#define spin_is_locked(lp) ((lp)->lock != 0) -#define spin_unlock_wait(lock) \ +#define spin_unlock_wait(lp) \ do { membar("#LoadLoad"); \ -} while(*((volatile unsigned char *)lock)) +} while(lp->lock) static inline void _raw_spin_lock(spinlock_t *lock) { @@ -109,20 +114,19 @@ static inline void _raw_spin_lock_flags(spinlock_t *lock, unsigned long flags) #else /* !(CONFIG_DEBUG_SPINLOCK) */ typedef struct { - unsigned char lock; + volatile unsigned char lock; unsigned int owner_pc, owner_cpu; +#ifdef CONFIG_PREEMPT + unsigned int break_lock; +#endif } spinlock_t; #define SPIN_LOCK_UNLOCKED (spinlock_t) { 0, 0, 0xff } -#define spin_lock_init(__lock) \ -do { (__lock)->lock = 0; \ - (__lock)->owner_pc = 0; \ - (__lock)->owner_cpu = 0xff; \ -} while(0) -#define spin_is_locked(__lock) (*((volatile unsigned char *)(&((__lock)->lock))) != 0) +#define spin_lock_init(lp) do { *(lp)= SPIN_LOCK_UNLOCKED; } while(0) +#define spin_is_locked(__lock) ((__lock)->lock != 0) #define spin_unlock_wait(__lock) \ do { \ membar("#LoadLoad"); \ -} while(*((volatile unsigned char *)(&((__lock)->lock)))) +} while((__lock)->lock) extern void _do_spin_lock (spinlock_t *lock, char *str); extern void _do_spin_unlock (spinlock_t *lock); @@ -139,8 +143,13 @@ extern int _do_spin_trylock (spinlock_t *lock); #ifndef CONFIG_DEBUG_SPINLOCK -typedef unsigned int rwlock_t; -#define RW_LOCK_UNLOCKED 0 +typedef struct { + volatile unsigned int lock; +#ifdef CONFIG_PREEMPT + unsigned int break_lock; +#endif +} rwlock_t; +#define RW_LOCK_UNLOCKED {0,} #define rwlock_init(lp) do { *(lp) = RW_LOCK_UNLOCKED; } while(0) static void inline __read_lock(rwlock_t *lock) @@ -251,9 +260,12 @@ static int inline __write_trylock(rwlock_t *lock) #else /* !(CONFIG_DEBUG_SPINLOCK) */ typedef struct { - unsigned long lock; + volatile unsigned long lock; unsigned int writer_pc, writer_cpu; unsigned int reader_pc[NR_CPUS]; +#ifdef CONFIG_PREEMPT + unsigned int break_lock; +#endif } rwlock_t; #define RW_LOCK_UNLOCKED (rwlock_t) { 0, 0, 0xff, { } } #define rwlock_init(lp) do { *(lp) = RW_LOCK_UNLOCKED; } while(0) @@ -304,6 +316,8 @@ do { unsigned long flags; \ #endif /* CONFIG_DEBUG_SPINLOCK */ #define _raw_read_trylock(lock) generic_raw_read_trylock(lock) +#define read_can_lock(rw) (!((rw)->lock & 0x80000000UL)) +#define write_can_lock(rw) (!(rw)->lock) #endif /* !(__ASSEMBLY__) */