.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (C) 2005-2006 Micronas USA Inc. |
---|
3 | | - * |
---|
4 | | - * This program is free software; you can redistribute it and/or modify |
---|
5 | | - * it under the terms of the GNU General Public License (Version 2) as |
---|
6 | | - * published by the Free Software Foundation. |
---|
7 | | - * |
---|
8 | | - * This program is distributed in the hope that it will be useful, |
---|
9 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
10 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
11 | | - * GNU General Public License for more details. |
---|
12 | 4 | */ |
---|
13 | 5 | |
---|
14 | 6 | #include <linux/module.h> |
---|
.. | .. |
---|
284 | 276 | { |
---|
285 | 277 | struct go7007 *go = video_drvdata(file); |
---|
286 | 278 | |
---|
287 | | - strlcpy(cap->driver, "go7007", sizeof(cap->driver)); |
---|
288 | | - strlcpy(cap->card, go->name, sizeof(cap->card)); |
---|
289 | | - strlcpy(cap->bus_info, go->bus_info, sizeof(cap->bus_info)); |
---|
290 | | - |
---|
291 | | - cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE | |
---|
292 | | - V4L2_CAP_STREAMING; |
---|
293 | | - |
---|
294 | | - if (go->board_info->num_aud_inputs) |
---|
295 | | - cap->device_caps |= V4L2_CAP_AUDIO; |
---|
296 | | - if (go->board_info->flags & GO7007_BOARD_HAS_TUNER) |
---|
297 | | - cap->device_caps |= V4L2_CAP_TUNER; |
---|
298 | | - cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS; |
---|
| 279 | + strscpy(cap->driver, "go7007", sizeof(cap->driver)); |
---|
| 280 | + strscpy(cap->card, go->name, sizeof(cap->card)); |
---|
| 281 | + strscpy(cap->bus_info, go->bus_info, sizeof(cap->bus_info)); |
---|
299 | 282 | return 0; |
---|
300 | 283 | } |
---|
301 | 284 | |
---|
302 | 285 | static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv, |
---|
303 | 286 | struct v4l2_fmtdesc *fmt) |
---|
304 | 287 | { |
---|
305 | | - char *desc = NULL; |
---|
306 | | - |
---|
307 | 288 | switch (fmt->index) { |
---|
308 | 289 | case 0: |
---|
309 | 290 | fmt->pixelformat = V4L2_PIX_FMT_MJPEG; |
---|
310 | | - desc = "Motion JPEG"; |
---|
311 | 291 | break; |
---|
312 | 292 | case 1: |
---|
313 | 293 | fmt->pixelformat = V4L2_PIX_FMT_MPEG1; |
---|
314 | | - desc = "MPEG-1 ES"; |
---|
315 | 294 | break; |
---|
316 | 295 | case 2: |
---|
317 | 296 | fmt->pixelformat = V4L2_PIX_FMT_MPEG2; |
---|
318 | | - desc = "MPEG-2 ES"; |
---|
319 | 297 | break; |
---|
320 | 298 | case 3: |
---|
321 | 299 | fmt->pixelformat = V4L2_PIX_FMT_MPEG4; |
---|
322 | | - desc = "MPEG-4 ES"; |
---|
323 | 300 | break; |
---|
324 | 301 | default: |
---|
325 | 302 | return -EINVAL; |
---|
326 | 303 | } |
---|
327 | | - fmt->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
---|
328 | | - fmt->flags = V4L2_FMT_FLAG_COMPRESSED; |
---|
329 | | - |
---|
330 | | - strncpy(fmt->description, desc, sizeof(fmt->description)); |
---|
331 | | - |
---|
332 | 304 | return 0; |
---|
333 | 305 | } |
---|
334 | 306 | |
---|
.. | .. |
---|
634 | 606 | if (inp->index >= go->board_info->num_inputs) |
---|
635 | 607 | return -EINVAL; |
---|
636 | 608 | |
---|
637 | | - strlcpy(inp->name, go->board_info->inputs[inp->index].name, |
---|
638 | | - sizeof(inp->name)); |
---|
| 609 | + strscpy(inp->name, go->board_info->inputs[inp->index].name, |
---|
| 610 | + sizeof(inp->name)); |
---|
639 | 611 | |
---|
640 | 612 | /* If this board has a tuner, it will be the first input */ |
---|
641 | 613 | if ((go->board_info->flags & GO7007_BOARD_HAS_TUNER) && |
---|
.. | .. |
---|
673 | 645 | |
---|
674 | 646 | if (a->index >= go->board_info->num_aud_inputs) |
---|
675 | 647 | return -EINVAL; |
---|
676 | | - strlcpy(a->name, go->board_info->aud_inputs[a->index].name, |
---|
| 648 | + strscpy(a->name, go->board_info->aud_inputs[a->index].name, |
---|
677 | 649 | sizeof(a->name)); |
---|
678 | 650 | a->capability = V4L2_AUDCAP_STEREO; |
---|
679 | 651 | return 0; |
---|
.. | .. |
---|
684 | 656 | struct go7007 *go = video_drvdata(file); |
---|
685 | 657 | |
---|
686 | 658 | a->index = go->aud_input; |
---|
687 | | - strlcpy(a->name, go->board_info->aud_inputs[go->aud_input].name, |
---|
| 659 | + strscpy(a->name, go->board_info->aud_inputs[go->aud_input].name, |
---|
688 | 660 | sizeof(a->name)); |
---|
689 | 661 | a->capability = V4L2_AUDCAP_STEREO; |
---|
690 | 662 | return 0; |
---|
.. | .. |
---|
742 | 714 | if (t->index != 0) |
---|
743 | 715 | return -EINVAL; |
---|
744 | 716 | |
---|
745 | | - strlcpy(t->name, "Tuner", sizeof(t->name)); |
---|
| 717 | + strscpy(t->name, "Tuner", sizeof(t->name)); |
---|
746 | 718 | return call_all(&go->v4l2_dev, tuner, g_tuner, t); |
---|
747 | 719 | } |
---|
748 | 720 | |
---|
.. | .. |
---|
1122 | 1094 | *vdev = go7007_template; |
---|
1123 | 1095 | vdev->lock = &go->serialize_lock; |
---|
1124 | 1096 | vdev->queue = &go->vidq; |
---|
| 1097 | + vdev->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE | |
---|
| 1098 | + V4L2_CAP_STREAMING; |
---|
| 1099 | + if (go->board_info->num_aud_inputs) |
---|
| 1100 | + vdev->device_caps |= V4L2_CAP_AUDIO; |
---|
| 1101 | + if (go->board_info->flags & GO7007_BOARD_HAS_TUNER) |
---|
| 1102 | + vdev->device_caps |= V4L2_CAP_TUNER; |
---|
1125 | 1103 | video_set_drvdata(vdev, go); |
---|
1126 | 1104 | vdev->v4l2_dev = &go->v4l2_dev; |
---|
1127 | 1105 | if (!v4l2_device_has_op(&go->v4l2_dev, 0, video, querystd)) |
---|
.. | .. |
---|
1160 | 1138 | go7007_s_input(go); |
---|
1161 | 1139 | if (go->board_info->sensor_flags & GO7007_SENSOR_TV) |
---|
1162 | 1140 | go7007_s_std(go); |
---|
1163 | | - rv = video_register_device(vdev, VFL_TYPE_GRABBER, -1); |
---|
| 1141 | + rv = video_register_device(vdev, VFL_TYPE_VIDEO, -1); |
---|
1164 | 1142 | if (rv < 0) |
---|
1165 | 1143 | return rv; |
---|
1166 | 1144 | dev_info(go->dev, "registered device %s [v4l2]\n", |
---|