Commit 5da6e984 authored by Ezequiel García's avatar Ezequiel García Committed by Mauro Carvalho Chehab

[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: default avatarEzequiel Garcia <elezegarcia@gmail.com>
Acked-by: default avatarJarod Wilson <jarod@redhat.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 593a2ce0
...@@ -1029,6 +1029,7 @@ EXPORT_SYMBOL_GPL(rc_free_device); ...@@ -1029,6 +1029,7 @@ EXPORT_SYMBOL_GPL(rc_free_device);
int rc_register_device(struct rc_dev *dev) int rc_register_device(struct rc_dev *dev)
{ {
static bool raw_init = false; /* raw decoders loaded? */
static atomic_t devno = ATOMIC_INIT(0); static atomic_t devno = ATOMIC_INIT(0);
struct rc_map *rc_map; struct rc_map *rc_map;
const char *path; const char *path;
...@@ -1103,6 +1104,12 @@ int rc_register_device(struct rc_dev *dev) ...@@ -1103,6 +1104,12 @@ int rc_register_device(struct rc_dev *dev)
kfree(path); kfree(path);
if (dev->driver_type == RC_DRIVER_IR_RAW) { 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); rc = ir_raw_event_register(dev);
if (rc < 0) if (rc < 0)
goto out_input; goto out_input;
...@@ -1176,8 +1183,6 @@ static int __init rc_core_init(void) ...@@ -1176,8 +1183,6 @@ static int __init rc_core_init(void)
return rc; return rc;
} }
/* Initialize/load the decoders/keymap code that will be used */
ir_raw_init();
rc_map_register(&empty_map); rc_map_register(&empty_map);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment