.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * Realtek RTL2832U SDR driver |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright (C) 2013 Antti Palosaari <crope@iki.fi> |
---|
5 | 6 | * |
---|
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 | | - * GNU General Public License for more details. |
---|
15 | | - * |
---|
16 | | - * You should have received a copy of the GNU General Public License along |
---|
17 | | - * with this program; if not, write to the Free Software Foundation, Inc., |
---|
18 | | - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
---|
19 | | - * |
---|
20 | 7 | * GNU Radio plugin "gr-kernel" for device usage will be on: |
---|
21 | | - * http://git.linuxtv.org/anttip/gr-kernel.git |
---|
22 | | - * |
---|
| 8 | + * https://git.linuxtv.org/anttip/gr-kernel.git |
---|
23 | 9 | */ |
---|
24 | 10 | |
---|
25 | 11 | #include "rtl2832_sdr.h" |
---|
.. | .. |
---|
95 | 81 | |
---|
96 | 82 | static struct rtl2832_sdr_format formats[] = { |
---|
97 | 83 | { |
---|
98 | | - .name = "Complex U8", |
---|
99 | 84 | .pixelformat = V4L2_SDR_FMT_CU8, |
---|
100 | 85 | .buffersize = BULK_BUFFER_SIZE, |
---|
101 | 86 | }, { |
---|
102 | | - .name = "Complex U16LE (emulated)", |
---|
103 | 87 | .pixelformat = V4L2_SDR_FMT_CU16LE, |
---|
104 | 88 | .buffersize = BULK_BUFFER_SIZE * 2, |
---|
105 | 89 | }, |
---|
.. | .. |
---|
439 | 423 | |
---|
440 | 424 | dev_dbg(&pdev->dev, "\n"); |
---|
441 | 425 | |
---|
442 | | - strlcpy(cap->driver, KBUILD_MODNAME, sizeof(cap->driver)); |
---|
443 | | - strlcpy(cap->card, dev->vdev.name, sizeof(cap->card)); |
---|
| 426 | + strscpy(cap->driver, KBUILD_MODNAME, sizeof(cap->driver)); |
---|
| 427 | + strscpy(cap->card, dev->vdev.name, sizeof(cap->card)); |
---|
444 | 428 | usb_make_path(dev->udev, cap->bus_info, sizeof(cap->bus_info)); |
---|
445 | | - cap->device_caps = V4L2_CAP_SDR_CAPTURE | V4L2_CAP_STREAMING | |
---|
446 | | - V4L2_CAP_READWRITE | V4L2_CAP_TUNER; |
---|
447 | | - cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS; |
---|
448 | 429 | return 0; |
---|
449 | 430 | } |
---|
450 | 431 | |
---|
.. | .. |
---|
471 | 452 | { |
---|
472 | 453 | struct rtl2832_sdr_dev *dev = vb2_get_drv_priv(vb->vb2_queue); |
---|
473 | 454 | |
---|
474 | | - /* Don't allow queing new buffers after device disconnection */ |
---|
| 455 | + /* Don't allow queueing new buffers after device disconnection */ |
---|
475 | 456 | if (!dev->udev) |
---|
476 | 457 | return -ENODEV; |
---|
477 | 458 | |
---|
.. | .. |
---|
976 | 957 | dev_dbg(&pdev->dev, "index=%d type=%d\n", v->index, v->type); |
---|
977 | 958 | |
---|
978 | 959 | if (v->index == 0) { |
---|
979 | | - strlcpy(v->name, "ADC: Realtek RTL2832", sizeof(v->name)); |
---|
| 960 | + strscpy(v->name, "ADC: Realtek RTL2832", sizeof(v->name)); |
---|
980 | 961 | v->type = V4L2_TUNER_ADC; |
---|
981 | 962 | v->capability = V4L2_TUNER_CAP_1HZ | V4L2_TUNER_CAP_FREQ_BANDS; |
---|
982 | 963 | v->rangelow = 300000; |
---|
.. | .. |
---|
986 | 967 | V4L2_SUBDEV_HAS_OP(dev->v4l2_subdev, tuner, g_tuner)) { |
---|
987 | 968 | ret = v4l2_subdev_call(dev->v4l2_subdev, tuner, g_tuner, v); |
---|
988 | 969 | } else if (v->index == 1) { |
---|
989 | | - strlcpy(v->name, "RF: <unknown>", sizeof(v->name)); |
---|
| 970 | + strscpy(v->name, "RF: <unknown>", sizeof(v->name)); |
---|
990 | 971 | v->type = V4L2_TUNER_RF; |
---|
991 | 972 | v->capability = V4L2_TUNER_CAP_1HZ | V4L2_TUNER_CAP_FREQ_BANDS; |
---|
992 | 973 | v->rangelow = 50000000; |
---|
.. | .. |
---|
1133 | 1114 | if (f->index >= dev->num_formats) |
---|
1134 | 1115 | return -EINVAL; |
---|
1135 | 1116 | |
---|
1136 | | - strlcpy(f->description, formats[f->index].name, sizeof(f->description)); |
---|
1137 | 1117 | f->pixelformat = formats[f->index].pixelformat; |
---|
1138 | 1118 | |
---|
1139 | 1119 | return 0; |
---|
.. | .. |
---|
1256 | 1236 | .release = video_device_release_empty, |
---|
1257 | 1237 | .fops = &rtl2832_sdr_fops, |
---|
1258 | 1238 | .ioctl_ops = &rtl2832_sdr_ioctl_ops, |
---|
| 1239 | + .device_caps = V4L2_CAP_SDR_CAPTURE | V4L2_CAP_STREAMING | |
---|
| 1240 | + V4L2_CAP_READWRITE | V4L2_CAP_TUNER, |
---|
1259 | 1241 | }; |
---|
1260 | 1242 | |
---|
1261 | 1243 | static int rtl2832_sdr_s_ctrl(struct v4l2_ctrl *ctrl) |
---|
.. | .. |
---|
1394 | 1376 | case RTL2832_SDR_TUNER_E4000: |
---|
1395 | 1377 | v4l2_ctrl_handler_init(&dev->hdl, 9); |
---|
1396 | 1378 | if (subdev) |
---|
1397 | | - v4l2_ctrl_add_handler(&dev->hdl, subdev->ctrl_handler, NULL); |
---|
| 1379 | + v4l2_ctrl_add_handler(&dev->hdl, subdev->ctrl_handler, |
---|
| 1380 | + NULL, true); |
---|
1398 | 1381 | break; |
---|
1399 | 1382 | case RTL2832_SDR_TUNER_R820T: |
---|
1400 | 1383 | case RTL2832_SDR_TUNER_R828D: |
---|
.. | .. |
---|
1423 | 1406 | v4l2_ctrl_handler_init(&dev->hdl, 2); |
---|
1424 | 1407 | if (subdev) |
---|
1425 | 1408 | v4l2_ctrl_add_handler(&dev->hdl, subdev->ctrl_handler, |
---|
1426 | | - NULL); |
---|
| 1409 | + NULL, true); |
---|
1427 | 1410 | break; |
---|
1428 | 1411 | default: |
---|
1429 | 1412 | v4l2_ctrl_handler_init(&dev->hdl, 0); |
---|
1430 | 1413 | dev_err(&pdev->dev, "Unsupported tuner\n"); |
---|
| 1414 | + ret = -ENODEV; |
---|
1431 | 1415 | goto err_v4l2_ctrl_handler_free; |
---|
1432 | 1416 | } |
---|
1433 | 1417 | if (dev->hdl.error) { |
---|