--- hub.c-original Tue Oct 9 17:15:02 2001 +++ hub.c Sun Oct 14 21:09:18 2001 @@ -5,7 +5,9 @@ * (C) Copyright 1999 Johannes Erdfelt * (C) Copyright 1999 Gregory P. Smith * (C) Copyright 2001 Brad Hards (bhards@bigpond.net.au) - * + */ +/* Workaround to avoid zombies. (Untested) + * (C) 2001 Kasper Dupont */ #include @@ -714,7 +716,7 @@ kfree(tempstr); } -static void usb_hub_events(void) +static void usb_hub_events(void*unused) { unsigned long flags; struct list_head *tmp; @@ -852,7 +854,22 @@ /* Send me a signal to get me die (for debugging) */ do { - usb_hub_events(); + /* Instead of calling usb_hub_events() + * I leave the job to keventd. That way + * new kernel threads will have keventd + * as father instead of khubd. It would + * be better but more difficult to have + * khubd taking care of its own dead + * children. + */ + struct tq_struct task; + task.routine=usb_hub_events; + schedule_task(&task); + /* I believe flushing at this point is + * the safest thing to do. It might not + * be the most efficient though. + */ + flush_scheduled_tasks(); interruptible_sleep_on(&khubd_wait); } while (!signal_pending(current));