drivers/crypto/intel/qat/qat_common/adf_cfg.c
Source file repositories/reference/linux-study-clean/drivers/crypto/intel/qat/qat_common/adf_cfg.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/crypto/intel/qat/qat_common/adf_cfg.c- Extension
.c- Size
- 10073 bytes
- Lines
- 375
- Domain
- Driver Families
- Bucket
- drivers/crypto
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/mutex.hlinux/slab.hlinux/list.hlinux/seq_file.hadf_accel_devices.hadf_cfg.hadf_common_drv.h
Detected Declarations
function qat_dev_cfg_showfunction qat_dev_cfg_stopfunction adf_cfg_dev_addfunction adf_cfg_dev_dbgfs_addfunction adf_cfg_dev_dbgfs_rmfunction adf_cfg_del_all_exceptfunction adf_cfg_dev_removefunction adf_cfg_keyval_addfunction adf_cfg_keyval_removefunction list_for_each_prev_safefunction adf_cfg_keyval_del_allfunction list_for_each_prev_safefunction adf_cfg_section_del_allfunction list_for_each_prev_safefunction adf_cfg_section_del_all_exceptfunction list_for_each_prev_safefunction list_for_eachfunction list_for_eachfunction adf_cfg_key_val_getfunction adf_cfg_add_key_value_paramfunction adf_cfg_section_addfunction adf_cfg_get_param_valueexport adf_cfg_dev_addexport adf_cfg_dev_removeexport adf_cfg_add_key_value_paramexport adf_cfg_section_addexport adf_cfg_get_param_value
Annotated Snippet
if (strncmp(temp_val, key_val->val, sizeof(temp_val))) {
adf_cfg_keyval_remove(key, section);
} else {
kfree(key_val);
goto out;
}
}
adf_cfg_keyval_add(key_val, section);
out:
up_write(&cfg->lock);
return 0;
}
EXPORT_SYMBOL_GPL(adf_cfg_add_key_value_param);
/**
* adf_cfg_section_add() - Add config section entry to config table.
* @accel_dev: Pointer to acceleration device.
* @name: Name of the section
*
* Function adds configuration section where key - value entries
* will be stored.
* To be used by QAT device specific drivers.
*
* Return: 0 on success, error code otherwise.
*/
int adf_cfg_section_add(struct adf_accel_dev *accel_dev, const char *name)
{
struct adf_cfg_device_data *cfg = accel_dev->cfg;
struct adf_cfg_section *sec = adf_cfg_sec_find(accel_dev, name);
if (sec)
return 0;
sec = kzalloc_obj(*sec);
if (!sec)
return -ENOMEM;
strscpy(sec->name, name, sizeof(sec->name));
INIT_LIST_HEAD(&sec->param_head);
down_write(&cfg->lock);
list_add_tail(&sec->list, &cfg->sec_list);
up_write(&cfg->lock);
return 0;
}
EXPORT_SYMBOL_GPL(adf_cfg_section_add);
int adf_cfg_get_param_value(struct adf_accel_dev *accel_dev,
const char *section, const char *name,
char *value)
{
struct adf_cfg_device_data *cfg = accel_dev->cfg;
int ret;
down_read(&cfg->lock);
ret = adf_cfg_key_val_get(accel_dev, section, name, value);
up_read(&cfg->lock);
return ret;
}
EXPORT_SYMBOL_GPL(adf_cfg_get_param_value);
Annotation
- Immediate include surface: `linux/mutex.h`, `linux/slab.h`, `linux/list.h`, `linux/seq_file.h`, `adf_accel_devices.h`, `adf_cfg.h`, `adf_common_drv.h`.
- Detected declarations: `function qat_dev_cfg_show`, `function qat_dev_cfg_stop`, `function adf_cfg_dev_add`, `function adf_cfg_dev_dbgfs_add`, `function adf_cfg_dev_dbgfs_rm`, `function adf_cfg_del_all_except`, `function adf_cfg_dev_remove`, `function adf_cfg_keyval_add`, `function adf_cfg_keyval_remove`, `function list_for_each_prev_safe`.
- Atlas domain: Driver Families / drivers/crypto.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.