From: Sakari Ailus <sakari.ailus@iki.fi>
To: Shuah Khan <shuahkh@osg.samsung.com>
Cc: mchehab@osg.samsung.com, linux-media@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] media: Media Controller fix to not let stream_count go negative
Date: Wed, 3 Feb 2016 00:53:21 +0200 [thread overview]
Message-ID: <20160202225321.GS14876@valkosipuli.retiisi.org.uk> (raw)
In-Reply-To: <1454184652-2427-1-git-send-email-shuahkh@osg.samsung.com>
Hi Shuah,
On Sat, Jan 30, 2016 at 01:10:52PM -0700, Shuah Khan wrote:
> Change media_entity_pipeline_stop() to not decrement
> stream_count of an inactive media pipeline. Doing so,
> results in preventing starting the pipeline.
>
> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
> ---
> drivers/media/media-entity.c | 18 ++++++++++++------
> 1 file changed, 12 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c
> index e89d85a..f2e4360 100644
> --- a/drivers/media/media-entity.c
> +++ b/drivers/media/media-entity.c
> @@ -452,9 +452,12 @@ error:
> media_entity_graph_walk_start(graph, entity_err);
>
> while ((entity_err = media_entity_graph_walk_next(graph))) {
> - entity_err->stream_count--;
> - if (entity_err->stream_count == 0)
> - entity_err->pipe = NULL;
> + /* don't let the stream_count go negative */
> + if (entity->stream_count > 0) {
> + entity_err->stream_count--;
> + if (entity_err->stream_count == 0)
> + entity_err->pipe = NULL;
> + }
>
> /*
> * We haven't increased stream_count further than this
> @@ -486,9 +489,12 @@ void media_entity_pipeline_stop(struct media_entity *entity)
> media_entity_graph_walk_start(graph, entity);
>
> while ((entity = media_entity_graph_walk_next(graph))) {
> - entity->stream_count--;
> - if (entity->stream_count == 0)
> - entity->pipe = NULL;
> + /* don't let the stream_count go negative */
> + if (entity->stream_count > 0) {
> + entity->stream_count--;
> + if (entity->stream_count == 0)
> + entity->pipe = NULL;
> + }
> }
>
> if (!--pipe->streaming_count)
Have you seen issues with a certain driver, for instance?
In the original design the streaming count is really a count --- streaming
starts when count becomes non-zero, and stops when it reaches zero again.
The calls to media_entity_pipeline_start() and media_entity_pipeline_stop()
should thus always be balanced. I'm fine with the patch, but the framework
should shout loud when the count would be decremented when it's zero.
That was some four or more years ago. I have to say I really haven't been
able to see good reasons for making this a count --- rather what's needed is
to mark the entity as busy so that its link configuration isn't touched. The
request API is a completely different matter then.
Such change would require more discussion IMHO.
--
Kind regards,
Sakari Ailus
e-mail: sakari.ailus@iki.fi XMPP: sailus@retiisi.org.uk
next prev parent reply other threads:[~2016-02-02 22:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-30 20:10 Shuah Khan
2016-02-02 22:53 ` Sakari Ailus [this message]
2016-02-02 23:04 ` Shuah Khan
2016-02-02 23:09 ` Sakari Ailus
2016-02-02 23:18 ` Shuah Khan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160202225321.GS14876@valkosipuli.retiisi.org.uk \
--to=sakari.ailus@iki.fi \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@osg.samsung.com \
--cc=shuahkh@osg.samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®