diff options
author | Ezequiel GarcĂa <elezegarcia@gmail.com> | 2012-03-15 19:53:49 (GMT) |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-03-20 01:11:04 (GMT) |
commit | 5da6e984805786c4d96498e1c51e971007dea6dc (patch) | |
tree | 68785330cc2b7f1b4fcb305b5728414416aebfe6 /drivers/media/rc | |
parent | 593a2ce0ae22188538d27933236a6acab57a0e65 (diff) | |
download | linux-5da6e984805786c4d96498e1c51e971007dea6dc.tar.xz |
[media] rc: Pospone ir raw decoders loading until really needed
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>
Diffstat (limited to 'drivers/media/rc')
-rw-r--r-- | drivers/media/rc/rc-main.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c index f6a930b..6e16b09 100644 --- a/drivers/media/rc/rc-main.c +++ b/drivers/media/rc/rc-main.c @@ -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; @@ -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; @@ -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; |