drivers/media/common/videobuf2/videobuf2-dvb.c

Source file repositories/reference/linux-study-clean/drivers/media/common/videobuf2/videobuf2-dvb.c

File Facts

System
Linux kernel
Corpus path
drivers/media/common/videobuf2/videobuf2-dvb.c
Extension
.c
Size
8425 bytes
Lines
343
Domain
Driver Families
Bucket
drivers/media
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 (res < 0) {
			pr_warn("%s: vb2_dvb_register_frontend failed (errno = %d)\n",
				fe->dvb.name, res);
			goto err;
		}
		res = dvb_create_media_graph(&f->adapter, false);
		if (res < 0)
			goto err;
	}

	mutex_unlock(&f->lock);
	return 0;

err:
	mutex_unlock(&f->lock);
	vb2_dvb_unregister_bus(f);
	return res;
}
EXPORT_SYMBOL(vb2_dvb_register_bus);

void vb2_dvb_unregister_bus(struct vb2_dvb_frontends *f)
{
	vb2_dvb_dealloc_frontends(f);

	dvb_unregister_adapter(&f->adapter);
}
EXPORT_SYMBOL(vb2_dvb_unregister_bus);

struct vb2_dvb_frontend *vb2_dvb_get_frontend(
	struct vb2_dvb_frontends *f, int id)
{
	struct list_head *list, *q;
	struct vb2_dvb_frontend *fe, *ret = NULL;

	mutex_lock(&f->lock);

	list_for_each_safe(list, q, &f->felist) {
		fe = list_entry(list, struct vb2_dvb_frontend, felist);
		if (fe->id == id) {
			ret = fe;
			break;
		}
	}

	mutex_unlock(&f->lock);

	return ret;
}
EXPORT_SYMBOL(vb2_dvb_get_frontend);

int vb2_dvb_find_frontend(struct vb2_dvb_frontends *f,
	struct dvb_frontend *p)
{
	struct list_head *list, *q;
	struct vb2_dvb_frontend *fe = NULL;
	int ret = 0;

	mutex_lock(&f->lock);

	list_for_each_safe(list, q, &f->felist) {
		fe = list_entry(list, struct vb2_dvb_frontend, felist);
		if (fe->dvb.frontend == p) {
			ret = fe->id;
			break;
		}
	}

	mutex_unlock(&f->lock);

	return ret;
}
EXPORT_SYMBOL(vb2_dvb_find_frontend);

struct vb2_dvb_frontend *vb2_dvb_alloc_frontend(
	struct vb2_dvb_frontends *f, int id)
{
	struct vb2_dvb_frontend *fe;

	fe = kzalloc_obj(struct vb2_dvb_frontend);
	if (fe == NULL)
		return NULL;

	fe->id = id;
	mutex_init(&fe->dvb.lock);

	mutex_lock(&f->lock);
	list_add_tail(&fe->felist, &f->felist);
	mutex_unlock(&f->lock);
	return fe;
}

Annotation

Implementation Notes