diff mbox series

[2/4] media: mt9m111: add VIDEO_V4L2_SUBDEV_API dependency

Message ID 1549637565-32096-3-git-send-email-akinobu.mita@gmail.com (mailing list archive)
State New, archived
Headers show
Series media: i2c: tweak Kconfig dependencies | expand

Commit Message

Akinobu Mita Feb. 8, 2019, 2:52 p.m. UTC
This driver currently supports MC and V4L2 sub-device uAPI, so add
related dependency and remove unneeded ifdefs.

Just adding VIDEO_V4L2_SUBDEV_API dependency is enough, because
VIDEO_V4L2_SUBDEV_API depends on MEDIA_CONTROLLER.

Suggested-by: Marco Felsch <m.felsch@pengutronix.de>
Cc: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
Cc: Michael Grzeschik <m.grzeschik@pengutronix.de>
Cc: Marco Felsch <m.felsch@pengutronix.de>
Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
---
 drivers/media/i2c/Kconfig   |  2 +-
 drivers/media/i2c/mt9m111.c | 13 +------------
 2 files changed, 2 insertions(+), 13 deletions(-)

Comments

Akinobu Mita Feb. 9, 2019, 11:54 a.m. UTC | #1
2019年2月9日(土) 1:20 kbuild test robot <lkp@intel.com>:
>
> Hi Akinobu,
>
> I love your patch! Yet something to improve:
>
> [auto build test ERROR on linuxtv-media/master]
> [also build test ERROR on next-20190208]
> [cannot apply to v5.0-rc4]
> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
>
> url:    https://github.com/0day-ci/linux/commits/Akinobu-Mita/media-i2c-tweak-Kconfig-dependencies/20190208-233718
> base:   git://linuxtv.org/media_tree.git master
> config: i386-randconfig-x019-201905 (attached as .config)

Ah, SOC_CAMERA_MT9M111 implicitly selects VIDEO_MT9M111 and in this case,
VIDEO_V4L2_SUBDEV_API is not required.

This build error can be fixed by removing SOC_CAMERA_MT9M111 from
drivers/media/i2c/soc_camera/Kconfig.
Sakari Ailus Feb. 9, 2019, 3:31 p.m. UTC | #2
On Sat, Feb 09, 2019 at 08:54:39PM +0900, Akinobu Mita wrote:
> 2019年2月9日(土) 1:20 kbuild test robot <lkp@intel.com>:
> >
> > Hi Akinobu,
> >
> > I love your patch! Yet something to improve:
> >
> > [auto build test ERROR on linuxtv-media/master]
> > [also build test ERROR on next-20190208]
> > [cannot apply to v5.0-rc4]
> > [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
> >
> > url:    https://github.com/0day-ci/linux/commits/Akinobu-Mita/media-i2c-tweak-Kconfig-dependencies/20190208-233718
> > base:   git://linuxtv.org/media_tree.git master
> > config: i386-randconfig-x019-201905 (attached as .config)
> 
> Ah, SOC_CAMERA_MT9M111 implicitly selects VIDEO_MT9M111 and in this case,
> VIDEO_V4L2_SUBDEV_API is not required.
> 
> This build error can be fixed by removing SOC_CAMERA_MT9M111 from
> drivers/media/i2c/soc_camera/Kconfig.

Ah, thanks, I was wondering what this could have been about. :-) I'll send
a patch.
kernel test robot Feb. 9, 2019, 9:02 p.m. UTC | #3
Hi Akinobu,

I love your patch! Yet something to improve:

[auto build test ERROR on linuxtv-media/master]
[also build test ERROR on next-20190208]
[cannot apply to v5.0-rc4]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Akinobu-Mita/media-i2c-tweak-Kconfig-dependencies/20190208-233718
base:   git://linuxtv.org/media_tree.git master
config: i386-randconfig-x0-02100114 (attached as .config)
compiler: gcc-5 (Debian 5.5.0-3) 5.4.1 20171010
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All error/warnings (new ones prefixed by >>):

   drivers/media/i2c/mt9m111.c: In function 'mt9m111_get_fmt':
>> drivers/media/i2c/mt9m111.c:530:8: error: implicit declaration of function 'v4l2_subdev_get_try_format' [-Werror=implicit-function-declaration]
      mf = v4l2_subdev_get_try_format(sd, cfg, format->pad);
           ^
>> drivers/media/i2c/mt9m111.c:530:6: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
      mf = v4l2_subdev_get_try_format(sd, cfg, format->pad);
         ^
   drivers/media/i2c/mt9m111.c: In function 'mt9m111_init_cfg':
