Re: [RFCv1 PATCH 19/32] v4l2-dev.c: add debug sysfs entry.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Hans,

Thanks for the patch.

On Sunday 10 June 2012 12:25:41 Hans Verkuil wrote:
> From: Hans Verkuil <hans.verkuil@xxxxxxxxx>
> 
> Signed-off-by: Hans Verkuil <hans.verkuil@xxxxxxxxx>
> ---
>  drivers/media/video/v4l2-dev.c |   24 ++++++++++++++++++++++++
>  1 file changed, 24 insertions(+)
> 
> diff --git a/drivers/media/video/v4l2-dev.c b/drivers/media/video/v4l2-dev.c
> index 1500208..5c0bb18 100644
> --- a/drivers/media/video/v4l2-dev.c
> +++ b/drivers/media/video/v4l2-dev.c
> @@ -46,6 +46,29 @@ static ssize_t show_index(struct device *cd,
>  	return sprintf(buf, "%i\n", vdev->index);
>  }
> 
> +static ssize_t show_debug(struct device *cd,
> +			 struct device_attribute *attr, char *buf)
> +{
> +	struct video_device *vdev = to_video_device(cd);
> +
> +	return sprintf(buf, "%i\n", vdev->debug);
> +}
> +
> +static ssize_t set_debug(struct device *cd, struct device_attribute *attr,
> +		   const char *buf, size_t len)
> +{
> +	struct video_device *vdev = to_video_device(cd);
> +	int res = 0;
> +	u16 value;
> +
> +	res = kstrtou16(buf, 0, &value);
> +	if (res)
> +		return res;
> +
> +	vdev->debug = value;

Can't this race with the various vdev->debug tests we have in the V4L core ?

> +	return len;
> +}
> +
>  static ssize_t show_name(struct device *cd,
>  			 struct device_attribute *attr, char *buf)
>  {
> @@ -56,6 +79,7 @@ static ssize_t show_name(struct device *cd,
> 
>  static struct device_attribute video_device_attrs[] = {
>  	__ATTR(name, S_IRUGO, show_name, NULL),
> +	__ATTR(debug, 0644, show_debug, set_debug),
>  	__ATTR(index, S_IRUGO, show_index, NULL),
>  	__ATTR_NULL
>  };
-- 
Regards,

Laurent Pinchart

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux