diff options
author | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2015-09-06 18:28:48 +0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2016-01-11 15:19:01 +0100 |
commit | 17813e2aa2f745545643df24af8f308bc36a04b0 (patch) | |
tree | 8d9753fe7fd26236cc54d4d0d58ece7df787a357 /drivers | |
parent | [media] DocBook: update entities documentation (diff) | |
download | linux-17813e2aa2f745545643df24af8f308bc36a04b0.tar.xz linux-17813e2aa2f745545643df24af8f308bc36a04b0.zip |
[media] dvbdev: move indirect links on dvr/demux to a separate function
Cleanup the code a little bit by moving the routine that creates
links between DVR and demux to the I/O entitis into a separate
function.
While here, fix the code to use strncmp() instead of strcmp().
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/dvb-core/dvbdev.c | 50 |
1 files changed, 31 insertions, 19 deletions
diff --git a/drivers/media/dvb-core/dvbdev.c b/drivers/media/dvb-core/dvbdev.c index f64e8b3fb687..d51a328bdcf9 100644 --- a/drivers/media/dvb-core/dvbdev.c +++ b/drivers/media/dvb-core/dvbdev.c @@ -540,6 +540,28 @@ EXPORT_SYMBOL(dvb_unregister_device); #ifdef CONFIG_MEDIA_CONTROLLER_DVB + +static int dvb_create_io_intf_links(struct dvb_adapter *adap, + struct media_interface *intf, + char *name) +{ + struct media_device *mdev = adap->mdev; + struct media_entity *entity; + struct media_link *link; + + media_device_for_each_entity(entity, mdev) { + if (entity->function == MEDIA_ENT_F_IO_DTV) { + if (strncmp(entity->name, name, strlen(name))) + continue; + link = media_create_intf_link(entity, intf, + MEDIA_LNK_FL_ENABLED); + if (!link) + return -ENOMEM; + } + } + return 0; +} + int dvb_create_media_graph(struct dvb_adapter *adap) { struct media_device *mdev = adap->mdev; @@ -637,25 +659,15 @@ int dvb_create_media_graph(struct dvb_adapter *adap) if (!link) return -ENOMEM; } - - media_device_for_each_entity(entity, mdev) { - if (entity->function == MEDIA_ENT_F_IO_DTV) { - if (!strcmp(entity->name, DVR_TSOUT)) { - link = media_create_intf_link(entity, - intf, - MEDIA_LNK_FL_ENABLED); - if (!link) - return -ENOMEM; - } - if (!strcmp(entity->name, DEMUX_TSOUT)) { - link = media_create_intf_link(entity, - intf, - MEDIA_LNK_FL_ENABLED); - if (!link) - return -ENOMEM; - } - break; - } + if (intf->type == MEDIA_INTF_T_DVB_DVR) { + ret = dvb_create_io_intf_links(adap, intf, DVR_TSOUT); + if (ret) + return ret; + } + if (intf->type == MEDIA_INTF_T_DVB_DEMUX) { + ret = dvb_create_io_intf_links(adap, intf, DEMUX_TSOUT); + if (ret) + return ret; } } return 0; |