diff options
author | Jonathan Bakker <xc-racer2@live.ca> | 2020-07-31 02:01:09 +0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+huawei@kernel.org> | 2020-09-01 15:13:25 +0300 |
commit | 401b463dac275a9159c80ce7061f8fe20ef892e5 (patch) | |
tree | d653a149992bb6a019193509590b508b00982d6e /drivers | |
parent | 1068fe3aaf0ed96c7c141a07eca8f507d791fc78 (diff) | |
download | linux-401b463dac275a9159c80ce7061f8fe20ef892e5.tar.xz |
media: exynos4-is: Use global num_sensors rather than local index
Instead of keeping a local copy of how many sensors we've probed
(which may not even properly represent the number of sensors
probed if we have a port without a sensor), use the global
num_sensors counter that has the actual number used.
This will also make it easier to add support for multiple sensors
being connected to the same port.
Signed-off-by: Jonathan Bakker <xc-racer2@live.ca>
Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/platform/exynos4-is/media-dev.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/media/platform/exynos4-is/media-dev.c b/drivers/media/platform/exynos4-is/media-dev.c index aae584f9770d..1ca9050195d6 100644 --- a/drivers/media/platform/exynos4-is/media-dev.c +++ b/drivers/media/platform/exynos4-is/media-dev.c @@ -397,9 +397,9 @@ static void fimc_md_pipelines_free(struct fimc_md *fmd) /* Parse port node and register as a sub-device any sensor specified there. */ static int fimc_md_parse_port_node(struct fimc_md *fmd, - struct device_node *port, - unsigned int index) + struct device_node *port) { + int index = fmd->num_sensors; struct fimc_source_info *pd = &fmd->sensor[index].pdata; struct device_node *rem, *ep, *np; struct v4l2_fwnode_endpoint endpoint = { .bus_type = 0 }; @@ -489,7 +489,6 @@ static int fimc_md_register_sensor_entities(struct fimc_md *fmd) struct device_node *parent = fmd->pdev->dev.of_node; struct device_node *ports = NULL; struct device_node *node; - int index = 0; int ret; /* @@ -516,13 +515,12 @@ static int fimc_md_register_sensor_entities(struct fimc_md *fmd) if (!port) continue; - ret = fimc_md_parse_port_node(fmd, port, index); + ret = fimc_md_parse_port_node(fmd, port); of_node_put(port); if (ret < 0) { of_node_put(node); goto cleanup; } - index++; } /* Attach sensors listed in the parallel-ports node */ @@ -531,12 +529,11 @@ static int fimc_md_register_sensor_entities(struct fimc_md *fmd) goto rpm_put; for_each_child_of_node(ports, node) { - ret = fimc_md_parse_port_node(fmd, node, index); + ret = fimc_md_parse_port_node(fmd, node); if (ret < 0) { of_node_put(node); goto cleanup; } - index++; } of_node_put(ports); |