drivers/dma/idxd/sysfs.c

Source file repositories/reference/linux-study-clean/drivers/dma/idxd/sysfs.c

File Facts

System
Linux kernel
Corpus path
drivers/dma/idxd/sysfs.c
Extension
.c
Size
50209 bytes
Lines
2009
Domain
Driver Families
Bucket
drivers/dma
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

rc = device_add(engine_confdev(engine));
		if (rc < 0)
			goto cleanup;
	}

	return 0;

cleanup:
	j = i - 1;
	for (; i < idxd->max_engines; i++) {
		engine = idxd->engines[i];
		put_device(engine_confdev(engine));
	}

	while (j--) {
		engine = idxd->engines[j];
		device_unregister(engine_confdev(engine));
	}
	return rc;
}

static int idxd_register_group_devices(struct idxd_device *idxd)
{
	struct idxd_group *group;
	int i, j, rc;

	for (i = 0; i < idxd->max_groups; i++) {
		group = idxd->groups[i];
		rc = device_add(group_confdev(group));
		if (rc < 0)
			goto cleanup;
	}

	return 0;

cleanup:
	j = i - 1;
	for (; i < idxd->max_groups; i++) {
		group = idxd->groups[i];
		put_device(group_confdev(group));
	}

	while (j--) {
		group = idxd->groups[j];
		device_unregister(group_confdev(group));
	}
	return rc;
}

static int idxd_register_wq_devices(struct idxd_device *idxd)
{
	struct idxd_wq *wq;
	int i, rc, j;

	for (i = 0; i < idxd->max_wqs; i++) {
		wq = idxd->wqs[i];
		rc = device_add(wq_confdev(wq));
		if (rc < 0)
			goto cleanup;
	}

	return 0;

cleanup:
	j = i - 1;
	for (; i < idxd->max_wqs; i++) {
		wq = idxd->wqs[i];
		put_device(wq_confdev(wq));
	}

	while (j--) {
		wq = idxd->wqs[j];
		device_unregister(wq_confdev(wq));
	}
	return rc;
}

int idxd_register_devices(struct idxd_device *idxd)
{
	struct device *dev = &idxd->pdev->dev;
	int rc, i;

	rc = device_add(idxd_confdev(idxd));
	if (rc < 0)
		return rc;

	rc = idxd_register_wq_devices(idxd);
	if (rc < 0) {
		dev_dbg(dev, "WQ devices registering failed: %d\n", rc);
		goto err_wq;

Annotation

Implementation Notes