Commit 4d1e4545 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

media: mark entity-intf links as IMMUTABLE

Currently links between entities and an interface are just marked as
ENABLED. But (at least today) these links cannot be disabled by userspace
or the driver, so they should also be marked as IMMUTABLE.

It might become possible that drivers can disable such links (if for some
reason the device node cannot be used), so we might need to add a new link
flag at some point to mark interface links that can be changed by the driver
but not by userspace.
Acked-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent 0245abf8
...@@ -440,8 +440,10 @@ static int dvb_register_media_device(struct dvb_device *dvbdev, ...@@ -440,8 +440,10 @@ static int dvb_register_media_device(struct dvb_device *dvbdev,
if (!dvbdev->entity) if (!dvbdev->entity)
return 0; return 0;
link = media_create_intf_link(dvbdev->entity, &dvbdev->intf_devnode->intf, link = media_create_intf_link(dvbdev->entity,
MEDIA_LNK_FL_ENABLED); &dvbdev->intf_devnode->intf,
MEDIA_LNK_FL_ENABLED |
MEDIA_LNK_FL_IMMUTABLE);
if (!link) if (!link)
return -ENOMEM; return -ENOMEM;
#endif #endif
...@@ -599,7 +601,8 @@ static int dvb_create_io_intf_links(struct dvb_adapter *adap, ...@@ -599,7 +601,8 @@ static int dvb_create_io_intf_links(struct dvb_adapter *adap,
if (strncmp(entity->name, name, strlen(name))) if (strncmp(entity->name, name, strlen(name)))
continue; continue;
link = media_create_intf_link(entity, intf, link = media_create_intf_link(entity, intf,
MEDIA_LNK_FL_ENABLED); MEDIA_LNK_FL_ENABLED |
MEDIA_LNK_FL_IMMUTABLE);
if (!link) if (!link)
return -ENOMEM; return -ENOMEM;
} }
...@@ -754,14 +757,16 @@ int dvb_create_media_graph(struct dvb_adapter *adap, ...@@ -754,14 +757,16 @@ int dvb_create_media_graph(struct dvb_adapter *adap,
media_device_for_each_intf(intf, mdev) { media_device_for_each_intf(intf, mdev) {
if (intf->type == MEDIA_INTF_T_DVB_CA && ca) { if (intf->type == MEDIA_INTF_T_DVB_CA && ca) {
link = media_create_intf_link(ca, intf, link = media_create_intf_link(ca, intf,
MEDIA_LNK_FL_ENABLED); MEDIA_LNK_FL_ENABLED |
MEDIA_LNK_FL_IMMUTABLE);
if (!link) if (!link)
return -ENOMEM; return -ENOMEM;
} }
if (intf->type == MEDIA_INTF_T_DVB_FE && tuner) { if (intf->type == MEDIA_INTF_T_DVB_FE && tuner) {
link = media_create_intf_link(tuner, intf, link = media_create_intf_link(tuner, intf,
MEDIA_LNK_FL_ENABLED); MEDIA_LNK_FL_ENABLED |
MEDIA_LNK_FL_IMMUTABLE);
if (!link) if (!link)
return -ENOMEM; return -ENOMEM;
} }
...@@ -773,7 +778,8 @@ int dvb_create_media_graph(struct dvb_adapter *adap, ...@@ -773,7 +778,8 @@ int dvb_create_media_graph(struct dvb_adapter *adap,
*/ */
if (intf->type == MEDIA_INTF_T_DVB_DVR && demux) { if (intf->type == MEDIA_INTF_T_DVB_DVR && demux) {
link = media_create_intf_link(demux, intf, link = media_create_intf_link(demux, intf,
MEDIA_LNK_FL_ENABLED); MEDIA_LNK_FL_ENABLED |
MEDIA_LNK_FL_IMMUTABLE);
if (!link) if (!link)
return -ENOMEM; return -ENOMEM;
} }
......
...@@ -808,7 +808,8 @@ static int video_register_media_controller(struct video_device *vdev, int type) ...@@ -808,7 +808,8 @@ static int video_register_media_controller(struct video_device *vdev, int type)
link = media_create_intf_link(&vdev->entity, link = media_create_intf_link(&vdev->entity,
&vdev->intf_devnode->intf, &vdev->intf_devnode->intf,
MEDIA_LNK_FL_ENABLED); MEDIA_LNK_FL_ENABLED |
MEDIA_LNK_FL_IMMUTABLE);
if (!link) { if (!link) {
media_devnode_remove(vdev->intf_devnode); media_devnode_remove(vdev->intf_devnode);
media_device_unregister_entity(&vdev->entity); media_device_unregister_entity(&vdev->entity);
......
...@@ -267,7 +267,8 @@ int v4l2_device_register_subdev_nodes(struct v4l2_device *v4l2_dev) ...@@ -267,7 +267,8 @@ int v4l2_device_register_subdev_nodes(struct v4l2_device *v4l2_dev)
link = media_create_intf_link(&sd->entity, link = media_create_intf_link(&sd->entity,
&vdev->intf_devnode->intf, &vdev->intf_devnode->intf,
MEDIA_LNK_FL_ENABLED); MEDIA_LNK_FL_ENABLED |
MEDIA_LNK_FL_IMMUTABLE);
if (!link) { if (!link) {
err = -ENOMEM; err = -ENOMEM;
goto clean_up; goto clean_up;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment