diff options
author | Sakari Ailus <sakari.ailus@iki.fi> | 2015-03-22 16:42:31 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2015-04-27 14:43:52 -0400 |
commit | 161aadaec11cd0f610950da56f82bd1778be4156 (patch) | |
tree | 088644cb9a61faa0648f3591442d500be4aad606 | |
parent | 2b5166efda83259fe1d98424a7875293718ec22e (diff) |
[media] v4l: of: Instead of zeroing bus_type and bus field separately, unify this
Zero the entire struct starting from bus_type. As more fields are added, no
changes will be needed in the function to reset their value explicitly.
Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
-rw-r--r-- | drivers/media/v4l2-core/v4l2-of.c | 5 | ||||
-rw-r--r-- | include/media/v4l2-of.h | 1 |
2 files changed, 4 insertions, 2 deletions
diff --git a/drivers/media/v4l2-core/v4l2-of.c b/drivers/media/v4l2-core/v4l2-of.c index 83143d39dea7..3ac634891f75 100644 --- a/drivers/media/v4l2-core/v4l2-of.c +++ b/drivers/media/v4l2-core/v4l2-of.c | |||
@@ -149,8 +149,9 @@ int v4l2_of_parse_endpoint(const struct device_node *node, | |||
149 | int rval; | 149 | int rval; |
150 | 150 | ||
151 | of_graph_parse_endpoint(node, &endpoint->base); | 151 | of_graph_parse_endpoint(node, &endpoint->base); |
152 | endpoint->bus_type = 0; | 152 | /* Zero fields from bus_type to until the end */ |
153 | memset(&endpoint->bus, 0, sizeof(endpoint->bus)); | 153 | memset(&endpoint->bus_type, 0, sizeof(*endpoint) - |
154 | offsetof(typeof(*endpoint), bus_type)); | ||
154 | 155 | ||
155 | rval = v4l2_of_parse_csi_bus(node, endpoint); | 156 | rval = v4l2_of_parse_csi_bus(node, endpoint); |
156 | if (rval) | 157 | if (rval) |
diff --git a/include/media/v4l2-of.h b/include/media/v4l2-of.h index f66b92cc8669..6c85c079544f 100644 --- a/include/media/v4l2-of.h +++ b/include/media/v4l2-of.h | |||
@@ -60,6 +60,7 @@ struct v4l2_of_bus_parallel { | |||
60 | */ | 60 | */ |
61 | struct v4l2_of_endpoint { | 61 | struct v4l2_of_endpoint { |
62 | struct of_endpoint base; | 62 | struct of_endpoint base; |
63 | /* Fields below this line will be zeroed by v4l2_of_parse_endpoint() */ | ||
63 | enum v4l2_mbus_type bus_type; | 64 | enum v4l2_mbus_type bus_type; |
64 | union { | 65 | union { |
65 | struct v4l2_of_bus_parallel parallel; | 66 | struct v4l2_of_bus_parallel parallel; |