* Release a reference to a firmware image returned by firmware_get. * The caller may specify, with the FIRMWARE_UNLOAD flag, its desire * to release the resource, but the flag is only advisory. * * If this is the last reference to the firmware image, and this is an * autoloaded module, wake up the firmware_unload_task to figure out * what to do with the associated module. */
| 355 | * what to do with the associated module. |
| 356 | */ |
| 357 | void |
| 358 | firmware_put(const struct firmware *p, int flags) |
| 359 | { |
| 360 | struct priv_fw *fp = PRIV_FW(p); |
| 361 | |
| 362 | mtx_lock(&firmware_mtx); |
| 363 | fp->refcnt--; |
| 364 | if (fp->refcnt == 0) { |
| 365 | if (fp->parent != NULL) |
| 366 | fp->parent->refcnt--; |
| 367 | if (flags & FIRMWARE_UNLOAD) |
| 368 | fp->flags |= FW_UNLOAD; |
| 369 | if (fp->file) |
| 370 | taskqueue_enqueue(firmware_tq, &firmware_unload_task); |
| 371 | } |
| 372 | mtx_unlock(&firmware_mtx); |
| 373 | } |
| 374 | |
| 375 | /* |
| 376 | * Setup directory state for the firmware_tq thread so we can do i/o. |
no test coverage detected