hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/media/radio/wl128x/fmdrv_v4l2.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * FM Driver for Connectivity chip of Texas Instruments.
34 * This file provides interfaces to V4L2 subsystem.
....@@ -12,16 +13,6 @@
1213 * Copyright (C) 2011 Texas Instruments
1314 * Author: Raja Mani <raja_mani@ti.com>
1415 * Author: Manjunatha Halli <manjunatha_halli@ti.com>
15
- *
16
- * This program is free software; you can redistribute it and/or modify
17
- * it under the terms of the GNU General Public License version 2 as
18
- * published by the Free Software Foundation.
19
- *
20
- * This program is distributed in the hope that it will be useful,
21
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
22
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
- * GNU General Public License for more details.
24
- *
2516 */
2617
2718 #include <linux/export.h>
....@@ -190,17 +181,10 @@
190181 static int fm_v4l2_vidioc_querycap(struct file *file, void *priv,
191182 struct v4l2_capability *capability)
192183 {
193
- strlcpy(capability->driver, FM_DRV_NAME, sizeof(capability->driver));
194
- strlcpy(capability->card, FM_DRV_CARD_SHORT_NAME,
195
- sizeof(capability->card));
184
+ strscpy(capability->driver, FM_DRV_NAME, sizeof(capability->driver));
185
+ strscpy(capability->card, FM_DRV_CARD_SHORT_NAME,
186
+ sizeof(capability->card));
196187 sprintf(capability->bus_info, "UART");
197
- capability->device_caps = V4L2_CAP_HW_FREQ_SEEK | V4L2_CAP_TUNER |
198
- V4L2_CAP_RADIO | V4L2_CAP_MODULATOR |
199
- V4L2_CAP_AUDIO | V4L2_CAP_READWRITE |
200
- V4L2_CAP_RDS_CAPTURE;
201
- capability->capabilities = capability->device_caps |
202
- V4L2_CAP_DEVICE_CAPS;
203
-
204188 return 0;
205189 }
206190
....@@ -249,7 +233,7 @@
249233 struct v4l2_audio *audio)
250234 {
251235 memset(audio, 0, sizeof(*audio));
252
- strcpy(audio->name, "Radio");
236
+ strscpy(audio->name, "Radio", sizeof(audio->name));
253237 audio->capability = V4L2_AUDCAP_STEREO;
254238
255239 return 0;
....@@ -293,7 +277,7 @@
293277 if (ret != 0)
294278 return ret;
295279
296
- strcpy(tuner->name, "FM");
280
+ strscpy(tuner->name, "FM", sizeof(tuner->name));
297281 tuner->type = V4L2_TUNER_RADIO;
298282 /* Store rangelow and rangehigh freq in unit of 62.5 Hz */
299283 tuner->rangelow = bottom_freq * 16;
....@@ -524,6 +508,9 @@
524508 * but that would affect applications using this driver.
525509 */
526510 .vfl_dir = VFL_DIR_M2M,
511
+ .device_caps = V4L2_CAP_HW_FREQ_SEEK | V4L2_CAP_TUNER | V4L2_CAP_RADIO |
512
+ V4L2_CAP_MODULATOR | V4L2_CAP_AUDIO |
513
+ V4L2_CAP_READWRITE | V4L2_CAP_RDS_CAPTURE,
527514 };
528515
529516 int fm_v4l2_init_video_device(struct fmdev *fmdev, int radio_nr)
....@@ -531,7 +518,8 @@
531518 struct v4l2_ctrl *ctrl;
532519 int ret;
533520
534
- strlcpy(fmdev->v4l2_dev.name, FM_DRV_NAME, sizeof(fmdev->v4l2_dev.name));
521
+ strscpy(fmdev->v4l2_dev.name, FM_DRV_NAME,
522
+ sizeof(fmdev->v4l2_dev.name));
535523 ret = v4l2_device_register(NULL, &fmdev->v4l2_dev);
536524 if (ret < 0)
537525 return ret;