浏览代码

Don't cache config location in the DPM code

Now that we cache the configuration location in the configuration code
itself, we don't need to cache it elsewhere.  This makes the DPM code
for evaluating Type-C Current much cleaner.
Clara Hobbs 7 年前
父节点
当前提交
042f47e110
共有 1 个文件被更改,包括 1 次插入7 次删除
  1. 1
    7
      src/device_policy_manager.c

+ 1
- 7
src/device_policy_manager.c 查看文件

@@ -187,13 +187,7 @@ bool pdb_dpm_giveback_enabled(void)
187 187
 
188 188
 bool pdb_dpm_evaluate_typec_current(void)
189 189
 {
190
-    static struct pdb_config *cfg = NULL;
191
-
192
-    /* Get the configuration the first time this function runs, and again any
193
-     * time the status is found to not be valid. */
194
-    if (cfg == NULL || cfg->status != PDB_CONFIG_STATUS_VALID) {
195
-        cfg = pdb_config_flash_read();
196
-    }
190
+    struct pdb_config *cfg = pdb_config_flash_read();
197 191
 
198 192
     /* We don't control the voltage anymore; it will always be 5 V. */
199 193
     dpm_requested_voltage = PD_MV2PDV(5000);

正在加载...
取消
保存