| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * FM Driver for Connectivity chip of Texas Instruments. |
|---|
| 3 | 4 | * This file provides interfaces to V4L2 subsystem. |
|---|
| .. | .. |
|---|
| 12 | 13 | * Copyright (C) 2011 Texas Instruments |
|---|
| 13 | 14 | * Author: Raja Mani <raja_mani@ti.com> |
|---|
| 14 | 15 | * 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 | | - * |
|---|
| 25 | 16 | */ |
|---|
| 26 | 17 | |
|---|
| 27 | 18 | #include <linux/export.h> |
|---|
| .. | .. |
|---|
| 190 | 181 | static int fm_v4l2_vidioc_querycap(struct file *file, void *priv, |
|---|
| 191 | 182 | struct v4l2_capability *capability) |
|---|
| 192 | 183 | { |
|---|
| 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)); |
|---|
| 196 | 187 | 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 | | - |
|---|
| 204 | 188 | return 0; |
|---|
| 205 | 189 | } |
|---|
| 206 | 190 | |
|---|
| .. | .. |
|---|
| 249 | 233 | struct v4l2_audio *audio) |
|---|
| 250 | 234 | { |
|---|
| 251 | 235 | memset(audio, 0, sizeof(*audio)); |
|---|
| 252 | | - strcpy(audio->name, "Radio"); |
|---|
| 236 | + strscpy(audio->name, "Radio", sizeof(audio->name)); |
|---|
| 253 | 237 | audio->capability = V4L2_AUDCAP_STEREO; |
|---|
| 254 | 238 | |
|---|
| 255 | 239 | return 0; |
|---|
| .. | .. |
|---|
| 293 | 277 | if (ret != 0) |
|---|
| 294 | 278 | return ret; |
|---|
| 295 | 279 | |
|---|
| 296 | | - strcpy(tuner->name, "FM"); |
|---|
| 280 | + strscpy(tuner->name, "FM", sizeof(tuner->name)); |
|---|
| 297 | 281 | tuner->type = V4L2_TUNER_RADIO; |
|---|
| 298 | 282 | /* Store rangelow and rangehigh freq in unit of 62.5 Hz */ |
|---|
| 299 | 283 | tuner->rangelow = bottom_freq * 16; |
|---|
| .. | .. |
|---|
| 524 | 508 | * but that would affect applications using this driver. |
|---|
| 525 | 509 | */ |
|---|
| 526 | 510 | .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, |
|---|
| 527 | 514 | }; |
|---|
| 528 | 515 | |
|---|
| 529 | 516 | int fm_v4l2_init_video_device(struct fmdev *fmdev, int radio_nr) |
|---|
| .. | .. |
|---|
| 531 | 518 | struct v4l2_ctrl *ctrl; |
|---|
| 532 | 519 | int ret; |
|---|
| 533 | 520 | |
|---|
| 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)); |
|---|
| 535 | 523 | ret = v4l2_device_register(NULL, &fmdev->v4l2_dev); |
|---|
| 536 | 524 | if (ret < 0) |
|---|
| 537 | 525 | return ret; |
|---|