media: rc: auto load encoder if necessary
authorSean Young <sean@mess.org>
Sat, 25 Feb 2017 11:51:31 +0000 (06:51 -0500)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Thu, 14 Dec 2017 15:35:16 +0000 (10:35 -0500)
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>
drivers/media/rc/rc-core-priv.h
drivers/media/rc/rc-ir-raw.c
drivers/media/rc/rc-main.c

index 2fab4069c023aafb4b2d923dba701011cc3f9fea..6014f116cba2b7a61cf5d369eae61e32e2294bbd 100644 (file)
@@ -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);
 
 /*
index 208db8a5adff5f92b562eee0c6f43d2add3a2d9d..78638d1b73ccc88e6c562a207ff23e3395eea548 100644 (file)
@@ -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) {
index 372f4d61cb4853226133e167e36931bc8bfdec98..29a90adb0f7c6620253d7fa2fef8612371a56c7d 100644 (file)
@@ -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;