forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/drivers/media/pci/smipcie/smipcie-main.c
....@@ -1,17 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * SMI PCIe driver for DVBSky cards.
34 *
45 * 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.
156 */
167
178 #include "smipcie.h"
....@@ -191,7 +182,7 @@
191182 /* i2c bus 0 */
192183 smi_i2c_cfg(dev, I2C_A_SW_CTL);
193184 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));
195186 dev->i2c_bus[0].owner = THIS_MODULE;
196187 dev->i2c_bus[0].dev.parent = &dev->pci_dev->dev;
197188 dev->i2c_bus[0].algo_data = &dev->i2c_bit[0];
....@@ -213,7 +204,7 @@
213204 /* i2c bus 1 */
214205 smi_i2c_cfg(dev, I2C_B_SW_CTL);
215206 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));
217208 dev->i2c_bus[1].owner = THIS_MODULE;
218209 dev->i2c_bus[1].dev.parent = &dev->pci_dev->dev;
219210 dev->i2c_bus[1].algo_data = &dev->i2c_bit[1];
....@@ -289,9 +280,9 @@
289280 }
290281
291282 /* 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)
293284 {
294
- struct smi_port *port = (struct smi_port *) data;
285
+ struct smi_port *port = from_tasklet(port, t, tasklet);
295286 struct smi_dev *dev = port->dev;
296287 u32 intr_status, finishedData, dmaManagement;
297288 u8 dmaChan0State, dmaChan1State;
....@@ -431,7 +422,7 @@
431422 }
432423
433424 smi_port_disableInterrupt(port);
434
- tasklet_init(&port->tasklet, smi_dma_xfer, (unsigned long)port);
425
+ tasklet_setup(&port->tasklet, smi_dma_xfer);
435426 tasklet_disable(&port->tasklet);
436427 port->enable = 1;
437428 return 0;
....@@ -493,8 +484,8 @@
493484 struct i2c_client *client;
494485
495486 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))
498489 goto err_add_i2c_client;
499490
500491 if (!try_module_get(client->dev.driver->owner)) {
....@@ -549,7 +540,7 @@
549540 }
550541 /* attach tuner */
551542 ts2020_config.fe = port->fe;
552
- strlcpy(tuner_info.type, "ts2020", I2C_NAME_SIZE);
543
+ strscpy(tuner_info.type, "ts2020", I2C_NAME_SIZE);
553544 tuner_info.addr = 0x60;
554545 tuner_info.platform_data = &ts2020_config;
555546 tuner_client = smi_add_i2c_client(tuner_i2c_adapter, &tuner_info);
....@@ -605,7 +596,7 @@
605596 }
606597 /* attach tuner */
607598 m88rs6000t_config.fe = port->fe;
608
- strlcpy(tuner_info.type, "m88rs6000t", I2C_NAME_SIZE);
599
+ strscpy(tuner_info.type, "m88rs6000t", I2C_NAME_SIZE);
609600 tuner_info.addr = 0x21;
610601 tuner_info.platform_data = &m88rs6000t_config;
611602 tuner_client = smi_add_i2c_client(tuner_i2c_adapter, &tuner_info);
....@@ -647,7 +638,7 @@
647638 si2168_config.ts_mode = SI2168_TS_PARALLEL;
648639
649640 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);
651642 client_info.addr = 0x64;
652643 client_info.platform_data = &si2168_config;
653644
....@@ -664,7 +655,7 @@
664655 si2157_config.if_port = 1;
665656
666657 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);
668659 client_info.addr = 0x60;
669660 client_info.platform_data = &si2157_config;
670661