public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
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,
	mchehab@kernel.org, hverkuil-cisco@xs4all.nl,
	andrey.konovalov@linaro.org, laurent.pinchart@ideasonboard.com
Subject: Re: [PATCH v5 4/6] media: v4l2-subdev: Assume V4L2_SUBDEV_API is selected
Date: Wed, 29 Apr 2020 00:26:43 +0300	[thread overview]
Message-ID: <20200428212643.GB5381@paasikivi.fi.intel.com> (raw)
In-Reply-To: <20200428210609.6793-5-jacopo@jmondi.org>

Hi Jacopo,

On Tue, Apr 28, 2020 at 11:06:07PM +0200, Jacopo Mondi wrote:
> A sub-device device node can be registered in user space only if the
> CONFIG_V4L2_SUBDEV_API Kconfig option is selected.
> 
> Remove checks from the v4l2-subdev file handle open/close functions and
> ioctl handler as they are only accessible if a device node was registered
> to user space in first place.

Is there other motivation with this than clean up things a little?

The change increases the binary size marginally if the Kconfig option is
disabled.

> 
> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
> ---
>  drivers/media/v4l2-core/v4l2-subdev.c | 10 ++--------
>  1 file changed, 2 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c
> index 1dc263c2ca0a..f3fe515b8ccb 100644
> --- a/drivers/media/v4l2-core/v4l2-subdev.c
> +++ b/drivers/media/v4l2-core/v4l2-subdev.c
> @@ -24,22 +24,19 @@
>  
>  static int subdev_fh_init(struct v4l2_subdev_fh *fh, struct v4l2_subdev *sd)
>  {
> -#if defined(CONFIG_VIDEO_V4L2_SUBDEV_API)
>  	if (sd->entity.num_pads) {
>  		fh->pad = v4l2_subdev_alloc_pad_config(sd);
>  		if (fh->pad == NULL)
>  			return -ENOMEM;
>  	}
> -#endif
> +
>  	return 0;
>  }
>  
>  static void subdev_fh_free(struct v4l2_subdev_fh *fh)
>  {
> -#if defined(CONFIG_VIDEO_V4L2_SUBDEV_API)
>  	v4l2_subdev_free_pad_config(fh->pad);
>  	fh->pad = NULL;
> -#endif
>  }
>  
>  static int subdev_open(struct file *file)
> @@ -329,10 +326,8 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)
>  	struct video_device *vdev = video_devdata(file);
>  	struct v4l2_subdev *sd = vdev_to_v4l2_subdev(vdev);
>  	struct v4l2_fh *vfh = file->private_data;
> -#if defined(CONFIG_VIDEO_V4L2_SUBDEV_API)
>  	struct v4l2_subdev_fh *subdev_fh = to_v4l2_subdev_fh(vfh);
>  	bool ro_subdev = test_bit(V4L2_FL_SUBDEV_RO_DEVNODE, &vdev->flags);
> -#endif
>  	int rval;
>  
>  	switch (cmd) {
> @@ -466,7 +461,6 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)
>  		return ret;
>  	}
>  
> -#if defined(CONFIG_VIDEO_V4L2_SUBDEV_API)
>  	case VIDIOC_SUBDEV_G_FMT: {
>  		struct v4l2_subdev_format *format = arg;
>  
> @@ -646,7 +640,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)
>  
>  	case VIDIOC_SUBDEV_QUERYSTD:
>  		return v4l2_subdev_call(sd, video, querystd, arg);
> -#endif
> +
>  	default:
>  		return v4l2_subdev_call(sd, core, ioctl, cmd, arg);
>  	}
> -- 
> 2.26.1
> 

-- 
Sakari Ailus

  reply	other threads:[~2020-04-28 21:26 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-28 21:06 [PATCH v5 0/6] media: Register read-only sub-dev devnode Jacopo Mondi
2020-04-28 21:06 ` [PATCH v5 1/6] Documentation: media: Update sub-device API intro Jacopo Mondi
2020-04-28 21:06 ` [PATCH v5 2/6] Documentation: media: Document read-only subdevice Jacopo Mondi
2020-04-28 21:06 ` [PATCH v5 3/6] media: v4l2-dev: Add v4l2_device_register_ro_subdev_node() Jacopo Mondi
2020-04-28 21:06 ` [PATCH v5 4/6] media: v4l2-subdev: Assume V4L2_SUBDEV_API is selected Jacopo Mondi
2020-04-28 21:26   ` Sakari Ailus [this message]
2020-04-29  7:02     ` Jacopo Mondi
2020-04-29  8:27       ` Sakari Ailus
2020-04-29  8:43         ` Jacopo Mondi
2020-04-28 23:44   ` kbuild test robot
2020-04-29  7:04     ` Jacopo Mondi
2020-04-29  8:58   ` [PATCH v5.1] media: v4l2-subdev: Guard whole fops and ioctl hdlr Jacopo Mondi
2020-04-29  9:49     ` Sakari Ailus
2020-04-29 10:16       ` Jacopo Mondi
2020-04-29 11:00         ` Sakari Ailus
2020-04-28 21:06 ` [PATCH v5 5/6] v4l2-subdev: add VIDIOC_SUBDEV_QUERYCAP ioctl Jacopo Mondi
2020-04-28 21:28   ` Sakari Ailus
2020-04-29  8:09     ` Jacopo Mondi
2020-04-29  8:18       ` Sakari Ailus
2020-05-06 13:29         ` Hans Verkuil
2020-05-06 18:34           ` Sakari Ailus
2020-05-07  7:14             ` Hans Verkuil
2020-04-28 21:06 ` [PATCH v5 6/6] v4l: document VIDIOC_SUBDEV_QUERYCAP Jacopo Mondi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200428212643.GB5381@paasikivi.fi.intel.com \
    --to=sakari.ailus@linux.intel.com \
    --cc=andrey.konovalov@linaro.org \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=jacopo@jmondi.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=libcamera-devel@lists.libcamera.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox