From 4e48afecd5ee3a394d228349fc1c33982e9fb557 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 27 Sep 2017 10:12:00 -0400 Subject: media: v4l2-async: simplify v4l2_async_subdev structure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The V4L2_ASYNC_MATCH_FWNODE match criteria requires just one struct to be filled (struct fwnode_handle). The V4L2_ASYNC_MATCH_DEVNAME match criteria requires just a device name. So, it doesn't make sense to enclose those into structs, as the criteria can go directly into the union. That makes easier to document it, as we don't need to document weird senseless structs. At drivers, this makes even clearer about the match criteria. Acked-by: Sylwester Nawrocki Acked-by: Benoit Parrot Acked-by: Alexandre Belloni Acked-by: Sakari Ailus Acked-by: Philipp Zabel Acked-by: Hyun Kwon Acked-by: Niklas Söderlund Acked-by: Lad, Prabhakar Signed-off-by: Mauro Carvalho Chehab --- drivers/media/v4l2-core/v4l2-async.c | 16 ++++++++-------- drivers/media/v4l2-core/v4l2-fwnode.c | 10 +++++----- 2 files changed, 13 insertions(+), 13 deletions(-) (limited to 'drivers/media/v4l2-core') diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c index e5acfab470a5..2b08d03b251d 100644 --- a/drivers/media/v4l2-core/v4l2-async.c +++ b/drivers/media/v4l2-core/v4l2-async.c @@ -68,12 +68,12 @@ static bool match_i2c(struct v4l2_subdev *sd, struct v4l2_async_subdev *asd) static bool match_devname(struct v4l2_subdev *sd, struct v4l2_async_subdev *asd) { - return !strcmp(asd->match.device_name.name, dev_name(sd->dev)); + return !strcmp(asd->match.device_name, dev_name(sd->dev)); } static bool match_fwnode(struct v4l2_subdev *sd, struct v4l2_async_subdev *asd) { - return sd->fwnode == asd->match.fwnode.fwnode; + return sd->fwnode == asd->match.fwnode; } static bool match_custom(struct v4l2_subdev *sd, struct v4l2_async_subdev *asd) @@ -319,7 +319,7 @@ static bool __v4l2_async_notifier_fwnode_has_async_subdev( if (asd->match_type != V4L2_ASYNC_MATCH_FWNODE) continue; - if (asd->match.fwnode.fwnode == fwnode) + if (asd->match.fwnode == fwnode) return true; } @@ -330,7 +330,7 @@ static bool __v4l2_async_notifier_fwnode_has_async_subdev( if (sd->asd->match_type != V4L2_ASYNC_MATCH_FWNODE) continue; - if (sd->asd->match.fwnode.fwnode == fwnode) + if (sd->asd->match.fwnode == fwnode) return true; } @@ -355,8 +355,8 @@ static bool v4l2_async_notifier_fwnode_has_async_subdev( struct v4l2_async_subdev *other_asd = notifier->subdevs[j]; if (other_asd->match_type == V4L2_ASYNC_MATCH_FWNODE && - asd->match.fwnode.fwnode == - other_asd->match.fwnode.fwnode) + asd->match.fwnode == + other_asd->match.fwnode) return true; } @@ -395,7 +395,7 @@ static int __v4l2_async_notifier_register(struct v4l2_async_notifier *notifier) break; case V4L2_ASYNC_MATCH_FWNODE: if (v4l2_async_notifier_fwnode_has_async_subdev( - notifier, asd->match.fwnode.fwnode, i)) { + notifier, asd->match.fwnode, i)) { dev_err(dev, "fwnode has already been registered or in notifier's subdev list\n"); ret = -EEXIST; @@ -510,7 +510,7 @@ void v4l2_async_notifier_cleanup(struct v4l2_async_notifier *notifier) switch (asd->match_type) { case V4L2_ASYNC_MATCH_FWNODE: - fwnode_handle_put(asd->match.fwnode.fwnode); + fwnode_handle_put(asd->match.fwnode); break; default: WARN_ON_ONCE(true); diff --git a/drivers/media/v4l2-core/v4l2-fwnode.c b/drivers/media/v4l2-core/v4l2-fwnode.c index fb72c7ac04d4..d630640642ee 100644 --- a/drivers/media/v4l2-core/v4l2-fwnode.c +++ b/drivers/media/v4l2-core/v4l2-fwnode.c @@ -359,9 +359,9 @@ static int v4l2_async_notifier_fwnode_parse_endpoint( return -ENOMEM; asd->match_type = V4L2_ASYNC_MATCH_FWNODE; - asd->match.fwnode.fwnode = + asd->match.fwnode = fwnode_graph_get_remote_port_parent(endpoint); - if (!asd->match.fwnode.fwnode) { + if (!asd->match.fwnode) { dev_warn(dev, "bad remote port parent\n"); ret = -EINVAL; goto out_err; @@ -393,7 +393,7 @@ static int v4l2_async_notifier_fwnode_parse_endpoint( return 0; out_err: - fwnode_handle_put(asd->match.fwnode.fwnode); + fwnode_handle_put(asd->match.fwnode); kfree(asd); return ret == -ENOTCONN ? 0 : ret; @@ -566,7 +566,7 @@ static int v4l2_fwnode_reference_parse( } notifier->subdevs[notifier->num_subdevs] = asd; - asd->match.fwnode.fwnode = args.fwnode; + asd->match.fwnode = args.fwnode; asd->match_type = V4L2_ASYNC_MATCH_FWNODE; notifier->num_subdevs++; } @@ -853,7 +853,7 @@ static int v4l2_fwnode_reference_parse_int_props( } notifier->subdevs[notifier->num_subdevs] = asd; - asd->match.fwnode.fwnode = fwnode; + asd->match.fwnode = fwnode; asd->match_type = V4L2_ASYNC_MATCH_FWNODE; notifier->num_subdevs++; } -- cgit v1.2.3