Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 138138
b: refs/heads/master
c: c1089bd
h: refs/heads/master
v: v3
  • Loading branch information
Jean Delvare authored and Mauro Carvalho Chehab committed Mar 30, 2009
1 parent 49ead47 commit 1e5d7b2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 18 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: f263bac9f7181df80b732b7bc11a7a4e38ca962f
refs/heads/master: c1089bdc07f06b90f0bc50d0789c2a4833097df7
20 changes: 5 additions & 15 deletions trunk/drivers/media/video/ir-kbd-i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,15 +279,9 @@ static void ir_key_poll(struct IR_i2c *ir)
}
}

static void ir_timer(unsigned long data)
{
struct IR_i2c *ir = (struct IR_i2c*)data;
schedule_work(&ir->work);
}

static void ir_work(struct work_struct *work)
{
struct IR_i2c *ir = container_of(work, struct IR_i2c, work);
struct IR_i2c *ir = container_of(work, struct IR_i2c, work.work);
int polling_interval = 100;

/* MSI TV@nywhere Plus requires more frequent polling
Expand All @@ -296,7 +290,7 @@ static void ir_work(struct work_struct *work)
polling_interval = 50;

ir_key_poll(ir);
mod_timer(&ir->timer, jiffies + msecs_to_jiffies(polling_interval));
schedule_delayed_work(&ir->work, msecs_to_jiffies(polling_interval));
}

/* ----------------------------------------------------------------------- */
Expand Down Expand Up @@ -452,11 +446,8 @@ static int ir_attach(struct i2c_adapter *adap, int addr,
ir->input->name, ir->input->phys, adap->name);

/* start polling via eventd */
INIT_WORK(&ir->work, ir_work);
init_timer(&ir->timer);
ir->timer.function = ir_timer;
ir->timer.data = (unsigned long)ir;
schedule_work(&ir->work);
INIT_DELAYED_WORK(&ir->work, ir_work);
schedule_delayed_work(&ir->work, 0);

return 0;

Expand All @@ -473,8 +464,7 @@ static int ir_detach(struct i2c_client *client)
struct IR_i2c *ir = i2c_get_clientdata(client);

/* kill outstanding polls */
del_timer_sync(&ir->timer);
flush_scheduled_work();
cancel_delayed_work_sync(&ir->work);

/* unregister devices */
input_unregister_device(ir->input);
Expand Down
3 changes: 1 addition & 2 deletions trunk/include/media/ir-kbd-i2c.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ struct IR_i2c {
/* Used to avoid fast repeating */
unsigned char old;

struct work_struct work;
struct timer_list timer;
struct delayed_work work;
char phys[32];
int (*get_key)(struct IR_i2c*, u32*, u32*);
};
Expand Down

0 comments on commit 1e5d7b2

Please sign in to comment.