• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

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

system/corennnnn


Commit MetaInfo

修订版fb5933318d51d7ecf9ef35a6a4504a2c337f00c4 (tree)
时间2016-09-29 12:32:06
作者Chih-Wei Huang <cwhuang@linu...>
CommiterChih-Wei Huang

Log Message

Merge remote-tracking branch 'x86/marshmallow-x86' into cm-13.0-x86

Conflicts:
init/devices.cpp
init/init.cpp

更改概述

差异

--- a/init/Android.mk
+++ b/init/Android.mk
@@ -38,6 +38,7 @@ include $(BUILD_STATIC_LIBRARY)
3838
3939 include $(CLEAR_VARS)
4040 LOCAL_CPPFLAGS := $(init_cflags)
41+LOCAL_CPPFLAGS += -DTARGET_PRODUCT=\"$(PRODUCT_RELEASE_NAME)\"
4142 LOCAL_SRC_FILES:= \
4243 bootchart.cpp \
4344 builtins.cpp \
--- a/init/devices.cpp
+++ b/init/devices.cpp
@@ -115,6 +115,7 @@ struct module_alias_node {
115115
116116 struct module_blacklist_node {
117117 char *name;
118+ bool deferred;
118119 struct listnode list;
119120 };
120121
@@ -852,7 +853,7 @@ static void handle_generic_device_event(struct uevent *uevent)
852853 uevent->major, uevent->minor, links);
853854 }
854855
855-static int is_module_blacklisted(const char *name)
856+static int is_module_blacklisted_or_deferred(const char *name, bool need_deferred)
856857 {
857858 struct listnode *blklst_node;
858859 struct module_blacklist_node *blacklist;
@@ -867,7 +868,7 @@ static int is_module_blacklisted(const char *name)
867868 list);
868869 if (!strcmp(name, blacklist->name)) {
869870 INFO("modules %s is blacklisted\n", name);
870- ret = 1;
871+ ret = blacklist->deferred ? (need_deferred ? 2 : 0) : 1;
871872 goto out;
872873 }
873874 }
@@ -876,7 +877,7 @@ out:
876877 return ret;
877878 }
878879
879-static int load_module_by_device_modalias(const char *id)
880+static int load_module_by_device_modalias(const char *id, bool need_deferred)
880881 {
881882 struct listnode *alias_node;
882883 struct module_alias_node *alias;
@@ -889,8 +890,9 @@ static int load_module_by_device_modalias(const char *id)
889890 if (fnmatch(alias->pattern, id, 0) == 0) {
890891 INFO("trying to load module %s due to uevents\n", alias->name);
891892
892- if (!is_module_blacklisted(alias->name)) {
893- if (insmod_by_dep(alias->name, "", NULL, 0, NULL)) {
893+ ret = is_module_blacklisted_or_deferred(alias->name, need_deferred);
894+ if (ret == 0) {
895+ if ((ret = insmod_by_dep(alias->name, "", NULL, 0, NULL))) {
894896 /* cannot load module. try another one since
895897 * there may be another match.
896898 */
@@ -899,8 +901,9 @@ static int load_module_by_device_modalias(const char *id)
899901 } else {
900902 /* loading was successful */
901903 INFO("loaded module %s due to uevents\n", alias->name);
902- ret = 0;
903904 }
905+ } else {
906+ NOTICE("blacklisted module %s: %d\n", alias->name, ret);
904907 }
905908 }
906909 }
@@ -924,7 +927,7 @@ static void handle_deferred_module_loading()
924927
925928 if (alias && alias->pattern) {
926929 INFO("deferred loading of module for %s\n", alias->pattern);
927- load_module_by_device_modalias(alias->pattern);
930+ load_module_by_device_modalias(alias->pattern, false);
928931 free(alias->pattern);
929932 list_remove(node);
930933 free(alias);
@@ -942,7 +945,12 @@ int module_probe(const char *modalias)
942945 return -1;
943946 }
944947
945- return modalias ? load_module_by_device_modalias(modalias) : -1;
948+ return modalias ? load_module_by_device_modalias(modalias, false) : -1;
949+}
950+
951+static int is_booting(void)
952+{
953+ return access("/dev/.booting", F_OK) == 0;
946954 }
947955
948956 static void handle_module_loading(const char *modalias)
@@ -955,13 +963,13 @@ static void handle_module_loading(const char *modalias)
955963 if (list_empty(&modules_aliases_map)) {
956964 if (read_modules_aliases() == 0) {
957965 read_modules_blacklist();
958- handle_deferred_module_loading();
959966 }
960967 }
961968
962969 if (!modalias) return;
963970
964- if (list_empty(&modules_aliases_map)) {
971+ if (list_empty(&modules_aliases_map) ||
972+ load_module_by_device_modalias(modalias, is_booting()) == 2) {
965973 /* if module alias mapping is empty,
966974 * queue it for loading later
967975 */
@@ -978,8 +986,6 @@ static void handle_module_loading(const char *modalias)
978986 } else {
979987 ERROR("failed to allocate memory to store device id for deferred module loading.\n");
980988 }
981- } else {
982- load_module_by_device_modalias(modalias);
983989 }
984990
985991 }
@@ -1045,11 +1051,6 @@ static int load_firmware(int fw_fd, gzFile gz_fd, int loading_fd, int data_fd)
10451051 return ret;
10461052 }
10471053
1048-static int is_booting(void)
1049-{
1050- return access("/dev/.booting", F_OK) == 0;
1051-}
1052-
10531054 gzFile fw_gzopen(const char *fname, const char *mode)
10541055 {
10551056 char *file1 = NULL;
@@ -1190,6 +1191,7 @@ static void parse_line_module_alias(struct parse_state *state, int nargs, char *
11901191 static void parse_line_module_blacklist(struct parse_state *state, int nargs, char **args)
11911192 {
11921193 struct module_blacklist_node *node;
1194+ bool deferred;
11931195
11941196 if (!args ||
11951197 (nargs != 2) ||
@@ -1198,8 +1200,13 @@ static void parse_line_module_blacklist(struct parse_state *state, int nargs, ch
11981200 return;
11991201 }
12001202
1201- /* this line does not being with "blacklist" */
1202- if (strncmp(args[0], "blacklist", 9)) return;
1203+ /* this line should be with "blacklist" or "deferred" */
1204+ if (!strncmp(args[0], "blacklist", 9))
1205+ deferred = false;
1206+ else if (!strncmp(args[0], "deferred", 8))
1207+ deferred = true;
1208+ else
1209+ return;
12031210
12041211 node = (module_blacklist_node *) calloc(1, sizeof(*node));
12051212 if (!node) return;
@@ -1209,6 +1216,7 @@ static void parse_line_module_blacklist(struct parse_state *state, int nargs, ch
12091216 free(node);
12101217 return;
12111218 }
1219+ node->deferred = deferred;
12121220
12131221 list_add_tail(&modules_blacklist, &node->list);
12141222 }
@@ -1406,6 +1414,7 @@ void device_init(bool child)
14061414 coldboot("/sys/class");
14071415 coldboot("/sys/block");
14081416 coldboot("/sys/devices");
1417+ handle_deferred_module_loading();
14091418 close(open(COLDBOOT_DONE, O_WRONLY|O_CREAT|O_CLOEXEC, 0000));
14101419 NOTICE("Coldboot took %.2fs.\n", t.duration());
14111420 }
--- a/init/init.cpp
+++ b/init/init.cpp
@@ -818,7 +818,7 @@ static void export_kernel_boot_props() {
818818 { "ro.boot.mode", "ro.bootmode", "unknown", },
819819 { "ro.boot.baseband", "ro.baseband", "unknown", },
820820 { "ro.boot.bootloader", "ro.bootloader", "unknown", },
821- { "ro.boot.hardware", "ro.hardware", "unknown", },
821+ { "ro.boot.hardware", "ro.hardware", TARGET_PRODUCT, },
822822 #ifndef IGNORE_RO_BOOT_REVISION
823823 { "ro.boot.revision", "ro.revision", "0", },
824824 #endif