Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 320129
b: refs/heads/master
c: 80131fe
h: refs/heads/master
i:
  320127: 386170a
v: v3
  • Loading branch information
Hans Verkuil authored and Mauro Carvalho Chehab committed Jul 6, 2012
1 parent 6a6f002 commit 32abc5e
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f18d8e07b28e2950679edaa4edaa7ce410dd57fc
refs/heads/master: 80131fe06e0bdd7b429594493c1317ddede89a61
24 changes: 24 additions & 0 deletions trunk/drivers/media/video/v4l2-dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
return len;
}

static ssize_t show_name(struct device *cd,
struct device_attribute *attr, char *buf)
{
Expand All @@ -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
};
Expand Down
9 changes: 5 additions & 4 deletions trunk/drivers/media/video/v4l2-ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1999,6 +1999,7 @@ static long __video_do_ioctl(struct file *file,
void *fh = file->private_data;
struct v4l2_fh *vfh = NULL;
int use_fh_prio = 0;
int debug = vfd->debug;
long ret = -ENOTTY;

if (ops == NULL) {
Expand Down Expand Up @@ -2032,7 +2033,7 @@ static long __video_do_ioctl(struct file *file,
}

write_only = _IOC_DIR(cmd) == _IOC_WRITE;
if (write_only && vfd->debug > V4L2_DEBUG_IOCTL) {
if (write_only && debug > V4L2_DEBUG_IOCTL) {
v4l_print_ioctl(vfd->name, cmd);
pr_cont(": ");
info->debug(arg, write_only);
Expand All @@ -2054,8 +2055,8 @@ static long __video_do_ioctl(struct file *file,
}

done:
if (vfd->debug) {
if (write_only && vfd->debug > V4L2_DEBUG_IOCTL) {
if (debug) {
if (write_only && debug > V4L2_DEBUG_IOCTL) {
if (ret < 0)
printk(KERN_DEBUG "%s: error %ld\n",
video_device_node_name(vfd), ret);
Expand All @@ -2064,7 +2065,7 @@ static long __video_do_ioctl(struct file *file,
v4l_print_ioctl(vfd->name, cmd);
if (ret < 0)
pr_cont(": error %ld\n", ret);
else if (vfd->debug == V4L2_DEBUG_IOCTL)
else if (debug == V4L2_DEBUG_IOCTL)
pr_cont("\n");
else if (_IOC_DIR(cmd) == _IOC_NONE)
info->debug(arg, write_only);
Expand Down

0 comments on commit 32abc5e

Please sign in to comment.