ChangeSet 1.1982.131.3, 2005/03/05 13:32:17-05:00, [EMAIL PROTECTED]

        
        Description: Use wait_event_interruptible() instead of the deprecated
        interruptible_sleep_on(). Add a helper function to make the condition
        for wait_event_interruptible() sane and lock-safe. Patch is 
compile-tested.
        
        Signed-off-by: Nishanth Aravamudan <[EMAIL PROTECTED]>
        Signed-off-by: Jody McIntyre <[EMAIL PROTECTED]>



 video1394.c |   31 ++++++++++++++++---------------
 1 files changed, 16 insertions(+), 15 deletions(-)


diff -Nru a/drivers/ieee1394/video1394.c b/drivers/ieee1394/video1394.c
--- a/drivers/ieee1394/video1394.c      2005-03-28 23:09:01 -08:00
+++ b/drivers/ieee1394/video1394.c      2005-03-28 23:09:01 -08:00
@@ -710,6 +710,17 @@
        reg_write(ohci, OHCI1394_IsoXmitIntMaskSet, 1<<d->ctx);
 }
 
+static inline unsigned video1394_buffer_state(struct dma_iso_ctx *d,
+                                             unsigned int buffer)
+{
+       unsigned long flags;
+       unsigned int ret;
+       spin_lock_irqsave(&d->lock, flags);
+       ret = d->buffer_status[buffer];
+       spin_unlock_irqrestore(&d->lock, flags);
+       return ret;
+}
+
 static int __video1394_ioctl(struct file *file,
                             unsigned int cmd, unsigned long arg)
 {
@@ -970,23 +981,13 @@
                            return -EINTR;
                        }
 
-#if 1
-                       while (d->buffer_status[v.buffer]!=
-                             VIDEO1394_BUFFER_READY) {
-                               spin_unlock_irqrestore(&d->lock, flags);
-                               interruptible_sleep_on(&d->waitq);
-                               spin_lock_irqsave(&d->lock, flags);
-                               if (signal_pending(current)) {
-                                       spin_unlock_irqrestore(&d->lock,flags);
-                                       return -EINTR;
-                               }
-                       }
-#else
+                       spin_unlock_irqrestore(&d->lock, flags);
                        wait_event_interruptible(d->waitq,
-                                       (d->buffer_status[v.buffer] == 
VIDEO1394_BUFFER_READY));
+                                       video1394_buffer_state(d, v.buffer) ==
+                                        VIDEO1394_BUFFER_READY);
                        if (signal_pending(current))
-                               return -EINTR;
-#endif
+                                return -EINTR;
+                       spin_lock_irqsave(&d->lock, flags);
                        d->buffer_status[v.buffer]=VIDEO1394_BUFFER_FREE;
                        break;
                default:
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to