Commit 7469cd3c authored by Daeseok Youn's avatar Daeseok Youn Committed by Greg Kroah-Hartman

staging: atomisp: use local variable to reduce number of references

Define new local variable to reduce the number of reference.
The new local variable is added to save the addess of dfs
and used in atomisp_freq_scaling() function.
Signed-off-by: default avatarDaeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: default avatarAlan Cox <alan@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent d317d054
...@@ -251,6 +251,7 @@ int atomisp_freq_scaling(struct atomisp_device *isp, ...@@ -251,6 +251,7 @@ int atomisp_freq_scaling(struct atomisp_device *isp,
{ {
/* FIXME! Only use subdev[0] status yet */ /* FIXME! Only use subdev[0] status yet */
struct atomisp_sub_device *asd = &isp->asd[0]; struct atomisp_sub_device *asd = &isp->asd[0];
const struct atomisp_dfs_config *dfs;
unsigned int new_freq; unsigned int new_freq;
struct atomisp_freq_scaling_rule curr_rules; struct atomisp_freq_scaling_rule curr_rules;
int i, ret; int i, ret;
...@@ -265,20 +266,22 @@ int atomisp_freq_scaling(struct atomisp_device *isp, ...@@ -265,20 +266,22 @@ int atomisp_freq_scaling(struct atomisp_device *isp,
ATOMISP_PCI_DEVICE_SOC_CHT && ATOMISP_USE_YUVPP(asd)) ATOMISP_PCI_DEVICE_SOC_CHT && ATOMISP_USE_YUVPP(asd))
isp->dfs = &dfs_config_cht_soc; isp->dfs = &dfs_config_cht_soc;
if (isp->dfs->lowest_freq == 0 || isp->dfs->max_freq_at_vmin == 0 || dfs = isp->dfs;
isp->dfs->highest_freq == 0 || isp->dfs->dfs_table_size == 0 ||
!isp->dfs->dfs_table) { if (dfs->lowest_freq == 0 || dfs->max_freq_at_vmin == 0 ||
dfs->highest_freq == 0 || dfs->dfs_table_size == 0 ||
!dfs->dfs_table) {
dev_err(isp->dev, "DFS configuration is invalid.\n"); dev_err(isp->dev, "DFS configuration is invalid.\n");
return -EINVAL; return -EINVAL;
} }
if (mode == ATOMISP_DFS_MODE_LOW) { if (mode == ATOMISP_DFS_MODE_LOW) {
new_freq = isp->dfs->lowest_freq; new_freq = dfs->lowest_freq;
goto done; goto done;
} }
if (mode == ATOMISP_DFS_MODE_MAX) { if (mode == ATOMISP_DFS_MODE_MAX) {
new_freq = isp->dfs->highest_freq; new_freq = dfs->highest_freq;
goto done; goto done;
} }
...@@ -304,26 +307,26 @@ int atomisp_freq_scaling(struct atomisp_device *isp, ...@@ -304,26 +307,26 @@ int atomisp_freq_scaling(struct atomisp_device *isp,
} }
/* search for the target frequency by looping freq rules*/ /* search for the target frequency by looping freq rules*/
for (i = 0; i < isp->dfs->dfs_table_size; i++) { for (i = 0; i < dfs->dfs_table_size; i++) {
if (curr_rules.width != isp->dfs->dfs_table[i].width && if (curr_rules.width != dfs->dfs_table[i].width &&
isp->dfs->dfs_table[i].width != ISP_FREQ_RULE_ANY) dfs->dfs_table[i].width != ISP_FREQ_RULE_ANY)
continue; continue;
if (curr_rules.height != isp->dfs->dfs_table[i].height && if (curr_rules.height != dfs->dfs_table[i].height &&
isp->dfs->dfs_table[i].height != ISP_FREQ_RULE_ANY) dfs->dfs_table[i].height != ISP_FREQ_RULE_ANY)
continue; continue;
if (curr_rules.fps != isp->dfs->dfs_table[i].fps && if (curr_rules.fps != dfs->dfs_table[i].fps &&
isp->dfs->dfs_table[i].fps != ISP_FREQ_RULE_ANY) dfs->dfs_table[i].fps != ISP_FREQ_RULE_ANY)
continue; continue;
if (curr_rules.run_mode != isp->dfs->dfs_table[i].run_mode && if (curr_rules.run_mode != dfs->dfs_table[i].run_mode &&
isp->dfs->dfs_table[i].run_mode != ISP_FREQ_RULE_ANY) dfs->dfs_table[i].run_mode != ISP_FREQ_RULE_ANY)
continue; continue;
break; break;
} }
if (i == isp->dfs->dfs_table_size) if (i == dfs->dfs_table_size)
new_freq = isp->dfs->max_freq_at_vmin; new_freq = dfs->max_freq_at_vmin;
else else
new_freq = isp->dfs->dfs_table[i].isp_freq; new_freq = dfs->dfs_table[i].isp_freq;
done: done:
dev_dbg(isp->dev, "DFS target frequency=%d.\n", new_freq); dev_dbg(isp->dev, "DFS target frequency=%d.\n", new_freq);
......
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