diff options
author | Gerrit Code Review <gerrit2@git-master.nvidia.com> | 2010-01-19 01:58:16 +0200 |
---|---|---|
committer | Gerrit Code Review <gerrit2@git-master.nvidia.com> | 2010-01-19 01:58:16 +0200 |
commit | 774dccd14e89b8ccdb9e93de385b9125077e7f1c (patch) | |
tree | fbbf1fd20beb6633de2a84f3317b25bf8eb0b51e | |
parent | 40a25d0286b9ae1344a75710bde3770799d1e778 (diff) | |
parent | 00c015186498c5712f46670c6dc0a0b5412f6eda (diff) |
Merge change I0b233c94 into android-tegra-2.6.29
* changes:
tegra nvos: return interrupted semaphores to user-land
-rw-r--r-- | arch/arm/mach-tegra/nvos/nvos.c | 8 | ||||
-rw-r--r-- | arch/arm/mach-tegra/nvos_user.c | 16 |
2 files changed, 20 insertions, 4 deletions
diff --git a/arch/arm/mach-tegra/nvos/nvos.c b/arch/arm/mach-tegra/nvos/nvos.c index 057f1e665676..b5e5b0181ea0 100644 --- a/arch/arm/mach-tegra/nvos/nvos.c +++ b/arch/arm/mach-tegra/nvos/nvos.c @@ -1105,6 +1105,14 @@ NvError NvOsSemaphoreUnmarshal( return NvSuccess; } +int NvOsSemaphoreWaitInterruptible(NvOsSemaphoreHandle semaphore); +int NvOsSemaphoreWaitInterruptible(NvOsSemaphoreHandle semaphore) +{ + NV_ASSERT( semaphore ); + + return down_interruptible( &semaphore->sem ); +} + void NvOsSemaphoreWait(NvOsSemaphoreHandle semaphore) { int ret; diff --git a/arch/arm/mach-tegra/nvos_user.c b/arch/arm/mach-tegra/nvos_user.c index 6f8c313929d6..5532d5b99c22 100644 --- a/arch/arm/mach-tegra/nvos_user.c +++ b/arch/arm/mach-tegra/nvos_user.c @@ -39,6 +39,7 @@ int nvos_open(struct inode *inode, struct file *file); int nvos_close(struct inode *inode, struct file *file); static long nvos_ioctl(struct file *file, unsigned int cmd, unsigned long arg); int nvos_mmap(struct file *file, struct vm_area_struct *vma); +int NvOsSemaphoreWaitInterruptible(NvOsSemaphoreHandle semaphore); #define DEVICE_NAME "nvos" @@ -398,8 +399,7 @@ static long nvos_ioctl(struct file *filp, DO_CLEANUP( NvOsCopyIn( &kernelSem, (void *)arg, sizeof(kernelSem) ) ); - - NvOsSemaphoreWait(kernelSem); + e = NvOsSemaphoreWaitInterruptible(kernelSem); break; case NV_IOCTL_SEMAPHORE_WAIT_TIMEOUT: { @@ -410,7 +410,15 @@ static long nvos_ioctl(struct file *filp, NvOsCopyIn( &k, p, sizeof(k) ) ); - k.error = NvOsSemaphoreWaitTimeout( k.sem, k.value ); + if (k.value == NV_WAIT_INFINITE) + { + k.error = NvSuccess; + e = NvOsSemaphoreWaitInterruptible(kernelSem); + } + else + { + k.error = NvOsSemaphoreWaitTimeout(k.sem, k.value); + } DO_CLEANUP( NvOsCopyOut( &p->error, &k.error, sizeof(k.error) ) @@ -460,7 +468,7 @@ static long nvos_ioctl(struct file *filp, return 0; } default: - printk("Unknown IOCTL: %x\n", _IOC_NR(cmd)); + pr_err("Unknown IOCTL: %x\n", _IOC_NR(cmd)); e = -1; } |