drivers/misc/ocxl/core.c

Source file repositories/reference/linux-study-clean/drivers/misc/ocxl/core.c

File Facts

System
Linux kernel
Corpus path
drivers/misc/ocxl/core.c
Extension
.c
Size
12518 bytes
Lines
570
Domain
Driver Families
Bucket
drivers/misc
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.

Dependency Surface

Detected Declarations

Annotated Snippet

if (rc > 0) {
			rc = init_afu(dev, fn, afu);
			if (rc) {
				dev_err(&dev->dev,
					"Can't initialize AFU index %d\n", afu);
				continue;
			}
			afu_count++;
		}
	}
	dev_info(&dev->dev, "%d AFU(s) configured\n", afu_count);
	return fn;
}
EXPORT_SYMBOL_GPL(ocxl_function_open);

struct list_head *ocxl_function_afu_list(struct ocxl_fn *fn)
{
	return &fn->afu_list;
}
EXPORT_SYMBOL_GPL(ocxl_function_afu_list);

struct ocxl_afu *ocxl_function_fetch_afu(struct ocxl_fn *fn, u8 afu_idx)
{
	struct ocxl_afu *afu;

	list_for_each_entry(afu, &fn->afu_list, list) {
		if (afu->config.idx == afu_idx)
			return afu;
	}

	return NULL;
}
EXPORT_SYMBOL_GPL(ocxl_function_fetch_afu);

const struct ocxl_fn_config *ocxl_function_config(struct ocxl_fn *fn)
{
	return &fn->config;
}
EXPORT_SYMBOL_GPL(ocxl_function_config);

void ocxl_function_close(struct ocxl_fn *fn)
{
	struct ocxl_afu *afu, *tmp;

	list_for_each_entry_safe(afu, tmp, &fn->afu_list, list) {
		remove_afu(afu);
	}

	deconfigure_function(fn);
	device_unregister(&fn->dev);
}
EXPORT_SYMBOL_GPL(ocxl_function_close);

// AFU Metadata

struct ocxl_afu_config *ocxl_afu_config(struct ocxl_afu *afu)
{
	return &afu->config;
}
EXPORT_SYMBOL_GPL(ocxl_afu_config);

void ocxl_afu_set_private(struct ocxl_afu *afu, void *private)
{
	afu->private = private;
}
EXPORT_SYMBOL_GPL(ocxl_afu_set_private);

void *ocxl_afu_get_private(struct ocxl_afu *afu)
{
	if (afu)
		return afu->private;

	return NULL;
}
EXPORT_SYMBOL_GPL(ocxl_afu_get_private);

Annotation

Implementation Notes