Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 193014
b: refs/heads/master
c: 42880cd
h: refs/heads/master
v: v3
  • Loading branch information
Mauro Carvalho Chehab committed May 19, 2010
1 parent 22dcbf1 commit 3af47aa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d46844300ccd99444d32e481751b6508c8c7834e
refs/heads/master: 42880cd438d6e74b6005648a7dc06867d4b30b44
10 changes: 6 additions & 4 deletions trunk/drivers/media/IR/ir-keytable.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,16 @@ static int ir_resize_table(struct ir_scancode_table *rc_tab)
* @rc_tab: the struct ir_scancode_table to set the keycode in
* @scancode: the scancode for the ir command
* @keycode: the keycode for the ir command
* @resize: whether the keytable may be shrunk
* @return: -EINVAL if the keycode could not be inserted, otherwise zero.
*
* This routine is used internally to manipulate the scancode->keycode table.
* The caller has to hold @rc_tab->lock.
*/
static int ir_do_setkeycode(struct input_dev *dev,
struct ir_scancode_table *rc_tab,
unsigned scancode, unsigned keycode)
unsigned scancode, unsigned keycode,
bool resize)
{
unsigned int i;
int old_keycode = KEY_RESERVED;
Expand Down Expand Up @@ -129,7 +131,7 @@ static int ir_do_setkeycode(struct input_dev *dev,

if (old_keycode == KEY_RESERVED && keycode != KEY_RESERVED) {
/* No previous mapping found, we might need to grow the table */
if (ir_resize_table(rc_tab))
if (resize && ir_resize_table(rc_tab))
return -ENOMEM;

IR_dprintk(1, "#%d: New scan 0x%04x with key 0x%04x\n",
Expand Down Expand Up @@ -177,7 +179,7 @@ static int ir_setkeycode(struct input_dev *dev,
struct ir_scancode_table *rc_tab = &ir_dev->rc_tab;

spin_lock_irqsave(&rc_tab->lock, flags);
rc = ir_do_setkeycode(dev, rc_tab, scancode, keycode);
rc = ir_do_setkeycode(dev, rc_tab, scancode, keycode, true);
spin_unlock_irqrestore(&rc_tab->lock, flags);
return rc;
}
Expand All @@ -204,7 +206,7 @@ static int ir_setkeytable(struct input_dev *dev,
spin_lock_irqsave(&rc_tab->lock, flags);
for (i = 0; i < from->size; i++) {
rc = ir_do_setkeycode(dev, to, from->scan[i].scancode,
from->scan[i].keycode);
from->scan[i].keycode, false);
if (rc)
break;
}
Expand Down

0 comments on commit 3af47aa

Please sign in to comment.