forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/drivers/media/pci/tw5864/tw5864-video.c
....@@ -1,17 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * TW5864 driver - video encoding functions
34 *
45 * Copyright (C) 2016 Bluecherry, LLC <maintainers@bluecherrydvr.com>
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation; either version 2 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
156 */
167
178 #include <linux/module.h>
....@@ -184,7 +175,7 @@
184175 static v4l2_std_id tw5864_get_v4l2_std(enum tw5864_vid_std std);
185176 static enum tw5864_vid_std tw5864_from_v4l2_std(v4l2_std_id v4l2_std);
186177
187
-static void tw5864_handle_frame_task(unsigned long data);
178
+static void tw5864_handle_frame_task(struct tasklet_struct *t);
188179 static void tw5864_handle_frame(struct tw5864_h264_frame *frame);
189180 static void tw5864_frame_interval_set(struct tw5864_input *input);
190181
....@@ -610,7 +601,7 @@
610601 {
611602 struct tw5864_input *input = video_drvdata(file);
612603
613
- strcpy(cap->driver, "tw5864");
604
+ strscpy(cap->driver, "tw5864", sizeof(cap->driver));
614605 snprintf(cap->card, sizeof(cap->card), "TW5864 Encoder %d",
615606 input->nr);
616607 sprintf(cap->bus_info, "PCI:%s", pci_name(input->root->pci));
....@@ -1072,8 +1063,7 @@
10721063 dev->irqmask |= TW5864_INTR_VLC_DONE | TW5864_INTR_TIMER;
10731064 tw5864_irqmask_apply(dev);
10741065
1075
- tasklet_init(&dev->tasklet, tw5864_handle_frame_task,
1076
- (unsigned long)dev);
1066
+ tasklet_setup(&dev->tasklet, tw5864_handle_frame_task);
10771067
10781068 for (i = 0; i < TW5864_INPUTS; i++) {
10791069 dev->inputs[i].root = dev;
....@@ -1171,7 +1161,7 @@
11711161 input->gop = GOP_SIZE;
11721162 input->frame_interval = 1;
11731163
1174
- ret = video_register_device(&input->vdev, VFL_TYPE_GRABBER, video_nr);
1164
+ ret = video_register_device(&input->vdev, VFL_TYPE_VIDEO, video_nr);
11751165 if (ret)
11761166 goto free_v4l2_hdl;
11771167
....@@ -1193,7 +1183,6 @@
11931183
11941184 free_v4l2_hdl:
11951185 v4l2_ctrl_handler_free(hdl);
1196
- vb2_queue_release(&input->vidq);
11971186 free_mutex:
11981187 mutex_destroy(&input->lock);
11991188
....@@ -1202,9 +1191,8 @@
12021191
12031192 static void tw5864_video_input_fini(struct tw5864_input *dev)
12041193 {
1205
- video_unregister_device(&dev->vdev);
1194
+ vb2_video_unregister_device(&dev->vdev);
12061195 v4l2_ctrl_handler_free(&dev->hdl);
1207
- vb2_queue_release(&dev->vidq);
12081196 }
12091197
12101198 void tw5864_video_fini(struct tw5864_dev *dev)
....@@ -1328,9 +1316,9 @@
13281316 return detected;
13291317 }
13301318
1331
-static void tw5864_handle_frame_task(unsigned long data)
1319
+static void tw5864_handle_frame_task(struct tasklet_struct *t)
13321320 {
1333
- struct tw5864_dev *dev = (struct tw5864_dev *)data;
1321
+ struct tw5864_dev *dev = from_tasklet(dev, t, tasklet);
13341322 unsigned long flags;
13351323 int batch_size = H264_BUF_CNT;
13361324