summaryrefslogtreecommitdiff
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>2015-08-28 16:17:40 -0300
commit4f0f300a3709c83e9125005f38b22f5ed5ca27cf (patch)
treeb19760d02b228cc140c2e52d18cb1d2bbd8b5d2c
parent442c6c0615b57426a7cbd3d255099ad9e36b58c3 (diff)
downloadlwn-4f0f300a3709c83e9125005f38b22f5ed5ca27cf.tar.gz
lwn-4f0f300a3709c83e9125005f38b22f5ed5ca27cf.zip
[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>
-rw-r--r--drivers/media/usb/au0828/au0828-cards.c4
-rw-r--r--drivers/media/usb/au0828/au0828-video.c19
-rw-r--r--drivers/media/usb/au0828/au0828.h1
3 files changed, 10 insertions, 14 deletions
diff --git a/drivers/media/usb/au0828/au0828-cards.c b/drivers/media/usb/au0828/au0828-cards.c
index 6b469e8c4c6e..ca861aea68a5 100644
--- a/drivers/media/usb/au0828/au0828-cards.c
+++ b/drivers/media/usb/au0828/au0828-cards.c
@@ -228,6 +228,10 @@ void au0828_card_analog_fe_setup(struct au0828_dev *dev)
"au8522", 0x8e >> 1, NULL);
if (sd == NULL)
pr_err("analog subdev registration failed\n");
+#ifdef CONFIG_MEDIA_CONTROLLER
+ if (sd)
+ dev->decoder = &sd->entity;
+#endif
}
/* Setup tuners */
diff --git a/drivers/media/usb/au0828/au0828-video.c b/drivers/media/usb/au0828/au0828-video.c
index 4ebe13673adf..939b2ad73501 100644
--- a/drivers/media/usb/au0828/au0828-video.c
+++ b/drivers/media/usb/au0828/au0828-video.c
@@ -641,11 +641,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;
/*
@@ -655,18 +655,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++;
diff --git a/drivers/media/usb/au0828/au0828.h b/drivers/media/usb/au0828/au0828.h
index 7e6a3bbc68ab..d3644b3fe6fa 100644
--- a/drivers/media/usb/au0828/au0828.h
+++ b/drivers/media/usb/au0828/au0828.h
@@ -280,6 +280,7 @@ struct au0828_dev {
#ifdef CONFIG_MEDIA_CONTROLLER
struct media_device *media_dev;
struct media_pad video_pad, vbi_pad;
+ struct media_entity *decoder;
#endif
};