Thread (36 messages) 36 messages, 3 authors, 2021-01-26

Re: [PATCH v2 04/14] media: exynos4-is: Use v4l2_async_notifier_add_fwnode_remote_subdev

From: Ezequiel Garcia <hidden>
Date: 2021-01-19 20:03:06

On Tue, 2021-01-19 at 15:52 -0300, Helen Koike wrote:
Hi Ezequiel,

On 1/17/21 10:52 PM, Ezequiel Garcia wrote:
quoted
The use of v4l2_async_notifier_add_subdev will be discouraged.
Drivers are instead encouraged to use a helper such as
v4l2_async_notifier_add_fwnode_remote_subdev.

This fixes a misuse of the API, as v4l2_async_notifier_add_subdev
should get a kmalloc'ed struct v4l2_async_subdev,
removing some boilerplate code while at it.

Use the appropriate helper v4l2_async_notifier_add_fwnode_remote_subdev,
which handles the needed setup, instead of open-coding it.

Signed-off-by: Ezequiel Garcia <redacted>
Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
---
 drivers/media/platform/exynos4-is/media-dev.c | 25 +++++++++++--------
 drivers/media/platform/exynos4-is/media-dev.h |  2 +-
 2 files changed, 15 insertions(+), 12 deletions(-)
diff --git a/drivers/media/platform/exynos4-is/media-dev.c b/drivers/media/platform/exynos4-is/media-dev.c
index e636c33e847b..de26ecdcfe81 100644
--- a/drivers/media/platform/exynos4-is/media-dev.c
+++ b/drivers/media/platform/exynos4-is/media-dev.c
@@ -401,6 +401,7 @@ static int fimc_md_parse_one_endpoint(struct fimc_md *fmd,
        int index = fmd->num_sensors;
        struct fimc_source_info *pd = &fmd->sensor[index].pdata;
        struct device_node *rem, *np;
+       struct v4l2_async_subdev *asd;
        struct v4l2_fwnode_endpoint endpoint = { .bus_type = 0 };
        int ret;
 
@@ -418,10 +419,11 @@ static int fimc_md_parse_one_endpoint(struct fimc_md *fmd,
        pd->mux_id = (endpoint.base.port - 1) & 0x1;
 
        rem = of_graph_get_remote_port_parent(ep);
-       of_node_put(ep);
        if (rem == NULL) {
                v4l2_info(&fmd->v4l2_dev, "Remote device at %pOF not found\n",
                                                        ep);
+               of_node_put(rem);
rem is NULL here.
Ouch, crap. Thanks for spotting this!

Ezequiel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help