| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * drivers/media/radio/si470x/radio-si470x-usb.c |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * USB driver for radios with Silicon Labs Si470x FM Radio Receivers |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * Copyright (c) 2009 Tobias Lorenz <tobias.lorenz@gmx.net> |
|---|
| 7 | | - * |
|---|
| 8 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 9 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 10 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 11 | | - * (at your option) any later version. |
|---|
| 12 | | - * |
|---|
| 13 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 14 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 15 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 16 | | - * GNU General Public License for more details. |
|---|
| 17 | 8 | */ |
|---|
| 18 | 9 | |
|---|
| 19 | 10 | |
|---|
| .. | .. |
|---|
| 519 | 510 | { |
|---|
| 520 | 511 | struct si470x_device *radio = video_drvdata(file); |
|---|
| 521 | 512 | |
|---|
| 522 | | - strlcpy(capability->driver, DRIVER_NAME, sizeof(capability->driver)); |
|---|
| 523 | | - strlcpy(capability->card, DRIVER_CARD, sizeof(capability->card)); |
|---|
| 513 | + strscpy(capability->driver, DRIVER_NAME, sizeof(capability->driver)); |
|---|
| 514 | + strscpy(capability->card, DRIVER_CARD, sizeof(capability->card)); |
|---|
| 524 | 515 | usb_make_path(radio->usbdev, capability->bus_info, |
|---|
| 525 | 516 | sizeof(capability->bus_info)); |
|---|
| 526 | | - capability->device_caps = V4L2_CAP_HW_FREQ_SEEK | V4L2_CAP_READWRITE | |
|---|
| 527 | | - V4L2_CAP_TUNER | V4L2_CAP_RADIO | V4L2_CAP_RDS_CAPTURE; |
|---|
| 528 | | - capability->capabilities = capability->device_caps | V4L2_CAP_DEVICE_CAPS; |
|---|
| 529 | 517 | return 0; |
|---|
| 530 | 518 | } |
|---|
| 531 | 519 | |
|---|
| .. | .. |
|---|
| 679 | 667 | radio->videodev.lock = &radio->lock; |
|---|
| 680 | 668 | radio->videodev.v4l2_dev = &radio->v4l2_dev; |
|---|
| 681 | 669 | radio->videodev.release = video_device_release_empty; |
|---|
| 670 | + radio->videodev.device_caps = |
|---|
| 671 | + V4L2_CAP_HW_FREQ_SEEK | V4L2_CAP_READWRITE | V4L2_CAP_TUNER | |
|---|
| 672 | + V4L2_CAP_RADIO | V4L2_CAP_RDS_CAPTURE; |
|---|
| 682 | 673 | video_set_drvdata(&radio->videodev, radio); |
|---|
| 683 | 674 | |
|---|
| 684 | 675 | /* get device and chip versions */ |
|---|
| .. | .. |
|---|
| 742 | 733 | |
|---|
| 743 | 734 | /* start radio */ |
|---|
| 744 | 735 | retval = si470x_start_usb(radio); |
|---|
| 745 | | - if (retval < 0) |
|---|
| 736 | + if (retval < 0 && !radio->int_in_running) |
|---|
| 746 | 737 | goto err_buf; |
|---|
| 738 | + else if (retval < 0) /* in case of radio->int_in_running == 1 */ |
|---|
| 739 | + goto err_all; |
|---|
| 747 | 740 | |
|---|
| 748 | 741 | /* set initial frequency */ |
|---|
| 749 | 742 | si470x_set_freq(radio, 87.5 * FREQ_MUL); /* available in all regions */ |
|---|