Linux Media Controller development
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Simon Que <sque@chromium.org>
Cc: mchehab@kernel.org, viro@zeniv.linux.org.uk,
	hans.verkuil@cisco.com, sakari.ailus@linux.intel.com,
	laurent.pinchart+renesas@ideasonboard.com,
	linux-media@vger.kernel.org
Subject: Re: [PATCH] [media] v4l2-core: Rename array 'video_driver' to 'video_drivers'
Date: Tue, 10 Apr 2018 00:13:29 +0300	[thread overview]
Message-ID: <3074650.Mf9NpMS9vO@avalon> (raw)
In-Reply-To: <20180409194738.186758-1-sque@chromium.org>

Hi Simon,

Thank you for the patch.

On Monday, 9 April 2018 22:47:38 EEST Simon Que wrote:
> Improves code clarity in two ways:
> 1. The plural name makes it more clear that it is an array.
> 2. The name of the array is now no longer identical to the struct type
> name, so it is easier to find in the code.
> 
> Signed-off-by: Simon Que <sque@chromium.org>

I like this and agree with the two reasons you have given.

Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  drivers/media/v4l2-core/v4l2-dev.c | 22 +++++++++++-----------
>  1 file changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/media/v4l2-core/v4l2-dev.c
> b/drivers/media/v4l2-core/v4l2-dev.c index 0301fe426a43..8d5f7cfe1695
> 100644
> --- a/drivers/media/v4l2-core/v4l2-dev.c
> +++ b/drivers/media/v4l2-core/v4l2-dev.c
> @@ -91,7 +91,7 @@ ATTRIBUTE_GROUPS(video_device);
>  /*
>   *	Active devices
>   */
> -static struct video_device *video_device[VIDEO_NUM_DEVICES];
> +static struct video_device *video_devices[VIDEO_NUM_DEVICES];
>  static DEFINE_MUTEX(videodev_lock);
>  static DECLARE_BITMAP(devnode_nums[VFL_TYPE_MAX], VIDEO_NUM_DEVICES);
> 
> @@ -173,14 +173,14 @@ static void v4l2_device_release(struct device *cd)
>  	struct v4l2_device *v4l2_dev = vdev->v4l2_dev;
> 
>  	mutex_lock(&videodev_lock);
> -	if (WARN_ON(video_device[vdev->minor] != vdev)) {
> +	if (WARN_ON(video_devices[vdev->minor] != vdev)) {
>  		/* should not happen */
>  		mutex_unlock(&videodev_lock);
>  		return;
>  	}
> 
>  	/* Free up this device for reuse */
> -	video_device[vdev->minor] = NULL;
> +	video_devices[vdev->minor] = NULL;
> 
>  	/* Delete the cdev on this minor as well */
>  	cdev_del(vdev->cdev);
> @@ -229,7 +229,7 @@ static struct class video_class = {
> 
>  struct video_device *video_devdata(struct file *file)
>  {
> -	return video_device[iminor(file_inode(file))];
> +	return video_devices[iminor(file_inode(file))];
>  }
>  EXPORT_SYMBOL(video_devdata);
> 
> @@ -493,9 +493,9 @@ static int get_index(struct video_device *vdev)
>  	bitmap_zero(used, VIDEO_NUM_DEVICES);
> 
>  	for (i = 0; i < VIDEO_NUM_DEVICES; i++) {
> -		if (video_device[i] != NULL &&
> -		    video_device[i]->v4l2_dev == vdev->v4l2_dev) {
> -			set_bit(video_device[i]->index, used);
> +		if (video_devices[i] != NULL &&
> +		    video_devices[i]->v4l2_dev == vdev->v4l2_dev) {
> +			set_bit(video_devices[i]->index, used);
>  		}
>  	}
> 
> @@ -929,7 +929,7 @@ int __video_register_device(struct video_device *vdev,
>  	/* The device node number and minor numbers are independent, so
>  	   we just find the first free minor number. */
>  	for (i = 0; i < VIDEO_NUM_DEVICES; i++)
> -		if (video_device[i] == NULL)
> +		if (video_devices[i] == NULL)
>  			break;
>  	if (i == VIDEO_NUM_DEVICES) {
>  		mutex_unlock(&videodev_lock);
> @@ -942,9 +942,9 @@ int __video_register_device(struct video_device *vdev,
>  	devnode_set(vdev);
> 
>  	/* Should not happen since we thought this minor was free */
> -	WARN_ON(video_device[vdev->minor] != NULL);
> +	WARN_ON(video_devices[vdev->minor] != NULL);
>  	vdev->index = get_index(vdev);
> -	video_device[vdev->minor] = vdev;
> +	video_devices[vdev->minor] = vdev;
>  	mutex_unlock(&videodev_lock);
> 
>  	if (vdev->ioctl_ops)
> @@ -999,7 +999,7 @@ int __video_register_device(struct video_device *vdev,
>  	mutex_lock(&videodev_lock);
>  	if (vdev->cdev)
>  		cdev_del(vdev->cdev);
> -	video_device[vdev->minor] = NULL;
> +	video_devices[vdev->minor] = NULL;
>  	devnode_clear(vdev);
>  	mutex_unlock(&videodev_lock);
>  	/* Mark this video device as never having been registered. */

-- 
Regards,

Laurent Pinchart

      reply	other threads:[~2018-04-09 21:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-09 19:47 [PATCH] [media] v4l2-core: Rename array 'video_driver' to 'video_drivers' Simon Que
2018-04-09 21:13 ` Laurent Pinchart [this message]

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=3074650.Mf9NpMS9vO@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=hans.verkuil@cisco.com \
    --cc=laurent.pinchart+renesas@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=sque@chromium.org \
    --cc=viro@zeniv.linux.org.uk \
    /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