| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * SMI PCIe driver for DVBSky cards. |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2014 Max nibble <nibble.max@gmail.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 | | - * GNU General Public License for more details. |
|---|
| 15 | 6 | */ |
|---|
| 16 | 7 | |
|---|
| 17 | 8 | #include "smipcie.h" |
|---|
| .. | .. |
|---|
| 191 | 182 | /* i2c bus 0 */ |
|---|
| 192 | 183 | smi_i2c_cfg(dev, I2C_A_SW_CTL); |
|---|
| 193 | 184 | i2c_set_adapdata(&dev->i2c_bus[0], dev); |
|---|
| 194 | | - strcpy(dev->i2c_bus[0].name, "SMI-I2C0"); |
|---|
| 185 | + strscpy(dev->i2c_bus[0].name, "SMI-I2C0", sizeof(dev->i2c_bus[0].name)); |
|---|
| 195 | 186 | dev->i2c_bus[0].owner = THIS_MODULE; |
|---|
| 196 | 187 | dev->i2c_bus[0].dev.parent = &dev->pci_dev->dev; |
|---|
| 197 | 188 | dev->i2c_bus[0].algo_data = &dev->i2c_bit[0]; |
|---|
| .. | .. |
|---|
| 213 | 204 | /* i2c bus 1 */ |
|---|
| 214 | 205 | smi_i2c_cfg(dev, I2C_B_SW_CTL); |
|---|
| 215 | 206 | i2c_set_adapdata(&dev->i2c_bus[1], dev); |
|---|
| 216 | | - strcpy(dev->i2c_bus[1].name, "SMI-I2C1"); |
|---|
| 207 | + strscpy(dev->i2c_bus[1].name, "SMI-I2C1", sizeof(dev->i2c_bus[1].name)); |
|---|
| 217 | 208 | dev->i2c_bus[1].owner = THIS_MODULE; |
|---|
| 218 | 209 | dev->i2c_bus[1].dev.parent = &dev->pci_dev->dev; |
|---|
| 219 | 210 | dev->i2c_bus[1].algo_data = &dev->i2c_bit[1]; |
|---|
| .. | .. |
|---|
| 289 | 280 | } |
|---|
| 290 | 281 | |
|---|
| 291 | 282 | /* tasklet handler: DMA data to dmx.*/ |
|---|
| 292 | | -static void smi_dma_xfer(unsigned long data) |
|---|
| 283 | +static void smi_dma_xfer(struct tasklet_struct *t) |
|---|
| 293 | 284 | { |
|---|
| 294 | | - struct smi_port *port = (struct smi_port *) data; |
|---|
| 285 | + struct smi_port *port = from_tasklet(port, t, tasklet); |
|---|
| 295 | 286 | struct smi_dev *dev = port->dev; |
|---|
| 296 | 287 | u32 intr_status, finishedData, dmaManagement; |
|---|
| 297 | 288 | u8 dmaChan0State, dmaChan1State; |
|---|
| .. | .. |
|---|
| 431 | 422 | } |
|---|
| 432 | 423 | |
|---|
| 433 | 424 | smi_port_disableInterrupt(port); |
|---|
| 434 | | - tasklet_init(&port->tasklet, smi_dma_xfer, (unsigned long)port); |
|---|
| 425 | + tasklet_setup(&port->tasklet, smi_dma_xfer); |
|---|
| 435 | 426 | tasklet_disable(&port->tasklet); |
|---|
| 436 | 427 | port->enable = 1; |
|---|
| 437 | 428 | return 0; |
|---|
| .. | .. |
|---|
| 493 | 484 | struct i2c_client *client; |
|---|
| 494 | 485 | |
|---|
| 495 | 486 | request_module(info->type); |
|---|
| 496 | | - client = i2c_new_device(adapter, info); |
|---|
| 497 | | - if (client == NULL || client->dev.driver == NULL) |
|---|
| 487 | + client = i2c_new_client_device(adapter, info); |
|---|
| 488 | + if (!i2c_client_has_driver(client)) |
|---|
| 498 | 489 | goto err_add_i2c_client; |
|---|
| 499 | 490 | |
|---|
| 500 | 491 | if (!try_module_get(client->dev.driver->owner)) { |
|---|
| .. | .. |
|---|
| 549 | 540 | } |
|---|
| 550 | 541 | /* attach tuner */ |
|---|
| 551 | 542 | ts2020_config.fe = port->fe; |
|---|
| 552 | | - strlcpy(tuner_info.type, "ts2020", I2C_NAME_SIZE); |
|---|
| 543 | + strscpy(tuner_info.type, "ts2020", I2C_NAME_SIZE); |
|---|
| 553 | 544 | tuner_info.addr = 0x60; |
|---|
| 554 | 545 | tuner_info.platform_data = &ts2020_config; |
|---|
| 555 | 546 | tuner_client = smi_add_i2c_client(tuner_i2c_adapter, &tuner_info); |
|---|
| .. | .. |
|---|
| 605 | 596 | } |
|---|
| 606 | 597 | /* attach tuner */ |
|---|
| 607 | 598 | m88rs6000t_config.fe = port->fe; |
|---|
| 608 | | - strlcpy(tuner_info.type, "m88rs6000t", I2C_NAME_SIZE); |
|---|
| 599 | + strscpy(tuner_info.type, "m88rs6000t", I2C_NAME_SIZE); |
|---|
| 609 | 600 | tuner_info.addr = 0x21; |
|---|
| 610 | 601 | tuner_info.platform_data = &m88rs6000t_config; |
|---|
| 611 | 602 | tuner_client = smi_add_i2c_client(tuner_i2c_adapter, &tuner_info); |
|---|
| .. | .. |
|---|
| 647 | 638 | si2168_config.ts_mode = SI2168_TS_PARALLEL; |
|---|
| 648 | 639 | |
|---|
| 649 | 640 | memset(&client_info, 0, sizeof(struct i2c_board_info)); |
|---|
| 650 | | - strlcpy(client_info.type, "si2168", I2C_NAME_SIZE); |
|---|
| 641 | + strscpy(client_info.type, "si2168", I2C_NAME_SIZE); |
|---|
| 651 | 642 | client_info.addr = 0x64; |
|---|
| 652 | 643 | client_info.platform_data = &si2168_config; |
|---|
| 653 | 644 | |
|---|
| .. | .. |
|---|
| 664 | 655 | si2157_config.if_port = 1; |
|---|
| 665 | 656 | |
|---|
| 666 | 657 | memset(&client_info, 0, sizeof(struct i2c_board_info)); |
|---|
| 667 | | - strlcpy(client_info.type, "si2157", I2C_NAME_SIZE); |
|---|
| 658 | + strscpy(client_info.type, "si2157", I2C_NAME_SIZE); |
|---|
| 668 | 659 | client_info.addr = 0x60; |
|---|
| 669 | 660 | client_info.platform_data = &si2157_config; |
|---|
| 670 | 661 | |
|---|