• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

system/core


Commit MetaInfo

Revisión11c6ac28c34f548ff57f0a3407e0b32170b4c3c9 (tree)
Tiempo2013-07-25 17:05:39
AutorChih-Wei Huang <cwhuang@linu...>
CommiterChih-Wei Huang

Log Message

ueventd: load modules in a forked process

Loading some modules (e.g., ath3k) will be blocked to wait for
firmware. The forking is necessary, otherwise ueventd has no
chance to load the firmware.

Cambiar Resumen

Diferencia incremental

--- a/init/devices.c
+++ b/init/devices.c
@@ -720,14 +720,12 @@ out:
720720 return ret;
721721 }
722722
723-static int load_module_by_device_modalias(const char *id)
723+static int do_load_module_by_device_modalias(const char *id)
724724 {
725725 struct listnode *alias_node;
726726 struct module_alias_node *alias;
727727 int ret = -1;
728728
729- if (!id) goto out;
730-
731729 list_for_each(alias_node, &modules_aliases_map) {
732730 alias = node_to_item(alias_node, struct module_alias_node, list);
733731
@@ -746,27 +744,38 @@ static int load_module_by_device_modalias(const char *id)
746744 /* loading was successful */
747745 INFO("loaded module %s due to uevents\n", alias->name);
748746 ret = 0;
749- goto out;
747+ break;
750748 }
751749 }
752750 }
753751 }
754752 }
755753
756-out:
757754 return ret;
758755 }
759756
760-static void handle_deferred_module_loading()
757+static void load_module_by_device_modalias(const char *id)
761758 {
762- struct listnode *node = NULL;
763- struct listnode *next = NULL;
764- struct module_alias_node *alias = NULL;
759+ if (id) {
760+ pid_t pid = fork();
761+ if (!pid) {
762+ exit(do_load_module_by_device_modalias(id));
763+ } else if (pid < 0) {
764+ ERROR("failed to fork for loading %s\n", id);
765+ }
766+ }
767+}
765768
769+static void handle_deferred_module_loading()
770+{
766771 /* try to read the module alias mapping if map is empty
767772 * if succeed, loading all the modules in the queue
768773 */
769774 if (!list_empty(&modules_aliases_map)) {
775+ struct listnode *node = NULL;
776+ struct listnode *next = NULL;
777+ struct module_alias_node *alias = NULL;
778+
770779 list_for_each_safe(node, next, &deferred_module_loading_list) {
771780 alias = node_to_item(node, struct module_alias_node, list);
772781
@@ -790,7 +799,7 @@ int module_probe(const char *modalias)
790799 return -1;
791800 }
792801
793- return load_module_by_device_modalias(modalias);
802+ return modalias ? do_load_module_by_device_modalias(modalias) : -1;
794803 }
795804
796805 static void handle_module_loading(const char *modalias)