| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | Montage Technology TS2020 - Silicon Tuner driver |
|---|
| 3 | 4 | Copyright (C) 2009-2012 Konstantin Dimitrov <kosio.dimitrov@gmail.com> |
|---|
| 4 | 5 | |
|---|
| 5 | 6 | Copyright (C) 2009-2012 TurboSight.com |
|---|
| 6 | 7 | |
|---|
| 7 | | - This program is free software; you can redistribute it and/or modify |
|---|
| 8 | | - it under the terms of the GNU General Public License as published by |
|---|
| 9 | | - the Free Software Foundation; either version 2 of the License, or |
|---|
| 10 | | - (at your option) any later version. |
|---|
| 11 | | - |
|---|
| 12 | | - This program is distributed in the hope that it will be useful, |
|---|
| 13 | | - but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 14 | | - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 15 | | - GNU General Public License for more details. |
|---|
| 16 | | - |
|---|
| 17 | | - You should have received a copy of the GNU General Public License |
|---|
| 18 | | - along with this program; if not, write to the Free Software |
|---|
| 19 | | - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
|---|
| 20 | 8 | */ |
|---|
| 21 | 9 | |
|---|
| 22 | 10 | #include <media/dvb_frontend.h> |
|---|
| .. | .. |
|---|
| 180 | 168 | unsigned int utmp; |
|---|
| 181 | 169 | |
|---|
| 182 | 170 | ret = regmap_read(dev->regmap, 0x3d, &utmp); |
|---|
| 171 | + if (ret) |
|---|
| 172 | + return ret; |
|---|
| 173 | + |
|---|
| 183 | 174 | utmp &= 0x7f; |
|---|
| 184 | 175 | if (utmp < 0x16) |
|---|
| 185 | 176 | utmp = 0xa1; |
|---|
| .. | .. |
|---|
| 525 | 516 | pdata.attach_in_use = true; |
|---|
| 526 | 517 | |
|---|
| 527 | 518 | memset(&board_info, 0, sizeof(board_info)); |
|---|
| 528 | | - strlcpy(board_info.type, "ts2020", I2C_NAME_SIZE); |
|---|
| 519 | + strscpy(board_info.type, "ts2020", I2C_NAME_SIZE); |
|---|
| 529 | 520 | board_info.addr = config->tuner_address; |
|---|
| 530 | 521 | board_info.platform_data = &pdata; |
|---|
| 531 | | - client = i2c_new_device(i2c, &board_info); |
|---|
| 532 | | - if (!client || !client->dev.driver) |
|---|
| 522 | + client = i2c_new_client_device(i2c, &board_info); |
|---|
| 523 | + if (!i2c_client_has_driver(client)) |
|---|
| 533 | 524 | return NULL; |
|---|
| 534 | 525 | |
|---|
| 535 | 526 | return fe; |
|---|
| 536 | 527 | } |
|---|
| 537 | | -EXPORT_SYMBOL(ts2020_attach); |
|---|
| 528 | +EXPORT_SYMBOL_GPL(ts2020_attach); |
|---|
| 538 | 529 | |
|---|
| 539 | 530 | /* |
|---|
| 540 | 531 | * We implement own regmap locking due to legacy DVB attach which uses frontend |
|---|