[{"id":4628,"web_url":"https://patchwork.libcamera.org/comment/4628/","msgid":"<20200428212643.GB5381@paasikivi.fi.intel.com>","date":"2020-04-28T21:26:43","subject":"Re: [libcamera-devel] [PATCH v5 4/6] media: v4l2-subdev: Assume\n\tV4L2_SUBDEV_API is selected","submitter":{"id":37,"url":"https://patchwork.libcamera.org/api/people/37/","name":"Sakari Ailus","email":"sakari.ailus@linux.intel.com"},"content":"Hi Jacopo,\n\nOn Tue, Apr 28, 2020 at 11:06:07PM +0200, Jacopo Mondi wrote:\n> A sub-device device node can be registered in user space only if the\n> CONFIG_V4L2_SUBDEV_API Kconfig option is selected.\n> \n> Remove checks from the v4l2-subdev file handle open/close functions and\n> ioctl handler as they are only accessible if a device node was registered\n> to user space in first place.\n\nIs there other motivation with this than clean up things a little?\n\nThe change increases the binary size marginally if the Kconfig option is\ndisabled.\n\n> \n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n>  drivers/media/v4l2-core/v4l2-subdev.c | 10 ++--------\n>  1 file changed, 2 insertions(+), 8 deletions(-)\n> \n> diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c\n> index 1dc263c2ca0a..f3fe515b8ccb 100644\n> --- a/drivers/media/v4l2-core/v4l2-subdev.c\n> +++ b/drivers/media/v4l2-core/v4l2-subdev.c\n> @@ -24,22 +24,19 @@\n>  \n>  static int subdev_fh_init(struct v4l2_subdev_fh *fh, struct v4l2_subdev *sd)\n>  {\n> -#if defined(CONFIG_VIDEO_V4L2_SUBDEV_API)\n>  \tif (sd->entity.num_pads) {\n>  \t\tfh->pad = v4l2_subdev_alloc_pad_config(sd);\n>  \t\tif (fh->pad == NULL)\n>  \t\t\treturn -ENOMEM;\n>  \t}\n> -#endif\n> +\n>  \treturn 0;\n>  }\n>  \n>  static void subdev_fh_free(struct v4l2_subdev_fh *fh)\n>  {\n> -#if defined(CONFIG_VIDEO_V4L2_SUBDEV_API)\n>  \tv4l2_subdev_free_pad_config(fh->pad);\n>  \tfh->pad = NULL;\n> -#endif\n>  }\n>  \n>  static int subdev_open(struct file *file)\n> @@ -329,10 +326,8 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)\n>  \tstruct video_device *vdev = video_devdata(file);\n>  \tstruct v4l2_subdev *sd = vdev_to_v4l2_subdev(vdev);\n>  \tstruct v4l2_fh *vfh = file->private_data;\n> -#if defined(CONFIG_VIDEO_V4L2_SUBDEV_API)\n>  \tstruct v4l2_subdev_fh *subdev_fh = to_v4l2_subdev_fh(vfh);\n>  \tbool ro_subdev = test_bit(V4L2_FL_SUBDEV_RO_DEVNODE, &vdev->flags);\n> -#endif\n>  \tint rval;\n>  \n>  \tswitch (cmd) {\n> @@ -466,7 +461,6 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)\n>  \t\treturn ret;\n>  \t}\n>  \n> -#if defined(CONFIG_VIDEO_V4L2_SUBDEV_API)\n>  \tcase VIDIOC_SUBDEV_G_FMT: {\n>  \t\tstruct v4l2_subdev_format *format = arg;\n>  \n> @@ -646,7 +640,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)\n>  \n>  \tcase VIDIOC_SUBDEV_QUERYSTD:\n>  \t\treturn v4l2_subdev_call(sd, video, querystd, arg);\n> -#endif\n> +\n>  \tdefault:\n>  \t\treturn v4l2_subdev_call(sd, core, ioctl, cmd, arg);\n>  \t}\n> -- \n> 2.26.1\n>","headers":{"Return-Path":"<sakari.ailus@linux.intel.com>","Received":["from mga11.intel.com (mga11.intel.com [192.55.52.93])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id A7E6760AF4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 28 Apr 2020 23:26:51 +0200 (CEST)","from fmsmga008.fm.intel.com ([10.253.24.58])\n\tby fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; \n\t28 Apr 2020 14:26:49 -0700","from paasikivi.fi.intel.com ([10.237.72.42])\n\tby fmsmga008-auth.fm.intel.com with\n\tESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Apr 2020 14:26:47 -0700","by paasikivi.fi.intel.com (Postfix, from userid 1000)\n\tid E84F0202F2; Wed, 29 Apr 2020 00:26:43 +0300 (EEST)"],"IronPort-SDR":["A9NNFwqmWGCmgpJ6EfCgIm90sXj/FT6Vs9jg2QBbQayUOVqBJycpolCxHOzkzxHRlg9vMEzaF9\n\t/BoU3uYDyEAg==","UgXjeyV15rceUG43acMoWxi3jf1Eun8z9T92+mxmbXwzjmU3znEXJKrQ0wg/CbUmvPHagYo9nb\n\tD2nal31YLXMw=="],"X-Amp-Result":"SKIPPED(no attachment in message)","X-Amp-File-Uploaded":"False","X-IronPort-AV":"E=Sophos;i=\"5.73,328,1583222400\"; d=\"scan'208\";a=\"249282168\"","Date":"Wed, 29 Apr 2020 00:26:43 +0300","From":"Sakari Ailus <sakari.ailus@linux.intel.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"linux-media@vger.kernel.org, libcamera-devel@lists.libcamera.org,\n\tmchehab@kernel.org, hverkuil-cisco@xs4all.nl,\n\tandrey.konovalov@linaro.org, laurent.pinchart@ideasonboard.com","Message-ID":"<20200428212643.GB5381@paasikivi.fi.intel.com>","References":"<20200428210609.6793-1-jacopo@jmondi.org>\n\t<20200428210609.6793-5-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20200428210609.6793-5-jacopo@jmondi.org>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH v5 4/6] media: v4l2-subdev: Assume\n\tV4L2_SUBDEV_API is selected","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Tue, 28 Apr 2020 21:26:52 -0000"}},{"id":4630,"web_url":"https://patchwork.libcamera.org/comment/4630/","msgid":"<202004290742.VN7hf64i%lkp@intel.com>","date":"2020-04-28T23:44:30","subject":"Re: [libcamera-devel] [PATCH v5 4/6] media: v4l2-subdev: Assume\n\tV4L2_SUBDEV_API is selected","submitter":{"id":45,"url":"https://patchwork.libcamera.org/api/people/45/","name":"kernel test robot","email":"lkp@intel.com"},"content":"Hi Jacopo,\n\nI love your patch! Yet something to improve:\n\n[auto build test ERROR on linuxtv-media/master]\n[also build test ERROR on linus/master v5.7-rc3 next-20200428]\n[if your patch is applied to the wrong git tree, please drop us a note to help\nimprove the system. BTW, we also suggest to use '--base' option to specify the\nbase tree in git format-patch, please see https://stackoverflow.com/a/37406982]\n\nurl:    https://github.com/0day-ci/linux/commits/Jacopo-Mondi/media-Register-read-only-sub-dev-devnode/20200429-062133\nbase:   git://linuxtv.org/media_tree.git master\nconfig: arm-at91_dt_defconfig (attached as .config)\ncompiler: arm-linux-gnueabi-gcc (GCC) 9.3.0\nreproduce:\n        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross\n        chmod +x ~/bin/make.cross\n        # save the attached .config to linux build tree\n        COMPILER_INSTALL_PATH=$HOME/0day GCC_VERSION=9.3.0 make.cross ARCH=arm \n\nIf you fix the issue, kindly add following tag as appropriate\nReported-by: kbuild test robot <lkp@intel.com>\n\nAll errors (new ones prefixed by >>):\n\n   drivers/media/v4l2-core/v4l2-subdev.c: In function 'subdev_fh_init':\n>> drivers/media/v4l2-core/v4l2-subdev.c:28:5: error: 'struct v4l2_subdev_fh' has no member named 'pad'\n      28 |   fh->pad = v4l2_subdev_alloc_pad_config(sd);\n         |     ^~\n   drivers/media/v4l2-core/v4l2-subdev.c:29:9: error: 'struct v4l2_subdev_fh' has no member named 'pad'\n      29 |   if (fh->pad == NULL)\n         |         ^~\n   drivers/media/v4l2-core/v4l2-subdev.c: In function 'subdev_fh_free':\n   drivers/media/v4l2-core/v4l2-subdev.c:38:32: error: 'struct v4l2_subdev_fh' has no member named 'pad'\n      38 |  v4l2_subdev_free_pad_config(fh->pad);\n         |                                ^~\n   drivers/media/v4l2-core/v4l2-subdev.c:39:4: error: 'struct v4l2_subdev_fh' has no member named 'pad'\n      39 |  fh->pad = NULL;\n         |    ^~\n   In file included from include/media/v4l2-device.h:13,\n                    from drivers/media/v4l2-core/v4l2-subdev.c:20:\n   drivers/media/v4l2-core/v4l2-subdev.c: In function 'subdev_do_ioctl':\n   drivers/media/v4l2-core/v4l2-subdev.c:469:54: error: 'struct v4l2_subdev_fh' has no member named 'pad'\n     469 |   return v4l2_subdev_call(sd, pad, get_fmt, subdev_fh->pad, format);\n         |                                                      ^~\n   include/media/v4l2-subdev.h:1111:16: note: in definition of macro 'v4l2_subdev_call'\n    1111 |        __sd, ##args); \\\n         |                ^~~~\n   drivers/media/v4l2-core/v4l2-subdev.c:469:54: error: 'struct v4l2_subdev_fh' has no member named 'pad'\n     469 |   return v4l2_subdev_call(sd, pad, get_fmt, subdev_fh->pad, format);\n         |                                                      ^~\n   include/media/v4l2-subdev.h:1113:39: note: in definition of macro 'v4l2_subdev_call'\n    1113 |    __result = __sd->ops->o->f(__sd, ##args); \\\n         |                                       ^~~~\n   drivers/media/v4l2-core/v4l2-subdev.c:480:54: error: 'struct v4l2_subdev_fh' has no member named 'pad'\n     480 |   return v4l2_subdev_call(sd, pad, set_fmt, subdev_fh->pad, format);\n         |                                                      ^~\n   include/media/v4l2-subdev.h:1111:16: note: in definition of macro 'v4l2_subdev_call'\n    1111 |        __sd, ##args); \\\n         |                ^~~~\n   drivers/media/v4l2-core/v4l2-subdev.c:480:54: error: 'struct v4l2_subdev_fh' has no member named 'pad'\n     480 |   return v4l2_subdev_call(sd, pad, set_fmt, subdev_fh->pad, format);\n         |                                                      ^~\n   include/media/v4l2-subdev.h:1113:39: note: in definition of macro 'v4l2_subdev_call'\n    1113 |    __result = __sd->ops->o->f(__sd, ##args); \\\n         |                                       ^~~~\n   drivers/media/v4l2-core/v4l2-subdev.c:494:37: error: 'struct v4l2_subdev_fh' has no member named 'pad'\n     494 |    sd, pad, get_selection, subdev_fh->pad, &sel);\n         |                                     ^~\n   include/media/v4l2-subdev.h:1111:16: note: in definition of macro 'v4l2_subdev_call'\n    1111 |        __sd, ##args); \\\n         |                ^~~~\n   drivers/media/v4l2-core/v4l2-subdev.c:494:37: error: 'struct v4l2_subdev_fh' has no member named 'pad'\n     494 |    sd, pad, get_selection, subdev_fh->pad, &sel);\n         |                                     ^~\n   include/media/v4l2-subdev.h:1113:39: note: in definition of macro 'v4l2_subdev_call'\n    1113 |    __result = __sd->ops->o->f(__sd, ##args); \\\n         |                                       ^~~~\n   drivers/media/v4l2-core/v4l2-subdev.c:516:37: error: 'struct v4l2_subdev_fh' has no member named 'pad'\n     516 |    sd, pad, set_selection, subdev_fh->pad, &sel);\n         |                                     ^~\n   include/media/v4l2-subdev.h:1111:16: note: in definition of macro 'v4l2_subdev_call'\n    1111 |        __sd, ##args); \\\n         |                ^~~~\n   drivers/media/v4l2-core/v4l2-subdev.c:516:37: error: 'struct v4l2_subdev_fh' has no member named 'pad'\n     516 |    sd, pad, set_selection, subdev_fh->pad, &sel);\n         |                                     ^~\n   include/media/v4l2-subdev.h:1113:39: note: in definition of macro 'v4l2_subdev_call'\n    1113 |    __result = __sd->ops->o->f(__sd, ##args); \\\n         |                                       ^~~~\n   drivers/media/v4l2-core/v4l2-subdev.c:527:61: error: 'struct v4l2_subdev_fh' has no member named 'pad'\n     527 |   return v4l2_subdev_call(sd, pad, enum_mbus_code, subdev_fh->pad,\n         |                                                             ^~\n   include/media/v4l2-subdev.h:1111:16: note: in definition of macro 'v4l2_subdev_call'\n    1111 |        __sd, ##args); \\\n         |                ^~~~\n   drivers/media/v4l2-core/v4l2-subdev.c:527:61: error: 'struct v4l2_subdev_fh' has no member named 'pad'\n     527 |   return v4l2_subdev_call(sd, pad, enum_mbus_code, subdev_fh->pad,\n         |                                                             ^~\n   include/media/v4l2-subdev.h:1113:39: note: in definition of macro 'v4l2_subdev_call'\n    1113 |    __result = __sd->ops->o->f(__sd, ##args); \\\n         |                                       ^~~~\n   drivers/media/v4l2-core/v4l2-subdev.c:535:62: error: 'struct v4l2_subdev_fh' has no member named 'pad'\n     535 |   return v4l2_subdev_call(sd, pad, enum_frame_size, subdev_fh->pad,\n         |                                                              ^~\n   include/media/v4l2-subdev.h:1111:16: note: in definition of macro 'v4l2_subdev_call'\n    1111 |        __sd, ##args); \\\n         |                ^~~~\n   drivers/media/v4l2-core/v4l2-subdev.c:535:62: error: 'struct v4l2_subdev_fh' has no member named 'pad'\n     535 |   return v4l2_subdev_call(sd, pad, enum_frame_size, subdev_fh->pad,\n         |                                                              ^~\n   include/media/v4l2-subdev.h:1113:39: note: in definition of macro 'v4l2_subdev_call'\n    1113 |    __result = __sd->ops->o->f(__sd, ##args); \\\n         |                                       ^~~~\n   drivers/media/v4l2-core/v4l2-subdev.c:560:66: error: 'struct v4l2_subdev_fh' has no member named 'pad'\n     560 |   return v4l2_subdev_call(sd, pad, enum_frame_interval, subdev_fh->pad,\n         |                                                                  ^~\n   include/media/v4l2-subdev.h:1111:16: note: in definition of macro 'v4l2_subdev_call'\n    1111 |        __sd, ##args); \\\n         |                ^~~~\n   drivers/media/v4l2-core/v4l2-subdev.c:560:66: error: 'struct v4l2_subdev_fh' has no member named 'pad'\n     560 |   return v4l2_subdev_call(sd, pad, enum_frame_interval, subdev_fh->pad,\n         |                                                                  ^~\n   include/media/v4l2-subdev.h:1113:39: note: in definition of macro 'v4l2_subdev_call'\n    1113 |    __result = __sd->ops->o->f(__sd, ##args); \\\n         |                                       ^~~~\n   drivers/media/v4l2-core/v4l2-subdev.c:569:37: error: 'struct v4l2_subdev_fh' has no member named 'pad'\n\nvim +28 drivers/media/v4l2-core/v4l2-subdev.c\n\n2096a5dcf9704f drivers/media/video/v4l2-subdev.c     Laurent Pinchart  2009-12-09  24  \n7cd5a16b22af7d drivers/media/video/v4l2-subdev.c     Stanimir Varbanov 2010-05-21  25  static int subdev_fh_init(struct v4l2_subdev_fh *fh, struct v4l2_subdev *sd)\n7cd5a16b22af7d drivers/media/video/v4l2-subdev.c     Stanimir Varbanov 2010-05-21  26  {\n9b02cbb3ede89b drivers/media/v4l2-core/v4l2-subdev.c Laurent Pinchart  2015-04-24  27  \tif (sd->entity.num_pads) {\n9b02cbb3ede89b drivers/media/v4l2-core/v4l2-subdev.c Laurent Pinchart  2015-04-24 @28  \t\tfh->pad = v4l2_subdev_alloc_pad_config(sd);\nae184cda8d0eeb drivers/media/video/v4l2-subdev.c     Sakari Ailus      2011-10-14  29  \t\tif (fh->pad == NULL)\n7cd5a16b22af7d drivers/media/video/v4l2-subdev.c     Stanimir Varbanov 2010-05-21  30  \t\t\treturn -ENOMEM;\n9b02cbb3ede89b drivers/media/v4l2-core/v4l2-subdev.c Laurent Pinchart  2015-04-24  31  \t}\nb9e6aad3939a62 drivers/media/v4l2-core/v4l2-subdev.c Jacopo Mondi      2020-04-28  32  \n7cd5a16b22af7d drivers/media/video/v4l2-subdev.c     Stanimir Varbanov 2010-05-21  33  \treturn 0;\n7cd5a16b22af7d drivers/media/video/v4l2-subdev.c     Stanimir Varbanov 2010-05-21  34  }\n7cd5a16b22af7d drivers/media/video/v4l2-subdev.c     Stanimir Varbanov 2010-05-21  35  \n\n:::::: The code at line 28 was first introduced by commit\n:::::: 9b02cbb3ede89b5cd84bbe4ef493bd130d76b070 [media] v4l: subdev: Add pad config allocator and init\n\n:::::: TO: Laurent Pinchart <laurent.pinchart@linaro.org>\n:::::: CC: Mauro Carvalho Chehab <mchehab@osg.samsung.com>\n\n---\n0-DAY CI Kernel Test Service, Intel Corporation\nhttps://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org","headers":{"Return-Path":"<lkp@intel.com>","Received":["from mga12.intel.com (mga12.intel.com [192.55.52.136])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 67A93603F9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 29 Apr 2020 01:44:57 +0200 (CEST)","from fmsmga008.fm.intel.com ([10.253.24.58])\n\tby fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; \n\t28 Apr 2020 16:44:49 -0700","from lkp-server01.sh.intel.com (HELO lkp-server01)\n\t([10.239.97.150])\n\tby fmsmga008.fm.intel.com with ESMTP; 28 Apr 2020 16:44:46 -0700","from kbuild by lkp-server01 with local (Exim 4.89)\n\t(envelope-from <lkp@intel.com>)\n\tid 1jTZuA-00068g-8Z; Wed, 29 Apr 2020 07:44:46 +0800"],"IronPort-SDR":["FIHhPPHcpMsRPubQnEFTgFLVAFDt2zzUrZhPXFpNs3bNPtGxjzKpgVbJclVmWWemDquVMBt0JD\n\toSVMwjhMNO9g==","jSAIwXyg9r5gzGZgppmboAro3vZBqbIxiktfrOjLRO69QudNjc7a7kzoo8ym4+lNLhNaJgDWMe\n\taHe5El4T2i5w=="],"X-Amp-Result":"UNKNOWN","X-Amp-Original-Verdict":"FILE UNKNOWN","X-Amp-File-Uploaded":"False","X-ExtLoop1":"1","X-IronPort-AV":"E=Sophos;i=\"5.73,328,1583222400\"; \n\td=\"gz'50?scan'50,208,50\";a=\"249310200\"","Date":"Wed, 29 Apr 2020 07:44:30 +0800","From":"kbuild test robot <lkp@intel.com>","To":"Jacopo Mondi <jacopo@jmondi.org>, linux-media@vger.kernel.org,\n\tlibcamera-devel@lists.libcamera.org","Cc":"kbuild-all@lists.01.org, Jacopo Mondi <jacopo@jmondi.org>,\n\tmchehab@kernel.org, hverkuil-cisco@xs4all.nl,\n\tsakari.ailus@linux.intel.com, andrey.konovalov@linaro.org,\n\tlaurent.pinchart@ideasonboard.com","Message-ID":"<202004290742.VN7hf64i%lkp@intel.com>","References":"<20200428210609.6793-5-jacopo@jmondi.org>","MIME-Version":"1.0","Content-Type":"multipart/mixed; boundary=\"6TrnltStXW4iwmi0\"","Content-Disposition":"inline","In-Reply-To":"<20200428210609.6793-5-jacopo@jmondi.org>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH v5 4/6] media: v4l2-subdev: Assume\n\tV4L2_SUBDEV_API is selected","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Tue, 28 Apr 2020 23:44:58 -0000"}},{"id":4636,"web_url":"https://patchwork.libcamera.org/comment/4636/","msgid":"<20200429070215.gh3757q455ky6bkq@uno.localdomain>","date":"2020-04-29T07:02:15","subject":"Re: [libcamera-devel] [PATCH v5 4/6] media: v4l2-subdev: Assume\n\tV4L2_SUBDEV_API is selected","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Sakari,\n\nOn Wed, Apr 29, 2020 at 12:26:43AM +0300, Sakari Ailus wrote:\n> Hi Jacopo,\n>\n> On Tue, Apr 28, 2020 at 11:06:07PM +0200, Jacopo Mondi wrote:\n> > A sub-device device node can be registered in user space only if the\n> > CONFIG_V4L2_SUBDEV_API Kconfig option is selected.\n> >\n> > Remove checks from the v4l2-subdev file handle open/close functions and\n> > ioctl handler as they are only accessible if a device node was registered\n> > to user space in first place.\n>\n> Is there other motivation with this than clean up things a little?\n>\n\nI had to add yet-another #if defined and I got fed up. If you don't\nhave a device node registered you won't be able to access any of the\nfunctions where the existing #if defined() where placed.\n\n> The change increases the binary size marginally if the Kconfig option is\n> disabled.\n>\n\nI see. Should we instead guard the whole file handle operations and\nioctl handler instead of having #if defined() spread inside them ? I\nassume they where there as leftover, as I'm still missing the point,\ngive that, as said, without V4L2_SUBDEV_API, you can't register any\ndevice node to userspace..\n\n> >\n> > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> > ---\n> >  drivers/media/v4l2-core/v4l2-subdev.c | 10 ++--------\n> >  1 file changed, 2 insertions(+), 8 deletions(-)\n> >\n> > diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c\n> > index 1dc263c2ca0a..f3fe515b8ccb 100644\n> > --- a/drivers/media/v4l2-core/v4l2-subdev.c\n> > +++ b/drivers/media/v4l2-core/v4l2-subdev.c\n> > @@ -24,22 +24,19 @@\n> >\n> >  static int subdev_fh_init(struct v4l2_subdev_fh *fh, struct v4l2_subdev *sd)\n> >  {\n> > -#if defined(CONFIG_VIDEO_V4L2_SUBDEV_API)\n> >  \tif (sd->entity.num_pads) {\n> >  \t\tfh->pad = v4l2_subdev_alloc_pad_config(sd);\n> >  \t\tif (fh->pad == NULL)\n> >  \t\t\treturn -ENOMEM;\n> >  \t}\n> > -#endif\n> > +\n> >  \treturn 0;\n> >  }\n> >\n> >  static void subdev_fh_free(struct v4l2_subdev_fh *fh)\n> >  {\n> > -#if defined(CONFIG_VIDEO_V4L2_SUBDEV_API)\n> >  \tv4l2_subdev_free_pad_config(fh->pad);\n> >  \tfh->pad = NULL;\n> > -#endif\n> >  }\n> >\n> >  static int subdev_open(struct file *file)\n> > @@ -329,10 +326,8 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)\n> >  \tstruct video_device *vdev = video_devdata(file);\n> >  \tstruct v4l2_subdev *sd = vdev_to_v4l2_subdev(vdev);\n> >  \tstruct v4l2_fh *vfh = file->private_data;\n> > -#if defined(CONFIG_VIDEO_V4L2_SUBDEV_API)\n> >  \tstruct v4l2_subdev_fh *subdev_fh = to_v4l2_subdev_fh(vfh);\n> >  \tbool ro_subdev = test_bit(V4L2_FL_SUBDEV_RO_DEVNODE, &vdev->flags);\n> > -#endif\n> >  \tint rval;\n> >\n> >  \tswitch (cmd) {\n> > @@ -466,7 +461,6 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)\n> >  \t\treturn ret;\n> >  \t}\n> >\n> > -#if defined(CONFIG_VIDEO_V4L2_SUBDEV_API)\n> >  \tcase VIDIOC_SUBDEV_G_FMT: {\n> >  \t\tstruct v4l2_subdev_format *format = arg;\n> >\n> > @@ -646,7 +640,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)\n> >\n> >  \tcase VIDIOC_SUBDEV_QUERYSTD:\n> >  \t\treturn v4l2_subdev_call(sd, video, querystd, arg);\n> > -#endif\n> > +\n> >  \tdefault:\n> >  \t\treturn v4l2_subdev_call(sd, core, ioctl, cmd, arg);\n> >  \t}\n> > --\n> > 2.26.1\n> >\n>\n> --\n> Sakari Ailus","headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net\n\t[217.70.183.201])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 10C56603F4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 29 Apr 2020 08:59:08 +0200 (CEST)","from uno.localdomain (2-224-242-101.ip172.fastwebnet.it\n\t[2.224.242.101]) (Authenticated sender: jacopo@jmondi.org)\n\tby relay8-d.mail.gandi.net (Postfix) with ESMTPSA id 2C3951BF204;\n\tWed, 29 Apr 2020 06:59:03 +0000 (UTC)"],"X-Originating-IP":"2.224.242.101","Date":"Wed, 29 Apr 2020 09:02:15 +0200","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Sakari Ailus <sakari.ailus@linux.intel.com>","Cc":"linux-media@vger.kernel.org, libcamera-devel@lists.libcamera.org,\n\tmchehab@kernel.org, hverkuil-cisco@xs4all.nl,\n\tandrey.konovalov@linaro.org, laurent.pinchart@ideasonboard.com","Message-ID":"<20200429070215.gh3757q455ky6bkq@uno.localdomain>","References":"<20200428210609.6793-1-jacopo@jmondi.org>\n\t<20200428210609.6793-5-jacopo@jmondi.org>\n\t<20200428212643.GB5381@paasikivi.fi.intel.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20200428212643.GB5381@paasikivi.fi.intel.com>","Subject":"Re: [libcamera-devel] [PATCH v5 4/6] media: v4l2-subdev: Assume\n\tV4L2_SUBDEV_API is selected","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Wed, 29 Apr 2020 06:59:08 -0000"}},{"id":4637,"web_url":"https://patchwork.libcamera.org/comment/4637/","msgid":"<20200429070442.ghdf5ro7nidspenm@uno.localdomain>","date":"2020-04-29T07:04:42","subject":"Re: [libcamera-devel] [PATCH v5 4/6] media: v4l2-subdev: Assume\n\tV4L2_SUBDEV_API is selected","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Here it goes -.-'\nI was hoping to have this going through kbuild soon\n\nWould guarding the whole file handle operations and the ioctl handler\na best option then ?\n\nOn Wed, Apr 29, 2020 at 07:44:30AM +0800, kbuild test robot wrote:\n> Hi Jacopo,\n>\n> I love your patch! Yet something to improve:\n>\n> [auto build test ERROR on linuxtv-media/master]\n> [also build test ERROR on linus/master v5.7-rc3 next-20200428]\n> [if your patch is applied to the wrong git tree, please drop us a note to help\n> improve the system. BTW, we also suggest to use '--base' option to specify the\n> base tree in git format-patch, please see https://stackoverflow.com/a/37406982]\n>\n> url:    https://github.com/0day-ci/linux/commits/Jacopo-Mondi/media-Register-read-only-sub-dev-devnode/20200429-062133\n> base:   git://linuxtv.org/media_tree.git master\n> config: arm-at91_dt_defconfig (attached as .config)\n> compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0\n> reproduce:\n>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross\n>         chmod +x ~/bin/make.cross\n>         # save the attached .config to linux build tree\n>         COMPILER_INSTALL_PATH=$HOME/0day GCC_VERSION=9.3.0 make.cross ARCH=arm\n>\n> If you fix the issue, kindly add following tag as appropriate\n> Reported-by: kbuild test robot <lkp@intel.com>\n>\n> All errors (new ones prefixed by >>):\n>\n>    drivers/media/v4l2-core/v4l2-subdev.c: In function 'subdev_fh_init':\n> >> drivers/media/v4l2-core/v4l2-subdev.c:28:5: error: 'struct v4l2_subdev_fh' has no member named 'pad'\n>       28 |   fh->pad = v4l2_subdev_alloc_pad_config(sd);\n>          |     ^~\n>    drivers/media/v4l2-core/v4l2-subdev.c:29:9: error: 'struct v4l2_subdev_fh' has no member named 'pad'\n>       29 |   if (fh->pad == NULL)\n>          |         ^~\n>    drivers/media/v4l2-core/v4l2-subdev.c: In function 'subdev_fh_free':\n>    drivers/media/v4l2-core/v4l2-subdev.c:38:32: error: 'struct v4l2_subdev_fh' has no member named 'pad'\n>       38 |  v4l2_subdev_free_pad_config(fh->pad);\n>          |                                ^~\n>    drivers/media/v4l2-core/v4l2-subdev.c:39:4: error: 'struct v4l2_subdev_fh' has no member named 'pad'\n>       39 |  fh->pad = NULL;\n>          |    ^~\n>    In file included from include/media/v4l2-device.h:13,\n>                     from drivers/media/v4l2-core/v4l2-subdev.c:20:\n>    drivers/media/v4l2-core/v4l2-subdev.c: In function 'subdev_do_ioctl':\n>    drivers/media/v4l2-core/v4l2-subdev.c:469:54: error: 'struct v4l2_subdev_fh' has no member named 'pad'\n>      469 |   return v4l2_subdev_call(sd, pad, get_fmt, subdev_fh->pad, format);\n>          |                                                      ^~\n>    include/media/v4l2-subdev.h:1111:16: note: in definition of macro 'v4l2_subdev_call'\n>     1111 |        __sd, ##args); \\\n>          |                ^~~~\n>    drivers/media/v4l2-core/v4l2-subdev.c:469:54: error: 'struct v4l2_subdev_fh' has no member named 'pad'\n>      469 |   return v4l2_subdev_call(sd, pad, get_fmt, subdev_fh->pad, format);\n>          |                                                      ^~\n>    include/media/v4l2-subdev.h:1113:39: note: in definition of macro 'v4l2_subdev_call'\n>     1113 |    __result = __sd->ops->o->f(__sd, ##args); \\\n>          |                                       ^~~~\n>    drivers/media/v4l2-core/v4l2-subdev.c:480:54: error: 'struct v4l2_subdev_fh' has no member named 'pad'\n>      480 |   return v4l2_subdev_call(sd, pad, set_fmt, subdev_fh->pad, format);\n>          |                                                      ^~\n>    include/media/v4l2-subdev.h:1111:16: note: in definition of macro 'v4l2_subdev_call'\n>     1111 |        __sd, ##args); \\\n>          |                ^~~~\n>    drivers/media/v4l2-core/v4l2-subdev.c:480:54: error: 'struct v4l2_subdev_fh' has no member named 'pad'\n>      480 |   return v4l2_subdev_call(sd, pad, set_fmt, subdev_fh->pad, format);\n>          |                                                      ^~\n>    include/media/v4l2-subdev.h:1113:39: note: in definition of macro 'v4l2_subdev_call'\n>     1113 |    __result = __sd->ops->o->f(__sd, ##args); \\\n>          |                                       ^~~~\n>    drivers/media/v4l2-core/v4l2-subdev.c:494:37: error: 'struct v4l2_subdev_fh' has no member named 'pad'\n>      494 |    sd, pad, get_selection, subdev_fh->pad, &sel);\n>          |                                     ^~\n>    include/media/v4l2-subdev.h:1111:16: note: in definition of macro 'v4l2_subdev_call'\n>     1111 |        __sd, ##args); \\\n>          |                ^~~~\n>    drivers/media/v4l2-core/v4l2-subdev.c:494:37: error: 'struct v4l2_subdev_fh' has no member named 'pad'\n>      494 |    sd, pad, get_selection, subdev_fh->pad, &sel);\n>          |                                     ^~\n>    include/media/v4l2-subdev.h:1113:39: note: in definition of macro 'v4l2_subdev_call'\n>     1113 |    __result = __sd->ops->o->f(__sd, ##args); \\\n>          |                                       ^~~~\n>    drivers/media/v4l2-core/v4l2-subdev.c:516:37: error: 'struct v4l2_subdev_fh' has no member named 'pad'\n>      516 |    sd, pad, set_selection, subdev_fh->pad, &sel);\n>          |                                     ^~\n>    include/media/v4l2-subdev.h:1111:16: note: in definition of macro 'v4l2_subdev_call'\n>     1111 |        __sd, ##args); \\\n>          |                ^~~~\n>    drivers/media/v4l2-core/v4l2-subdev.c:516:37: error: 'struct v4l2_subdev_fh' has no member named 'pad'\n>      516 |    sd, pad, set_selection, subdev_fh->pad, &sel);\n>          |                                     ^~\n>    include/media/v4l2-subdev.h:1113:39: note: in definition of macro 'v4l2_subdev_call'\n>     1113 |    __result = __sd->ops->o->f(__sd, ##args); \\\n>          |                                       ^~~~\n>    drivers/media/v4l2-core/v4l2-subdev.c:527:61: error: 'struct v4l2_subdev_fh' has no member named 'pad'\n>      527 |   return v4l2_subdev_call(sd, pad, enum_mbus_code, subdev_fh->pad,\n>          |                                                             ^~\n>    include/media/v4l2-subdev.h:1111:16: note: in definition of macro 'v4l2_subdev_call'\n>     1111 |        __sd, ##args); \\\n>          |                ^~~~\n>    drivers/media/v4l2-core/v4l2-subdev.c:527:61: error: 'struct v4l2_subdev_fh' has no member named 'pad'\n>      527 |   return v4l2_subdev_call(sd, pad, enum_mbus_code, subdev_fh->pad,\n>          |                                                             ^~\n>    include/media/v4l2-subdev.h:1113:39: note: in definition of macro 'v4l2_subdev_call'\n>     1113 |    __result = __sd->ops->o->f(__sd, ##args); \\\n>          |                                       ^~~~\n>    drivers/media/v4l2-core/v4l2-subdev.c:535:62: error: 'struct v4l2_subdev_fh' has no member named 'pad'\n>      535 |   return v4l2_subdev_call(sd, pad, enum_frame_size, subdev_fh->pad,\n>          |                                                              ^~\n>    include/media/v4l2-subdev.h:1111:16: note: in definition of macro 'v4l2_subdev_call'\n>     1111 |        __sd, ##args); \\\n>          |                ^~~~\n>    drivers/media/v4l2-core/v4l2-subdev.c:535:62: error: 'struct v4l2_subdev_fh' has no member named 'pad'\n>      535 |   return v4l2_subdev_call(sd, pad, enum_frame_size, subdev_fh->pad,\n>          |                                                              ^~\n>    include/media/v4l2-subdev.h:1113:39: note: in definition of macro 'v4l2_subdev_call'\n>     1113 |    __result = __sd->ops->o->f(__sd, ##args); \\\n>          |                                       ^~~~\n>    drivers/media/v4l2-core/v4l2-subdev.c:560:66: error: 'struct v4l2_subdev_fh' has no member named 'pad'\n>      560 |   return v4l2_subdev_call(sd, pad, enum_frame_interval, subdev_fh->pad,\n>          |                                                                  ^~\n>    include/media/v4l2-subdev.h:1111:16: note: in definition of macro 'v4l2_subdev_call'\n>     1111 |        __sd, ##args); \\\n>          |                ^~~~\n>    drivers/media/v4l2-core/v4l2-subdev.c:560:66: error: 'struct v4l2_subdev_fh' has no member named 'pad'\n>      560 |   return v4l2_subdev_call(sd, pad, enum_frame_interval, subdev_fh->pad,\n>          |                                                                  ^~\n>    include/media/v4l2-subdev.h:1113:39: note: in definition of macro 'v4l2_subdev_call'\n>     1113 |    __result = __sd->ops->o->f(__sd, ##args); \\\n>          |                                       ^~~~\n>    drivers/media/v4l2-core/v4l2-subdev.c:569:37: error: 'struct v4l2_subdev_fh' has no member named 'pad'\n>\n> vim +28 drivers/media/v4l2-core/v4l2-subdev.c\n>\n> 2096a5dcf9704f drivers/media/video/v4l2-subdev.c     Laurent Pinchart  2009-12-09  24\n> 7cd5a16b22af7d drivers/media/video/v4l2-subdev.c     Stanimir Varbanov 2010-05-21  25  static int subdev_fh_init(struct v4l2_subdev_fh *fh, struct v4l2_subdev *sd)\n> 7cd5a16b22af7d drivers/media/video/v4l2-subdev.c     Stanimir Varbanov 2010-05-21  26  {\n> 9b02cbb3ede89b drivers/media/v4l2-core/v4l2-subdev.c Laurent Pinchart  2015-04-24  27  \tif (sd->entity.num_pads) {\n> 9b02cbb3ede89b drivers/media/v4l2-core/v4l2-subdev.c Laurent Pinchart  2015-04-24 @28  \t\tfh->pad = v4l2_subdev_alloc_pad_config(sd);\n> ae184cda8d0eeb drivers/media/video/v4l2-subdev.c     Sakari Ailus      2011-10-14  29  \t\tif (fh->pad == NULL)\n> 7cd5a16b22af7d drivers/media/video/v4l2-subdev.c     Stanimir Varbanov 2010-05-21  30  \t\t\treturn -ENOMEM;\n> 9b02cbb3ede89b drivers/media/v4l2-core/v4l2-subdev.c Laurent Pinchart  2015-04-24  31  \t}\n> b9e6aad3939a62 drivers/media/v4l2-core/v4l2-subdev.c Jacopo Mondi      2020-04-28  32\n> 7cd5a16b22af7d drivers/media/video/v4l2-subdev.c     Stanimir Varbanov 2010-05-21  33  \treturn 0;\n> 7cd5a16b22af7d drivers/media/video/v4l2-subdev.c     Stanimir Varbanov 2010-05-21  34  }\n> 7cd5a16b22af7d drivers/media/video/v4l2-subdev.c     Stanimir Varbanov 2010-05-21  35\n>\n> :::::: The code at line 28 was first introduced by commit\n> :::::: 9b02cbb3ede89b5cd84bbe4ef493bd130d76b070 [media] v4l: subdev: Add pad config allocator and init\n>\n> :::::: TO: Laurent Pinchart <laurent.pinchart@linaro.org>\n> :::::: CC: Mauro Carvalho Chehab <mchehab@osg.samsung.com>\n>\n> ---\n> 0-DAY CI Kernel Test Service, Intel Corporation\n> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org","headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay12.mail.gandi.net (relay12.mail.gandi.net\n\t[217.70.178.232])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 174BA601B8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 29 Apr 2020 09:01:34 +0200 (CEST)","from uno.localdomain (2-224-242-101.ip172.fastwebnet.it\n\t[2.224.242.101]) (Authenticated sender: jacopo@jmondi.org)\n\tby relay12.mail.gandi.net (Postfix) with ESMTPSA id 7073D20000E;\n\tWed, 29 Apr 2020 07:01:31 +0000 (UTC)"],"Date":"Wed, 29 Apr 2020 09:04:42 +0200","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"kbuild test robot <lkp@intel.com>","Cc":"linux-media@vger.kernel.org, libcamera-devel@lists.libcamera.org,\n\tkbuild-all@lists.01.org, mchehab@kernel.org,\n\thverkuil-cisco@xs4all.nl, sakari.ailus@linux.intel.com,\n\tandrey.konovalov@linaro.org, laurent.pinchart@ideasonboard.com","Message-ID":"<20200429070442.ghdf5ro7nidspenm@uno.localdomain>","References":"<20200428210609.6793-5-jacopo@jmondi.org>\n\t<202004290742.VN7hf64i%lkp@intel.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<202004290742.VN7hf64i%lkp@intel.com>","Subject":"Re: [libcamera-devel] [PATCH v5 4/6] media: v4l2-subdev: Assume\n\tV4L2_SUBDEV_API is selected","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Wed, 29 Apr 2020 07:01:34 -0000"}},{"id":4640,"web_url":"https://patchwork.libcamera.org/comment/4640/","msgid":"<20200429082737.GB9190@paasikivi.fi.intel.com>","date":"2020-04-29T08:27:37","subject":"Re: [libcamera-devel] [PATCH v5 4/6] media: v4l2-subdev: Assume\n\tV4L2_SUBDEV_API is selected","submitter":{"id":37,"url":"https://patchwork.libcamera.org/api/people/37/","name":"Sakari Ailus","email":"sakari.ailus@linux.intel.com"},"content":"Hi Jacopo,\n\nOn Wed, Apr 29, 2020 at 09:02:15AM +0200, Jacopo Mondi wrote:\n> Hi Sakari,\n> \n> On Wed, Apr 29, 2020 at 12:26:43AM +0300, Sakari Ailus wrote:\n> > Hi Jacopo,\n> >\n> > On Tue, Apr 28, 2020 at 11:06:07PM +0200, Jacopo Mondi wrote:\n> > > A sub-device device node can be registered in user space only if the\n> > > CONFIG_V4L2_SUBDEV_API Kconfig option is selected.\n> > >\n> > > Remove checks from the v4l2-subdev file handle open/close functions and\n> > > ioctl handler as they are only accessible if a device node was registered\n> > > to user space in first place.\n> >\n> > Is there other motivation with this than clean up things a little?\n> >\n> \n> I had to add yet-another #if defined and I got fed up. If you don't\n> have a device node registered you won't be able to access any of the\n> functions where the existing #if defined() where placed.\n> \n> > The change increases the binary size marginally if the Kconfig option is\n> > disabled.\n> >\n> \n> I see. Should we instead guard the whole file handle operations and\n> ioctl handler instead of having #if defined() spread inside them ? I\n> assume they where there as leftover, as I'm still missing the point,\n> give that, as said, without V4L2_SUBDEV_API, you can't register any\n> device node to userspace..\n\nI think that's why those #ifdefs have been originally put there --- it's\njust dead code without the subdev nodes, and the compiler won't be able to\nfigure this out.\n\nBut it seems, later on, when people have added code that supports\nsub-device nodes, no #ifdefs have been added.\n\nI think I'd make sense to remove the current #ifdefs and add dummy ops for\neverything where needed that truly depends on that Kconfig option (i.e.\nsub-device nodes). Or just to remove these, as your patch does. It's not a\nlot of code.","headers":{"Return-Path":"<sakari.ailus@linux.intel.com>","Received":["from mga11.intel.com (mga11.intel.com [192.55.52.93])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D924C601B8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 29 Apr 2020 10:27:42 +0200 (CEST)","from fmsmga006.fm.intel.com ([10.253.24.20])\n\tby fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; \n\t29 Apr 2020 01:27:41 -0700","from paasikivi.fi.intel.com ([10.237.72.42])\n\tby fmsmga006-auth.fm.intel.com with\n\tESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Apr 2020 01:27:39 -0700","by paasikivi.fi.intel.com (Postfix, from userid 1000)\n\tid 5DE1F202AE; Wed, 29 Apr 2020 11:27:37 +0300 (EEST)"],"IronPort-SDR":["otcZmPbQF/V2wN/2qf3m/oEbG6kxQkLW1QpgeRmMEUBvbcKbOFTbDv9L7Bw8YzYp/Mib5NlqYu\n\tAJ/4zJe/MShw==","W/4msyKdb9V+98MIMYKss3DorlLQxeoO0zaHiX4tmZRrDLXQEG8oP2kR2ClkWDEZ1lsCVNkEsI\n\t27mnvlVHAcBA=="],"X-Amp-Result":"SKIPPED(no attachment in message)","X-Amp-File-Uploaded":"False","X-IronPort-AV":"E=Sophos;i=\"5.73,330,1583222400\"; d=\"scan'208\";a=\"459510757\"","Date":"Wed, 29 Apr 2020 11:27:37 +0300","From":"Sakari Ailus <sakari.ailus@linux.intel.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Cc":"linux-media@vger.kernel.org, libcamera-devel@lists.libcamera.org,\n\tmchehab@kernel.org, hverkuil-cisco@xs4all.nl,\n\tandrey.konovalov@linaro.org, laurent.pinchart@ideasonboard.com","Message-ID":"<20200429082737.GB9190@paasikivi.fi.intel.com>","References":"<20200428210609.6793-1-jacopo@jmondi.org>\n\t<20200428210609.6793-5-jacopo@jmondi.org>\n\t<20200428212643.GB5381@paasikivi.fi.intel.com>\n\t<20200429070215.gh3757q455ky6bkq@uno.localdomain>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20200429070215.gh3757q455ky6bkq@uno.localdomain>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH v5 4/6] media: v4l2-subdev: Assume\n\tV4L2_SUBDEV_API is selected","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Wed, 29 Apr 2020 08:27:43 -0000"}},{"id":4641,"web_url":"https://patchwork.libcamera.org/comment/4641/","msgid":"<20200429084358.ssliiljy4jdzrvl3@uno.localdomain>","date":"2020-04-29T08:43:58","subject":"Re: [libcamera-devel] [PATCH v5 4/6] media: v4l2-subdev: Assume\n\tV4L2_SUBDEV_API is selected","submitter":{"id":3,"url":"https://patchwork.libcamera.org/api/people/3/","name":"Jacopo Mondi","email":"jacopo@jmondi.org"},"content":"Hi Sakari\n\nOn Wed, Apr 29, 2020 at 11:27:37AM +0300, Sakari Ailus wrote:\n> Hi Jacopo,\n>\n> On Wed, Apr 29, 2020 at 09:02:15AM +0200, Jacopo Mondi wrote:\n> > Hi Sakari,\n> >\n> > On Wed, Apr 29, 2020 at 12:26:43AM +0300, Sakari Ailus wrote:\n> > > Hi Jacopo,\n> > >\n> > > On Tue, Apr 28, 2020 at 11:06:07PM +0200, Jacopo Mondi wrote:\n> > > > A sub-device device node can be registered in user space only if the\n> > > > CONFIG_V4L2_SUBDEV_API Kconfig option is selected.\n> > > >\n> > > > Remove checks from the v4l2-subdev file handle open/close functions and\n> > > > ioctl handler as they are only accessible if a device node was registered\n> > > > to user space in first place.\n> > >\n> > > Is there other motivation with this than clean up things a little?\n> > >\n> >\n> > I had to add yet-another #if defined and I got fed up. If you don't\n> > have a device node registered you won't be able to access any of the\n> > functions where the existing #if defined() where placed.\n> >\n> > > The change increases the binary size marginally if the Kconfig option is\n> > > disabled.\n> > >\n> >\n> > I see. Should we instead guard the whole file handle operations and\n> > ioctl handler instead of having #if defined() spread inside them ? I\n> > assume they where there as leftover, as I'm still missing the point,\n> > give that, as said, without V4L2_SUBDEV_API, you can't register any\n> > device node to userspace..\n>\n> I think that's why those #ifdefs have been originally put there --- it's\n> just dead code without the subdev nodes, and the compiler won't be able to\n> figure this out.\n>\n> But it seems, later on, when people have added code that supports\n> sub-device nodes, no #ifdefs have been added.\n>\n> I think I'd make sense to remove the current #ifdefs and add dummy ops for\n> everything where needed that truly depends on that Kconfig option (i.e.\n> sub-device nodes). Or just to remove these, as your patch does. It's not a\n> lot of code.\n\nthat's what I've done now, as soon as I've run a few compile test, I'll send\na new version.\n\nThanks\n   j\n\n>\n> --\n> Kind regards,\n>\n> Sakari Ailus","headers":{"Return-Path":"<jacopo@jmondi.org>","Received":["from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net\n\t[217.70.183.201])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 11F28601B8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 29 Apr 2020 10:40:49 +0200 (CEST)","from uno.localdomain (2-224-242-101.ip172.fastwebnet.it\n\t[2.224.242.101]) (Authenticated sender: jacopo@jmondi.org)\n\tby relay8-d.mail.gandi.net (Postfix) with ESMTPSA id 1F9D61BF208;\n\tWed, 29 Apr 2020 08:40:46 +0000 (UTC)"],"X-Originating-IP":"2.224.242.101","Date":"Wed, 29 Apr 2020 10:43:58 +0200","From":"Jacopo Mondi <jacopo@jmondi.org>","To":"Sakari Ailus <sakari.ailus@linux.intel.com>","Cc":"linux-media@vger.kernel.org, libcamera-devel@lists.libcamera.org,\n\tmchehab@kernel.org, hverkuil-cisco@xs4all.nl,\n\tandrey.konovalov@linaro.org, laurent.pinchart@ideasonboard.com","Message-ID":"<20200429084358.ssliiljy4jdzrvl3@uno.localdomain>","References":"<20200428210609.6793-1-jacopo@jmondi.org>\n\t<20200428210609.6793-5-jacopo@jmondi.org>\n\t<20200428212643.GB5381@paasikivi.fi.intel.com>\n\t<20200429070215.gh3757q455ky6bkq@uno.localdomain>\n\t<20200429082737.GB9190@paasikivi.fi.intel.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20200429082737.GB9190@paasikivi.fi.intel.com>","Subject":"Re: [libcamera-devel] [PATCH v5 4/6] media: v4l2-subdev: Assume\n\tV4L2_SUBDEV_API is selected","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Wed, 29 Apr 2020 08:40:49 -0000"}}]