| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * |
|---|
| 3 | 4 | * Copyright (c) 2003 Gerd Knorr |
|---|
| 4 | 5 | * 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. |
|---|
| 15 | 6 | */ |
|---|
| 16 | 7 | |
|---|
| 17 | 8 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
|---|
| .. | .. |
|---|
| 93 | 84 | data = ir_extract_bits(gpio, ir->mask_keycode); |
|---|
| 94 | 85 | |
|---|
| 95 | 86 | /* Check if it is keyup */ |
|---|
| 96 | | - keyup = (gpio & ir->mask_keyup) ? 1 << 31 : 0; |
|---|
| 87 | + keyup = (gpio & ir->mask_keyup) ? 1UL << 31 : 0; |
|---|
| 97 | 88 | |
|---|
| 98 | 89 | if ((ir->last_gpio & 0x7f) != data) { |
|---|
| 99 | 90 | dprintk("gpio=0x%x code=%d | %s\n", |
|---|
| .. | .. |
|---|
| 104 | 95 | if (keyup) |
|---|
| 105 | 96 | rc_keyup(ir->dev); |
|---|
| 106 | 97 | } else { |
|---|
| 107 | | - if ((ir->last_gpio & 1 << 31) == keyup) |
|---|
| 98 | + if ((ir->last_gpio & 1UL << 31) == keyup) |
|---|
| 108 | 99 | return; |
|---|
| 109 | 100 | |
|---|
| 110 | 101 | dprintk("(cnt) gpio=0x%x code=%d | %s\n", |
|---|
| .. | .. |
|---|
| 370 | 361 | /* Instantiate the I2C IR receiver device, if present */ |
|---|
| 371 | 362 | void init_bttv_i2c_ir(struct bttv *btv) |
|---|
| 372 | 363 | { |
|---|
| 373 | | - const unsigned short addr_list[] = { |
|---|
| 364 | + static const unsigned short addr_list[] = { |
|---|
| 374 | 365 | 0x1a, 0x18, 0x64, 0x30, 0x71, |
|---|
| 375 | 366 | I2C_CLIENT_END |
|---|
| 376 | 367 | }; |
|---|
| .. | .. |
|---|
| 382 | 373 | |
|---|
| 383 | 374 | memset(&info, 0, sizeof(struct i2c_board_info)); |
|---|
| 384 | 375 | 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); |
|---|
| 386 | 377 | |
|---|
| 387 | 378 | switch (btv->c.type) { |
|---|
| 388 | 379 | case BTTV_BOARD_PV951: |
|---|
| .. | .. |
|---|
| 395 | 386 | |
|---|
| 396 | 387 | if (btv->init_data.name) { |
|---|
| 397 | 388 | 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); |
|---|
| 399 | 390 | } else { |
|---|
| 400 | 391 | /* |
|---|
| 401 | 392 | * The external IR receiver is at i2c address 0x34 (0x35 for |
|---|
| .. | .. |
|---|
| 405 | 396 | * internal. |
|---|
| 406 | 397 | * That's why we probe 0x1a (~0x34) first. CB |
|---|
| 407 | 398 | */ |
|---|
| 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); |
|---|
| 409 | 400 | } |
|---|
| 410 | | - if (NULL == i2c_dev) |
|---|
| 401 | + if (IS_ERR(i2c_dev)) |
|---|
| 411 | 402 | return; |
|---|
| 412 | 403 | |
|---|
| 413 | 404 | #if defined(CONFIG_MODULES) && defined(MODULE) |
|---|