diff options
author | Alex Frid <afrid@nvidia.com> | 2010-02-16 16:12:43 -0800 |
---|---|---|
committer | Alex Frid <afrid@nvidia.com> | 2010-02-16 16:18:06 -0800 |
commit | 06c6c96baa909c9ccf1102c5bda0cb33b8749190 (patch) | |
tree | 48563e343bba5d91e8f4bc8e72895480a5fab21c /arch/arm/mach-tegra/nvos | |
parent | 140c5a12fb023152eded54a9e9aebb850463e0db (diff) |
tegra: Added spinlock primitives to NvOs.
Added spinlock primitives to NvOs.
Converted PMC scratch registers access mutexes to spin-locks.
Change-Id: I862baf4d3a7a8fcdf1e8552356805afd4ac897c3
Diffstat (limited to 'arch/arm/mach-tegra/nvos')
-rw-r--r-- | arch/arm/mach-tegra/nvos/nvos.c | 36 | ||||
-rw-r--r-- | arch/arm/mach-tegra/nvos/nvos_exports.c | 4 |
2 files changed, 40 insertions, 0 deletions
diff --git a/arch/arm/mach-tegra/nvos/nvos.c b/arch/arm/mach-tegra/nvos/nvos.c index 14f531f76f13..3e98dfc03063 100644 --- a/arch/arm/mach-tegra/nvos/nvos.c +++ b/arch/arm/mach-tegra/nvos/nvos.c @@ -772,6 +772,42 @@ void NvOsIntrMutexDestroy(NvOsIntrMutexHandle mutex) kfree(mutex); } +typedef struct NvOsSpinMutexRec +{ + spinlock_t lock; +} NvOsSpinMutex; + +NvError NvOsSpinMutexCreate(NvOsSpinMutexHandle *mutex) +{ + NvOsSpinMutex *m; + + m = kzalloc( sizeof(NvOsSpinMutex), GFP_KERNEL ); + if( !m ) + return NvError_InsufficientMemory; + + spin_lock_init( &m->lock ); + *mutex = m; + return NvSuccess; +} + +void NvOsSpinMutexLock(NvOsSpinMutexHandle mutex) +{ + NV_ASSERT( mutex ); + spin_lock( &mutex->lock ); +} + +void NvOsSpinMutexUnlock(NvOsSpinMutexHandle mutex) +{ + NV_ASSERT( mutex ); + spin_unlock( &mutex->lock ); +} + +void NvOsSpinMutexDestroy(NvOsSpinMutexHandle mutex) +{ + if (mutex) + kfree(mutex); +} + typedef struct NvOsSemaphoreRec { struct semaphore sem; diff --git a/arch/arm/mach-tegra/nvos/nvos_exports.c b/arch/arm/mach-tegra/nvos/nvos_exports.c index 6e39f50ffde1..916daca3ec28 100644 --- a/arch/arm/mach-tegra/nvos/nvos_exports.c +++ b/arch/arm/mach-tegra/nvos/nvos_exports.c @@ -112,6 +112,10 @@ EXPORT_SYMBOL(NvOsIntrMutexCreate); EXPORT_SYMBOL(NvOsIntrMutexLock); EXPORT_SYMBOL(NvOsIntrMutexUnlock); EXPORT_SYMBOL(NvOsIntrMutexDestroy); +EXPORT_SYMBOL(NvOsSpinMutexCreate); +EXPORT_SYMBOL(NvOsSpinMutexLock); +EXPORT_SYMBOL(NvOsSpinMutexUnlock); +EXPORT_SYMBOL(NvOsSpinMutexDestroy); EXPORT_SYMBOL(NvOsSemaphoreCreate); EXPORT_SYMBOL(NvOsSemaphoreClone); EXPORT_SYMBOL(NvOsSemaphoreUnmarshal); |