Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 268567
b: refs/heads/master
c: 8517e87
h: refs/heads/master
i:
  268565: e4bc6ca
  268563: b98f78d
  268559: a867079
v: v3
  • Loading branch information
Julian Andres Klode authored and Greg Kroah-Hartman committed Sep 30, 2011
1 parent e48e07c commit eb7479c
Show file tree
Hide file tree
Showing 2 changed files with 32 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: e7c40851fd7989dad297988b6343f4e3cb687292
refs/heads/master: 8517e879e0d11a277275616b9e1c749afe2fceff
31 changes: 31 additions & 0 deletions trunk/drivers/staging/nvec/nvec.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,37 @@ static void nvec_msg_free(struct nvec_chip *nvec, struct nvec_msg *msg)
atomic_set(&msg->used, 0);
}

/**
* nvec_msg_is_event - Return %true if @msg is an event
* @msg: A message
*/
static bool nvec_msg_is_event(struct nvec_msg *msg)
{
return msg->data[0] >> 7;
}

/**
* nvec_msg_size - Get the size of a message
* @msg: The message to get the size for
*
* This only works for received messages, not for outgoing messages.
*/
static size_t nvec_msg_size(struct nvec_msg *msg)
{
bool is_event = nvec_msg_is_event(msg);
int event_length = (msg->data[0] & 0x60) >> 5;

/* for variable size, payload size in byte 1 + count (1) + cmd (1) */
if (!is_event || event_length == NVEC_VAR_SIZE)
return (msg->pos || msg->size) ? (msg->data[1] + 2) : 0;
else if (event_length == NVEC_2BYTES)
return 2;
else if (event_length == NVEC_3BYTES)
return 3;
else
return 0;
}

static void nvec_gpio_set_value(struct nvec_chip *nvec, int value)
{
dev_dbg(nvec->dev, "GPIO changed from %u to %u\n",
Expand Down

0 comments on commit eb7479c

Please sign in to comment.