From 1bfde36b920f19a2edac38e25fa2a14f34e38564 Mon Sep 17 00:00:00 2001 From: David Herrmann Date: Thu, 17 Nov 2011 14:12:02 +0100 Subject: [PATCH] --- yaml --- r: 282335 b: refs/heads/master c: 82fb1b39581e7cdd71a6ce3cf12996711a583df2 h: refs/heads/master i: 282333: dda33e2d6c4b1bf4454d34c371feed591e179435 282331: 5cc80bc88d4156669d0e0718c5edc8e2472877f6 282327: 39af6b2c727bf69dc1d6c3e76e94e48c59426cc8 282319: db4a9aac19a8f06966fc1265780e65c6a68b9934 282303: f17bf0163188ea3b0293129020cd6f7a873141fb v: v3 --- [refs] | 2 +- trunk/drivers/hid/hid-wiimote-ext.c | 38 +++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 727b6ec2bcdb..c53e97721f29 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: cb99221ba74bb16576a9c3b7e49357b6b12ff3ea +refs/heads/master: 82fb1b39581e7cdd71a6ce3cf12996711a583df2 diff --git a/trunk/drivers/hid/hid-wiimote-ext.c b/trunk/drivers/hid/hid-wiimote-ext.c index fa9c67722aca..3e3e1fc8d838 100644 --- a/trunk/drivers/hid/hid-wiimote-ext.c +++ b/trunk/drivers/hid/hid-wiimote-ext.c @@ -33,10 +33,48 @@ enum wiiext_type { WIIEXT_NUNCHUCK, /* Nintendo nunchuck controller */ }; +/* diable all extensions */ +static void ext_disable(struct wiimote_ext *ext) +{ + unsigned long flags; + + spin_lock_irqsave(&ext->wdata->state.lock, flags); + ext->motionp = false; + ext->ext_type = WIIEXT_NONE; + spin_unlock_irqrestore(&ext->wdata->state.lock, flags); +} + +static bool motionp_read(struct wiimote_ext *ext) +{ + return false; +} + +static __u8 ext_read(struct wiimote_ext *ext) +{ + return WIIEXT_NONE; +} + +static void ext_enable(struct wiimote_ext *ext, bool motionp, __u8 ext_type) +{ + unsigned long flags; + + spin_lock_irqsave(&ext->wdata->state.lock, flags); + ext->motionp = motionp; + ext->ext_type = ext_type; + spin_unlock_irqrestore(&ext->wdata->state.lock, flags); +} + static void wiiext_worker(struct work_struct *work) { struct wiimote_ext *ext = container_of(work, struct wiimote_ext, worker); + bool motionp; + __u8 ext_type; + + ext_disable(ext); + motionp = motionp_read(ext); + ext_type = ext_read(ext); + ext_enable(ext, motionp, ext_type); } /* schedule work only once, otherwise mark for reschedule */