>> drivers/media/i2c/mt9m111.c:1107:3: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
      v4l2_subdev_get_try_format(sd, cfg, 0);
      ^
   drivers/media/i2c/mt9m111.c: In function 'mt9m111_probe':
   drivers/media/i2c/mt9m111.c:1290:17: error: 'struct v4l2_subdev' has no member named 'entity'
     mt9m111->subdev.entity.function = MEDIA_ENT_F_CAM_SENSOR;
                    ^
   drivers/media/i2c/mt9m111.c:1291:47: error: 'struct v4l2_subdev' has no member named 'entity'
     ret = media_entity_pads_init(&mt9m111->subdev.entity, 1, &mt9m111->pad);
                                                  ^
   cc1: some warnings being treated as errors

vim +/v4l2_subdev_get_try_format +530 drivers/media/i2c/mt9m111.c

6a6c8786 drivers/media/video/mt9m111.c          Guennadi Liakhovetski 2009-08-25  518  
da298c6d drivers/media/i2c/soc_camera/mt9m111.c Hans Verkuil          2015-04-09  519  static int mt9m111_get_fmt(struct v4l2_subdev *sd,
da298c6d drivers/media/i2c/soc_camera/mt9m111.c Hans Verkuil          2015-04-09  520  		struct v4l2_subdev_pad_config *cfg,
da298c6d drivers/media/i2c/soc_camera/mt9m111.c Hans Verkuil          2015-04-09  521  		struct v4l2_subdev_format *format)
6a6c8786 drivers/media/video/mt9m111.c          Guennadi Liakhovetski 2009-08-25  522  {
da298c6d drivers/media/i2c/soc_camera/mt9m111.c Hans Verkuil          2015-04-09  523  	struct v4l2_mbus_framefmt *mf = &format->format;
2768cbbb drivers/media/video/mt9m111.c          Guennadi Liakhovetski 2011-06-07  524  	struct mt9m111 *mt9m111 = container_of(sd, struct mt9m111, subdev);
6a6c8786 drivers/media/video/mt9m111.c          Guennadi Liakhovetski 2009-08-25  525  
da298c6d drivers/media/i2c/soc_camera/mt9m111.c Hans Verkuil          2015-04-09  526  	if (format->pad)
da298c6d drivers/media/i2c/soc_camera/mt9m111.c Hans Verkuil          2015-04-09  527  		return -EINVAL;
da298c6d drivers/media/i2c/soc_camera/mt9m111.c Hans Verkuil          2015-04-09  528  
49410d3a drivers/media/i2c/mt9m111.c            Akinobu Mita          2019-01-15  529  	if (format->which == V4L2_SUBDEV_FORMAT_TRY) {
49410d3a drivers/media/i2c/mt9m111.c            Akinobu Mita          2019-01-15 @530  		mf = v4l2_subdev_get_try_format(sd, cfg, format->pad);
49410d3a drivers/media/i2c/mt9m111.c            Akinobu Mita          2019-01-15  531  		format->format = *mf;
49410d3a drivers/media/i2c/mt9m111.c            Akinobu Mita          2019-01-15  532  		return 0;
49410d3a drivers/media/i2c/mt9m111.c            Akinobu Mita          2019-01-15  533  	}
49410d3a drivers/media/i2c/mt9m111.c            Akinobu Mita          2019-01-15  534  
da673e60 drivers/media/video/mt9m111.c          Guennadi Liakhovetski 2011-11-04  535  	mf->width	= mt9m111->width;
da673e60 drivers/media/video/mt9m111.c          Guennadi Liakhovetski 2011-11-04  536  	mf->height	= mt9m111->height;
760697be drivers/media/video/mt9m111.c          Guennadi Liakhovetski 2009-12-11  537  	mf->code	= mt9m111->fmt->code;
01f5a394 drivers/media/video/mt9m111.c          Michael Grzeschik     2010-08-03  538  	mf->colorspace	= mt9m111->fmt->colorspace;
760697be drivers/media/video/mt9m111.c          Guennadi Liakhovetski 2009-12-11  539  	mf->field	= V4L2_FIELD_NONE;
2e1566ab drivers/media/i2c/mt9m111.c            Akinobu Mita          2019-01-15  540  	mf->ycbcr_enc	= V4L2_YCBCR_ENC_DEFAULT;
2e1566ab drivers/media/i2c/mt9m111.c            Akinobu Mita          2019-01-15  541  	mf->quantization	= V4L2_QUANTIZATION_DEFAULT;
2e1566ab drivers/media/i2c/mt9m111.c            Akinobu Mita          2019-01-15  542  	mf->xfer_func	= V4L2_XFER_FUNC_DEFAULT;
6a6c8786 drivers/media/video/mt9m111.c          Guennadi Liakhovetski 2009-08-25  543  
6a6c8786 drivers/media/video/mt9m111.c          Guennadi Liakhovetski 2009-08-25  544  	return 0;
6a6c8786 drivers/media/video/mt9m111.c          Guennadi Liakhovetski 2009-08-25  545  }
6a6c8786 drivers/media/video/mt9m111.c          Guennadi Liakhovetski 2009-08-25  546  

:::::: The code at line 530 was first introduced by commit
:::::: 49410d3abf4492d8be1e6ce6e8ece0e16407f22d media: mt9m111: make SUBDEV_G_FMT ioctl work with SUBDEV_FORMAT_TRY

:::::: TO: Akinobu Mita <akinobu.mita@gmail.com>
:::::: CC: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
diff mbox series

Patch

diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
index 12d7e52..71c7433 100644
--- a/drivers/media/i2c/Kconfig
+++ b/drivers/media/i2c/Kconfig
@@ -876,7 +876,7 @@  config VIDEO_MT9M032
 
 config VIDEO_MT9M111
 	tristate "mt9m111, mt9m112 and mt9m131 support"
-	depends on I2C && VIDEO_V4L2
+	depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
 	select V4L2_FWNODE
 	help
 	  This driver supports MT9M111, MT9M112 and MT9M131 cameras from
diff --git a/drivers/media/i2c/mt9m111.c b/drivers/media/i2c/mt9m111.c
index 5168bb5..55e2f46 100644
--- a/drivers/media/i2c/mt9m111.c
+++ b/drivers/media/i2c/mt9m111.c
@@ -246,9 +246,7 @@  struct mt9m111 {
 	bool is_streaming;
 	/* user point of view - 0: falling 1: rising edge */
 	unsigned int pclk_sample:1;
-#ifdef CONFIG_MEDIA_CONTROLLER
 	struct media_pad pad;
-#endif
 };
 
 static const struct mt9m111_mode_info mt9m111_mode_data[MT9M111_NUM_MODES] = {
@@ -529,13 +527,9 @@  static int mt9m111_get_fmt(struct v4l2_subdev *sd,
 		return -EINVAL;
 
 	if (format->which == V4L2_SUBDEV_FORMAT_TRY) {
-#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API
 		mf = v4l2_subdev_get_try_format(sd, cfg, format->pad);
 		format->format = *mf;
 		return 0;
-#else
-		return -ENOTTY;
-#endif
 	}
 
 	mf->width	= mt9m111->width;
@@ -1109,7 +1103,6 @@  static int mt9m111_s_stream(struct v4l2_subdev *sd, int enable)
 static int mt9m111_init_cfg(struct v4l2_subdev *sd,
 			    struct v4l2_subdev_pad_config *cfg)
 {
-#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API
 	struct v4l2_mbus_framefmt *format =
 		v4l2_subdev_get_try_format(sd, cfg, 0);
 
@@ -1121,7 +1114,7 @@  static int mt9m111_init_cfg(struct v4l2_subdev *sd,
 	format->ycbcr_enc	= V4L2_YCBCR_ENC_DEFAULT;
 	format->quantization	= V4L2_QUANTIZATION_DEFAULT;
 	format->xfer_func	= V4L2_XFER_FUNC_DEFAULT;
-#endif
+
 	return 0;
 }
 
@@ -1293,13 +1286,11 @@  static int mt9m111_probe(struct i2c_client *client,
 		goto out_clkput;
 	}
 
-#ifdef CONFIG_MEDIA_CONTROLLER
 	mt9m111->pad.flags = MEDIA_PAD_FL_SOURCE;
 	mt9m111->subdev.entity.function = MEDIA_ENT_F_CAM_SENSOR;
 	ret = media_entity_pads_init(&mt9m111->subdev.entity, 1, &mt9m111->pad);
 	if (ret < 0)
 		goto out_hdlfree;
-#endif
 
 	mt9m111->current_mode = &mt9m111_mode_data[MT9M111_MODE_SXGA_15FPS];
 	mt9m111->frame_interval.numerator = 1;
@@ -1328,10 +1319,8 @@  static int mt9m111_probe(struct i2c_client *client,
 	return 0;
 
 out_entityclean:
-#ifdef CONFIG_MEDIA_CONTROLLER
 	media_entity_cleanup(&mt9m111->subdev.entity);
 out_hdlfree:
-#endif
 	v4l2_ctrl_handler_free(&mt9m111->hdl);
 out_clkput:
 	v4l2_clk_put(mt9m111->clk);