drivers/most/configfs.c

Source file repositories/reference/linux-study-clean/drivers/most/configfs.c

File Facts

System
Linux kernel
Corpus path
drivers/most/configfs.c
Extension
.c
Size
17976 bytes
Lines
725
Domain
Driver Families
Bucket
drivers/most
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

struct mdev_link {
	struct config_item item;
	struct list_head list;
	bool create_link;
	bool destroy_link;
	u16 num_buffers;
	u16 buffer_size;
	u16 subbuffer_size;
	u16 packets_per_xact;
	u16 dbr_size;
	char datatype[MAX_STRING_SIZE];
	char direction[MAX_STRING_SIZE];
	char name[MAX_STRING_SIZE];
	char device[MAX_STRING_SIZE];
	char channel[MAX_STRING_SIZE];
	char comp[MAX_STRING_SIZE];
	char comp_params[MAX_STRING_SIZE];
};

static struct list_head mdev_link_list;

static int set_cfg_buffer_size(struct mdev_link *link)
{
	return most_set_cfg_buffer_size(link->device, link->channel,
					link->buffer_size);
}

static int set_cfg_subbuffer_size(struct mdev_link *link)
{
	return most_set_cfg_subbuffer_size(link->device, link->channel,
					   link->subbuffer_size);
}

static int set_cfg_dbr_size(struct mdev_link *link)
{
	return most_set_cfg_dbr_size(link->device, link->channel,
				     link->dbr_size);
}

static int set_cfg_num_buffers(struct mdev_link *link)
{
	return most_set_cfg_num_buffers(link->device, link->channel,
					link->num_buffers);
}

static int set_cfg_packets_xact(struct mdev_link *link)
{
	return most_set_cfg_packets_xact(link->device, link->channel,
					 link->packets_per_xact);
}

static int set_cfg_direction(struct mdev_link *link)
{
	return most_set_cfg_direction(link->device, link->channel,
				      link->direction);
}

static int set_cfg_datatype(struct mdev_link *link)
{
	return most_set_cfg_datatype(link->device, link->channel,
				     link->datatype);
}

static int (*set_config_val[])(struct mdev_link *link) = {
	set_cfg_buffer_size,
	set_cfg_subbuffer_size,
	set_cfg_dbr_size,
	set_cfg_num_buffers,
	set_cfg_packets_xact,
	set_cfg_direction,
	set_cfg_datatype,
};

static struct mdev_link *to_mdev_link(struct config_item *item)
{
	return container_of(item, struct mdev_link, item);
}

static int set_config_and_add_link(struct mdev_link *mdev_link)
{
	int i;
	int ret;

	for (i = 0; i < ARRAY_SIZE(set_config_val); i++) {
		ret = set_config_val[i](mdev_link);
		if (ret < 0 && ret != -ENODEV) {
			pr_err("Config failed\n");
			return ret;
		}
	}

Annotation

Implementation Notes