* [PATCH v3] media: vimc: streamer: if kthread_stop fails, ignore the error
@ 2020-01-17 9:50 Dafna Hirschfeld
2020-01-17 14:33 ` Helen Koike
0 siblings, 1 reply; 2+ messages in thread
From: Dafna Hirschfeld @ 2020-01-17 9:50 UTC (permalink / raw)
To: linux-media
Cc: dafna.hirschfeld, helen.koike, ezequiel, skhan, hverkuil, kernel, dafna3
Ignore errors returned from kthread_stop since the
vimc subdevices should still be notified that
streaming stopped so they can release the memory for
the streaming, and also kthread should be set to NULL.
kthread_stop can return -EINTR in case the thread
did not yet run. This can happen if userspace calls
streamon and streamoff right after.
Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
---
changes since v2: add a comment explaning why we ignore the error
drivers/media/platform/vimc/vimc-streamer.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/media/platform/vimc/vimc-streamer.c b/drivers/media/platform/vimc/vimc-streamer.c
index cd6b55433c9e..6a6fa6c21138 100644
--- a/drivers/media/platform/vimc/vimc-streamer.c
+++ b/drivers/media/platform/vimc/vimc-streamer.c
@@ -215,9 +215,13 @@ int vimc_streamer_s_stream(struct vimc_stream *stream,
return 0;
ret = kthread_stop(stream->kthread);
- if (ret)
- return ret;
+ /*
+ * ignore errors from kthread_stop since we have to set kthread
+ * to NULL and notify the subdevs that the stream stopped anyway
+ */
+ if (ret)
+ dev_warn(ved->dev, "kthread_stop returned '%d'\n", ret);
stream->kthread = NULL;
vimc_streamer_pipeline_terminate(stream);
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v3] media: vimc: streamer: if kthread_stop fails, ignore the error
2020-01-17 9:50 [PATCH v3] media: vimc: streamer: if kthread_stop fails, ignore the error Dafna Hirschfeld
@ 2020-01-17 14:33 ` Helen Koike
0 siblings, 0 replies; 2+ messages in thread
From: Helen Koike @ 2020-01-17 14:33 UTC (permalink / raw)
To: Dafna Hirschfeld, linux-media; +Cc: ezequiel, skhan, hverkuil, kernel, dafna3
On 1/17/20 7:50 AM, Dafna Hirschfeld wrote:
> Ignore errors returned from kthread_stop since the
> vimc subdevices should still be notified that
> streaming stopped so they can release the memory for
> the streaming, and also kthread should be set to NULL.
> kthread_stop can return -EINTR in case the thread
> did not yet run. This can happen if userspace calls
> streamon and streamoff right after.
>
> Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
> ---
> changes since v2: add a comment explaning why we ignore the error
>
> drivers/media/platform/vimc/vimc-streamer.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/media/platform/vimc/vimc-streamer.c b/drivers/media/platform/vimc/vimc-streamer.c
> index cd6b55433c9e..6a6fa6c21138 100644
> --- a/drivers/media/platform/vimc/vimc-streamer.c
> +++ b/drivers/media/platform/vimc/vimc-streamer.c
> @@ -215,9 +215,13 @@ int vimc_streamer_s_stream(struct vimc_stream *stream,
> return 0;
>
> ret = kthread_stop(stream->kthread);
> - if (ret)
> - return ret;
>
this new line is not required
> + /*
> + * ignore errors from kthread_stop since we have to set kthread
> + * to NULL and notify the subdevs that the stream stopped anyway
> + */
hmm, I think what we could make it clear is in which situation kthread_stop would return
an error.
How about:
"kthread_stop returns error in cases when streamon was immediately followed by
streamoff, and the thread didn't had a chance to run.
Ignore errors to stop the stream in the pipeline."
Helen
> + if (ret)
> + dev_warn(ved->dev, "kthread_stop returned '%d'\n", ret);
> stream->kthread = NULL;
>
> vimc_streamer_pipeline_terminate(stream);
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-01-17 14:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-17 9:50 [PATCH v3] media: vimc: streamer: if kthread_stop fails, ignore the error Dafna Hirschfeld
2020-01-17 14:33 ` Helen Koike
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.