Date: Mon, 12 Jun 2006 20:30:49 GMT From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 99078 for review Message-ID: <200606122030.k5CKUnZE007842@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=99078 Change 99078 by jhb@jhb_mutex on 2006/06/12 20:30:28 Style fixes and close a race. Affected files ... .. //depot/projects/smpng/sys/kern/subr_firmware.c#9 edit Differences ... ==== //depot/projects/smpng/sys/kern/subr_firmware.c#9 (text+ko) ==== @@ -96,11 +96,6 @@ return frp; } -/* - * Note that for a module loaded via kldload before it was asked for by - * a consumer, fp->file will be NULL, so we won't try to unload the - * module when the last reference is dropped. - */ static void clearentry(struct firmware *fp) { @@ -226,8 +221,7 @@ if (fp == NULL) break; file = fp->file; - /* No longer explicitly loaded. */ - fp->file = NULL; + clearentry(fp); mtx_unlock(&firmware_mtx); linker_release_module(NULL, NULL, file); @@ -251,6 +245,8 @@ if (fp->refcnt == 0) { if ((flags & FIRMWARE_UNLOAD) == 0) fp->flags |= FIRMWAREFLAG_KEEPKLDREF; + else if (fp->file) + taskqueue_enqueue(taskqueue_thread, &firmware_task); } mtx_unlock(&firmware_mtx); } @@ -261,6 +257,7 @@ static int firmware_modevent(module_t mod, int type, void *unused) { + struct firmware *fp; int i; switch (type) { @@ -269,7 +266,7 @@ return 0; case MOD_UNLOAD: for (i = 0; i < FIRMWARE_MAX; i++) { - struct firmware *fp = &firmware_table[i]; + fp = &firmware_table[i]; fp->flags &= ~FIRMWAREFLAG_KEEPKLDREF; } taskqueue_enqueue(taskqueue_thread, &firmware_task);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200606122030.k5CKUnZE007842>