forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-04 1543e317f1da31b75942316931e8f491a8920811
kernel/drivers/media/usb/ttusb-dec/ttusb_dec.c
....@@ -1,19 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * TTUSB DEC Driver
34 *
45 * Copyright (C) 2003-2004 Alex Woods <linux-dvb@giblets.org>
56 * IR support by Peter Beutner <p.beutner@gmx.net>
6
- *
7
- * This program is free software; you can redistribute it and/or modify
8
- * it under the terms of the GNU General Public License as published by
9
- * the Free Software Foundation; either version 2 of the License, or
10
- * (at your option) any later version.
11
- *
12
- * This program is distributed in the hope that it will be useful,
13
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
- * GNU General Public License for more details.
16
- *
177 */
188
199 #include <linux/list.h>
....@@ -260,6 +250,7 @@
260250 struct ttusb_dec *dec = urb->context;
261251 char *buffer = dec->irq_buffer;
262252 int retval;
253
+ int index = buffer[4];
263254
264255 switch(urb->status) {
265256 case 0: /*success*/
....@@ -284,18 +275,18 @@
284275 *
285276 * this is an fact a bit too simple implementation;
286277 * the box also reports a keyrepeat signal
287
- * (with buffer[3] == 0x40) in an intervall of ~100ms.
278
+ * (with buffer[3] == 0x40) in an interval of ~100ms.
288279 * But to handle this correctly we had to imlemenent some
289280 * kind of timer which signals a 'key up' event if no
290281 * keyrepeat signal is received for lets say 200ms.
291282 * this should/could be added later ...
292283 * for now lets report each signal as a key down and up
293284 */
294
- if (buffer[4] - 1 < ARRAY_SIZE(rc_keys)) {
295
- dprintk("%s:rc signal:%d\n", __func__, buffer[4]);
296
- input_report_key(dec->rc_input_dev, rc_keys[buffer[4] - 1], 1);
285
+ if (index - 1 < ARRAY_SIZE(rc_keys)) {
286
+ dprintk("%s:rc signal:%d\n", __func__, index);
287
+ input_report_key(dec->rc_input_dev, rc_keys[index - 1], 1);
297288 input_sync(dec->rc_input_dev);
298
- input_report_key(dec->rc_input_dev, rc_keys[buffer[4] - 1], 0);
289
+ input_report_key(dec->rc_input_dev, rc_keys[index - 1], 0);
299290 input_sync(dec->rc_input_dev);
300291 }
301292 }
....@@ -778,9 +769,9 @@
778769 }
779770 }
780771
781
-static void ttusb_dec_process_urb_frame_list(unsigned long data)
772
+static void ttusb_dec_process_urb_frame_list(struct tasklet_struct *t)
782773 {
783
- struct ttusb_dec *dec = (struct ttusb_dec *)data;
774
+ struct ttusb_dec *dec = from_tasklet(dec, t, urb_tasklet);
784775 struct list_head *item;
785776 struct urb_frame *frame;
786777 unsigned long flags;
....@@ -1218,8 +1209,7 @@
12181209 {
12191210 spin_lock_init(&dec->urb_frame_list_lock);
12201211 INIT_LIST_HEAD(&dec->urb_frame_list);
1221
- tasklet_init(&dec->urb_tasklet, ttusb_dec_process_urb_frame_list,
1222
- (unsigned long)dec);
1212
+ tasklet_setup(&dec->urb_tasklet, ttusb_dec_process_urb_frame_list);
12231213 }
12241214
12251215 static int ttusb_init_rc( struct ttusb_dec *dec)
....@@ -1561,8 +1551,7 @@
15611551 dvb_dmx_release(&dec->demux);
15621552 if (dec->fe) {
15631553 dvb_unregister_frontend(dec->fe);
1564
- if (dec->fe->ops.release)
1565
- dec->fe->ops.release(dec->fe);
1554
+ dvb_frontend_detach(dec->fe);
15661555 }
15671556 dvb_unregister_adapter(&dec->adapter);
15681557 }