drivers/crypto/intel/qat/qat_common/adf_sysfs.c
Source file repositories/reference/linux-study-clean/drivers/crypto/intel/qat/qat_common/adf_sysfs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/crypto/intel/qat/qat_common/adf_sysfs.c- Extension
.c- Size
- 8357 bytes
- Lines
- 354
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/device.hlinux/errno.hlinux/pci.hlinux/string_choices.hadf_accel_devices.hadf_cfg.hadf_cfg_services.hadf_common_drv.h
Detected Declarations
function state_showfunction state_storefunction cfg_services_showfunction adf_sysfs_update_dev_configfunction cfg_services_storefunction pm_idle_enabled_showfunction pm_idle_enabled_storefunction auto_reset_showfunction auto_reset_storefunction rp2srv_showfunction rp2srv_storefunction num_rps_showfunction adf_sysfs_initexport adf_sysfs_init
Annotated Snippet
if (!adf_dev_started(accel_dev)) {
dev_info(&GET_DEV(accel_dev), "Device qat_dev%d already down\n",
accel_id);
break;
}
ret = adf_dev_down(accel_dev);
if (ret)
return ret;
break;
case DEV_UP:
dev_info(dev, "Starting device qat_dev%d\n", accel_id);
ret = adf_dev_up(accel_dev, true);
if (ret == -EALREADY) {
break;
} else if (ret) {
dev_err(dev, "Failed to start device qat_dev%d\n",
accel_id);
adf_dev_down(accel_dev);
return ret;
}
break;
default:
return -EINVAL;
}
return count;
}
static ssize_t cfg_services_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
char services[ADF_CFG_MAX_VAL_LEN_IN_BYTES] = {0};
struct adf_accel_dev *accel_dev;
int ret;
accel_dev = adf_devmgr_pci_to_accel_dev(to_pci_dev(dev));
if (!accel_dev)
return -EINVAL;
ret = adf_cfg_get_param_value(accel_dev, ADF_GENERAL_SEC,
ADF_SERVICES_ENABLED, services);
if (ret)
return ret;
return sysfs_emit(buf, "%s\n", services);
}
static int adf_sysfs_update_dev_config(struct adf_accel_dev *accel_dev,
const char *services)
{
return adf_cfg_add_key_value_param(accel_dev, ADF_GENERAL_SEC,
ADF_SERVICES_ENABLED, services,
ADF_STR);
}
static ssize_t cfg_services_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{
char services[ADF_CFG_MAX_VAL_LEN_IN_BYTES] = { };
struct adf_hw_device_data *hw_data;
struct adf_accel_dev *accel_dev;
int ret;
accel_dev = adf_devmgr_pci_to_accel_dev(to_pci_dev(dev));
if (!accel_dev)
return -EINVAL;
ret = adf_parse_service_string(accel_dev, buf, count, services,
ADF_CFG_MAX_VAL_LEN_IN_BYTES);
if (ret)
return ret;
if (adf_dev_started(accel_dev)) {
dev_info(dev, "Device qat_dev%d must be down to reconfigure the service.\n",
accel_dev->accel_id);
return -EINVAL;
}
ret = adf_sysfs_update_dev_config(accel_dev, services);
if (ret < 0)
return ret;
hw_data = GET_HW_DATA(accel_dev);
/* Update capabilities mask after change in configuration.
* A call to this function is required as capabilities are, at the
Annotation
- Immediate include surface: `linux/device.h`, `linux/errno.h`, `linux/pci.h`, `linux/string_choices.h`, `adf_accel_devices.h`, `adf_cfg.h`, `adf_cfg_services.h`, `adf_common_drv.h`.
- Detected declarations: `function state_show`, `function state_store`, `function cfg_services_show`, `function adf_sysfs_update_dev_config`, `function cfg_services_store`, `function pm_idle_enabled_show`, `function pm_idle_enabled_store`, `function auto_reset_show`, `function auto_reset_store`, `function rp2srv_show`.
- Atlas domain: Driver Families / drivers/crypto.
- Implementation status: integration implementation candidate.
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.