diff mbox series

[v9,10/22] media: uvcvideo: Use dev->name for querycap()

Message ID 20210326095840.364424-11-ribalda@chromium.org
State Superseded
Headers show
Series uvcvideo: Fix v4l2-compliance errors | expand

Commit Message

Ricardo Ribalda March 26, 2021, 9:58 a.m. UTC
Use the device name for the card name instead of vdev->name.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
 drivers/media/usb/uvc/uvc_metadata.c | 2 +-
 drivers/media/usb/uvc/uvc_v4l2.c     | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)

Comments

Laurent Pinchart June 10, 2021, 4:44 p.m. UTC | #1
Hi Ricardo,

Thank you for the patch.

On Fri, Mar 26, 2021 at 10:58:28AM +0100, Ricardo Ribalda wrote:
> Use the device name for the card name instead of vdev->name.


The commit message should explain at least briefly why this is desired.

> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>

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

> Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>


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


> ---

>  drivers/media/usb/uvc/uvc_metadata.c | 2 +-

>  drivers/media/usb/uvc/uvc_v4l2.c     | 3 +--

>  2 files changed, 2 insertions(+), 3 deletions(-)

> 

> diff --git a/drivers/media/usb/uvc/uvc_metadata.c b/drivers/media/usb/uvc/uvc_metadata.c

> index b6279ad7ac84..82de7781f5b6 100644

> --- a/drivers/media/usb/uvc/uvc_metadata.c

> +++ b/drivers/media/usb/uvc/uvc_metadata.c

> @@ -30,7 +30,7 @@ static int uvc_meta_v4l2_querycap(struct file *file, void *fh,

>  	struct uvc_video_chain *chain = stream->chain;

>  

>  	strscpy(cap->driver, "uvcvideo", sizeof(cap->driver));

> -	strscpy(cap->card, vfh->vdev->name, sizeof(cap->card));

> +	strscpy(cap->card, stream->dev->name, sizeof(cap->card));

>  	usb_make_path(stream->dev->udev, cap->bus_info, sizeof(cap->bus_info));

>  	cap->capabilities = V4L2_CAP_DEVICE_CAPS | V4L2_CAP_STREAMING

>  			  | chain->caps;

> diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c

> index 1eeeb00280e4..9cdd30eff495 100644

> --- a/drivers/media/usb/uvc/uvc_v4l2.c

> +++ b/drivers/media/usb/uvc/uvc_v4l2.c

> @@ -617,13 +617,12 @@ static int uvc_v4l2_release(struct file *file)

>  static int uvc_ioctl_querycap(struct file *file, void *fh,

>  			      struct v4l2_capability *cap)

>  {

> -	struct video_device *vdev = video_devdata(file);

>  	struct uvc_fh *handle = file->private_data;

>  	struct uvc_video_chain *chain = handle->chain;

>  	struct uvc_streaming *stream = handle->stream;

>  

>  	strscpy(cap->driver, "uvcvideo", sizeof(cap->driver));

> -	strscpy(cap->card, vdev->name, sizeof(cap->card));

> +	strscpy(cap->card, handle->stream->dev->name, sizeof(cap->card));

>  	usb_make_path(stream->dev->udev, cap->bus_info, sizeof(cap->bus_info));

>  	cap->capabilities = V4L2_CAP_DEVICE_CAPS | V4L2_CAP_STREAMING

>  			  | chain->caps;


-- 
Regards,

Laurent Pinchart
diff mbox series

Patch

diff --git a/drivers/media/usb/uvc/uvc_metadata.c b/drivers/media/usb/uvc/uvc_metadata.c
index b6279ad7ac84..82de7781f5b6 100644
--- a/drivers/media/usb/uvc/uvc_metadata.c
+++ b/drivers/media/usb/uvc/uvc_metadata.c
@@ -30,7 +30,7 @@  static int uvc_meta_v4l2_querycap(struct file *file, void *fh,
 	struct uvc_video_chain *chain = stream->chain;
 
 	strscpy(cap->driver, "uvcvideo", sizeof(cap->driver));
-	strscpy(cap->card, vfh->vdev->name, sizeof(cap->card));
+	strscpy(cap->card, stream->dev->name, sizeof(cap->card));
 	usb_make_path(stream->dev->udev, cap->bus_info, sizeof(cap->bus_info));
 	cap->capabilities = V4L2_CAP_DEVICE_CAPS | V4L2_CAP_STREAMING
 			  | chain->caps;
diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c
index 1eeeb00280e4..9cdd30eff495 100644
--- a/drivers/media/usb/uvc/uvc_v4l2.c
+++ b/drivers/media/usb/uvc/uvc_v4l2.c
@@ -617,13 +617,12 @@  static int uvc_v4l2_release(struct file *file)
 static int uvc_ioctl_querycap(struct file *file, void *fh,
 			      struct v4l2_capability *cap)
 {
-	struct video_device *vdev = video_devdata(file);
 	struct uvc_fh *handle = file->private_data;
 	struct uvc_video_chain *chain = handle->chain;
 	struct uvc_streaming *stream = handle->stream;
 
 	strscpy(cap->driver, "uvcvideo", sizeof(cap->driver));
-	strscpy(cap->card, vdev->name, sizeof(cap->card));
+	strscpy(cap->card, handle->stream->dev->name, sizeof(cap->card));
 	usb_make_path(stream->dev->udev, cap->bus_info, sizeof(cap->bus_info));
 	cap->capabilities = V4L2_CAP_DEVICE_CAPS | V4L2_CAP_STREAMING
 			  | chain->caps;