From 3a03284dd4e7a9923acda7d73ec418378d3af6cc Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Fri, 17 Aug 2018 04:50:02 -0400 Subject: media: uvcvideo: Store device information pointer in struct uvc_device The device information structure is currently copied field by field in the uvc_device structure. As we only have two fields at the moment this isn't much of an issue, but it prevents easy addition of new info fields. Fix this by storing the uvc_device_info pointer in the uvc_device structure. As a result the uvc_device meta_format field can be removed. The quirks field, however, needs to stay as it can be modified through a module parameter. As not all device have an information structure, we declare a global "NULL" info instance that is used as a fallback when the driver_info is empty. Signed-off-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/uvc/uvc_metadata.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'drivers/media/usb/uvc/uvc_metadata.c') diff --git a/drivers/media/usb/uvc/uvc_metadata.c b/drivers/media/usb/uvc/uvc_metadata.c index cd1aec19cc5b..ed0f0c0732cb 100644 --- a/drivers/media/usb/uvc/uvc_metadata.c +++ b/drivers/media/usb/uvc/uvc_metadata.c @@ -74,7 +74,8 @@ static int uvc_meta_v4l2_try_format(struct file *file, void *fh, memset(fmt, 0, sizeof(*fmt)); - fmt->dataformat = fmeta == dev->meta_format ? fmeta : V4L2_META_FMT_UVC; + fmt->dataformat = fmeta == dev->info->meta_format + ? fmeta : V4L2_META_FMT_UVC; fmt->buffersize = UVC_METATADA_BUF_SIZE; return 0; @@ -118,14 +119,14 @@ static int uvc_meta_v4l2_enum_formats(struct file *file, void *fh, u32 index = fdesc->index; if (fdesc->type != vfh->vdev->queue->type || - index > 1U || (index && !dev->meta_format)) + index > 1U || (index && !dev->info->meta_format)) return -EINVAL; memset(fdesc, 0, sizeof(*fdesc)); fdesc->type = vfh->vdev->queue->type; fdesc->index = index; - fdesc->pixelformat = index ? dev->meta_format : V4L2_META_FMT_UVC; + fdesc->pixelformat = index ? dev->info->meta_format : V4L2_META_FMT_UVC; return 0; } -- cgit v1.2.3-55-g7522