aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/rc
diff options
context:
space:
mode:
authorKonstantin Khlebnikov <khlebnikov@openvz.org>2012-12-14 05:02:48 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-12-27 14:45:40 -0500
commita4bb6f353e287f51a52a347670fd60938a566c25 (patch)
tree46322aeee9382370f7a41495145791783726c2ab /drivers/media/rc
parentf7c3f5ce17a135610b114a17e917b5a53c4d07c4 (diff)
[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: Konstantin Khlebnikov <khlebnikov@openvz.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/rc')
-rw-r--r--drivers/media/rc/ir-raw.c17
-rw-r--r--drivers/media/rc/rc-core-priv.h16
2 files changed, 9 insertions, 24 deletions
diff --git a/drivers/media/rc/ir-raw.c b/drivers/media/rc/ir-raw.c
index 97dc8d13b06b..17c94be9f24c 100644
--- a/drivers/media/rc/ir-raw.c
+++ b/drivers/media/rc/ir-raw.c
@@ -31,11 +31,6 @@ static DEFINE_MUTEX(ir_raw_handler_lock);
31static LIST_HEAD(ir_raw_handler_list); 31static LIST_HEAD(ir_raw_handler_list);
32static u64 available_protocols; 32static u64 available_protocols;
33 33
34#ifdef MODULE
35/* Used to load the decoders */
36static struct work_struct wq_load;
37#endif
38
39static int ir_raw_event_thread(void *data) 34static int ir_raw_event_thread(void *data)
40{ 35{
41 struct ir_raw_event ev; 36 struct ir_raw_event ev;
@@ -347,8 +342,7 @@ void ir_raw_handler_unregister(struct ir_raw_handler *ir_raw_handler)
347} 342}
348EXPORT_SYMBOL(ir_raw_handler_unregister); 343EXPORT_SYMBOL(ir_raw_handler_unregister);
349 344
350#ifdef MODULE 345void ir_raw_init(void)
351static void init_decoders(struct work_struct *work)
352{ 346{
353 /* Load the decoder modules */ 347 /* Load the decoder modules */
354 348
@@ -365,12 +359,3 @@ static void init_decoders(struct work_struct *work)
365 it is needed to change the CONFIG_MODULE test at rc-core.h 359 it is needed to change the CONFIG_MODULE test at rc-core.h
366 */ 360 */
367} 361}
368#endif
369
370void ir_raw_init(void)
371{
372#ifdef MODULE
373 INIT_WORK(&wq_load, init_decoders);
374 schedule_work(&wq_load);
375#endif
376}
diff --git a/drivers/media/rc/rc-core-priv.h b/drivers/media/rc/rc-core-priv.h
index 96f0a8bb39ea..5d87287ed372 100644
--- a/drivers/media/rc/rc-core-priv.h
+++ b/drivers/media/rc/rc-core-priv.h
@@ -165,56 +165,56 @@ void ir_raw_init(void);
165 165
166/* from ir-nec-decoder.c */ 166/* from ir-nec-decoder.c */
167#ifdef CONFIG_IR_NEC_DECODER_MODULE 167#ifdef CONFIG_IR_NEC_DECODER_MODULE
168#define load_nec_decode() request_module("ir-nec-decoder") 168#define load_nec_decode() request_module_nowait("ir-nec-decoder")
169#else 169#else
170static inline void load_nec_decode(void) { } 170static inline void load_nec_decode(void) { }
171#endif 171#endif
172 172
173/* from ir-rc5-decoder.c */ 173/* from ir-rc5-decoder.c */
174#ifdef CONFIG_IR_RC5_DECODER_MODULE 174#ifdef CONFIG_IR_RC5_DECODER_MODULE
175#define load_rc5_decode() request_module("ir-rc5-decoder") 175#define load_rc5_decode() request_module_nowait("ir-rc5-decoder")
176#else 176#else
177static inline void load_rc5_decode(void) { } 177static inline void load_rc5_decode(void) { }
178#endif 178#endif
179 179
180/* from ir-rc6-decoder.c */ 180/* from ir-rc6-decoder.c */
181#ifdef CONFIG_IR_RC6_DECODER_MODULE 181#ifdef CONFIG_IR_RC6_DECODER_MODULE
182#define load_rc6_decode() request_module("ir-rc6-decoder") 182#define load_rc6_decode() request_module_nowait("ir-rc6-decoder")
183#else 183#else
184static inline void load_rc6_decode(void) { } 184static inline void load_rc6_decode(void) { }
185#endif 185#endif
186 186
187/* from ir-jvc-decoder.c */ 187/* from ir-jvc-decoder.c */
188#ifdef CONFIG_IR_JVC_DECODER_MODULE 188#ifdef CONFIG_IR_JVC_DECODER_MODULE
189#define load_jvc_decode() request_module("ir-jvc-decoder") 189#define load_jvc_decode() request_module_nowait("ir-jvc-decoder")
190#else 190#else
191static inline void load_jvc_decode(void) { } 191static inline void load_jvc_decode(void) { }
192#endif 192#endif
193 193
194/* from ir-sony-decoder.c */ 194/* from ir-sony-decoder.c */
195#ifdef CONFIG_IR_SONY_DECODER_MODULE 195#ifdef CONFIG_IR_SONY_DECODER_MODULE
196#define load_sony_decode() request_module("ir-sony-decoder") 196#define load_sony_decode() request_module_nowait("ir-sony-decoder")
197#else 197#else
198static inline void load_sony_decode(void) { } 198static inline void load_sony_decode(void) { }
199#endif 199#endif
200 200
201/* from ir-sanyo-decoder.c */ 201/* from ir-sanyo-decoder.c */
202#ifdef CONFIG_IR_SANYO_DECODER_MODULE 202#ifdef CONFIG_IR_SANYO_DECODER_MODULE
203#define load_sanyo_decode() request_module("ir-sanyo-decoder") 203#define load_sanyo_decode() request_module_nowait("ir-sanyo-decoder")
204#else 204#else
205static inline void load_sanyo_decode(void) { } 205static inline void load_sanyo_decode(void) { }
206#endif 206#endif
207 207
208/* from ir-mce_kbd-decoder.c */ 208/* from ir-mce_kbd-decoder.c */
209#ifdef CONFIG_IR_MCE_KBD_DECODER_MODULE 209#ifdef CONFIG_IR_MCE_KBD_DECODER_MODULE
210#define load_mce_kbd_decode() request_module("ir-mce_kbd-decoder") 210#define load_mce_kbd_decode() request_module_nowait("ir-mce_kbd-decoder")
211#else 211#else
212static inline void load_mce_kbd_decode(void) { } 212static inline void load_mce_kbd_decode(void) { }
213#endif 213#endif
214 214
215/* from ir-lirc-codec.c */ 215/* from ir-lirc-codec.c */
216#ifdef CONFIG_IR_LIRC_CODEC_MODULE 216#ifdef CONFIG_IR_LIRC_CODEC_MODULE
217#define load_lirc_codec() request_module("ir-lirc-codec") 217#define load_lirc_codec() request_module_nowait("ir-lirc-codec")
218#else 218#else
219static inline void load_lirc_codec(void) { } 219static inline void load_lirc_codec(void) { }
220#endif 220#endif