drivers/crypto/intel/qat/qat_common/adf_sysfs_anti_rb.c

Source file repositories/reference/linux-study-clean/drivers/crypto/intel/qat/qat_common/adf_sysfs_anti_rb.c

File Facts

System
Linux kernel
Corpus path
drivers/crypto/intel/qat/qat_common/adf_sysfs_anti_rb.c
Extension
.c
Size
2891 bytes
Lines
134
Domain
Driver Families
Bucket
drivers/crypto
Inferred role
Driver Families: implementation source
Status
source 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.

Dependency Surface

Detected Declarations

Annotated Snippet

// SPDX-License-Identifier: GPL-2.0-only
/* Copyright(c) 2026 Intel Corporation */
#include <linux/sysfs.h>
#include <linux/types.h>

#include "adf_anti_rb.h"
#include "adf_common_drv.h"
#include "adf_sysfs_anti_rb.h"

static ssize_t enforced_min_show(struct device *dev, struct device_attribute *attr,
				 char *buf)
{
	struct adf_accel_dev *accel_dev;
	int err;
	u8 svn;

	accel_dev = adf_devmgr_pci_to_accel_dev(to_pci_dev(dev));
	if (!accel_dev)
		return -EINVAL;

	err = adf_anti_rb_query(accel_dev, ARB_ENFORCED_MIN_SVN, &svn);
	if (err)
		return err;

	return sysfs_emit(buf, "%u\n", svn);
}
static DEVICE_ATTR_RO(enforced_min);

static ssize_t active_show(struct device *dev, struct device_attribute *attr,
			   char *buf)
{
	struct adf_accel_dev *accel_dev;
	int err;
	u8 svn;

	accel_dev = adf_devmgr_pci_to_accel_dev(to_pci_dev(dev));
	if (!accel_dev)
		return -EINVAL;

	err = adf_anti_rb_query(accel_dev, ARB_ACTIVE_SVN, &svn);
	if (err)
		return err;

	return sysfs_emit(buf, "%u\n", svn);
}
static DEVICE_ATTR_RO(active);

static ssize_t permanent_min_show(struct device *dev, struct device_attribute *attr,
				  char *buf)
{
	struct adf_accel_dev *accel_dev;
	int err;
	u8 svn;

	accel_dev = adf_devmgr_pci_to_accel_dev(to_pci_dev(dev));
	if (!accel_dev)
		return -EINVAL;

	err = adf_anti_rb_query(accel_dev, ARB_PERMANENT_MIN_SVN, &svn);
	if (err)
		return err;

	return sysfs_emit(buf, "%u\n", svn);
}
static DEVICE_ATTR_RO(permanent_min);

static ssize_t commit_store(struct device *dev, struct device_attribute *attr,
			    const char *buf, size_t count)
{
	struct adf_accel_dev *accel_dev;
	bool val;
	int err;

	accel_dev = adf_devmgr_pci_to_accel_dev(to_pci_dev(dev));
	if (!accel_dev)
		return -EINVAL;

	err = kstrtobool(buf, &val);
	if (err)
		return err;

	if (!val)
		return -EINVAL;

	err = adf_anti_rb_commit(accel_dev);
	if (err)
		return err;

	return count;
}

Annotation

Implementation Notes