OSDN Git Service

media: rcar-vin: Specify media device ops at group creation time
authorNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Fri, 9 Jul 2021 14:25:58 +0000 (16:25 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Thu, 30 Sep 2021 08:07:34 +0000 (10:07 +0200)
The media device operations structure will be different depending on
what media graph layout is used. Instead of hard-coding the R-Car CSI-2
layout allow the operations to be passed as an argument.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/platform/rcar-vin/rcar-core.c

index d04c222..8c27d9d 100644 (file)
@@ -248,7 +248,8 @@ static void rvin_group_cleanup(struct rvin_group *group)
 }
 
 static int rvin_group_init(struct rvin_group *group, struct rvin_dev *vin,
-                          int (*link_setup)(struct rvin_dev *))
+                          int (*link_setup)(struct rvin_dev *),
+                          const struct media_device_ops *ops)
 {
        struct media_device *mdev = &group->mdev;
        const struct of_device_id *match;
@@ -267,7 +268,7 @@ static int rvin_group_init(struct rvin_group *group, struct rvin_dev *vin,
        group->link_setup = link_setup;
 
        mdev->dev = vin->dev;
-       mdev->ops = &rvin_media_ops;
+       mdev->ops = ops;
 
        match = of_match_node(vin->dev->driver->of_match_table,
                              vin->dev->of_node);
@@ -299,7 +300,8 @@ static void rvin_group_release(struct kref *kref)
 }
 
 static int rvin_group_get(struct rvin_dev *vin,
-                         int (*link_setup)(struct rvin_dev *))
+                         int (*link_setup)(struct rvin_dev *),
+                         const struct media_device_ops *ops)
 {
        struct rvin_group *group;
        u32 id;
@@ -331,7 +333,7 @@ static int rvin_group_get(struct rvin_dev *vin,
                        goto err_group;
                }
 
-               ret = rvin_group_init(group, vin, link_setup);
+               ret = rvin_group_init(group, vin, link_setup, ops);
                if (ret) {
                        kfree(group);
                        vin_err(vin, "Failed to initialize group\n");
@@ -985,7 +987,7 @@ static int rvin_csi2_init(struct rvin_dev *vin)
        if (ret < 0)
                return ret;
 
-       ret = rvin_group_get(vin, rvin_csi2_setup_links);
+       ret = rvin_group_get(vin, rvin_csi2_setup_links, &rvin_media_ops);
        if (ret)
                goto err_controls;