1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
From 9243f7de67345adfcac52198f78bd12cfebb6867 Mon Sep 17 00:00:00 2001
From: Kieran Bingham <kieran.bingham@ideasonboard.com>
Date: Wed, 20 Mar 2019 11:35:26 +0000
Subject: [PATCH] staging: bcm2835-codec: Pass driver context to create
entities
Pass the bcm2835_codec_driver driver context directly into the
bcm2835_codec_create() so that it can be used to store driver global
state. Pass the struct platform_device *pdev by adding it to the driver
global state.
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
.../bcm2835-codec/bcm2835-v4l2-codec.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
--- a/drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c
+++ b/drivers/staging/vc04_services/bcm2835-codec/bcm2835-v4l2-codec.c
@@ -457,6 +457,8 @@ struct bcm2835_codec_ctx {
};
struct bcm2835_codec_driver {
+ struct platform_device *pdev;
+
struct bcm2835_codec_dev *encode;
struct bcm2835_codec_dev *decode;
struct bcm2835_codec_dev *isp;
@@ -2587,10 +2589,11 @@ destroy_component:
return ret;
}
-static int bcm2835_codec_create(struct platform_device *pdev,
+static int bcm2835_codec_create(struct bcm2835_codec_driver *drv,
struct bcm2835_codec_dev **new_dev,
enum bcm2835_codec_role role)
{
+ struct platform_device *pdev = drv->pdev;
struct bcm2835_codec_dev *dev;
struct video_device *vfd;
int video_nr;
@@ -2711,15 +2714,17 @@ static int bcm2835_codec_probe(struct pl
if (!drv)
return -ENOMEM;
- ret = bcm2835_codec_create(pdev, &drv->decode, DECODE);
+ drv->pdev = pdev;
+
+ ret = bcm2835_codec_create(drv, &drv->decode, DECODE);
if (ret)
goto out;
- ret = bcm2835_codec_create(pdev, &drv->encode, ENCODE);
+ ret = bcm2835_codec_create(drv, &drv->encode, ENCODE);
if (ret)
goto out;
- ret = bcm2835_codec_create(pdev, &drv->isp, ISP);
+ ret = bcm2835_codec_create(drv, &drv->isp, ISP);
if (ret)
goto out;
|