* [PATCH v5] media: vimc: streamer: if kthread_stop fails, ignore the error
@ 2020-01-22 9:52 Dafna Hirschfeld
2020-01-22 13:57 ` Helen Koike
0 siblings, 1 reply; 2+ messages in thread
From: Dafna Hirschfeld @ 2020-01-22 9:52 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 from v4: change dev_warn to dev_dbg, delete and add a empty lines
Changes from v3: change the comment to explain when kthread fails
changes since v2: add a comment explaning why we ignore the error
Changes from v1: undo deletion of an empty line
drivers/media/platform/vimc/vimc-streamer.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/media/platform/vimc/vimc-streamer.c b/drivers/media/platform/vimc/vimc-streamer.c
index cd6b55433c9e..9d2b1ff2ba45 100644
--- a/drivers/media/platform/vimc/vimc-streamer.c
+++ b/drivers/media/platform/vimc/vimc-streamer.c
@@ -215,8 +215,14 @@ int vimc_streamer_s_stream(struct vimc_stream *stream,
return 0;
ret = kthread_stop(stream->kthread);
+ /*
+ * kthread_stop returns -EINTR 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.
+ */
if (ret)
- return ret;
+ dev_dbg(ved->dev, "kthread_stop returned '%d'\n", ret);
stream->kthread = NULL;
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v5] media: vimc: streamer: if kthread_stop fails, ignore the error
2020-01-22 9:52 [PATCH v5] media: vimc: streamer: if kthread_stop fails, ignore the error Dafna Hirschfeld
@ 2020-01-22 13:57 ` Helen Koike
0 siblings, 0 replies; 2+ messages in thread
From: Helen Koike @ 2020-01-22 13:57 UTC (permalink / raw)
To: Dafna Hirschfeld, linux-media; +Cc: ezequiel, skhan, hverkuil, kernel, dafna3
On 1/22/20 7:52 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>
Acked-by: Helen Koike <helen.koike@collabora.com>
Thanks
Helen
> ---
> changes from v4: change dev_warn to dev_dbg, delete and add a empty lines
> Changes from v3: change the comment to explain when kthread fails
> changes since v2: add a comment explaning why we ignore the error
> Changes from v1: undo deletion of an empty line
>
> drivers/media/platform/vimc/vimc-streamer.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/platform/vimc/vimc-streamer.c b/drivers/media/platform/vimc/vimc-streamer.c
> index cd6b55433c9e..9d2b1ff2ba45 100644
> --- a/drivers/media/platform/vimc/vimc-streamer.c
> +++ b/drivers/media/platform/vimc/vimc-streamer.c
> @@ -215,8 +215,14 @@ int vimc_streamer_s_stream(struct vimc_stream *stream,
> return 0;
>
> ret = kthread_stop(stream->kthread);
> + /*
> + * kthread_stop returns -EINTR 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.
> + */
> if (ret)
> - return ret;
> + dev_dbg(ved->dev, "kthread_stop returned '%d'\n", ret);
>
> stream->kthread = NULL;
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-01-22 13:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-22 9:52 [PATCH v5] media: vimc: streamer: if kthread_stop fails, ignore the error Dafna Hirschfeld
2020-01-22 13:57 ` 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.