hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/media/rc/rc-loopback.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Loopback driver for rc-core,
34 *
....@@ -6,17 +7,6 @@
67 * This driver receives TX data and passes it back as RX data,
78 * which is useful for (scripted) debugging of rc-core without
89 * having to use actual hardware.
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
- *
2010 */
2111
2212 #include <linux/device.h>
....@@ -103,7 +93,7 @@
10393 struct loopback_dev *lodev = dev->priv;
10494 u32 rxmask;
10595 unsigned i;
106
- DEFINE_IR_RAW_EVENT(rawir);
96
+ struct ir_raw_event rawir = {};
10797
10898 if (lodev->txcarrier < lodev->rxcarriermin ||
10999 lodev->txcarrier > lodev->rxcarriermax) {
....@@ -123,7 +113,7 @@
123113
124114 for (i = 0; i < count; i++) {
125115 rawir.pulse = i % 2 ? false : true;
126
- rawir.duration = txbuf[i] * 1000;
116
+ rawir.duration = txbuf[i];
127117 if (rawir.duration)
128118 ir_raw_event_store_with_filter(dev, &rawir);
129119 }
....@@ -229,11 +219,11 @@
229219 rc->allowed_protocols = RC_PROTO_BIT_ALL_IR_DECODER;
230220 rc->allowed_wakeup_protocols = RC_PROTO_BIT_ALL_IR_ENCODER;
231221 rc->encode_wakeup = true;
232
- rc->timeout = 100 * 1000 * 1000; /* 100 ms */
222
+ rc->timeout = MS_TO_US(100); /* 100 ms */
233223 rc->min_timeout = 1;
234224 rc->max_timeout = UINT_MAX;
235
- rc->rx_resolution = 1000;
236
- rc->tx_resolution = 1000;
225
+ rc->rx_resolution = 1;
226
+ rc->tx_resolution = 1;
237227 rc->s_tx_mask = loop_set_tx_mask;
238228 rc->s_tx_carrier = loop_set_tx_carrier;
239229 rc->s_tx_duty_cycle = loop_set_tx_duty_cycle;