forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/drivers/media/pci/cx88/cx88-input.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 *
34 * Device driver for GPIO attached remote control interfaces
....@@ -6,16 +7,6 @@
67 * Copyright (c) 2003 Pavel Machek
78 * Copyright (c) 2004 Gerd Knorr
89 * 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.
1910 */
2011
2112 #include "cx88.h"
....@@ -176,14 +167,14 @@
176167
177168 static enum hrtimer_restart cx88_ir_work(struct hrtimer *timer)
178169 {
179
- unsigned long missed;
170
+ u64 missed;
180171 struct cx88_IR *ir = container_of(timer, struct cx88_IR, timer);
181172
182173 cx88_ir_handle_key(ir);
183174 missed = hrtimer_forward_now(&ir->timer,
184175 ktime_set(0, ir->polling * 1000000));
185176 if (missed > 1)
186
- ir_dprintk("Missed ticks %ld\n", missed - 1);
177
+ ir_dprintk("Missed ticks %llu\n", missed - 1);
187178
188179 return HRTIMER_RESTART;
189180 }
....@@ -488,7 +479,7 @@
488479 dev->scancode_mask = hardware_mask;
489480
490481 if (ir->sampling) {
491
- dev->timeout = 10 * 1000 * 1000; /* 10 ms */
482
+ dev->timeout = MS_TO_US(10); /* 10 ms */
492483 } else {
493484 dev->driver_type = RC_DRIVER_SCANCODE;
494485 dev->allowed_protocols = rc_proto;
....@@ -535,7 +526,7 @@
535526 struct cx88_IR *ir = core->ir;
536527 u32 samples;
537528 unsigned int todo, bits;
538
- struct ir_raw_event ev;
529
+ struct ir_raw_event ev = {};
539530
540531 if (!ir || !ir->sampling)
541532 return;
....@@ -550,11 +541,10 @@
550541 if (samples == 0xff && ir->dev->idle)
551542 return;
552543
553
- init_ir_raw_event(&ev);
554544 for (todo = 32; todo > 0; todo -= bits) {
555545 ev.pulse = samples & 0x80000000 ? false : true;
556546 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;
558548 ir_raw_event_store_with_filter(ir->dev, &ev);
559549 samples <<= bits;
560550 }
....@@ -610,7 +600,7 @@
610600 return;
611601
612602 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);
614604
615605 switch (core->boardnr) {
616606 case CX88_BOARD_LEADTEK_PVR2000:
....@@ -623,7 +613,7 @@
623613 }
624614
625615 /*
626
- * We can't call i2c_new_probed_device() because it uses
616
+ * We can't call i2c_new_scanned_device() because it uses
627617 * quick writes for probing and at least some RC receiver
628618 * devices only reply to reads.
629619 * Also, Hauppauge XVR needs to be specified, as address 0x71
....@@ -635,7 +625,7 @@
635625
636626 if (*addrp == 0x71) {
637627 /* Hauppauge Z8F0811 */
638
- strlcpy(info.type, "ir_z8f0811_haup", I2C_NAME_SIZE);
628
+ strscpy(info.type, "ir_z8f0811_haup", I2C_NAME_SIZE);
639629 core->init_data.name = core->board.name;
640630 core->init_data.ir_codes = RC_MAP_HAUPPAUGE;
641631 core->init_data.type = RC_PROTO_BIT_RC5 |
....@@ -648,7 +638,7 @@
648638 I2C_SMBUS_READ, 0,
649639 I2C_SMBUS_QUICK, NULL) >= 0) {
650640 info.addr = *addrp;
651
- i2c_new_device(&core->i2c_adap, &info);
641
+ i2c_new_client_device(&core->i2c_adap, &info);
652642 break;
653643 }
654644 }