summaryrefslogtreecommitdiff
path: root/drivers/media/usb/au0828/au0828-video.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-06-18 13:06:38 -0300
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2016-01-11 12:18:39 -0200
commit0158e7b6a29f33a2c91cf045468958fbe8cb0b4c (patch)
treebf8910826ee8bd6f5dc29e93e21d285a5ede7eac /drivers/media/usb/au0828/au0828-video.c
parentbed6919665072b1e5bad31a013d53798394e097c (diff)
[media] au0828: Cache the decoder info at au0828 dev structure
Instead of seeking for the decoder every time analog stream is started, cache it. This simplifies the code a little bit. Requested-by: Hans Verkuil <hverkuil@xs4all.nl> Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/usb/au0828/au0828-video.c')
-rw-r--r--drivers/media/usb/au0828/au0828-video.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/drivers/media/usb/au0828/au0828-video.c b/drivers/media/usb/au0828/au0828-video.c
index 7aa7d509885b..0b6e97d4fd94 100644
--- a/drivers/media/usb/au0828/au0828-video.c
+++ b/drivers/media/usb/au0828/au0828-video.c
@@ -642,11 +642,11 @@ static int au0828_enable_analog_tuner(struct au0828_dev *dev)
{
#ifdef CONFIG_MEDIA_CONTROLLER
struct media_device *mdev = dev->media_dev;
- struct media_entity *entity, *decoder = NULL, *source;
+ struct media_entity *entity, *source;
struct media_link *link, *found_link = NULL;
int i, ret, active_links = 0;
- if (!mdev)
+ if (!mdev || !dev->decoder)
return 0;
/*
@@ -656,18 +656,9 @@ static int au0828_enable_analog_tuner(struct au0828_dev *dev)
* do DVB streaming while the DMA engine is being used for V4L2,
* this should be enough for the actual needs.
*/
- media_device_for_each_entity(entity, mdev) {
- if (entity->type == MEDIA_ENT_T_V4L2_SUBDEV_DECODER) {
- decoder = entity;
- break;
- }
- }
- if (!decoder)
- return 0;
-
- for (i = 0; i < decoder->num_links; i++) {
- link = &decoder->links[i];
- if (link->sink->entity == decoder) {
+ for (i = 0; i < dev->decoder->num_links; i++) {
+ link = &dev->decoder->links[i];
+ if (link->sink->entity == dev->decoder) {
found_link = link;
if (link->flags & MEDIA_LNK_FL_ENABLED)
active_links++;