Commit a4bb6f35 authored by Konstantin Khlebnikov's avatar Konstantin Khlebnikov Committed by Mauro Carvalho Chehab

[media] media/rc: fix oops on unloading module rc-core

During modiles initialization rc-core schedules work which calls
request_module() several times to load ir-*-decoder modules, but
it does not wait or cancel this work on module unloading.
rc-core should use request_module_nowait() instead, because it
anyway cannot load modules synchronously or cancel/wait pending
work on unloading, because this leads to deadlock on modules_mutex
between several "modprobe" processes.
Signed-off-by: default avatarKonstantin Khlebnikov <khlebnikov@openvz.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent f7c3f5ce
...@@ -31,11 +31,6 @@ static DEFINE_MUTEX(ir_raw_handler_lock); ...@@ -31,11 +31,6 @@ static DEFINE_MUTEX(ir_raw_handler_lock);
static LIST_HEAD(ir_raw_handler_list); static LIST_HEAD(ir_raw_handler_list);
static u64 available_protocols; static u64 available_protocols;
#ifdef MODULE
/* Used to load the decoders */
static struct work_struct wq_load;
#endif
static int ir_raw_event_thread(void *data) static int ir_raw_event_thread(void *data)
{ {
struct ir_raw_event ev; struct ir_raw_event ev;
...@@ -347,8 +342,7 @@ void ir_raw_handler_unregister(struct ir_raw_handler *ir_raw_handler) ...@@ -347,8 +342,7 @@ void ir_raw_handler_unregister(struct ir_raw_handler *ir_raw_handler)
} }
EXPORT_SYMBOL(ir_raw_handler_unregister); EXPORT_SYMBOL(ir_raw_handler_unregister);
#ifdef MODULE void ir_raw_init(void)
static void init_decoders(struct work_struct *work)
{ {
/* Load the decoder modules */ /* Load the decoder modules */
...@@ -365,12 +359,3 @@ static void init_decoders(struct work_struct *work) ...@@ -365,12 +359,3 @@ static void init_decoders(struct work_struct *work)
it is needed to change the CONFIG_MODULE test at rc-core.h it is needed to change the CONFIG_MODULE test at rc-core.h
*/ */
} }
#endif
void ir_raw_init(void)
{
#ifdef MODULE
INIT_WORK(&wq_load, init_decoders);
schedule_work(&wq_load);
#endif
}
...@@ -165,56 +165,56 @@ void ir_raw_init(void); ...@@ -165,56 +165,56 @@ void ir_raw_init(void);
/* from ir-nec-decoder.c */ /* from ir-nec-decoder.c */
#ifdef CONFIG_IR_NEC_DECODER_MODULE #ifdef CONFIG_IR_NEC_DECODER_MODULE
#define load_nec_decode() request_module("ir-nec-decoder") #define load_nec_decode() request_module_nowait("ir-nec-decoder")
#else #else
static inline void load_nec_decode(void) { } static inline void load_nec_decode(void) { }
#endif #endif
/* from ir-rc5-decoder.c */ /* from ir-rc5-decoder.c */
#ifdef CONFIG_IR_RC5_DECODER_MODULE #ifdef CONFIG_IR_RC5_DECODER_MODULE
#define load_rc5_decode() request_module("ir-rc5-decoder") #define load_rc5_decode() request_module_nowait("ir-rc5-decoder")
#else #else
static inline void load_rc5_decode(void) { } static inline void load_rc5_decode(void) { }
#endif #endif
/* from ir-rc6-decoder.c */ /* from ir-rc6-decoder.c */
#ifdef CONFIG_IR_RC6_DECODER_MODULE #ifdef CONFIG_IR_RC6_DECODER_MODULE
#define load_rc6_decode() request_module("ir-rc6-decoder") #define load_rc6_decode() request_module_nowait("ir-rc6-decoder")
#else #else
static inline void load_rc6_decode(void) { } static inline void load_rc6_decode(void) { }
#endif #endif
/* from ir-jvc-decoder.c */ /* from ir-jvc-decoder.c */
#ifdef CONFIG_IR_JVC_DECODER_MODULE #ifdef CONFIG_IR_JVC_DECODER_MODULE
#define load_jvc_decode() request_module("ir-jvc-decoder") #define load_jvc_decode() request_module_nowait("ir-jvc-decoder")
#else #else
static inline void load_jvc_decode(void) { } static inline void load_jvc_decode(void) { }
#endif #endif
/* from ir-sony-decoder.c */ /* from ir-sony-decoder.c */
#ifdef CONFIG_IR_SONY_DECODER_MODULE #ifdef CONFIG_IR_SONY_DECODER_MODULE
#define load_sony_decode() request_module("ir-sony-decoder") #define load_sony_decode() request_module_nowait("ir-sony-decoder")
#else #else
static inline void load_sony_decode(void) { } static inline void load_sony_decode(void) { }
#endif #endif
/* from ir-sanyo-decoder.c */ /* from ir-sanyo-decoder.c */
#ifdef CONFIG_IR_SANYO_DECODER_MODULE #ifdef CONFIG_IR_SANYO_DECODER_MODULE
#define load_sanyo_decode() request_module("ir-sanyo-decoder") #define load_sanyo_decode() request_module_nowait("ir-sanyo-decoder")
#else #else
static inline void load_sanyo_decode(void) { } static inline void load_sanyo_decode(void) { }
#endif #endif
/* from ir-mce_kbd-decoder.c */ /* from ir-mce_kbd-decoder.c */
#ifdef CONFIG_IR_MCE_KBD_DECODER_MODULE #ifdef CONFIG_IR_MCE_KBD_DECODER_MODULE
#define load_mce_kbd_decode() request_module("ir-mce_kbd-decoder") #define load_mce_kbd_decode() request_module_nowait("ir-mce_kbd-decoder")
#else #else
static inline void load_mce_kbd_decode(void) { } static inline void load_mce_kbd_decode(void) { }
#endif #endif
/* from ir-lirc-codec.c */ /* from ir-lirc-codec.c */
#ifdef CONFIG_IR_LIRC_CODEC_MODULE #ifdef CONFIG_IR_LIRC_CODEC_MODULE
#define load_lirc_codec() request_module("ir-lirc-codec") #define load_lirc_codec() request_module_nowait("ir-lirc-codec")
#else #else
static inline void load_lirc_codec(void) { } static inline void load_lirc_codec(void) { }
#endif #endif
......
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