hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/media/pci/cx23885/cx23885-417.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 *
34 * Support for a cx23417 mpeg encoder via cx23885 host port.
....@@ -8,16 +9,6 @@
89 * - CX23885/7/8 support
910 *
1011 * Includes parts from the ivtv driver <http://sourceforge.net/projects/ivtv/>
11
- *
12
- * This program is free software; you can redistribute it and/or modify
13
- * it under the terms of the GNU General Public License as published by
14
- * the Free Software Foundation; either version 2 of the License, or
15
- * (at your option) any later version.
16
- *
17
- * This program is distributed in the hope that it will be useful,
18
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
- * GNU General Public License for more details.
2112 */
2213
2314 #include "cx23885.h"
....@@ -1280,7 +1271,7 @@
12801271 return -EINVAL;
12811272 if (0 != t->index)
12821273 return -EINVAL;
1283
- strcpy(t->name, "Television");
1274
+ strscpy(t->name, "Television", sizeof(t->name));
12841275 call_all(dev, tuner, g_tuner, t);
12851276
12861277 dprintk(1, "VIDIOC_G_TUNER: tuner type %d\n", t->type);
....@@ -1329,16 +1320,15 @@
13291320 struct cx23885_dev *dev = video_drvdata(file);
13301321 struct cx23885_tsport *tsport = &dev->ts1;
13311322
1332
- strlcpy(cap->driver, dev->name, sizeof(cap->driver));
1333
- strlcpy(cap->card, cx23885_boards[tsport->dev->board].name,
1323
+ strscpy(cap->driver, dev->name, sizeof(cap->driver));
1324
+ strscpy(cap->card, cx23885_boards[tsport->dev->board].name,
13341325 sizeof(cap->card));
13351326 sprintf(cap->bus_info, "PCIe:%s", pci_name(dev->pci));
1336
- cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE |
1337
- V4L2_CAP_STREAMING;
1327
+ cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE |
1328
+ V4L2_CAP_STREAMING | V4L2_CAP_VBI_CAPTURE |
1329
+ V4L2_CAP_AUDIO | V4L2_CAP_DEVICE_CAPS;
13381330 if (dev->tuner_type != TUNER_ABSENT)
1339
- cap->device_caps |= V4L2_CAP_TUNER;
1340
- cap->capabilities = cap->device_caps | V4L2_CAP_VBI_CAPTURE |
1341
- V4L2_CAP_AUDIO | V4L2_CAP_DEVICE_CAPS;
1331
+ cap->capabilities |= V4L2_CAP_TUNER;
13421332
13431333 return 0;
13441334 }
....@@ -1349,7 +1339,6 @@
13491339 if (f->index != 0)
13501340 return -EINVAL;
13511341
1352
- strlcpy(f->description, "MPEG", sizeof(f->description));
13531342 f->pixelformat = V4L2_PIX_FMT_MPEG;
13541343
13551344 return 0;
....@@ -1527,7 +1516,7 @@
15271516 dev->cxhdl.priv = dev;
15281517 dev->cxhdl.func = cx23885_api_func;
15291518 cx2341x_handler_set_50hz(&dev->cxhdl, tsport->height == 576);
1530
- v4l2_ctrl_add_handler(&dev->ctrl_handler, &dev->cxhdl.hdl, NULL);
1519
+ v4l2_ctrl_add_handler(&dev->ctrl_handler, &dev->cxhdl.hdl, NULL, false);
15311520
15321521 /* Allocate and initialize V4L video device */
15331522 dev->v4l_device = cx23885_video_dev_alloc(tsport,
....@@ -1551,8 +1540,12 @@
15511540 video_set_drvdata(dev->v4l_device, dev);
15521541 dev->v4l_device->lock = &dev->lock;
15531542 dev->v4l_device->queue = q;
1543
+ dev->v4l_device->device_caps = V4L2_CAP_VIDEO_CAPTURE |
1544
+ V4L2_CAP_READWRITE | V4L2_CAP_STREAMING;
1545
+ if (dev->tuner_type != TUNER_ABSENT)
1546
+ dev->v4l_device->device_caps |= V4L2_CAP_TUNER;
15541547 err = video_register_device(dev->v4l_device,
1555
- VFL_TYPE_GRABBER, -1);
1548
+ VFL_TYPE_VIDEO, -1);
15561549 if (err < 0) {
15571550 pr_info("%s: can't register mpeg device\n", dev->name);
15581551 return err;
....@@ -1561,7 +1554,7 @@
15611554 pr_info("%s: registered device %s [mpeg]\n",
15621555 dev->name, video_device_node_name(dev->v4l_device));
15631556
1564
- /* ST: Configure the encoder paramaters, but don't begin
1557
+ /* ST: Configure the encoder parameters, but don't begin
15651558 * encoding, this resolves an issue where the first time the
15661559 * encoder is started video can be choppy.
15671560 */