.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * |
---|
3 | 4 | * Device driver for GPIO attached remote control interfaces |
---|
.. | .. |
---|
6 | 7 | * Copyright (c) 2003 Pavel Machek |
---|
7 | 8 | * Copyright (c) 2004 Gerd Knorr |
---|
8 | 9 | * Copyright (c) 2004, 2005 Chris Pascoe |
---|
9 | | - * |
---|
10 | | - * This program is free software; you can redistribute it and/or modify |
---|
11 | | - * it under the terms of the GNU General Public License as published by |
---|
12 | | - * the Free Software Foundation; either version 2 of the License, or |
---|
13 | | - * (at your option) any later version. |
---|
14 | | - * |
---|
15 | | - * This program is distributed in the hope that it will be useful, |
---|
16 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
17 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
18 | | - * GNU General Public License for more details. |
---|
19 | 10 | */ |
---|
20 | 11 | |
---|
21 | 12 | #include "cx88.h" |
---|
.. | .. |
---|
176 | 167 | |
---|
177 | 168 | static enum hrtimer_restart cx88_ir_work(struct hrtimer *timer) |
---|
178 | 169 | { |
---|
179 | | - unsigned long missed; |
---|
| 170 | + u64 missed; |
---|
180 | 171 | struct cx88_IR *ir = container_of(timer, struct cx88_IR, timer); |
---|
181 | 172 | |
---|
182 | 173 | cx88_ir_handle_key(ir); |
---|
183 | 174 | missed = hrtimer_forward_now(&ir->timer, |
---|
184 | 175 | ktime_set(0, ir->polling * 1000000)); |
---|
185 | 176 | if (missed > 1) |
---|
186 | | - ir_dprintk("Missed ticks %ld\n", missed - 1); |
---|
| 177 | + ir_dprintk("Missed ticks %llu\n", missed - 1); |
---|
187 | 178 | |
---|
188 | 179 | return HRTIMER_RESTART; |
---|
189 | 180 | } |
---|
.. | .. |
---|
488 | 479 | dev->scancode_mask = hardware_mask; |
---|
489 | 480 | |
---|
490 | 481 | if (ir->sampling) { |
---|
491 | | - dev->timeout = 10 * 1000 * 1000; /* 10 ms */ |
---|
| 482 | + dev->timeout = MS_TO_US(10); /* 10 ms */ |
---|
492 | 483 | } else { |
---|
493 | 484 | dev->driver_type = RC_DRIVER_SCANCODE; |
---|
494 | 485 | dev->allowed_protocols = rc_proto; |
---|
.. | .. |
---|
535 | 526 | struct cx88_IR *ir = core->ir; |
---|
536 | 527 | u32 samples; |
---|
537 | 528 | unsigned int todo, bits; |
---|
538 | | - struct ir_raw_event ev; |
---|
| 529 | + struct ir_raw_event ev = {}; |
---|
539 | 530 | |
---|
540 | 531 | if (!ir || !ir->sampling) |
---|
541 | 532 | return; |
---|
.. | .. |
---|
550 | 541 | if (samples == 0xff && ir->dev->idle) |
---|
551 | 542 | return; |
---|
552 | 543 | |
---|
553 | | - init_ir_raw_event(&ev); |
---|
554 | 544 | for (todo = 32; todo > 0; todo -= bits) { |
---|
555 | 545 | ev.pulse = samples & 0x80000000 ? false : true; |
---|
556 | 546 | bits = min(todo, 32U - fls(ev.pulse ? samples : ~samples)); |
---|
557 | | - ev.duration = (bits * (NSEC_PER_SEC / 1000)) / ir_samplerate; |
---|
| 547 | + ev.duration = (bits * (USEC_PER_SEC / 1000)) / ir_samplerate; |
---|
558 | 548 | ir_raw_event_store_with_filter(ir->dev, &ev); |
---|
559 | 549 | samples <<= bits; |
---|
560 | 550 | } |
---|
.. | .. |
---|
610 | 600 | return; |
---|
611 | 601 | |
---|
612 | 602 | memset(&info, 0, sizeof(struct i2c_board_info)); |
---|
613 | | - strlcpy(info.type, "ir_video", I2C_NAME_SIZE); |
---|
| 603 | + strscpy(info.type, "ir_video", I2C_NAME_SIZE); |
---|
614 | 604 | |
---|
615 | 605 | switch (core->boardnr) { |
---|
616 | 606 | case CX88_BOARD_LEADTEK_PVR2000: |
---|
.. | .. |
---|
623 | 613 | } |
---|
624 | 614 | |
---|
625 | 615 | /* |
---|
626 | | - * We can't call i2c_new_probed_device() because it uses |
---|
| 616 | + * We can't call i2c_new_scanned_device() because it uses |
---|
627 | 617 | * quick writes for probing and at least some RC receiver |
---|
628 | 618 | * devices only reply to reads. |
---|
629 | 619 | * Also, Hauppauge XVR needs to be specified, as address 0x71 |
---|
.. | .. |
---|
635 | 625 | |
---|
636 | 626 | if (*addrp == 0x71) { |
---|
637 | 627 | /* Hauppauge Z8F0811 */ |
---|
638 | | - strlcpy(info.type, "ir_z8f0811_haup", I2C_NAME_SIZE); |
---|
| 628 | + strscpy(info.type, "ir_z8f0811_haup", I2C_NAME_SIZE); |
---|
639 | 629 | core->init_data.name = core->board.name; |
---|
640 | 630 | core->init_data.ir_codes = RC_MAP_HAUPPAUGE; |
---|
641 | 631 | core->init_data.type = RC_PROTO_BIT_RC5 | |
---|
.. | .. |
---|
648 | 638 | I2C_SMBUS_READ, 0, |
---|
649 | 639 | I2C_SMBUS_QUICK, NULL) >= 0) { |
---|
650 | 640 | info.addr = *addrp; |
---|
651 | | - i2c_new_device(&core->i2c_adap, &info); |
---|
| 641 | + i2c_new_client_device(&core->i2c_adap, &info); |
---|
652 | 642 | break; |
---|
653 | 643 | } |
---|
654 | 644 | } |
---|