<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">ChangeSet 1.889.26.11, 2003/01/12 00:17:10-08:00, oliver@oenone.homelinux.org

[PATCH] USB midi fixes

    - correct write error path
    - use GFP_ATOMIC in interrupt


diff -Nru a/drivers/usb/class/usb-midi.c b/drivers/usb/class/usb-midi.c
--- a/drivers/usb/class/usb-midi.c	Mon Jan 13 14:26:04 2003
+++ b/drivers/usb/class/usb-midi.c	Mon Jan 13 14:26:04 2003
@@ -337,7 +337,8 @@
     
 	if (status) {
 		printk(KERN_ERR "usbmidi: Cannot submit urb (%d)\n",status);
-		ret = -EFAULT;
+		ret = -EIO;
+		goto error;
 	}
 
 	add_wait_queue( &amp;ep-&gt;wait, &amp;wait );
@@ -354,6 +355,7 @@
 	set_current_state( TASK_RUNNING );
 	remove_wait_queue( &amp;ep-&gt;wait, &amp;wait );
 
+error:
 	return ret;
 }
 
@@ -369,7 +371,6 @@
 	struct midi_in_endpoint *ep = (struct midi_in_endpoint *)(urb-&gt;context);
 	unsigned char *data = urb-&gt;transfer_buffer;
 	int i, j, wake;
-	unsigned long int flags;
 
 	if ( !ep-&gt;urbSubmitted ) {
 		return;
@@ -377,7 +378,7 @@
 
 	if ( (urb-&gt;status == 0) &amp;&amp; (urb-&gt;actual_length &gt; 0) ) {
 		wake = 0;
-		spin_lock_irqsave( &amp;ep-&gt;lock, flags );
+		spin_lock( &amp;ep-&gt;lock );
 
 		for(j = 0; j &lt; urb-&gt;actual_length; j += 4) {
 			int cin = (data[j]&gt;&gt;0)&amp;0xf;
@@ -397,7 +398,7 @@
 			}
 		}
 
-		spin_unlock_irqrestore( &amp;ep-&gt;lock, flags );
+		spin_unlock &amp;ep-&gt;lock );
 		if ( wake ) {
 			wake_up( &amp;ep-&gt;wait );
 		}
@@ -407,7 +408,7 @@
 	urb-&gt;dev = ep-&gt;usbdev;
 
 	urb-&gt;actual_length = 0;
-	usb_submit_urb(urb, GFP_KERNEL);
+	usb_submit_urb(urb, GFP_ATOMIC);
 }
 
 
@@ -855,7 +856,6 @@
 		add_wait_queue( &amp;open_wait, &amp;wait );
 		up(&amp;open_sem);
 		schedule();
-		__set_current_state(TASK_RUNNING);
 		remove_wait_queue( &amp;open_wait, &amp;wait );
 		if ( signal_pending(current) ) {
 			return -ERESTARTSYS;
</pre></body></html>