hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/media/rc/streamzap.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Streamzap Remote Control driver
34 *
....@@ -15,16 +16,6 @@
1516 *
1617 * This driver is based on the USB skeleton driver packaged with the
1718 * kernel; copyright (C) 2001-2003 Greg Kroah-Hartman (greg@kroah.com)
18
- *
19
- * This program is free software; you can redistribute it and/or modify
20
- * it under the terms of the GNU General Public License as published by
21
- * the Free Software Foundation; either version 2 of the License, or
22
- * (at your option) any later version.
23
- *
24
- * This program is distributed in the hope that it will be useful,
25
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
26
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27
- * GNU General Public License for more details.
2819 */
2920
3021 #include <linux/device.h>
....@@ -130,7 +121,7 @@
130121 static void sz_push_full_pulse(struct streamzap_ir *sz,
131122 unsigned char value)
132123 {
133
- DEFINE_IR_RAW_EVENT(rawir);
124
+ struct ir_raw_event rawir = {};
134125
135126 if (sz->idle) {
136127 int delta;
....@@ -146,7 +137,6 @@
146137 } else {
147138 rawir.duration = delta;
148139 rawir.duration -= sz->sum;
149
- rawir.duration = US_TO_NS(rawir.duration);
150140 rawir.duration = (rawir.duration > IR_MAX_DURATION) ?
151141 IR_MAX_DURATION : rawir.duration;
152142 }
....@@ -160,7 +150,6 @@
160150 rawir.duration = ((int) value) * SZ_RESOLUTION;
161151 rawir.duration += SZ_RESOLUTION / 2;
162152 sz->sum += rawir.duration;
163
- rawir.duration = US_TO_NS(rawir.duration);
164153 rawir.duration = (rawir.duration > IR_MAX_DURATION) ?
165154 IR_MAX_DURATION : rawir.duration;
166155 sz_push(sz, rawir);
....@@ -175,13 +164,12 @@
175164 static void sz_push_full_space(struct streamzap_ir *sz,
176165 unsigned char value)
177166 {
178
- DEFINE_IR_RAW_EVENT(rawir);
167
+ struct ir_raw_event rawir = {};
179168
180169 rawir.pulse = false;
181170 rawir.duration = ((int) value) * SZ_RESOLUTION;
182171 rawir.duration += SZ_RESOLUTION / 2;
183172 sz->sum += rawir.duration;
184
- rawir.duration = US_TO_NS(rawir.duration);
185173 sz_push(sz, rawir);
186174 }
187175
....@@ -249,10 +237,10 @@
249237 break;
250238 case FullSpace:
251239 if (sz->buf_in[i] == SZ_TIMEOUT) {
252
- DEFINE_IR_RAW_EVENT(rawir);
253
-
254
- rawir.pulse = false;
255
- rawir.duration = sz->rdev->timeout;
240
+ struct ir_raw_event rawir = {
241
+ .pulse = false,
242
+ .duration = sz->rdev->timeout
243
+ };
256244 sz->idle = true;
257245 if (sz->timeout_enabled)
258246 sz_push(sz, rawir);
....@@ -396,7 +384,7 @@
396384 if (usbdev->descriptor.iManufacturer
397385 && usb_string(usbdev, usbdev->descriptor.iManufacturer,
398386 buf, sizeof(buf)) > 0)
399
- strlcpy(name, buf, sizeof(name));
387
+ strscpy(name, buf, sizeof(name));
400388
401389 if (usbdev->descriptor.iProduct
402390 && usb_string(usbdev, usbdev->descriptor.iProduct,
....@@ -412,13 +400,12 @@
412400 sz->decoder_state = PulseSpace;
413401 /* FIXME: don't yet have a way to set this */
414402 sz->timeout_enabled = true;
415
- sz->rdev->timeout = ((US_TO_NS(SZ_TIMEOUT * SZ_RESOLUTION) &
416
- IR_MAX_DURATION) | 0x03000000);
403
+ sz->rdev->timeout = SZ_TIMEOUT * SZ_RESOLUTION;
417404 #if 0
418405 /* not yet supported, depends on patches from maxim */
419406 /* see also: LIRC_GET_REC_RESOLUTION and LIRC_SET_REC_TIMEOUT */
420
- sz->min_timeout = US_TO_NS(SZ_TIMEOUT * SZ_RESOLUTION);
421
- sz->max_timeout = US_TO_NS(SZ_TIMEOUT * SZ_RESOLUTION);
407
+ sz->min_timeout = SZ_TIMEOUT * SZ_RESOLUTION;
408
+ sz->max_timeout = SZ_TIMEOUT * SZ_RESOLUTION;
422409 #endif
423410
424411 sz->signal_start = ktime_get_real();