All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 01/14] staging: atomisp: use local variable to reduce number of references
@ 2017-04-12 18:20 Alan Cox
  2017-04-12 18:20 ` [PATCH 02/14] staging/atomisp: fix spelling mistake: "falied" -> "failed" Alan Cox
                   ` (12 more replies)
  0 siblings, 13 replies; 18+ messages in thread
From: Alan Cox @ 2017-04-12 18:20 UTC (permalink / raw)
  To: greg, linux-media

From: Daeseok Youn <daeseok.youn@gmail.com>

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: Daeseok Youn <daeseok.youn@gmail.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
---
 .../media/atomisp/pci/atomisp2/atomisp_cmd.c       |   37 +++++++++++---------
 1 file changed, 20 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c
index 94bc793..9ad5146 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c
@@ -251,6 +251,7 @@ int atomisp_freq_scaling(struct atomisp_device *isp,
 {
 	/* FIXME! Only use subdev[0] status yet */
 	struct atomisp_sub_device *asd = &isp->asd[0];
+	const struct atomisp_dfs_config *dfs;
 	unsigned int new_freq;
 	struct atomisp_freq_scaling_rule curr_rules;
 	int i, ret;
@@ -265,20 +266,22 @@ int atomisp_freq_scaling(struct atomisp_device *isp,
 		ATOMISP_PCI_DEVICE_SOC_CHT && ATOMISP_USE_YUVPP(asd))
 		isp->dfs = &dfs_config_cht_soc;
 
-	if (isp->dfs->lowest_freq == 0 || isp->dfs->max_freq_at_vmin == 0 ||
-	    isp->dfs->highest_freq == 0 || isp->dfs->dfs_table_size == 0 ||
-	    !isp->dfs->dfs_table) {
+	dfs = isp->dfs;
+
+	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");
 		return -EINVAL;
 	}
 
 	if (mode == ATOMISP_DFS_MODE_LOW) {
-		new_freq = isp->dfs->lowest_freq;
+		new_freq = dfs->lowest_freq;
 		goto done;
 	}
 
 	if (mode == ATOMISP_DFS_MODE_MAX) {
-		new_freq = isp->dfs->highest_freq;
+		new_freq = dfs->highest_freq;
 		goto done;
 	}
 
@@ -304,26 +307,26 @@ int atomisp_freq_scaling(struct atomisp_device *isp,
 	}
 
 	/* search for the target frequency by looping freq rules*/
-	for (i = 0; i < isp->dfs->dfs_table_size; i++) {
-		if (curr_rules.width != isp->dfs->dfs_table[i].width &&
-		    isp->dfs->dfs_table[i].width != ISP_FREQ_RULE_ANY)
+	for (i = 0; i < dfs->dfs_table_size; i++) {
+		if (curr_rules.width != dfs->dfs_table[i].width &&
+		    dfs->dfs_table[i].width != ISP_FREQ_RULE_ANY)
 			continue;
-		if (curr_rules.height != isp->dfs->dfs_table[i].height &&
-		    isp->dfs->dfs_table[i].height != ISP_FREQ_RULE_ANY)
+		if (curr_rules.height != dfs->dfs_table[i].height &&
+		    dfs->dfs_table[i].height != ISP_FREQ_RULE_ANY)
 			continue;
-		if (curr_rules.fps != isp->dfs->dfs_table[i].fps &&
-		    isp->dfs->dfs_table[i].fps != ISP_FREQ_RULE_ANY)
+		if (curr_rules.fps != dfs->dfs_table[i].fps &&
+		    dfs->dfs_table[i].fps != ISP_FREQ_RULE_ANY)
 			continue;
-		if (curr_rules.run_mode != isp->dfs->dfs_table[i].run_mode &&
-		    isp->dfs->dfs_table[i].run_mode != ISP_FREQ_RULE_ANY)
+		if (curr_rules.run_mode != dfs->dfs_table[i].run_mode &&
+		    dfs->dfs_table[i].run_mode != ISP_FREQ_RULE_ANY)
 			continue;
 		break;
 	}
 
-	if (i == isp->dfs->dfs_table_size)
-		new_freq = isp->dfs->max_freq_at_vmin;
+	if (i == dfs->dfs_table_size)
+		new_freq = dfs->max_freq_at_vmin;
 	else
-		new_freq = isp->dfs->dfs_table[i].isp_freq;
+		new_freq = dfs->dfs_table[i].isp_freq;
 
 done:
 	dev_dbg(isp->dev, "DFS target frequency=%d.\n", new_freq);

^ permalink raw reply related	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2017-04-14  8:11 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-12 18:20 [PATCH 01/14] staging: atomisp: use local variable to reduce number of references Alan Cox
2017-04-12 18:20 ` [PATCH 02/14] staging/atomisp: fix spelling mistake: "falied" -> "failed" Alan Cox
2017-04-12 18:20 ` [PATCH 03/14] staging: atomisp: remove enable_isp_irq function and add disable_isp_irq Alan Cox
2017-04-12 18:20 ` [PATCH 04/14] staging: atomisp: replace "&isp->asd[i]" with "asd" in __get_asd_from_port() Alan Cox
2017-04-12 18:20 ` [PATCH 05/14] staging: atomisp: move mipi_info assignment to next line " Alan Cox
2017-04-12 18:21 ` [PATCH 06/14] atomisp: remove most of the uses of atomisp_kernel_malloc Alan Cox
2017-04-12 18:21 ` [PATCH 07/14] atomisp: unwrap the _ex malloc/free functions Alan Cox
2017-04-12 18:21 ` [PATCH 08/14] atomisp: remove indirection from sh_css_malloc Alan Cox
2017-04-12 18:21 ` [PATCH 09/14] atomisp: remove sh_css_malloc indirections where we can Alan Cox
2017-04-12 18:21 ` [PATCH 10/14] atomisp: remove contiguous handling Alan Cox
2017-04-12 18:22 ` [PATCH 11/14] atomisp: remove satm kernel Alan Cox
2017-04-12 18:22 ` [PATCH 12/14] atomisp: remove fixedbds kernel code Alan Cox
2017-04-13 11:53   ` kbuild test robot
2017-04-14  8:09     ` Greg KH
2017-04-12 18:22 ` [PATCH 13/14] atomisp: remove xnr3_0_5 and xnr3_0_11 Alan Cox
2017-04-12 18:22 ` [PATCH 14/14] atomisp: remove UDS kernel code Alan Cox
2017-04-13 19:27   ` kbuild test robot
2017-04-14  8:11     ` Greg KH

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.