diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/hid/hid-wiimote-ext.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/drivers/hid/hid-wiimote-ext.c b/drivers/hid/hid-wiimote-ext.c index fa9c67722ac..3e3e1fc8d83 100644 --- a/drivers/hid/hid-wiimote-ext.c +++ b/drivers/hid/hid-wiimote-ext.c | |||
@@ -33,10 +33,48 @@ enum wiiext_type { | |||
33 | WIIEXT_NUNCHUCK, /* Nintendo nunchuck controller */ | 33 | WIIEXT_NUNCHUCK, /* Nintendo nunchuck controller */ |
34 | }; | 34 | }; |
35 | 35 | ||
36 | /* diable all extensions */ | ||
37 | static void ext_disable(struct wiimote_ext *ext) | ||
38 | { | ||
39 | unsigned long flags; | ||
40 | |||
41 | spin_lock_irqsave(&ext->wdata->state.lock, flags); | ||
42 | ext->motionp = false; | ||
43 | ext->ext_type = WIIEXT_NONE; | ||
44 | spin_unlock_irqrestore(&ext->wdata->state.lock, flags); | ||
45 | } | ||
46 | |||
47 | static bool motionp_read(struct wiimote_ext *ext) | ||
48 | { | ||
49 | return false; | ||
50 | } | ||
51 | |||
52 | static __u8 ext_read(struct wiimote_ext *ext) | ||
53 | { | ||
54 | return WIIEXT_NONE; | ||
55 | } | ||
56 | |||
57 | static void ext_enable(struct wiimote_ext *ext, bool motionp, __u8 ext_type) | ||
58 | { | ||
59 | unsigned long flags; | ||
60 | |||
61 | spin_lock_irqsave(&ext->wdata->state.lock, flags); | ||
62 | ext->motionp = motionp; | ||
63 | ext->ext_type = ext_type; | ||
64 | spin_unlock_irqrestore(&ext->wdata->state.lock, flags); | ||
65 | } | ||
66 | |||
36 | static void wiiext_worker(struct work_struct *work) | 67 | static void wiiext_worker(struct work_struct *work) |
37 | { | 68 | { |
38 | struct wiimote_ext *ext = container_of(work, struct wiimote_ext, | 69 | struct wiimote_ext *ext = container_of(work, struct wiimote_ext, |
39 | worker); | 70 | worker); |
71 | bool motionp; | ||
72 | __u8 ext_type; | ||
73 | |||
74 | ext_disable(ext); | ||
75 | motionp = motionp_read(ext); | ||
76 | ext_type = ext_read(ext); | ||
77 | ext_enable(ext, motionp, ext_type); | ||
40 | } | 78 | } |
41 | 79 | ||
42 | /* schedule work only once, otherwise mark for reschedule */ | 80 | /* schedule work only once, otherwise mark for reschedule */ |