From 9c42a1ada1786f5c7637bf68e7e3755f62fb0171 Mon Sep 17 00:00:00 2001 From: Frank Mori Hess Date: Wed, 17 Jul 2002 00:45:55 +0000 Subject: [PATCH] trying to fix problems people are having with commands working fine, then failing when interrupt is set to RT priority. --- comedi/rt.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/comedi/rt.c b/comedi/rt.c index cec0bbfe..a967ceca 100644 --- a/comedi/rt.c +++ b/comedi/rt.c @@ -144,6 +144,7 @@ void comedi_free_irq(unsigned int irq,void *dev_id) void comedi_switch_to_rt(comedi_device *dev) { struct comedi_irq_struct *it=comedi_irqs[dev->irq]; + unsigned long flags; /* drivers might not be using an interrupt for commands */ if(it == NULL)return; @@ -154,22 +155,21 @@ void comedi_switch_to_rt(comedi_device *dev) return; } - spin_lock_irq(&dev->spinlock); - RT_protect(); - sti(); + comedi_spin_lock_irqsave( &dev->spinlock, flags ); if(!dev->rt) rt_get_irq(it); dev->rt++; it->rt=1; - spin_unlock(&dev->spinlock); - RT_unprotect(); + + comedi_spin_unlock_irqrestore( &dev->spinlock, flags ); } void comedi_switch_to_non_rt(comedi_device *dev) { struct comedi_irq_struct *it=comedi_irqs[dev->irq]; + unsigned long flags; if(it == NULL) return; @@ -178,14 +178,15 @@ void comedi_switch_to_non_rt(comedi_device *dev) if(it->flags & SA_SHIRQ) return; - RT_spin_lock_irq(&dev->spinlock); + comedi_spin_lock_irqsave( &dev->spinlock, flags ); dev->rt--; if(!dev->rt) rt_release_irq(it); it->rt=0; - RT_spin_unlock_irq(&dev->spinlock); + + comedi_spin_unlock_irqrestore( &dev->spinlock, flags ); } void wake_up_int_handler(int arg1, void * arg2) -- 2.26.2