drivers/media/usb/uvc/uvc_entity.c
Source file repositories/reference/linux-study-clean/drivers/media/usb/uvc/uvc_entity.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/usb/uvc/uvc_entity.c- Extension
.c- Size
- 3992 bytes
- Lines
- 162
- Domain
- Driver Families
- Bucket
- drivers/media
- 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.
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/list.hlinux/videodev2.hmedia/v4l2-common.huvcvideo.h
Detected Declarations
function Copyrightfunction uvc_mc_cleanup_entityfunction uvc_mc_init_entityfunction uvc_mc_register_entitiesfunction list_for_each_entryfunction list_for_each_entry
Annotated Snippet
switch (UVC_ENTITY_TYPE(entity)) {
case UVC_VC_SELECTOR_UNIT:
function = MEDIA_ENT_F_VID_MUX;
break;
case UVC_VC_PROCESSING_UNIT:
case UVC_VC_EXTENSION_UNIT:
/* For lack of a better option. */
function = MEDIA_ENT_F_PROC_VIDEO_PIXEL_FORMATTER;
break;
case UVC_COMPOSITE_CONNECTOR:
case UVC_COMPONENT_CONNECTOR:
function = MEDIA_ENT_F_CONN_COMPOSITE;
break;
case UVC_SVIDEO_CONNECTOR:
function = MEDIA_ENT_F_CONN_SVIDEO;
break;
case UVC_ITT_CAMERA:
function = MEDIA_ENT_F_CAM_SENSOR;
break;
case UVC_TT_VENDOR_SPECIFIC:
case UVC_ITT_VENDOR_SPECIFIC:
case UVC_ITT_MEDIA_TRANSPORT_INPUT:
case UVC_OTT_VENDOR_SPECIFIC:
case UVC_OTT_DISPLAY:
case UVC_OTT_MEDIA_TRANSPORT_OUTPUT:
case UVC_EXTERNAL_VENDOR_SPECIFIC:
case UVC_EXT_GPIO_UNIT:
default:
function = MEDIA_ENT_F_V4L2_SUBDEV_UNKNOWN;
break;
}
entity->subdev.entity.function = function;
ret = media_entity_pads_init(&entity->subdev.entity,
entity->num_pads, entity->pads);
if (ret < 0)
return ret;
ret = v4l2_device_register_subdev(&chain->dev->vdev,
&entity->subdev);
} else if (entity->vdev != NULL) {
ret = media_entity_pads_init(&entity->vdev->entity,
entity->num_pads, entity->pads);
if (entity->flags & UVC_ENTITY_FLAG_DEFAULT)
entity->vdev->entity.flags |= MEDIA_ENT_FL_DEFAULT;
} else
ret = 0;
return ret;
}
int uvc_mc_register_entities(struct uvc_video_chain *chain)
{
struct uvc_entity *entity;
int ret;
list_for_each_entry(entity, &chain->entities, chain) {
ret = uvc_mc_init_entity(chain, entity);
if (ret < 0) {
dev_info(&chain->dev->intf->dev,
"Failed to initialize entity for entity %u\n",
entity->id);
return ret;
}
}
list_for_each_entry(entity, &chain->entities, chain) {
ret = uvc_mc_create_links(chain, entity);
if (ret < 0) {
dev_info(&chain->dev->intf->dev,
"Failed to create links for entity %u\n",
entity->id);
return ret;
}
}
return 0;
}
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/list.h`, `linux/videodev2.h`, `media/v4l2-common.h`, `uvcvideo.h`.
- Detected declarations: `function Copyright`, `function uvc_mc_cleanup_entity`, `function uvc_mc_init_entity`, `function uvc_mc_register_entities`, `function list_for_each_entry`, `function list_for_each_entry`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.