779 static void wait_for_zero_refcount(struct module *mod) 780 { 781 /* Since we might sleep for some time, release the mutex first */ 782 mutex_unlock(&module_mutex); 783 for (;;) { 784 DEBUGP("Looking at refcount...\n"); 785 set_current_state(TASK_UNINTERRUPTIBLE); 786 if (module_refcount(mod) == 0) 787 break; 788 schedule(); 789 } 790 current->state = TASK_RUNNING; 791 mutex_lock(&module_mutex); 792 }