.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * Driver for the NXP SAA7164 PCIe bridge |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright (c) 2010-2015 Steven Toth <stoth@kernellabs.com> |
---|
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 | | - * |
---|
15 | | - * GNU General Public License for more details. |
---|
16 | 6 | */ |
---|
17 | 7 | |
---|
18 | 8 | #include "saa7164.h" |
---|
.. | .. |
---|
120 | 110 | |
---|
121 | 111 | memset(&bi, 0, sizeof(bi)); |
---|
122 | 112 | |
---|
123 | | - strlcpy(bi.type, "si2157", I2C_NAME_SIZE); |
---|
| 113 | + strscpy(bi.type, "si2157", I2C_NAME_SIZE); |
---|
124 | 114 | bi.platform_data = cfg; |
---|
125 | 115 | bi.addr = addr8bit >> 1; |
---|
126 | 116 | |
---|
127 | 117 | request_module(bi.type); |
---|
128 | 118 | |
---|
129 | | - tuner = i2c_new_device(adapter, &bi); |
---|
130 | | - if (tuner == NULL || tuner->dev.driver == NULL) |
---|
| 119 | + tuner = i2c_new_client_device(adapter, &bi); |
---|
| 120 | + if (!i2c_client_has_driver(tuner)) |
---|
131 | 121 | return -ENODEV; |
---|
132 | 122 | |
---|
133 | 123 | if (!try_module_get(tuner->dev.driver->owner)) { |
---|
.. | .. |
---|
347 | 337 | |
---|
348 | 338 | dprintk(DBGLVL_DVB, "%s(port=%d)\n", __func__, port->nr); |
---|
349 | 339 | |
---|
350 | | - if (port->type != SAA7164_MPEG_DVB) |
---|
351 | | - BUG(); |
---|
| 340 | + BUG_ON(port->type != SAA7164_MPEG_DVB); |
---|
352 | 341 | |
---|
353 | 342 | /* Sanity check that the PCI configuration space is active */ |
---|
354 | 343 | if (port->hwcfg.BARLocation == 0) { |
---|
.. | .. |
---|
489 | 478 | |
---|
490 | 479 | dprintk(DBGLVL_DVB, "%s()\n", __func__); |
---|
491 | 480 | |
---|
492 | | - if (port->type != SAA7164_MPEG_DVB) |
---|
493 | | - BUG(); |
---|
| 481 | + BUG_ON(port->type != SAA7164_MPEG_DVB); |
---|
494 | 482 | |
---|
495 | 483 | /* Remove any allocated buffers */ |
---|
496 | 484 | mutex_lock(&port->dmaqueue_lock); |
---|
.. | .. |
---|
529 | 517 | return 0; |
---|
530 | 518 | } |
---|
531 | 519 | |
---|
532 | | -/* All the DVB attach calls go here, this function get's modified |
---|
| 520 | +/* All the DVB attach calls go here, this function gets modified |
---|
533 | 521 | * for each new card. |
---|
534 | 522 | */ |
---|
535 | 523 | int saa7164_dvb_register(struct saa7164_port *port) |
---|
.. | .. |
---|
643 | 631 | si2168_config.fe = &port->dvb.frontend; |
---|
644 | 632 | si2168_config.ts_mode = SI2168_TS_SERIAL; |
---|
645 | 633 | memset(&info, 0, sizeof(struct i2c_board_info)); |
---|
646 | | - strlcpy(info.type, "si2168", I2C_NAME_SIZE); |
---|
| 634 | + strscpy(info.type, "si2168", I2C_NAME_SIZE); |
---|
647 | 635 | info.addr = 0xc8 >> 1; |
---|
648 | 636 | info.platform_data = &si2168_config; |
---|
649 | 637 | request_module(info.type); |
---|
650 | | - client_demod = i2c_new_device(&dev->i2c_bus[2].i2c_adap, |
---|
651 | | - &info); |
---|
652 | | - if (!client_demod || !client_demod->dev.driver) |
---|
| 638 | + client_demod = i2c_new_client_device(&dev->i2c_bus[2].i2c_adap, &info); |
---|
| 639 | + if (!i2c_client_has_driver(client_demod)) |
---|
653 | 640 | goto frontend_detach; |
---|
654 | 641 | |
---|
655 | 642 | if (!try_module_get(client_demod->dev.driver->owner)) { |
---|
.. | .. |
---|
663 | 650 | si2157_config.if_port = 1; |
---|
664 | 651 | si2157_config.fe = port->dvb.frontend; |
---|
665 | 652 | memset(&info, 0, sizeof(struct i2c_board_info)); |
---|
666 | | - strlcpy(info.type, "si2157", I2C_NAME_SIZE); |
---|
| 653 | + strscpy(info.type, "si2157", I2C_NAME_SIZE); |
---|
667 | 654 | info.addr = 0xc0 >> 1; |
---|
668 | 655 | info.platform_data = &si2157_config; |
---|
669 | 656 | request_module(info.type); |
---|
670 | | - client_tuner = i2c_new_device(&dev->i2c_bus[0].i2c_adap, |
---|
671 | | - &info); |
---|
672 | | - if (!client_tuner || !client_tuner->dev.driver) { |
---|
| 657 | + client_tuner = i2c_new_client_device(&dev->i2c_bus[0].i2c_adap, &info); |
---|
| 658 | + if (!i2c_client_has_driver(client_tuner)) { |
---|
673 | 659 | module_put(client_demod->dev.driver->owner); |
---|
674 | 660 | i2c_unregister_device(client_demod); |
---|
675 | 661 | goto frontend_detach; |
---|
.. | .. |
---|
688 | 674 | si2168_config.fe = &port->dvb.frontend; |
---|
689 | 675 | si2168_config.ts_mode = SI2168_TS_SERIAL; |
---|
690 | 676 | memset(&info, 0, sizeof(struct i2c_board_info)); |
---|
691 | | - strlcpy(info.type, "si2168", I2C_NAME_SIZE); |
---|
| 677 | + strscpy(info.type, "si2168", I2C_NAME_SIZE); |
---|
692 | 678 | info.addr = 0xcc >> 1; |
---|
693 | 679 | info.platform_data = &si2168_config; |
---|
694 | 680 | request_module(info.type); |
---|
695 | | - client_demod = i2c_new_device(&dev->i2c_bus[2].i2c_adap, |
---|
696 | | - &info); |
---|
697 | | - if (!client_demod || !client_demod->dev.driver) |
---|
| 681 | + client_demod = i2c_new_client_device(&dev->i2c_bus[2].i2c_adap, &info); |
---|
| 682 | + if (!i2c_client_has_driver(client_demod)) |
---|
698 | 683 | goto frontend_detach; |
---|
699 | 684 | |
---|
700 | 685 | if (!try_module_get(client_demod->dev.driver->owner)) { |
---|
.. | .. |
---|
708 | 693 | si2157_config.fe = port->dvb.frontend; |
---|
709 | 694 | si2157_config.if_port = 1; |
---|
710 | 695 | memset(&info, 0, sizeof(struct i2c_board_info)); |
---|
711 | | - strlcpy(info.type, "si2157", I2C_NAME_SIZE); |
---|
| 696 | + strscpy(info.type, "si2157", I2C_NAME_SIZE); |
---|
712 | 697 | info.addr = 0xc0 >> 1; |
---|
713 | 698 | info.platform_data = &si2157_config; |
---|
714 | 699 | request_module(info.type); |
---|
715 | | - client_tuner = i2c_new_device(&dev->i2c_bus[1].i2c_adap, |
---|
716 | | - &info); |
---|
717 | | - if (!client_tuner || !client_tuner->dev.driver) { |
---|
| 700 | + client_tuner = i2c_new_client_device(&dev->i2c_bus[1].i2c_adap, &info); |
---|
| 701 | + if (!i2c_client_has_driver(client_tuner)) { |
---|
718 | 702 | module_put(client_demod->dev.driver->owner); |
---|
719 | 703 | i2c_unregister_device(client_demod); |
---|
720 | 704 | goto frontend_detach; |
---|
.. | .. |
---|
754 | 738 | printk(KERN_ERR "%s() Frontend/I2C initialization failed\n", __func__); |
---|
755 | 739 | return -1; |
---|
756 | 740 | } |
---|
757 | | - |
---|