Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1320796 > unrolled thread
| Started by | Mauro Carvalho Chehab <mchehab@osg.samsung.com> |
|---|---|
| First post | 2016-01-28 16:40 +0100 |
| Last post | 2016-01-28 20:00 +0100 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH 13/31] media: au0828 fix au0828_create_media_graph() entity checks Mauro Carvalho Chehab <mchehab@osg.samsung.com> - 2016-01-28 16:40 +0100
Re: [PATCH 13/31] media: au0828 fix au0828_create_media_graph() entity checks Shuah Khan <shuahkh@osg.samsung.com> - 2016-01-28 20:00 +0100
| From | Mauro Carvalho Chehab <mchehab@osg.samsung.com> |
|---|---|
| Date | 2016-01-28 16:40 +0100 |
| Subject | Re: [PATCH 13/31] media: au0828 fix au0828_create_media_graph() entity checks |
| Message-ID | <qVWPV-5sX-23@gated-at.bofh.it> |
Em Wed, 6 Jan 2016 13:27:02 -0700
Shuah Khan <shuahkh@osg.samsung.com> escreveu:
> au0828_create_media_graph() doesn't do any checks to determine,
> if vbi_dev, vdev, and input entities have been registered prior
> to creating pad links. Checking graph_obj.mdev field works as
> the graph_obj.mdev field gets initialized in the entity register
> interface. Fix it to check graph_obj.mdev field before creating
> pad links.
>
> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
> ---
> drivers/media/usb/au0828/au0828-core.c | 27 +++++++++++++++++----------
> 1 file changed, 17 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/media/usb/au0828/au0828-core.c b/drivers/media/usb/au0828/au0828-core.c
> index f46fb43..8ef7c71 100644
> --- a/drivers/media/usb/au0828/au0828-core.c
> +++ b/drivers/media/usb/au0828/au0828-core.c
> @@ -291,20 +291,27 @@ static int au0828_create_media_graph(struct au0828_dev *dev)
> if (ret)
> return ret;
> }
> - ret = media_create_pad_link(decoder, AU8522_PAD_VID_OUT,
> - &dev->vdev.entity, 0,
> - MEDIA_LNK_FL_ENABLED);
> - if (ret)
> - return ret;
> - ret = media_create_pad_link(decoder, AU8522_PAD_VBI_OUT,
> - &dev->vbi_dev.entity, 0,
> - MEDIA_LNK_FL_ENABLED);
> - if (ret)
> - return ret;
> + if (dev->vdev.entity.graph_obj.mdev) {
> + ret = media_create_pad_link(decoder, AU8522_PAD_VID_OUT,
> + &dev->vdev.entity, 0,
> + MEDIA_LNK_FL_ENABLED);
> + if (ret)
> + return ret;
> + }
Those new if() doesn't look right. We can't continue if the entities
weren't registered, as the graph would have troubles. The logic should
ensure that the entities will always be created before running
au0828_create_media_graph(). If this is not the case, some async
logic is needed to ensure that.
> + if (dev->vbi_dev.entity.graph_obj.mdev) {
> + ret = media_create_pad_link(decoder, AU8522_PAD_VBI_OUT,
> + &dev->vbi_dev.entity, 0,
> + MEDIA_LNK_FL_ENABLED);
> + if (ret)
> + return ret;
> + }
>
> for (i = 0; i < AU0828_MAX_INPUT; i++) {
> struct media_entity *ent = &dev->input_ent[i];
>
> + if (!ent->graph_obj.mdev)
> + continue;
> +
> if (AUVI_INPUT(i).type == AU0828_VMUX_UNDEFINED)
> break;
>
[toc] | [next] | [standalone]
| From | Shuah Khan <shuahkh@osg.samsung.com> |
|---|---|
| Date | 2016-01-28 20:00 +0100 |
| Message-ID | <qVZXt-7BG-23@gated-at.bofh.it> |
| In reply to | #1320796 |
On 01/28/2016 08:37 AM, Mauro Carvalho Chehab wrote:
> Em Wed, 6 Jan 2016 13:27:02 -0700
> Shuah Khan <shuahkh@osg.samsung.com> escreveu:
>
>> au0828_create_media_graph() doesn't do any checks to determine,
>> if vbi_dev, vdev, and input entities have been registered prior
>> to creating pad links. Checking graph_obj.mdev field works as
>> the graph_obj.mdev field gets initialized in the entity register
>> interface. Fix it to check graph_obj.mdev field before creating
>> pad links.
>
>>
>> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
>> ---
>> drivers/media/usb/au0828/au0828-core.c | 27 +++++++++++++++++----------
>> 1 file changed, 17 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/media/usb/au0828/au0828-core.c b/drivers/media/usb/au0828/au0828-core.c
>> index f46fb43..8ef7c71 100644
>> --- a/drivers/media/usb/au0828/au0828-core.c
>> +++ b/drivers/media/usb/au0828/au0828-core.c
>> @@ -291,20 +291,27 @@ static int au0828_create_media_graph(struct au0828_dev *dev)
>> if (ret)
>> return ret;
>> }
>> - ret = media_create_pad_link(decoder, AU8522_PAD_VID_OUT,
>> - &dev->vdev.entity, 0,
>> - MEDIA_LNK_FL_ENABLED);
>> - if (ret)
>> - return ret;
>> - ret = media_create_pad_link(decoder, AU8522_PAD_VBI_OUT,
>> - &dev->vbi_dev.entity, 0,
>> - MEDIA_LNK_FL_ENABLED);
>> - if (ret)
>> - return ret;
>> + if (dev->vdev.entity.graph_obj.mdev) {
>> + ret = media_create_pad_link(decoder, AU8522_PAD_VID_OUT,
>> + &dev->vdev.entity, 0,
>> + MEDIA_LNK_FL_ENABLED);
>> + if (ret)
>> + return ret;
>> + }
>
> Those new if() doesn't look right. We can't continue if the entities
> weren't registered, as the graph would have troubles. The logic should
> ensure that the entities will always be created before running
> au0828_create_media_graph(). If this is not the case, some async
> logic is needed to ensure that.
There have been some changes in au0828 media init and
register sequence in 4.5-rc1. wau0828 does its graph
creation before it registers media_device.
I needed these checks before this above. It looks
like I might have simply rebased my patch over
without taking this change into account. I will
try without these checks.
Async method is already in place for snd-usb-audio
part of the graph. Please see patch 20 in the series.
thanks,
-- Shuah
>
>> + if (dev->vbi_dev.entity.graph_obj.mdev) {
>> + ret = media_create_pad_link(decoder, AU8522_PAD_VBI_OUT,
>> + &dev->vbi_dev.entity, 0,
>> + MEDIA_LNK_FL_ENABLED);
>> + if (ret)
>> + return ret;
>> + }
>>
>> for (i = 0; i < AU0828_MAX_INPUT; i++) {
>> struct media_entity *ent = &dev->input_ent[i];
>>
>> + if (!ent->graph_obj.mdev)
>> + continue;
>> +
>> if (AUVI_INPUT(i).type == AU0828_VMUX_UNDEFINED)
>> break;
>>
--
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America (Silicon Valley)
shuahkh@osg.samsung.com | (970) 217-8978
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web