if (!purge && oldinfo) { if (oldinfo->count >= newinfo->count)
dev_warn(adev->dev, "refreshing %d modules info with %d\n",
oldinfo->count, newinfo->count);
tocopy_count = oldinfo->count;
}
ida_ptrs = kcalloc(newinfo->count, sizeof(*ida_ptrs), GFP_KERNEL); if (!ida_ptrs) return -ENOMEM;
if (tocopy_count)
memcpy(ida_ptrs, adev->mod_idas, tocopy_count * sizeof(*ida_ptrs));
for (i = tocopy_count; i < newinfo->count; i++) {
ida_ptrs[i] = kzalloc(sizeof(**ida_ptrs), GFP_KERNEL); if (!ida_ptrs[i]) { while (i--)
kfree(ida_ptrs[i]);
kfree(ida_ptrs); return -ENOMEM;
}
ida_init(ida_ptrs[i]);
}
/* If old elements have been reused, don't wipe them. */ if (tocopy_count)
kfree(adev->mod_idas); else
avs_module_ida_destroy(adev);
adev->mod_idas = ida_ptrs; return 0;
}
int avs_module_info_init(struct avs_dev *adev, bool purge)
{ struct avs_mods_info *info; int ret;
ret = avs_ipc_get_modules_info(adev, &info); if (ret) return AVS_IPC_RET(ret);
mutex_lock(&adev->modres_mutex);
ret = avs_module_ida_alloc(adev, info, purge); if (ret < 0) {
dev_err(adev->dev, "initialize module idas failed: %d\n", ret); gotoexit;
}
/* Refresh current information with newly received table. */
kfree(adev->mods_info);
adev->mods_info = info;
/* * Once driver loads FW it should keep it in memory, so we are not affected * by FW removal from filesystem or even worse by loading different FW at * runtime suspend/resume.
*/ int avs_request_firmware(struct avs_dev *adev, conststruct firmware **fw_p, constchar *name)
{ struct avs_fw_entry *entry; int ret;
/* first check in list if it is not already loaded */
list_for_each_entry(entry, &adev->fw_list, node) { if (!strcmp(name, entry->name)) {
*fw_p = entry->fw; return 0;
}
}
/* FW is not loaded, let's load it now and add to the list */
entry = kzalloc(sizeof(*entry), GFP_KERNEL); if (!entry) return -ENOMEM;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.