ChangeSet 1.738.5.19, 2002/10/11 15:31:15-07:00, adam@yggdrasil.com [PATCH] linux-2.5.41/drivers/usb/core/hub.c called down() from interrupt context On second thought after reading Oliver Neukum's question about "shaving off a cycle or two", here is version of my fix for down() being called from interrupt context that uses unlikely() to get the speed advantage that would be available from BUG_ON(), while still ensuring that the condition is executed even if assertions are compiled out. diff -Nru a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c --- a/drivers/usb/core/hub.c Sun Oct 13 17:09:12 2002 +++ b/drivers/usb/core/hub.c Sun Oct 13 17:09:12 2002 @@ -943,7 +943,9 @@ list_del_init(tmp); - down(&hub->khubd_sem); /* never blocks, we were on list */ + if (unlikely(down_trylock(&hub->khubd_sem))) + BUG(); /* never blocks, we were on list */ + spin_unlock_irqrestore(&hub_event_lock, flags); if (hub->error) {