forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-10 cde9070d9970eef1f7ec2360586c802a16230ad8
kernel/drivers/media/pci/saa7164/saa7164-encoder.c
....@@ -1,18 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Driver for the NXP SAA7164 PCIe bridge
34 *
45 * Copyright (c) 2010-2015 Steven Toth <stoth@kernellabs.com>
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation; either version 2 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- *
15
- * GNU General Public License for more details.
166 */
177
188 #include "saa7164.h"
....@@ -258,7 +248,7 @@
258248 if (i->index >= 7)
259249 return -EINVAL;
260250
261
- strcpy(i->name, inputs[i->index]);
251
+ strscpy(i->name, inputs[i->index], sizeof(i->name));
262252
263253 if (i->index == 0)
264254 i->type = V4L2_INPUT_TYPE_TUNER;
....@@ -325,7 +315,7 @@
325315 if (0 != t->index)
326316 return -EINVAL;
327317
328
- strcpy(t->name, "tuner");
318
+ strscpy(t->name, "tuner", sizeof(t->name));
329319 t->capability = V4L2_TUNER_CAP_NORM | V4L2_TUNER_CAP_STEREO;
330320 t->rangelow = SAA7164_TV_MIN_FREQ;
331321 t->rangehigh = SAA7164_TV_MAX_FREQ;
....@@ -497,20 +487,13 @@
497487 struct saa7164_port *port = fh->port;
498488 struct saa7164_dev *dev = port->dev;
499489
500
- strcpy(cap->driver, dev->name);
501
- strlcpy(cap->card, saa7164_boards[dev->board].name,
490
+ strscpy(cap->driver, dev->name, sizeof(cap->driver));
491
+ strscpy(cap->card, saa7164_boards[dev->board].name,
502492 sizeof(cap->card));
503493 sprintf(cap->bus_info, "PCI:%s", pci_name(dev->pci));
504
-
505
- cap->device_caps =
506
- V4L2_CAP_VIDEO_CAPTURE |
507
- V4L2_CAP_READWRITE |
508
- V4L2_CAP_TUNER;
509
-
510
- cap->capabilities = cap->device_caps |
511
- V4L2_CAP_VBI_CAPTURE |
512
- V4L2_CAP_DEVICE_CAPS;
513
-
494
+ cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE |
495
+ V4L2_CAP_TUNER | V4L2_CAP_VBI_CAPTURE |
496
+ V4L2_CAP_DEVICE_CAPS;
514497 return 0;
515498 }
516499
....@@ -520,7 +503,6 @@
520503 if (f->index != 0)
521504 return -EINVAL;
522505
523
- strlcpy(f->description, "MPEG", sizeof(f->description));
524506 f->pixelformat = V4L2_PIX_FMT_MPEG;
525507
526508 return 0;
....@@ -983,6 +965,8 @@
983965 .ioctl_ops = &mpeg_ioctl_ops,
984966 .minor = -1,
985967 .tvnorms = SAA7164_NORMS,
968
+ .device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE |
969
+ V4L2_CAP_TUNER,
986970 };
987971
988972 static struct video_device *saa7164_encoder_alloc(
....@@ -1103,7 +1087,7 @@
11031087 v4l2_ctrl_handler_setup(hdl);
11041088 video_set_drvdata(port->v4l_device, port);
11051089 result = video_register_device(port->v4l_device,
1106
- VFL_TYPE_GRABBER, -1);
1090
+ VFL_TYPE_VIDEO, -1);
11071091 if (result < 0) {
11081092 printk(KERN_INFO "%s: can't register mpeg device\n",
11091093 dev->name);