forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-11 04dd17822334871b23ea2862f7798fb0e0007777
kernel/drivers/media/usb/airspy/airspy.c
....@@ -1,17 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * AirSpy SDR driver
34 *
45 * Copyright (C) 2014 Antti Palosaari <crope@iki.fi>
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
- * GNU General Public License for more details.
156 */
167
178 #include <linux/module.h>
....@@ -80,7 +71,6 @@
8071
8172 /* stream formats */
8273 struct airspy_format {
83
- char *name;
8474 u32 pixelformat;
8575 u32 buffersize;
8676 };
....@@ -88,7 +78,6 @@
8878 /* format descriptions for capture and preview */
8979 static struct airspy_format formats[] = {
9080 {
91
- .name = "Real U12LE",
9281 .pixelformat = V4L2_SDR_FMT_RU12LE,
9382 .buffersize = BULK_BUFFER_SIZE,
9483 },
....@@ -619,13 +608,9 @@
619608 {
620609 struct airspy *s = video_drvdata(file);
621610
622
- strlcpy(cap->driver, KBUILD_MODNAME, sizeof(cap->driver));
623
- strlcpy(cap->card, s->vdev.name, sizeof(cap->card));
611
+ strscpy(cap->driver, KBUILD_MODNAME, sizeof(cap->driver));
612
+ strscpy(cap->card, s->vdev.name, sizeof(cap->card));
624613 usb_make_path(s->udev, cap->bus_info, sizeof(cap->bus_info));
625
- cap->device_caps = V4L2_CAP_SDR_CAPTURE | V4L2_CAP_STREAMING |
626
- V4L2_CAP_READWRITE | V4L2_CAP_TUNER;
627
- cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
628
-
629614 return 0;
630615 }
631616
....@@ -635,7 +620,6 @@
635620 if (f->index >= NUM_FORMATS)
636621 return -EINVAL;
637622
638
- strlcpy(f->description, formats[f->index].name, sizeof(f->description));
639623 f->pixelformat = formats[f->index].pixelformat;
640624
641625 return 0;
....@@ -720,14 +704,14 @@
720704 int ret;
721705
722706 if (v->index == 0) {
723
- strlcpy(v->name, "AirSpy ADC", sizeof(v->name));
707
+ strscpy(v->name, "AirSpy ADC", sizeof(v->name));
724708 v->type = V4L2_TUNER_ADC;
725709 v->capability = V4L2_TUNER_CAP_1HZ | V4L2_TUNER_CAP_FREQ_BANDS;
726710 v->rangelow = bands[0].rangelow;
727711 v->rangehigh = bands[0].rangehigh;
728712 ret = 0;
729713 } else if (v->index == 1) {
730
- strlcpy(v->name, "AirSpy RF", sizeof(v->name));
714
+ strscpy(v->name, "AirSpy RF", sizeof(v->name));
731715 v->type = V4L2_TUNER_RF;
732716 v->capability = V4L2_TUNER_CAP_1HZ | V4L2_TUNER_CAP_FREQ_BANDS;
733717 v->rangelow = bands_rf[0].rangelow;
....@@ -1066,6 +1050,8 @@
10661050 s->v4l2_dev.ctrl_handler = &s->hdl;
10671051 s->vdev.v4l2_dev = &s->v4l2_dev;
10681052 s->vdev.lock = &s->v4l2_lock;
1053
+ s->vdev.device_caps = V4L2_CAP_SDR_CAPTURE | V4L2_CAP_STREAMING |
1054
+ V4L2_CAP_READWRITE | V4L2_CAP_TUNER;
10691055
10701056 ret = video_register_device(&s->vdev, VFL_TYPE_SDR, -1);
10711057 if (ret) {