patch-2.4.0-test9 linux/drivers/char/drm/i810_dma.c

Next file: linux/drivers/char/drm/i810_drv.c
Previous file: linux/drivers/char/drm/gamma_drv.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test8/linux/drivers/char/drm/i810_dma.c linux/drivers/char/drm/i810_dma.c
@@ -252,16 +252,15 @@
 	buf = i810_freelist_get(dev);
 	if (!buf) {
 		retcode = -ENOMEM;
-	   	DRM_DEBUG("%s retcode %d\n", __FUNCTION__, retcode);
-		goto out_get_buf;
+	   	DRM_DEBUG("retcode=%d\n", retcode);
+		return retcode;
 	}
    
 	retcode = i810_map_buffer(buf, filp);
 	if(retcode) {
 		i810_freelist_put(dev, buf);
-	   	DRM_DEBUG("mapbuf failed in %s retcode %d\n", 
-			  __FUNCTION__, retcode);
-	   	goto out_get_buf;
+	   	DRM_DEBUG("mapbuf failed, retcode %d\n", retcode);
+		return retcode;
 	}
 	buf->pid     = priv->pid;
 	buf_priv = buf->dev_private;	
@@ -270,7 +269,6 @@
    	d->request_size = buf->total;
    	d->virtual = buf_priv->virtual;
 
-out_get_buf:
 	return retcode;
 }
 
@@ -1069,11 +1067,11 @@
 	   	return;
 	}
       	atomic_set(&dev_priv->flush_done, 0);
-   	current->state = TASK_INTERRUPTIBLE;
    	add_wait_queue(&dev_priv->flush_queue, &entry);
    	end = jiffies + (HZ*3);
    
    	for (;;) {
+		current->state = TASK_INTERRUPTIBLE;
 	      	i810_dma_quiescent_emit(dev);
 	   	if (atomic_read(&dev_priv->flush_done) == 1) break;
 		if((signed)(end - jiffies) <= 0) {
@@ -1104,10 +1102,10 @@
 	   	return 0;
 	}
       	atomic_set(&dev_priv->flush_done, 0);
-   	current->state = TASK_INTERRUPTIBLE;
    	add_wait_queue(&dev_priv->flush_queue, &entry);
    	end = jiffies + (HZ*3);
    	for (;;) {
+		current->state = TASK_INTERRUPTIBLE;
 	      	i810_dma_emit_flush(dev);
 	   	if (atomic_read(&dev_priv->flush_done) == 1) break;
 		if((signed)(end - jiffies) <= 0) {
@@ -1201,6 +1199,7 @@
 	if (!ret) {
 		add_wait_queue(&dev->lock.lock_queue, &entry);
 		for (;;) {
+			current->state = TASK_INTERRUPTIBLE;
 			if (!dev->lock.hw_lock) {
 				/* Device has been unregistered */
 				ret = -EINTR;
@@ -1216,7 +1215,6 @@
 			
 				/* Contention */
 			atomic_inc(&dev->total_sleeps);
-			current->state = TASK_INTERRUPTIBLE;
 		   	DRM_DEBUG("Calling lock schedule\n");
 			schedule();
 			if (signal_pending(current)) {

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)