| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Streamzap Remote Control driver |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 15 | 16 | * |
|---|
| 16 | 17 | * This driver is based on the USB skeleton driver packaged with the |
|---|
| 17 | 18 | * 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. |
|---|
| 28 | 19 | */ |
|---|
| 29 | 20 | |
|---|
| 30 | 21 | #include <linux/device.h> |
|---|
| .. | .. |
|---|
| 130 | 121 | static void sz_push_full_pulse(struct streamzap_ir *sz, |
|---|
| 131 | 122 | unsigned char value) |
|---|
| 132 | 123 | { |
|---|
| 133 | | - DEFINE_IR_RAW_EVENT(rawir); |
|---|
| 124 | + struct ir_raw_event rawir = {}; |
|---|
| 134 | 125 | |
|---|
| 135 | 126 | if (sz->idle) { |
|---|
| 136 | 127 | int delta; |
|---|
| .. | .. |
|---|
| 146 | 137 | } else { |
|---|
| 147 | 138 | rawir.duration = delta; |
|---|
| 148 | 139 | rawir.duration -= sz->sum; |
|---|
| 149 | | - rawir.duration = US_TO_NS(rawir.duration); |
|---|
| 150 | 140 | rawir.duration = (rawir.duration > IR_MAX_DURATION) ? |
|---|
| 151 | 141 | IR_MAX_DURATION : rawir.duration; |
|---|
| 152 | 142 | } |
|---|
| .. | .. |
|---|
| 160 | 150 | rawir.duration = ((int) value) * SZ_RESOLUTION; |
|---|
| 161 | 151 | rawir.duration += SZ_RESOLUTION / 2; |
|---|
| 162 | 152 | sz->sum += rawir.duration; |
|---|
| 163 | | - rawir.duration = US_TO_NS(rawir.duration); |
|---|
| 164 | 153 | rawir.duration = (rawir.duration > IR_MAX_DURATION) ? |
|---|
| 165 | 154 | IR_MAX_DURATION : rawir.duration; |
|---|
| 166 | 155 | sz_push(sz, rawir); |
|---|
| .. | .. |
|---|
| 175 | 164 | static void sz_push_full_space(struct streamzap_ir *sz, |
|---|
| 176 | 165 | unsigned char value) |
|---|
| 177 | 166 | { |
|---|
| 178 | | - DEFINE_IR_RAW_EVENT(rawir); |
|---|
| 167 | + struct ir_raw_event rawir = {}; |
|---|
| 179 | 168 | |
|---|
| 180 | 169 | rawir.pulse = false; |
|---|
| 181 | 170 | rawir.duration = ((int) value) * SZ_RESOLUTION; |
|---|
| 182 | 171 | rawir.duration += SZ_RESOLUTION / 2; |
|---|
| 183 | 172 | sz->sum += rawir.duration; |
|---|
| 184 | | - rawir.duration = US_TO_NS(rawir.duration); |
|---|
| 185 | 173 | sz_push(sz, rawir); |
|---|
| 186 | 174 | } |
|---|
| 187 | 175 | |
|---|
| .. | .. |
|---|
| 249 | 237 | break; |
|---|
| 250 | 238 | case FullSpace: |
|---|
| 251 | 239 | 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 | + }; |
|---|
| 256 | 244 | sz->idle = true; |
|---|
| 257 | 245 | if (sz->timeout_enabled) |
|---|
| 258 | 246 | sz_push(sz, rawir); |
|---|
| .. | .. |
|---|
| 396 | 384 | if (usbdev->descriptor.iManufacturer |
|---|
| 397 | 385 | && usb_string(usbdev, usbdev->descriptor.iManufacturer, |
|---|
| 398 | 386 | buf, sizeof(buf)) > 0) |
|---|
| 399 | | - strlcpy(name, buf, sizeof(name)); |
|---|
| 387 | + strscpy(name, buf, sizeof(name)); |
|---|
| 400 | 388 | |
|---|
| 401 | 389 | if (usbdev->descriptor.iProduct |
|---|
| 402 | 390 | && usb_string(usbdev, usbdev->descriptor.iProduct, |
|---|
| .. | .. |
|---|
| 412 | 400 | sz->decoder_state = PulseSpace; |
|---|
| 413 | 401 | /* FIXME: don't yet have a way to set this */ |
|---|
| 414 | 402 | 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; |
|---|
| 417 | 404 | #if 0 |
|---|
| 418 | 405 | /* not yet supported, depends on patches from maxim */ |
|---|
| 419 | 406 | /* 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; |
|---|
| 422 | 409 | #endif |
|---|
| 423 | 410 | |
|---|
| 424 | 411 | sz->signal_start = ktime_get_real(); |
|---|