All of lore.kernel.org
 help / color / mirror / Atom feed
* Add dprintk calls for control validation in v4l2-ctrls.c?
@ 2021-04-27  0:17 Daniel Almeida
  2021-04-28  7:43 ` Hans Verkuil
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel Almeida @ 2021-04-27  0:17 UTC (permalink / raw)
  To: Hans Verkuil, Ezequiel Garcia; +Cc: linux-media, kernel

Hi Hans, Ezequiel & all.

I find it a bit hard to debug my own code when it invariably sneaks in a 
bad control value with the VIDIOC_S_EXT_CTRLS ioctl.


I feel that it would be tremendously beneficial to encourage the use of 
dprintk calls in v4l2-ctrls.c to inform the user about what pieces of 
data were actually rejected in the validation functions.

#define dprintk(vdev, fmt, arg...) do {					\
	if (!WARN_ON(!(vdev)) && ((vdev)->dev_debug & V4L2_DEV_DEBUG_CTRL)) \
		printk(KERN_DEBUG pr_fmt("%s: %s: " fmt),		\
		       __func__, video_device_node_name(vdev), ##arg);	


Unfortunately the dprintk macro above takes a pointer to struct 
video_device as argument. This is not available in the places I want to 
actually place the calls, as far as I could tell.

E.g. here:

static int std_validate_compound(const struct v4l2_ctrl *ctrl, u32 idx,
				 union v4l2_ctrl_ptr ptr)

I'd like to make the changes to make this possible, if any, or be 
pointed at another solution if there is one - such as calling pr_err 
directly or something along these lines - please.

Kindly advise?

-- thanks
-- Daniel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-04-28  7:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-27  0:17 Add dprintk calls for control validation in v4l2-ctrls.c? Daniel Almeida
2021-04-28  7:43 ` Hans Verkuil

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.