Skip to content

Commit

Permalink
[media] rc: Pospone ir raw decoders loading until really needed
Browse files Browse the repository at this point in the history
This changes rc_core to not load the IR decoders at load time,
postponing it to load only if a RC_DRIVER_IR_RAW device is
registered via rc_register_device.
We use a static boolean variable, to ensure decoders modules
are only loaded once.
Tested with rc-loopback device only.

Signed-off-by: Ezequiel Garcia <elezegarcia@gmail.com>
Acked-by: Jarod Wilson <jarod@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Ezequiel García authored and Mauro Carvalho Chehab committed Mar 20, 2012
1 parent 593a2ce commit 5da6e98
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions drivers/media/rc/rc-main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1029,6 +1029,7 @@ EXPORT_SYMBOL_GPL(rc_free_device);

int rc_register_device(struct rc_dev *dev)
{
static bool raw_init = false; /* raw decoders loaded? */
static atomic_t devno = ATOMIC_INIT(0);
struct rc_map *rc_map;
const char *path;
Expand Down Expand Up @@ -1103,6 +1104,12 @@ int rc_register_device(struct rc_dev *dev)
kfree(path);

if (dev->driver_type == RC_DRIVER_IR_RAW) {
/* Load raw decoders, if they aren't already */
if (!raw_init) {
IR_dprintk(1, "Loading raw decoders\n");
ir_raw_init();
raw_init = true;
}
rc = ir_raw_event_register(dev);
if (rc < 0)
goto out_input;
Expand Down Expand Up @@ -1176,8 +1183,6 @@ static int __init rc_core_init(void)
return rc;
}

/* Initialize/load the decoders/keymap code that will be used */
ir_raw_init();
rc_map_register(&empty_map);

return 0;
Expand Down

0 comments on commit 5da6e98

Please sign in to comment.