aboutsummaryrefslogtreecommitdiffstats
path: root/litmus/nvidia_info.c
diff options
context:
space:
mode:
Diffstat (limited to 'litmus/nvidia_info.c')
-rw-r--r--litmus/nvidia_info.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/litmus/nvidia_info.c b/litmus/nvidia_info.c
index 78f035244d21..d17152138c63 100644
--- a/litmus/nvidia_info.c
+++ b/litmus/nvidia_info.c
@@ -361,6 +361,7 @@ int get_nv_device_id(struct task_struct* owner)
361 361
362static int __reg_nv_device(int reg_device_id) 362static int __reg_nv_device(int reg_device_id)
363{ 363{
364 int ret = 0;
364 struct task_struct* old = 365 struct task_struct* old =
365 cmpxchg(&NV_DEVICE_REG[reg_device_id].device_owner, 366 cmpxchg(&NV_DEVICE_REG[reg_device_id].device_owner,
366 NULL, 367 NULL,
@@ -370,16 +371,21 @@ static int __reg_nv_device(int reg_device_id)
370 371
371 if(likely(old == NULL)) 372 if(likely(old == NULL))
372 { 373 {
374#ifdef CONFIG_LITMUS_SOFTIRQD
373 down_and_set_stat(current, HELD, &tsk_rt(current)->klitirqd_sem); 375 down_and_set_stat(current, HELD, &tsk_rt(current)->klitirqd_sem);
376#endif
374 TRACE_CUR("%s: device %d registered.\n", __FUNCTION__, reg_device_id); 377 TRACE_CUR("%s: device %d registered.\n", __FUNCTION__, reg_device_id);
375 return(0);
376 } 378 }
377 else 379 else
378 { 380 {
379 TRACE_CUR("%s: device %d is already in use!\n", __FUNCTION__, reg_device_id); 381 TRACE_CUR("%s: device %d is already in use!\n", __FUNCTION__, reg_device_id);
380 return(-EBUSY); 382 ret = -EBUSY;
381 } 383 }
382 384
385 return(ret);
386
387
388
383#if 0 389#if 0
384 //unsigned long flags; 390 //unsigned long flags;
385 //raw_spin_lock_irqsave(&NV_DEVICE_REG[reg_device_id].lock, flags); 391 //raw_spin_lock_irqsave(&NV_DEVICE_REG[reg_device_id].lock, flags);
@@ -411,19 +417,22 @@ static int __reg_nv_device(int reg_device_id)
411 417
412static int __clear_reg_nv_device(int de_reg_device_id) 418static int __clear_reg_nv_device(int de_reg_device_id)
413{ 419{
414 int ret; 420 int ret = 0;
415 unsigned long flags;
416 struct task_struct* klitirqd_th = get_klitirqd(de_reg_device_id);
417 struct task_struct* old; 421 struct task_struct* old;
418 422
423#ifdef CONFIG_LITMUS_SOFTIRQD
424 unsigned long flags;
425 struct task_struct* klitirqd_th = get_klitirqd(de_reg_device_id);
419 lock_nv_registry(de_reg_device_id, &flags); 426 lock_nv_registry(de_reg_device_id, &flags);
427#endif
420 428
421 old = cmpxchg(&NV_DEVICE_REG[de_reg_device_id].device_owner, 429 old = cmpxchg(&NV_DEVICE_REG[de_reg_device_id].device_owner,
422 current, 430 current,
423 NULL); 431 NULL);
424 432
425 mb(); 433 mb();
426 434
435#ifdef CONFIG_LITMUS_SOFTIRQD
427 if(likely(old == current)) 436 if(likely(old == current))
428 { 437 {
429 flush_pending(klitirqd_th, current); 438 flush_pending(klitirqd_th, current);
@@ -448,6 +457,7 @@ static int __clear_reg_nv_device(int de_reg_device_id)
448 TRACE_CUR("%s: device %d is not registered for this process's use! No one is!\n", 457 TRACE_CUR("%s: device %d is not registered for this process's use! No one is!\n",
449 __FUNCTION__, de_reg_device_id); 458 __FUNCTION__, de_reg_device_id);
450 } 459 }
460#endif
451 461
452 return(ret); 462 return(ret);
453} 463}