| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Sony CXD2820R demodulator driver |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2010 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. |
|---|
| 15 | | - * |
|---|
| 16 | | - * You should have received a copy of the GNU General Public License along |
|---|
| 17 | | - * with this program; if not, write to the Free Software Foundation, Inc., |
|---|
| 18 | | - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
|---|
| 19 | 6 | */ |
|---|
| 20 | 7 | |
|---|
| 21 | 8 | |
|---|
| .. | .. |
|---|
| 540 | 527 | pdata.attach_in_use = true; |
|---|
| 541 | 528 | |
|---|
| 542 | 529 | memset(&board_info, 0, sizeof(board_info)); |
|---|
| 543 | | - strlcpy(board_info.type, "cxd2820r", I2C_NAME_SIZE); |
|---|
| 530 | + strscpy(board_info.type, "cxd2820r", I2C_NAME_SIZE); |
|---|
| 544 | 531 | board_info.addr = config->i2c_address; |
|---|
| 545 | 532 | board_info.platform_data = &pdata; |
|---|
| 546 | | - client = i2c_new_device(adapter, &board_info); |
|---|
| 547 | | - if (!client || !client->dev.driver) |
|---|
| 533 | + client = i2c_new_client_device(adapter, &board_info); |
|---|
| 534 | + if (!i2c_client_has_driver(client)) |
|---|
| 548 | 535 | return NULL; |
|---|
| 549 | 536 | |
|---|
| 550 | 537 | return pdata.get_dvb_frontend(client); |
|---|
| 551 | 538 | } |
|---|
| 552 | | -EXPORT_SYMBOL(cxd2820r_attach); |
|---|
| 539 | +EXPORT_SYMBOL_GPL(cxd2820r_attach); |
|---|
| 553 | 540 | |
|---|
| 554 | 541 | static struct dvb_frontend *cxd2820r_get_dvb_frontend(struct i2c_client *client) |
|---|
| 555 | 542 | { |
|---|
| .. | .. |
|---|
| 645 | 632 | * one dummy I2C client in in order to get own I2C client for each |
|---|
| 646 | 633 | * register bank. |
|---|
| 647 | 634 | */ |
|---|
| 648 | | - priv->client[1] = i2c_new_dummy(client->adapter, client->addr | (1 << 1)); |
|---|
| 649 | | - if (!priv->client[1]) { |
|---|
| 650 | | - ret = -ENODEV; |
|---|
| 635 | + priv->client[1] = i2c_new_dummy_device(client->adapter, client->addr | (1 << 1)); |
|---|
| 636 | + if (IS_ERR(priv->client[1])) { |
|---|
| 637 | + ret = PTR_ERR(priv->client[1]); |
|---|
| 651 | 638 | dev_err(&client->dev, "I2C registration failed\n"); |
|---|
| 652 | | - if (ret) |
|---|
| 653 | | - goto err_regmap_0_regmap_exit; |
|---|
| 639 | + goto err_regmap_0_regmap_exit; |
|---|
| 654 | 640 | } |
|---|
| 655 | 641 | |
|---|
| 656 | 642 | priv->regmap[1] = regmap_init_i2c(priv->client[1], ®map_config1); |
|---|