aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/ir-kbd-i2c.c
diff options
context:
space:
mode:
authorDavid Härdeman <david@hardeman.nu>2010-10-29 15:08:23 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-12-29 05:16:37 -0500
commitd8b4b5822f51e2142b731b42c81e3f03eec475b2 (patch)
treefce9a9b7ca5031adc95fbd6be118352fb2527da5 /drivers/media/video/ir-kbd-i2c.c
parent4c7b355df6e7f05304e05f6b7a286e59a5f1cc54 (diff)
[media] ir-core: make struct rc_dev the primary interface
This patch merges the ir_input_dev and ir_dev_props structs into a single struct called rc_dev. The drivers and various functions in rc-core used by the drivers are also changed to use rc_dev as the primary interface when dealing with rc-core. This means that the input_dev is abstracted away from the drivers which is necessary if we ever want to support multiple input devs per rc device. The new API is similar to what the input subsystem uses, i.e: rc_device_alloc() rc_device_free() rc_device_register() rc_device_unregister() [mchehab@redhat.com: Fix compilation on mceusb and cx231xx, due to merge conflicts] Signed-off-by: David Härdeman <david@hardeman.nu> Acked-by: Jarod Wilson <jarod@redhat.com> Tested-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/ir-kbd-i2c.c')
-rw-r--r--drivers/media/video/ir-kbd-i2c.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c
index a78883a6e0e7..83b59a195230 100644
--- a/drivers/media/video/ir-kbd-i2c.c
+++ b/drivers/media/video/ir-kbd-i2c.c
@@ -252,7 +252,7 @@ static void ir_key_poll(struct IR_i2c *ir)
252 } 252 }
253 253
254 if (rc) 254 if (rc)
255 ir_keydown(ir->input, ir_key, 0); 255 ir_keydown(ir->rc, ir_key, 0);
256} 256}
257 257
258static void ir_work(struct work_struct *work) 258static void ir_work(struct work_struct *work)
@@ -271,20 +271,20 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
271 const char *name = NULL; 271 const char *name = NULL;
272 u64 ir_type = IR_TYPE_UNKNOWN; 272 u64 ir_type = IR_TYPE_UNKNOWN;
273 struct IR_i2c *ir; 273 struct IR_i2c *ir;
274 struct input_dev *input_dev; 274 struct rc_dev *rc;
275 struct i2c_adapter *adap = client->adapter; 275 struct i2c_adapter *adap = client->adapter;
276 unsigned short addr = client->addr; 276 unsigned short addr = client->addr;
277 int err; 277 int err;
278 278
279 ir = kzalloc(sizeof(struct IR_i2c),GFP_KERNEL); 279 ir = kzalloc(sizeof(struct IR_i2c),GFP_KERNEL);
280 input_dev = input_allocate_device(); 280 rc = rc_allocate_device();
281 if (!ir || !input_dev) { 281 if (!ir || !rc) {
282 err = -ENOMEM; 282 err = -ENOMEM;
283 goto err_out_free; 283 goto err_out_free;
284 } 284 }
285 285
286 ir->c = client; 286 ir->c = client;
287 ir->input = input_dev; 287 ir->rc = rc;
288 ir->polling_interval = DEFAULT_POLLING_INTERVAL; 288 ir->polling_interval = DEFAULT_POLLING_INTERVAL;
289 i2c_set_clientdata(client, ir); 289 i2c_set_clientdata(client, ir);
290 290
@@ -383,16 +383,18 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
383 dev_name(&client->dev)); 383 dev_name(&client->dev));
384 384
385 /* init + register input device */ 385 /* init + register input device */
386 input_dev->id.bustype = BUS_I2C; 386 rc->input_id.bustype = BUS_I2C;
387 input_dev->name = ir->name; 387 rc->input_name = ir->name;
388 input_dev->phys = ir->phys; 388 rc->input_phys = ir->phys;
389 rc->map_name = ir->ir_codes;
390 rc->driver_name = MODULE_NAME;
389 391
390 err = ir_input_register(ir->input, ir->ir_codes, NULL, MODULE_NAME); 392 err = rc_register_device(rc);
391 if (err) 393 if (err)
392 goto err_out_free; 394 goto err_out_free;
393 395
394 printk(MODULE_NAME ": %s detected at %s [%s]\n", 396 printk(MODULE_NAME ": %s detected at %s [%s]\n",
395 ir->input->name, ir->input->phys, adap->name); 397 ir->name, ir->phys, adap->name);
396 398
397 /* start polling via eventd */ 399 /* start polling via eventd */
398 INIT_DELAYED_WORK(&ir->work, ir_work); 400 INIT_DELAYED_WORK(&ir->work, ir_work);
@@ -401,6 +403,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
401 return 0; 403 return 0;
402 404
403 err_out_free: 405 err_out_free:
406 rc_free_device(rc);
404 kfree(ir); 407 kfree(ir);
405 return err; 408 return err;
406} 409}
@@ -413,7 +416,7 @@ static int ir_remove(struct i2c_client *client)
413 cancel_delayed_work_sync(&ir->work); 416 cancel_delayed_work_sync(&ir->work);
414 417
415 /* unregister device */ 418 /* unregister device */
416 ir_input_unregister(ir->input); 419 rc_unregister_device(ir->rc);
417 420
418 /* free memory */ 421 /* free memory */
419 kfree(ir); 422 kfree(ir);