ChangeSet 1.1267.20.2, 2003/12/19 10:52:08-08:00, [EMAIL PROTECTED]

[PATCH] USB: memory allocations in storage code path for 2.4

in block io or error paths we must use GFP_NOIO instead of GFP_KERNEL.
Under 2.4 we cannot tell and must assume the worst, hence always use GFP_NOIO.
This cset against your 2.4 BK tree does that for hcd drivers.

  -fix deadlocks with storage


 drivers/usb/host/sl811.c    |    4 ++--
 drivers/usb/host/usb-ohci.c |    2 +-
 drivers/usb/host/usb-ohci.h |    2 +-
 drivers/usb/host/usb-uhci.c |    4 ++--
 4 files changed, 6 insertions(+), 6 deletions(-)


diff -Nru a/drivers/usb/host/sl811.c b/drivers/usb/host/sl811.c
--- a/drivers/usb/host/sl811.c  Wed Jan 28 13:37:00 2004
+++ b/drivers/usb/host/sl811.c  Wed Jan 28 13:37:00 2004
@@ -652,7 +652,7 @@
 {
        struct sl811_urb_priv *urbp;
        
-       urbp = kmalloc(sizeof(*urbp), GFP_KERNEL);
+       urbp = kmalloc(sizeof(*urbp), GFP_ATOMIC);
        if (!urbp)
                return NULL;
        
@@ -763,7 +763,7 @@
        struct sl811_urb_priv *urbp = urb->hcpriv;
        struct sl811_td *td;
        
-       td = kmalloc(sizeof (*td), GFP_KERNEL);
+       td = kmalloc(sizeof (*td), GFP_ATOMIC);
        if (!td)
                return NULL;
        
diff -Nru a/drivers/usb/host/usb-ohci.c b/drivers/usb/host/usb-ohci.c
--- a/drivers/usb/host/usb-ohci.c       Wed Jan 28 13:37:00 2004
+++ b/drivers/usb/host/usb-ohci.c       Wed Jan 28 13:37:00 2004
@@ -628,7 +628,7 @@
 
        /* allocate the private part of the URB */
        urb_priv = kmalloc (sizeof (urb_priv_t) + size * sizeof (td_t *), 
-                                                       in_interrupt() ? GFP_ATOMIC : 
GFP_KERNEL);
+                                                       in_interrupt() ? GFP_ATOMIC : 
GFP_NOIO);
        if (!urb_priv) {
                usb_dec_dev_use (urb->dev);     
                return -ENOMEM;
diff -Nru a/drivers/usb/host/usb-ohci.h b/drivers/usb/host/usb-ohci.h
--- a/drivers/usb/host/usb-ohci.h       Wed Jan 28 13:37:00 2004
+++ b/drivers/usb/host/usb-ohci.h       Wed Jan 28 13:37:00 2004
@@ -439,7 +439,7 @@
 
 /*-------------------------------------------------------------------------*/
 
-#define ALLOC_FLAGS (in_interrupt () || current->state != TASK_RUNNING ? GFP_ATOMIC : 
GFP_KERNEL)
+#define ALLOC_FLAGS (in_interrupt () || current->state != TASK_RUNNING ? GFP_ATOMIC : 
GFP_NOIO)
 
 #ifdef DEBUG
 #      define OHCI_MEM_FLAGS   SLAB_POISON
diff -Nru a/drivers/usb/host/usb-uhci.c b/drivers/usb/host/usb-uhci.c
--- a/drivers/usb/host/usb-uhci.c       Wed Jan 28 13:37:00 2004
+++ b/drivers/usb/host/usb-uhci.c       Wed Jan 28 13:37:00 2004
@@ -88,8 +88,8 @@
        static kmem_cache_t *urb_priv_kmem;
 #endif
 
-#define SLAB_FLAG     (in_interrupt () || current->state != TASK_RUNNING ? 
SLAB_ATOMIC : SLAB_KERNEL)
-#define KMALLOC_FLAG  (in_interrupt () || current->state != TASK_RUNNING ? GFP_ATOMIC 
: GFP_KERNEL)
+#define SLAB_FLAG     (in_interrupt () || current->state != TASK_RUNNING ? 
SLAB_ATOMIC : SLAB_NOIO)
+#define KMALLOC_FLAG  (in_interrupt () || current->state != TASK_RUNNING ? GFP_ATOMIC 
: GFP_NOIO)
 
 /* CONFIG_USB_UHCI_HIGH_BANDWITH turns on Full Speed Bandwidth
  * Reclamation: feature that puts loop on descriptor loop when



-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to