Commit 5525b831 authored by Ezequiel Garcia's avatar Ezequiel Garcia Committed by Mauro Carvalho Chehab

media: mem2mem: Make .job_abort optional

Implementing job_abort() does not make sense on some drivers.
This is not a problem, as the abort is not required to
wait for the job to finish. Quite the opposite, drivers
are encouraged not to wait.

Demote v4l2_m2m_ops.job_abort from required to optional, and
clean all drivers with dummy implementations.
Signed-off-by: default avatarEzequiel Garcia <ezequiel@collabora.com>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent 774f1c91
...@@ -861,14 +861,9 @@ static int mtk_jpeg_job_ready(void *priv) ...@@ -861,14 +861,9 @@ static int mtk_jpeg_job_ready(void *priv)
return (ctx->state == MTK_JPEG_RUNNING) ? 1 : 0; return (ctx->state == MTK_JPEG_RUNNING) ? 1 : 0;
} }
static void mtk_jpeg_job_abort(void *priv)
{
}
static const struct v4l2_m2m_ops mtk_jpeg_m2m_ops = { static const struct v4l2_m2m_ops mtk_jpeg_m2m_ops = {
.device_run = mtk_jpeg_device_run, .device_run = mtk_jpeg_device_run,
.job_ready = mtk_jpeg_job_ready, .job_ready = mtk_jpeg_job_ready,
.job_abort = mtk_jpeg_job_abort,
}; };
static int mtk_jpeg_queue_init(void *priv, struct vb2_queue *src_vq, static int mtk_jpeg_queue_init(void *priv, struct vb2_queue *src_vq,
......
...@@ -441,10 +441,6 @@ static void mtk_mdp_m2m_stop_streaming(struct vb2_queue *q) ...@@ -441,10 +441,6 @@ static void mtk_mdp_m2m_stop_streaming(struct vb2_queue *q)
pm_runtime_put(&ctx->mdp_dev->pdev->dev); pm_runtime_put(&ctx->mdp_dev->pdev->dev);
} }
static void mtk_mdp_m2m_job_abort(void *priv)
{
}
/* The color format (num_planes) must be already configured. */ /* The color format (num_planes) must be already configured. */
static void mtk_mdp_prepare_addr(struct mtk_mdp_ctx *ctx, static void mtk_mdp_prepare_addr(struct mtk_mdp_ctx *ctx,
struct vb2_buffer *vb, struct vb2_buffer *vb,
...@@ -1215,7 +1211,6 @@ static const struct v4l2_file_operations mtk_mdp_m2m_fops = { ...@@ -1215,7 +1211,6 @@ static const struct v4l2_file_operations mtk_mdp_m2m_fops = {
static const struct v4l2_m2m_ops mtk_mdp_m2m_ops = { static const struct v4l2_m2m_ops mtk_mdp_m2m_ops = {
.device_run = mtk_mdp_m2m_device_run, .device_run = mtk_mdp_m2m_device_run,
.job_abort = mtk_mdp_m2m_job_abort,
}; };
int mtk_mdp_register_m2m_device(struct mtk_mdp_dev *mdp) int mtk_mdp_register_m2m_device(struct mtk_mdp_dev *mdp)
......
...@@ -1492,13 +1492,8 @@ static void jpu_device_run(void *priv) ...@@ -1492,13 +1492,8 @@ static void jpu_device_run(void *priv)
spin_unlock_irqrestore(&ctx->jpu->lock, flags); spin_unlock_irqrestore(&ctx->jpu->lock, flags);
} }
static void jpu_job_abort(void *priv)
{
}
static const struct v4l2_m2m_ops jpu_m2m_ops = { static const struct v4l2_m2m_ops jpu_m2m_ops = {
.device_run = jpu_device_run, .device_run = jpu_device_run,
.job_abort = jpu_job_abort,
}; };
/* /*
......
...@@ -39,11 +39,6 @@ ...@@ -39,11 +39,6 @@
static int debug; static int debug;
module_param(debug, int, 0644); module_param(debug, int, 0644);
static void job_abort(void *prv)
{
/* Can't do anything rational here */
}
static void device_run(void *prv) static void device_run(void *prv)
{ {
struct rga_ctx *ctx = prv; struct rga_ctx *ctx = prv;
...@@ -104,7 +99,6 @@ static irqreturn_t rga_isr(int irq, void *prv) ...@@ -104,7 +99,6 @@ static irqreturn_t rga_isr(int irq, void *prv)
static struct v4l2_m2m_ops rga_m2m_ops = { static struct v4l2_m2m_ops rga_m2m_ops = {
.device_run = device_run, .device_run = device_run,
.job_abort = job_abort,
}; };
static int static int
......
...@@ -483,10 +483,6 @@ static int vidioc_s_crop(struct file *file, void *prv, const struct v4l2_crop *c ...@@ -483,10 +483,6 @@ static int vidioc_s_crop(struct file *file, void *prv, const struct v4l2_crop *c
return 0; return 0;
} }
static void job_abort(void *prv)
{
}
static void device_run(void *prv) static void device_run(void *prv)
{ {
struct g2d_ctx *ctx = prv; struct g2d_ctx *ctx = prv;
...@@ -605,7 +601,6 @@ static const struct video_device g2d_videodev = { ...@@ -605,7 +601,6 @@ static const struct video_device g2d_videodev = {
static const struct v4l2_m2m_ops g2d_m2m_ops = { static const struct v4l2_m2m_ops g2d_m2m_ops = {
.device_run = device_run, .device_run = device_run,
.job_abort = job_abort,
}; };
static const struct of_device_id exynos_g2d_match[]; static const struct of_device_id exynos_g2d_match[];
......
...@@ -2467,26 +2467,19 @@ static int s5p_jpeg_job_ready(void *priv) ...@@ -2467,26 +2467,19 @@ static int s5p_jpeg_job_ready(void *priv)
return 1; return 1;
} }
static void s5p_jpeg_job_abort(void *priv)
{
}
static struct v4l2_m2m_ops s5p_jpeg_m2m_ops = { static struct v4l2_m2m_ops s5p_jpeg_m2m_ops = {
.device_run = s5p_jpeg_device_run, .device_run = s5p_jpeg_device_run,
.job_ready = s5p_jpeg_job_ready, .job_ready = s5p_jpeg_job_ready,
.job_abort = s5p_jpeg_job_abort,
}; };
static struct v4l2_m2m_ops exynos3250_jpeg_m2m_ops = { static struct v4l2_m2m_ops exynos3250_jpeg_m2m_ops = {
.device_run = exynos3250_jpeg_device_run, .device_run = exynos3250_jpeg_device_run,
.job_ready = s5p_jpeg_job_ready, .job_ready = s5p_jpeg_job_ready,
.job_abort = s5p_jpeg_job_abort,
}; };
static struct v4l2_m2m_ops exynos4_jpeg_m2m_ops = { static struct v4l2_m2m_ops exynos4_jpeg_m2m_ops = {
.device_run = exynos4_jpeg_device_run, .device_run = exynos4_jpeg_device_run,
.job_ready = s5p_jpeg_job_ready, .job_ready = s5p_jpeg_job_ready,
.job_abort = s5p_jpeg_job_abort,
}; };
/* /*
......
...@@ -322,7 +322,8 @@ static void v4l2_m2m_cancel_job(struct v4l2_m2m_ctx *m2m_ctx) ...@@ -322,7 +322,8 @@ static void v4l2_m2m_cancel_job(struct v4l2_m2m_ctx *m2m_ctx)
m2m_ctx->job_flags |= TRANS_ABORT; m2m_ctx->job_flags |= TRANS_ABORT;
if (m2m_ctx->job_flags & TRANS_RUNNING) { if (m2m_ctx->job_flags & TRANS_RUNNING) {
spin_unlock_irqrestore(&m2m_dev->job_spinlock, flags); spin_unlock_irqrestore(&m2m_dev->job_spinlock, flags);
m2m_dev->m2m_ops->job_abort(m2m_ctx->priv); if (m2m_dev->m2m_ops->job_abort)
m2m_dev->m2m_ops->job_abort(m2m_ctx->priv);
dprintk("m2m_ctx %p running, will wait to complete", m2m_ctx); dprintk("m2m_ctx %p running, will wait to complete", m2m_ctx);
wait_event(m2m_ctx->finished, wait_event(m2m_ctx->finished,
!(m2m_ctx->job_flags & TRANS_RUNNING)); !(m2m_ctx->job_flags & TRANS_RUNNING));
...@@ -788,8 +789,7 @@ struct v4l2_m2m_dev *v4l2_m2m_init(const struct v4l2_m2m_ops *m2m_ops) ...@@ -788,8 +789,7 @@ struct v4l2_m2m_dev *v4l2_m2m_init(const struct v4l2_m2m_ops *m2m_ops)
{ {
struct v4l2_m2m_dev *m2m_dev; struct v4l2_m2m_dev *m2m_dev;
if (!m2m_ops || WARN_ON(!m2m_ops->device_run) || if (!m2m_ops || WARN_ON(!m2m_ops->device_run))
WARN_ON(!m2m_ops->job_abort))
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
m2m_dev = kzalloc(sizeof *m2m_dev, GFP_KERNEL); m2m_dev = kzalloc(sizeof *m2m_dev, GFP_KERNEL);
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
* assumed that one source and one destination buffer are all * assumed that one source and one destination buffer are all
* that is required for the driver to perform one full transaction. * that is required for the driver to perform one full transaction.
* This method may not sleep. * This method may not sleep.
* @job_abort: required. Informs the driver that it has to abort the currently * @job_abort: optional. Informs the driver that it has to abort the currently
* running transaction as soon as possible (i.e. as soon as it can * running transaction as soon as possible (i.e. as soon as it can
* stop the device safely; e.g. in the next interrupt handler), * stop the device safely; e.g. in the next interrupt handler),
* even if the transaction would not have been finished by then. * even if the transaction would not have been finished by then.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment