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