# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#	           ChangeSet	1.411   -> 1.412  
#	drivers/usb/usb-ohci.h	1.9     -> 1.10   
#	drivers/usb/usb-uhci.c	1.22    -> 1.23   
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/05/03	oliver@oenone.homelinux.org	1.412
# [PATCH] USB host TASK_RUNNING fix
# 
# - fixed memory allocation so that the state of the task is not
#   acidentally changed to TASK_RUNNING
# --------------------------------------------
#
diff -Nru a/drivers/usb/usb-ohci.h b/drivers/usb/usb-ohci.h
--- a/drivers/usb/usb-ohci.h	Fri May  3 14:51:31 2002
+++ b/drivers/usb/usb-ohci.h	Fri May  3 14:51:31 2002
@@ -439,7 +439,7 @@
 
 /*-------------------------------------------------------------------------*/
 
-#define ALLOC_FLAGS (in_interrupt () ? GFP_ATOMIC : GFP_KERNEL)
+#define ALLOC_FLAGS (in_interrupt () || current->state != TASK_RUNNING ? GFP_ATOMIC : GFP_KERNEL)
 
 #ifdef DEBUG
 #	define OHCI_MEM_FLAGS	SLAB_POISON
diff -Nru a/drivers/usb/usb-uhci.c b/drivers/usb/usb-uhci.c
--- a/drivers/usb/usb-uhci.c	Fri May  3 14:51:31 2002
+++ b/drivers/usb/usb-uhci.c	Fri May  3 14:51:31 2002
@@ -86,8 +86,8 @@
 	static kmem_cache_t *urb_priv_kmem;
 #endif
 
-#define SLAB_FLAG     (in_interrupt ()? SLAB_ATOMIC : SLAB_KERNEL)
-#define KMALLOC_FLAG  (in_interrupt ()? GFP_ATOMIC : GFP_KERNEL)
+#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)
 
 /* CONFIG_USB_UHCI_HIGH_BANDWITH turns on Full Speed Bandwidth
  * Reclamation: feature that puts loop on descriptor loop when
@@ -95,7 +95,7 @@
  * is optimal, but PCI can be slowed down up-to 5 times, slowing down
  * system performance (eg. framebuffer devices).
  */
-#define CONFIG_USB_UHCI_HIGH_BANDWIDTH 
+#define CONFIG_USB_UHCI_HIGH_BANDWIDTH
 
 /* *_DEPTH_FIRST puts descriptor in depth-first mode. This has
  * somehow similar effect to FSBR (higher speed), but does not
@@ -143,7 +143,7 @@
 	q=s->free_desc.prev;
 
 	while (q != &s->free_desc && (force || n<100)) {
-		qh = list_entry (q, uhci_desc_t, horizontal);		
+		qh = list_entry (q, uhci_desc_t, horizontal);
 		q=qh->horizontal.prev;
 
 		if ((qh->last_used!=now) || force)
