forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/drivers/media/pci/bt8xx/bttv-input.c
....@@ -1,17 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 *
34 * Copyright (c) 2003 Gerd Knorr
45 * Copyright (c) 2003 Pavel Machek
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 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
....@@ -93,7 +84,7 @@
9384 data = ir_extract_bits(gpio, ir->mask_keycode);
9485
9586 /* Check if it is keyup */
96
- keyup = (gpio & ir->mask_keyup) ? 1 << 31 : 0;
87
+ keyup = (gpio & ir->mask_keyup) ? 1UL << 31 : 0;
9788
9889 if ((ir->last_gpio & 0x7f) != data) {
9990 dprintk("gpio=0x%x code=%d | %s\n",
....@@ -104,7 +95,7 @@
10495 if (keyup)
10596 rc_keyup(ir->dev);
10697 } else {
107
- if ((ir->last_gpio & 1 << 31) == keyup)
98
+ if ((ir->last_gpio & 1UL << 31) == keyup)
10899 return;
109100
110101 dprintk("(cnt) gpio=0x%x code=%d | %s\n",
....@@ -370,7 +361,7 @@
370361 /* Instantiate the I2C IR receiver device, if present */
371362 void init_bttv_i2c_ir(struct bttv *btv)
372363 {
373
- const unsigned short addr_list[] = {
364
+ static const unsigned short addr_list[] = {
374365 0x1a, 0x18, 0x64, 0x30, 0x71,
375366 I2C_CLIENT_END
376367 };
....@@ -382,7 +373,7 @@
382373
383374 memset(&info, 0, sizeof(struct i2c_board_info));
384375 memset(&btv->init_data, 0, sizeof(btv->init_data));
385
- strlcpy(info.type, "ir_video", I2C_NAME_SIZE);
376
+ strscpy(info.type, "ir_video", I2C_NAME_SIZE);
386377
387378 switch (btv->c.type) {
388379 case BTTV_BOARD_PV951:
....@@ -395,7 +386,7 @@
395386
396387 if (btv->init_data.name) {
397388 info.platform_data = &btv->init_data;
398
- i2c_dev = i2c_new_device(&btv->c.i2c_adap, &info);
389
+ i2c_dev = i2c_new_client_device(&btv->c.i2c_adap, &info);
399390 } else {
400391 /*
401392 * The external IR receiver is at i2c address 0x34 (0x35 for
....@@ -405,9 +396,9 @@
405396 * internal.
406397 * That's why we probe 0x1a (~0x34) first. CB
407398 */
408
- i2c_dev = i2c_new_probed_device(&btv->c.i2c_adap, &info, addr_list, NULL);
399
+ i2c_dev = i2c_new_scanned_device(&btv->c.i2c_adap, &info, addr_list, NULL);
409400 }
410
- if (NULL == i2c_dev)
401
+ if (IS_ERR(i2c_dev))
411402 return;
412403
413404 #if defined(CONFIG_MODULES) && defined(MODULE)