driverdev-devel.linuxdriverproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v7 1/4] media: v4l2-ctrl: Add a comment on why we zero out compound controls fields
       [not found] <20190725185602.22522-1-paul.kocialkowski@bootlin.com>
@ 2019-07-25 18:55 ` Paul Kocialkowski
  0 siblings, 0 replies; only message in thread
From: Paul Kocialkowski @ 2019-07-25 18:55 UTC (permalink / raw)
  To: linux-media, linux-kernel, devel, linux-arm-kernel, linux-sunxi
  Cc: Hans Verkuil, Jernej Skrabec, Sakari Ailus, Alexandre Courbot,
	Jonas Karlman, Maxime Ripard, Greg Kroah-Hartman, Tomasz Figa,
	Paul Kocialkowski, Chen-Yu Tsai, Boris Brezillon,
	Nicolas Dufresne, Thomas Petazzoni, Mauro Carvalho Chehab,
	Ezequiel Garcia

Since it's not necessarily very explicit why we need to zero some fields
in std_validate_compound, add a comment before the function to explain
why, which should help as a reminder.

Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
---
 drivers/media/v4l2-core/v4l2-ctrls.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c
index 76fa2db0e8fb..cd1ae016706f 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls.c
@@ -1645,6 +1645,10 @@ static void std_log(const struct v4l2_ctrl *ctrl)
 #define zero_padding(s) \
 	memset(&(s).padding, 0, sizeof((s).padding))
 
+/*
+ * Compound controls validation requires setting unused fields/flags to zero
+ * in order to properly detect unchanged controls with std_equal's memcmp.
+ */
 static int std_validate_compound(const struct v4l2_ctrl *ctrl, u32 idx,
 				 union v4l2_ctrl_ptr ptr)
 {
-- 
2.22.0

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-07-25 18:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20190725185602.22522-1-paul.kocialkowski@bootlin.com>
2019-07-25 18:55 ` [PATCH v7 1/4] media: v4l2-ctrl: Add a comment on why we zero out compound controls fields Paul Kocialkowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).