diff options
Diffstat (limited to 'linux/drivers/media/video/ir-kbd-i2c.c')
-rw-r--r-- | linux/drivers/media/video/ir-kbd-i2c.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/linux/drivers/media/video/ir-kbd-i2c.c b/linux/drivers/media/video/ir-kbd-i2c.c index ce7655dc0..a1673ca59 100644 --- a/linux/drivers/media/video/ir-kbd-i2c.c +++ b/linux/drivers/media/video/ir-kbd-i2c.c @@ -1,5 +1,5 @@ /* - * $Id: ir-kbd-i2c.c,v 1.28 2005/11/20 02:13:48 mchehab Exp $ + * $Id: ir-kbd-i2c.c,v 1.29 2005/12/04 01:12:43 rmcc Exp $ * * keyboard input driver for i2c IR remote controls * @@ -253,9 +253,9 @@ static void ir_key_poll(struct IR_i2c *ir) } if (0 == rc) { - ir_input_nokey(&ir->input,&ir->ir); + ir_input_nokey(ir->input, &ir->ir); } else { - ir_input_keydown(&ir->input,&ir->ir, ir_key, ir_raw); + ir_input_keydown(ir->input, &ir->ir, ir_key, ir_raw); } } @@ -300,12 +300,19 @@ static int ir_attach(struct i2c_adapter *adap, int addr, char *name; int ir_type; struct IR_i2c *ir; + struct input_dev *input_dev; - if (NULL == (ir = kmalloc(sizeof(struct IR_i2c),GFP_KERNEL))) + ir = kzalloc(sizeof(struct IR_i2c),GFP_KERNEL); + input_dev = input_allocate_device(); + if (!ir || !input_dev) { + input_free_device(input_dev); + kfree(ir); return -ENOMEM; + } memset(ir,0,sizeof(*ir)); ir->c = client_template; + ir->input = input_dev; ir->c.adapter = adap; ir->c.addr = addr; @@ -374,15 +381,15 @@ static int ir_attach(struct i2c_adapter *adap, int addr, ir->c.dev.bus_id); /* init + register input device */ - ir_input_init(&ir->input,&ir->ir,ir_type,ir->ir_codes); - ir->input.id.bustype = BUS_I2C; - ir->input.name = ir->c.name; - ir->input.phys = ir->phys; + ir_input_init(input_dev,&ir->ir,ir_type,ir->ir_codes); + input_dev->id.bustype = BUS_I2C; + input_dev->name = ir->c.name; + input_dev->phys = ir->phys; /* register event device */ - input_register_device(&ir->input); + input_register_device(ir->input); printk(DEVNAME ": %s detected at %s [%s]\n", - ir->input.name,ir->input.phys,adap->name); + ir->input->name,ir->input->phys,adap->name); /* start polling via eventd */ INIT_WORK(&ir->work, ir_work, ir); @@ -403,7 +410,7 @@ static int ir_detach(struct i2c_client *client) flush_scheduled_work(); /* unregister devices */ - input_unregister_device(&ir->input); + input_unregister_device(ir->input); i2c_detach_client(&ir->c); /* free memory */ |