*参照元 [#k720e381] #backlinks *説明 [#s45835a0] -パス: [[linux-4.4.1/drivers/base/firmware_class.c]] -FIXME: これは何? --説明 **引数 [#d0fcfe4f] -const struct firmware **firmware_p -- --[[linux-4.4.1/firmware]] -const char *name -- -struct device *device -- --[[linux-4.4.1/device]] -unsigned int opt_flags -- **返り値 [#wef839c2] -int -- **参考 [#ce14f3c2] *実装 [#y269b049] /* called from request_firmware() and request_firmware_work_func() */ static int _request_firmware(const struct firmware **firmware_p, const char *name, struct device *device, unsigned int opt_flags) { struct firmware *fw; long timeout; int ret; - --[[linux-4.4.1/firmware]] if (!firmware_p) return -EINVAL; if (!name || name[0] == '\0') return -EINVAL; ret = _request_firmware_prepare(&fw, name, device); if (ret <= 0) /* error or already assigned */ goto out; - --[[linux-4.4.1/_request_firmware_prepare()]] ret = 0; timeout = firmware_loading_timeout(); - --[[linux-4.4.1/firmware_loading_timeout()]] if (opt_flags & FW_OPT_NOWAIT) { timeout = usermodehelper_read_lock_wait(timeout); if (!timeout) { dev_dbg(device, "firmware: %s loading timed out\n", name); ret = -EBUSY; goto out; } - --[[linux-4.4.1/usermodehelper_read_lock_wait()]] --[[linux-4.4.1/dev_dbg()]] } else { ret = usermodehelper_read_trylock(); if (WARN_ON(ret)) { dev_err(device, "firmware: %s will not be loaded\n", name); goto out; } - --[[linux-4.4.1/usermodehelper_read_trylock()]] --[[linux-4.4.1/WARN_ON()]] --[[linux-4.4.1/dev_err()]] } ret = fw_get_filesystem_firmware(device, fw->priv); if (ret) { if (!(opt_flags & FW_OPT_NO_WARN)) dev_warn(device, "Direct firmware load for %s failed with error %d\n", name, ret); if (opt_flags & FW_OPT_USERHELPER) { dev_warn(device, "Falling back to user helper\n"); ret = fw_load_from_user_helper(fw, name, device, opt_flags, timeout); } } - --[[linux-4.4.1/fw_get_filesystem_firmware()]] --[[linux-4.4.1/dev_warn()]] --[[linux-4.4.1/fw_load_from_user_helper()]] if (!ret) ret = assign_firmware_buf(fw, device, opt_flags); usermodehelper_read_unlock(); - --[[linux-4.4.1/assign_firmware_buf()]] --[[linux-4.4.1/usermodehelper_read_unlock()]] out: if (ret < 0) { release_firmware(fw); fw = NULL; } - --[[linux-4.4.1/release_firmware()]] *firmware_p = fw; return ret; } *コメント [#g7328a08]