diff mbox series

[v12,5/6] media: microchip: microchip-isc: move media_pipeline_* to (un)prepare cb

Message ID 20221107141818.104937-6-eugen.hristev@microchip.com
State Accepted
Commit 05255605d378db23b20c0a54c0158ccda5a5d015
Headers show
Series media: atmel: atmel-isc: driver redesign | expand

Commit Message

Eugen Hristev Nov. 7, 2022, 2:18 p.m. UTC
Move the media_pipeline_start/stop calls from start/stop streaming to
the new prepare_streaming and unprepare_streaming callbacks.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
---
 .../platform/microchip/microchip-isc-base.c   | 27 ++++++++++++-------
 1 file changed, 17 insertions(+), 10 deletions(-)

Comments

kernel test robot Nov. 11, 2022, 11:07 p.m. UTC | #1
Hi Eugen,

I love your patch! Yet something to improve:

[auto build test ERROR on media-tree/master]
[also build test ERROR on soc/for-next linus/master sailus-media-tree/streams v6.1-rc4 next-20221111]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Eugen-Hristev/media-atmel-atmel-isc-driver-redesign/20221107-222554
base:   git://linuxtv.org/media_tree.git master
patch link:    https://lore.kernel.org/r/20221107141818.104937-6-eugen.hristev%40microchip.com
patch subject: [PATCH v12 5/6] media: microchip: microchip-isc: move media_pipeline_* to (un)prepare cb
config: ia64-allmodconfig
compiler: ia64-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/03b56a6f5e4cea93bf3bb2072be7a1d2ca8c5449
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Eugen-Hristev/media-atmel-atmel-isc-driver-redesign/20221107-222554
        git checkout 03b56a6f5e4cea93bf3bb2072be7a1d2ca8c5449
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=ia64 SHELL=/bin/bash drivers/media/platform/microchip/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> drivers/media/platform/microchip/microchip-isc-base.c:480:10: error: 'const struct vb2_ops' has no member named 'prepare_streaming'; did you mean 'start_streaming'?
     480 |         .prepare_streaming      = isc_prepare_streaming,
         |          ^~~~~~~~~~~~~~~~~
         |          start_streaming
>> drivers/media/platform/microchip/microchip-isc-base.c:480:35: error: initialization of 'void (*)(struct vb2_buffer *)' from incompatible pointer type 'int (*)(struct vb2_queue *)' [-Werror=incompatible-pointer-types]
     480 |         .prepare_streaming      = isc_prepare_streaming,
         |                                   ^~~~~~~~~~~~~~~~~~~~~
   drivers/media/platform/microchip/microchip-isc-base.c:480:35: note: (near initialization for 'isc_vb2_ops.buf_request_complete')
>> drivers/media/platform/microchip/microchip-isc-base.c:481:10: error: 'const struct vb2_ops' has no member named 'unprepare_streaming'; did you mean 'start_streaming'?
     481 |         .unprepare_streaming    = isc_unprepare_streaming,
         |          ^~~~~~~~~~~~~~~~~~~
         |          start_streaming
   drivers/media/platform/microchip/microchip-isc-base.c:481:35: warning: excess elements in struct initializer
     481 |         .unprepare_streaming    = isc_unprepare_streaming,
         |                                   ^~~~~~~~~~~~~~~~~~~~~~~
   drivers/media/platform/microchip/microchip-isc-base.c:481:35: note: (near initialization for 'isc_vb2_ops')
   cc1: some warnings being treated as errors


vim +480 drivers/media/platform/microchip/microchip-isc-base.c

   471	
   472	static const struct vb2_ops isc_vb2_ops = {
   473		.queue_setup		= isc_queue_setup,
   474		.wait_prepare		= vb2_ops_wait_prepare,
   475		.wait_finish		= vb2_ops_wait_finish,
   476		.buf_prepare		= isc_buffer_prepare,
   477		.start_streaming	= isc_start_streaming,
   478		.stop_streaming		= isc_stop_streaming,
   479		.buf_queue		= isc_buffer_queue,
 > 480		.prepare_streaming	= isc_prepare_streaming,
 > 481		.unprepare_streaming	= isc_unprepare_streaming,
   482	};
   483
diff mbox series

Patch

diff --git a/drivers/media/platform/microchip/microchip-isc-base.c b/drivers/media/platform/microchip/microchip-isc-base.c
index 28749a09b0c3..e2994d48f10c 100644
--- a/drivers/media/platform/microchip/microchip-isc-base.c
+++ b/drivers/media/platform/microchip/microchip-isc-base.c
@@ -328,6 +328,13 @@  static int isc_configure(struct isc_device *isc)
 	return isc_update_profile(isc);
 }
 
+static int isc_prepare_streaming(struct vb2_queue *vq)
+{
+	struct isc_device *isc = vb2_get_drv_priv(vq);
+
+	return media_pipeline_start(isc->video_dev.entity.pads, &isc->mpipe);
+}
+
 static int isc_start_streaming(struct vb2_queue *vq, unsigned int count)
 {
 	struct isc_device *isc = vb2_get_drv_priv(vq);
@@ -336,10 +343,6 @@  static int isc_start_streaming(struct vb2_queue *vq, unsigned int count)
 	unsigned long flags;
 	int ret;
 
-	ret = media_pipeline_start(isc->video_dev.entity.pads, &isc->mpipe);
-	if (ret)
-		goto err_pipeline_start;
-
 	/* Enable stream on the sub device */
 	ret = v4l2_subdev_call(isc->current_subdev->sd, video, s_stream, 1);
 	if (ret && ret != -ENOIOCTLCMD) {
@@ -389,9 +392,6 @@  static int isc_start_streaming(struct vb2_queue *vq, unsigned int count)
 	v4l2_subdev_call(isc->current_subdev->sd, video, s_stream, 0);
 
 err_start_stream:
-	media_pipeline_stop(isc->video_dev.entity.pads);
-
-err_pipeline_start:
 	spin_lock_irqsave(&isc->dma_queue_lock, flags);
 	list_for_each_entry(buf, &isc->dma_queue, list)
 		vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_QUEUED);
@@ -401,6 +401,14 @@  static int isc_start_streaming(struct vb2_queue *vq, unsigned int count)
 	return ret;
 }
 
+static void isc_unprepare_streaming(struct vb2_queue *vq)
+{
+	struct isc_device *isc = vb2_get_drv_priv(vq);
+
+	/* Stop media pipeline */
+	media_pipeline_stop(isc->video_dev.entity.pads);
+}
+
 static void isc_stop_streaming(struct vb2_queue *vq)
 {
 	struct isc_device *isc = vb2_get_drv_priv(vq);
@@ -430,9 +438,6 @@  static void isc_stop_streaming(struct vb2_queue *vq)
 	if (ret && ret != -ENOIOCTLCMD)
 		v4l2_err(&isc->v4l2_dev, "stream off failed in subdev\n");
 
-	/* Stop media pipeline */
-	media_pipeline_stop(isc->video_dev.entity.pads);
-
 	/* Release all active buffers */
 	spin_lock_irqsave(&isc->dma_queue_lock, flags);
 	if (unlikely(isc->cur_frm)) {
@@ -472,6 +477,8 @@  static const struct vb2_ops isc_vb2_ops = {
 	.start_streaming	= isc_start_streaming,
 	.stop_streaming		= isc_stop_streaming,
 	.buf_queue		= isc_buffer_queue,
+	.prepare_streaming	= isc_prepare_streaming,
+	.unprepare_streaming	= isc_unprepare_streaming,
 };
 
 static int isc_querycap(struct file *file, void *priv,