参照元

説明

引数

返り値

参考

実装

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;
        for (i = 0; i < ARRAY_SIZE(fw_path); i++) {
                struct file *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;
                }
                file = filp_open(path, O_RDONLY, 0);
                if (IS_ERR(file))
                        continue;
                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;
        }
        __putname(path);
        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);
        }
        return rc;
}

コメント


トップ   編集 凍結 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2016-04-12 (火) 20:27:32