.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * uvc_v4l2.c -- USB Video Class driver - V4L2 API |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright (C) 2005-2010 |
---|
5 | 6 | * Laurent Pinchart (laurent.pinchart@ideasonboard.com) |
---|
6 | | - * |
---|
7 | | - * This program is free software; you can redistribute it and/or modify |
---|
8 | | - * it under the terms of the GNU General Public License as published by |
---|
9 | | - * the Free Software Foundation; either version 2 of the License, or |
---|
10 | | - * (at your option) any later version. |
---|
11 | | - * |
---|
12 | 7 | */ |
---|
13 | 8 | |
---|
14 | 9 | #include <linux/compat.h> |
---|
.. | .. |
---|
288 | 283 | fmt->fmt.pix.sizeimage = probe->dwMaxVideoFrameSize; |
---|
289 | 284 | fmt->fmt.pix.pixelformat = format->fcc; |
---|
290 | 285 | fmt->fmt.pix.colorspace = format->colorspace; |
---|
291 | | - fmt->fmt.pix.priv = 0; |
---|
| 286 | + fmt->fmt.pix.xfer_func = format->xfer_func; |
---|
| 287 | + fmt->fmt.pix.ycbcr_enc = format->ycbcr_enc; |
---|
292 | 288 | |
---|
293 | 289 | if (uvc_format != NULL) |
---|
294 | 290 | *uvc_format = format; |
---|
.. | .. |
---|
325 | 321 | fmt->fmt.pix.bytesperline = uvc_v4l2_get_bytesperline(format, frame); |
---|
326 | 322 | fmt->fmt.pix.sizeimage = stream->ctrl.dwMaxVideoFrameSize; |
---|
327 | 323 | fmt->fmt.pix.colorspace = format->colorspace; |
---|
328 | | - fmt->fmt.pix.priv = 0; |
---|
| 324 | + fmt->fmt.pix.xfer_func = format->xfer_func; |
---|
| 325 | + fmt->fmt.pix.ycbcr_enc = format->ycbcr_enc; |
---|
329 | 326 | |
---|
330 | 327 | done: |
---|
331 | 328 | mutex_unlock(&stream->mutex); |
---|
.. | .. |
---|
624 | 621 | struct uvc_video_chain *chain = handle->chain; |
---|
625 | 622 | struct uvc_streaming *stream = handle->stream; |
---|
626 | 623 | |
---|
627 | | - strlcpy(cap->driver, "uvcvideo", sizeof(cap->driver)); |
---|
628 | | - strlcpy(cap->card, vdev->name, sizeof(cap->card)); |
---|
| 624 | + strscpy(cap->driver, "uvcvideo", sizeof(cap->driver)); |
---|
| 625 | + strscpy(cap->card, vdev->name, sizeof(cap->card)); |
---|
629 | 626 | usb_make_path(stream->dev->udev, cap->bus_info, sizeof(cap->bus_info)); |
---|
630 | 627 | cap->capabilities = V4L2_CAP_DEVICE_CAPS | V4L2_CAP_STREAMING |
---|
631 | 628 | | chain->caps; |
---|
.. | .. |
---|
651 | 648 | fmt->flags = 0; |
---|
652 | 649 | if (format->flags & UVC_FMT_FLAG_COMPRESSED) |
---|
653 | 650 | fmt->flags |= V4L2_FMT_FLAG_COMPRESSED; |
---|
654 | | - strlcpy(fmt->description, format->name, sizeof(fmt->description)); |
---|
| 651 | + strscpy(fmt->description, format->name, sizeof(fmt->description)); |
---|
655 | 652 | fmt->description[sizeof(fmt->description) - 1] = 0; |
---|
656 | 653 | fmt->pixelformat = format->fcc; |
---|
657 | 654 | return 0; |
---|
.. | .. |
---|
784 | 781 | if (!uvc_has_privileges(handle)) |
---|
785 | 782 | return -EBUSY; |
---|
786 | 783 | |
---|
787 | | - return uvc_queue_buffer(&stream->queue, buf); |
---|
| 784 | + return uvc_queue_buffer(&stream->queue, |
---|
| 785 | + stream->vdev.v4l2_dev->mdev, buf); |
---|
788 | 786 | } |
---|
789 | 787 | |
---|
790 | 788 | static int uvc_ioctl_expbuf(struct file *file, void *fh, |
---|
.. | .. |
---|
865 | 863 | struct uvc_video_chain *chain = handle->chain; |
---|
866 | 864 | const struct uvc_entity *selector = chain->selector; |
---|
867 | 865 | struct uvc_entity *iterm = NULL; |
---|
| 866 | + struct uvc_entity *it; |
---|
868 | 867 | u32 index = input->index; |
---|
869 | | - int pin = 0; |
---|
870 | 868 | |
---|
871 | 869 | if (selector == NULL || |
---|
872 | 870 | (chain->dev->quirks & UVC_QUIRK_IGNORE_SELECTOR_UNIT)) { |
---|
873 | 871 | if (index != 0) |
---|
874 | 872 | return -EINVAL; |
---|
875 | | - list_for_each_entry(iterm, &chain->entities, chain) { |
---|
876 | | - if (UVC_ENTITY_IS_ITERM(iterm)) |
---|
| 873 | + list_for_each_entry(it, &chain->entities, chain) { |
---|
| 874 | + if (UVC_ENTITY_IS_ITERM(it)) { |
---|
| 875 | + iterm = it; |
---|
877 | 876 | break; |
---|
| 877 | + } |
---|
878 | 878 | } |
---|
879 | | - pin = iterm->id; |
---|
880 | 879 | } else if (index < selector->bNrInPins) { |
---|
881 | | - pin = selector->baSourceID[index]; |
---|
882 | | - list_for_each_entry(iterm, &chain->entities, chain) { |
---|
883 | | - if (!UVC_ENTITY_IS_ITERM(iterm)) |
---|
| 880 | + list_for_each_entry(it, &chain->entities, chain) { |
---|
| 881 | + if (!UVC_ENTITY_IS_ITERM(it)) |
---|
884 | 882 | continue; |
---|
885 | | - if (iterm->id == pin) |
---|
| 883 | + if (it->id == selector->baSourceID[index]) { |
---|
| 884 | + iterm = it; |
---|
886 | 885 | break; |
---|
| 886 | + } |
---|
887 | 887 | } |
---|
888 | 888 | } |
---|
889 | 889 | |
---|
890 | | - if (iterm == NULL || iterm->id != pin) |
---|
| 890 | + if (iterm == NULL) |
---|
891 | 891 | return -EINVAL; |
---|
892 | 892 | |
---|
893 | 893 | memset(input, 0, sizeof(*input)); |
---|
894 | 894 | input->index = index; |
---|
895 | | - strlcpy(input->name, iterm->name, sizeof(input->name)); |
---|
| 895 | + strscpy(input->name, iterm->name, sizeof(input->name)); |
---|
896 | 896 | if (UVC_ENTITY_TYPE(iterm) == UVC_ITT_CAMERA) |
---|
897 | 897 | input->type = V4L2_INPUT_TYPE_CAMERA; |
---|
898 | 898 | |
---|
.. | .. |
---|
984 | 984 | |
---|
985 | 985 | qec->id = qc.id; |
---|
986 | 986 | qec->type = qc.type; |
---|
987 | | - strlcpy(qec->name, qc.name, sizeof(qec->name)); |
---|
| 987 | + strscpy(qec->name, qc.name, sizeof(qec->name)); |
---|
988 | 988 | qec->minimum = qc.minimum; |
---|
989 | 989 | qec->maximum = qc.maximum; |
---|
990 | 990 | qec->step = qc.step; |
---|