diff options
author | David Herrmann <dh.herrmann@gmail.com> | 2013-05-05 23:13:03 +0200 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2013-06-03 11:07:04 +0200 |
commit | d76f89e13a0439649120a85297085e8d8fff77ec (patch) | |
tree | 2b4d434b7085dfba62a2dfb19cb50dc3d5f092e7 /drivers/hid/hid-wiimote-debug.c | |
parent | HID: wiimote: fix ctx pointer in debugfs DRM-write (diff) | |
download | linux-d76f89e13a0439649120a85297085e8d8fff77ec.tar.xz linux-d76f89e13a0439649120a85297085e8d8fff77ec.zip |
HID: wiimote: lock DRM mode during debugfs overwrite
If we write a DRM mode via debugfs, we shouldn't allow normal operations
to overwrite this DRM mode. This is important if we want to debug
3rd-party devices and we want to see what data is sent on each mode.
If we write NULL/0 as DRM, the lock is removed again so the best matching
DRM is chosen by wiimote core.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/hid-wiimote-debug.c')
-rw-r--r-- | drivers/hid/hid-wiimote-debug.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/hid/hid-wiimote-debug.c b/drivers/hid/hid-wiimote-debug.c index 0c0deaa23774..6e76a2c3b00a 100644 --- a/drivers/hid/hid-wiimote-debug.c +++ b/drivers/hid/hid-wiimote-debug.c @@ -154,7 +154,10 @@ static ssize_t wiidebug_drm_write(struct file *f, const char __user *u, i = simple_strtoul(buf, NULL, 10); spin_lock_irqsave(&dbg->wdata->state.lock, flags); + dbg->wdata->state.flags &= ~WIIPROTO_FLAG_DRM_LOCKED; wiiproto_req_drm(dbg->wdata, (__u8) i); + if (i != WIIPROTO_REQ_NULL) + dbg->wdata->state.flags |= WIIPROTO_FLAG_DRM_LOCKED; spin_unlock_irqrestore(&dbg->wdata->state.lock, flags); return len; |