Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 282335
b: refs/heads/master
c: 82fb1b3
h: refs/heads/master
i:
  282333: dda33e2
  282331: 5cc80bc
  282327: 39af6b2
  282319: db4a9aa
  282303: f17bf01
v: v3
  • Loading branch information
David Herrmann authored and Jiri Kosina committed Nov 22, 2011
1 parent a259a96 commit 1bfde36
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: cb99221ba74bb16576a9c3b7e49357b6b12ff3ea
refs/heads/master: 82fb1b39581e7cdd71a6ce3cf12996711a583df2
38 changes: 38 additions & 0 deletions trunk/drivers/hid/hid-wiimote-ext.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit 1bfde36

Please sign in to comment.