*参照元 [#q3130c01] #backlinks *説明 [#k701c721] -パス: [[linux-4.4.1/drivers/base/firmware_class.c]] -FIXME: これは何? --説明 **引数 [#q71c2e1d] -struct device *device -- --[[linux-4.4.1/device]] -struct firmware_buf *buf -- --[[linux-4.4.1/firmware_buf]] **返り値 [#sf56d833] -int -- **参考 [#hab64a1f] *実装 [#p97ecc73] static int fw_get_filesystem_firmware(struct device *device, struct firmware_buf *buf) { int i, len; int rc = -ENOENT; char *path; path = __getname(); if (!path) return -ENOMEM; - --[[linux-4.4.1/__getname()]] for (i = 0; i < ARRAY_SIZE(fw_path); i++) { struct file *file; - --[[linux-4.4.1/ARRAY_SIZE()]] --[[linux-4.4.1/fw_path(global)]] --[[linux-4.4.1/file]] /* skip the unset customized path */ if (!fw_path[i][0]) continue; len = snprintf(path, PATH_MAX, "%s/%s", fw_path[i], buf->fw_id); if (len >= PATH_MAX) { rc = -ENAMETOOLONG; break; } - --[[linux-4.4.1/snprintf()]] file = filp_open(path, O_RDONLY, 0); if (IS_ERR(file)) continue; - --[[linux-4.4.1/filp_open()]] --[[linux-4.4.1/IS_ERR()]] rc = fw_read_file_contents(file, buf); fput(file); if (rc) dev_warn(device, "firmware, attempted to load %s, but failed with error %d\n", path, rc); else break; - --[[linux-4.4.1/fw_read_file_contents()]] --[[linux-4.4.1/fput()]] --[[linux-4.4.1/dev_warn()]] } __putname(path); - --[[linux-4.4.1/__putname()]] if (!rc) { dev_dbg(device, "firmware: direct-loading firmware %s\n", buf->fw_id); mutex_lock(&fw_lock); set_bit(FW_STATUS_DONE, &buf->status); complete_all(&buf->completion); mutex_unlock(&fw_lock); } - --[[linux-4.4.1/dev_dbg()]] --[[linux-4.4.1/mutex_lock()]] --[[linux-4.4.1/set_bit()]] --[[linux-4.4.1/complete_all()]] --[[linux-4.4.1/mutex_unlock()]] return rc; } *コメント [#d5feb851]