aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Young <sean@mess.org>2017-02-25 06:51:31 -0500
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2017-12-14 09:58:34 -0500
commit5e55f58000ae5f646119a14b27afca3cd7fba262 (patch)
tree481138b24ccbd083dffe09117f3dd9474c1dee96
parent1540d7228f09358f580bdea0663c2af65d89c129 (diff)
media: rc: auto load encoder if necessary
When sending scancodes, load the encoder if we need it. Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
-rw-r--r--drivers/media/rc/rc-core-priv.h1
-rw-r--r--drivers/media/rc/rc-ir-raw.c2
-rw-r--r--drivers/media/rc/rc-main.c2
3 files changed, 4 insertions, 1 deletions
diff --git a/drivers/media/rc/rc-core-priv.h b/drivers/media/rc/rc-core-priv.h
index 2fab4069c023..6014f116cba2 100644
--- a/drivers/media/rc/rc-core-priv.h
+++ b/drivers/media/rc/rc-core-priv.h
@@ -261,6 +261,7 @@ void ir_raw_event_free(struct rc_dev *dev);
void ir_raw_event_unregister(struct rc_dev *dev);
int ir_raw_handler_register(struct ir_raw_handler *ir_raw_handler);
void ir_raw_handler_unregister(struct ir_raw_handler *ir_raw_handler);
+void ir_raw_load_modules(u64 *protocols);
void ir_raw_init(void);
/*
diff --git a/drivers/media/rc/rc-ir-raw.c b/drivers/media/rc/rc-ir-raw.c
index 208db8a5adff..78638d1b73cc 100644
--- a/drivers/media/rc/rc-ir-raw.c
+++ b/drivers/media/rc/rc-ir-raw.c
@@ -448,6 +448,8 @@ int ir_raw_encode_scancode(enum rc_proto protocol, u32 scancode,
int ret = -EINVAL;
u64 mask = 1ULL << protocol;
+ ir_raw_load_modules(&mask);
+
mutex_lock(&ir_raw_handler_lock);
list_for_each_entry(handler, &ir_raw_handler_list, list) {
if (handler->protocols & mask && handler->encode) {
diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
index 372f4d61cb48..29a90adb0f7c 100644
--- a/drivers/media/rc/rc-main.c
+++ b/drivers/media/rc/rc-main.c
@@ -1082,7 +1082,7 @@ static int parse_protocol_change(u64 *protocols, const char *buf)
return count;
}
-static void ir_raw_load_modules(u64 *protocols)
+void ir_raw_load_modules(u64 *protocols)
{
u64 available;
int i, ret;

Privacy Policy