All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] staging: atomisp: simplify the if condition in atomisp_freq_scaling()
@ 2017-03-30  6:24 ` Daeseok Youn
  0 siblings, 0 replies; 6+ messages in thread
From: Daeseok Youn @ 2017-03-30  6:24 UTC (permalink / raw)
  To: mchehab
  Cc: gregkh, daeseok.youn, alan, dan.carpenter, singhalsimran0,
	linux-media, devel, linux-kernel, kernel-janitors

The condition line in if-statement is needed to be shorthen to
improve readability.

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
---
 drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 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..eebfccd 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c
@@ -255,14 +255,17 @@ int atomisp_freq_scaling(struct atomisp_device *isp,
 	struct atomisp_freq_scaling_rule curr_rules;
 	int i, ret;
 	unsigned short fps = 0;
+	unsigned short masked_dev = 0;
 
 	if (isp->sw_contex.power_state != ATOM_ISP_POWER_UP) {
 		dev_err(isp->dev, "DFS cannot proceed due to no power.\n");
 		return -EINVAL;
 	}
 
-	if ((isp->pdev->device & ATOMISP_PCI_DEVICE_SOC_MASK) ==
-		ATOMISP_PCI_DEVICE_SOC_CHT && ATOMISP_USE_YUVPP(asd))
+	masked_dev = isp->pdev->device & ATOMISP_PCI_DEVICE_SOC_MASK;
+
+	if (masked_dev == 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 ||
-- 
1.9.1

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

* [PATCH 1/2] staging: atomisp: simplify the if condition in atomisp_freq_scaling()
@ 2017-03-30  6:24 ` Daeseok Youn
  0 siblings, 0 replies; 6+ messages in thread
From: Daeseok Youn @ 2017-03-30  6:24 UTC (permalink / raw)
  To: mchehab
  Cc: gregkh, daeseok.youn, alan, dan.carpenter, singhalsimran0,
	linux-media, devel, linux-kernel, kernel-janitors

The condition line in if-statement is needed to be shorthen to
improve readability.

Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
---
 drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 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..eebfccd 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c
@@ -255,14 +255,17 @@ int atomisp_freq_scaling(struct atomisp_device *isp,
 	struct atomisp_freq_scaling_rule curr_rules;
 	int i, ret;
 	unsigned short fps = 0;
+	unsigned short masked_dev = 0;
 
 	if (isp->sw_contex.power_state != ATOM_ISP_POWER_UP) {
 		dev_err(isp->dev, "DFS cannot proceed due to no power.\n");
 		return -EINVAL;
 	}
 
-	if ((isp->pdev->device & ATOMISP_PCI_DEVICE_SOC_MASK) =
-		ATOMISP_PCI_DEVICE_SOC_CHT && ATOMISP_USE_YUVPP(asd))
+	masked_dev = isp->pdev->device & ATOMISP_PCI_DEVICE_SOC_MASK;
+
+	if (masked_dev = 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 ||
-- 
1.9.1


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

* Re: [PATCH 1/2] staging: atomisp: simplify the if condition in atomisp_freq_scaling()
  2017-03-30  6:24 ` Daeseok Youn
@ 2017-03-30 10:52   ` Alan Cox
  -1 siblings, 0 replies; 6+ messages in thread
From: Alan Cox @ 2017-03-30 10:52 UTC (permalink / raw)
  To: Daeseok Youn, mchehab
  Cc: gregkh, dan.carpenter, singhalsimran0, linux-media, devel,
	linux-kernel, kernel-janitors

On Thu, 2017-03-30 at 15:24 +0900, Daeseok Youn wrote:
> The condition line in if-statement is needed to be shorthen to
> improve readability.
> 
> Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
> ---

How about a define for ATOMISP_IS_CHT(isp) instead - as we will need
these tests in other places where there are ISP2400/ISP2401 ifdefs ?

Alan

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

* Re: [PATCH 1/2] staging: atomisp: simplify the if condition in atomisp_freq_scaling()
@ 2017-03-30 10:52   ` Alan Cox
  0 siblings, 0 replies; 6+ messages in thread
From: Alan Cox @ 2017-03-30 10:52 UTC (permalink / raw)
  To: Daeseok Youn, mchehab
  Cc: gregkh, dan.carpenter, singhalsimran0, linux-media, devel,
	linux-kernel, kernel-janitors

On Thu, 2017-03-30 at 15:24 +0900, Daeseok Youn wrote:
> The condition line in if-statement is needed to be shorthen to
> improve readability.
> 
> Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
> ---

How about a define for ATOMISP_IS_CHT(isp) instead - as we will need
these tests in other places where there are ISP2400/ISP2401 ifdefs ?

Alan


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

* Re: [PATCH 1/2] staging: atomisp: simplify the if condition in atomisp_freq_scaling()
  2017-03-30 10:52   ` Alan Cox
@ 2017-03-30 15:39     ` DaeSeok Youn
  -1 siblings, 0 replies; 6+ messages in thread
From: DaeSeok Youn @ 2017-03-30 15:39 UTC (permalink / raw)
  To: Alan Cox
  Cc: mchehab, Greg KH, Dan Carpenter, SIMRAN SINGHAL, linux-media,
	devel, linux-kernel, kernel-janitors

2017-03-30 19:52 GMT+09:00 Alan Cox <alan@linux.intel.com>:
> On Thu, 2017-03-30 at 15:24 +0900, Daeseok Youn wrote:
>> The condition line in if-statement is needed to be shorthen to
>> improve readability.
>>
>> Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
>> ---
>
> How about a define for ATOMISP_IS_CHT(isp) instead - as we will need
hmm.. I think there is another way to get a *device*(unsigned short or
__u32) to mask with "ATOMISP_PCI_DEVICE_SOC_MASK".
In the atomisp_freq_scaling() function, the "device" value is getting
started from "isp" structure.
(isp->pdev->device)

if the function has only "pci_dev" struction as a parameter and it
need to check the CHT. Then we cannot use the definition like
ATOMISP_IS_CHT(isp). it means we have another definition to check the
CHT.

Am I right?

> these tests in other places where there are ISP2400/ISP2401 ifdefs ?
I am not sure whether these tests are needed in other place or not.
(Actually, I didn't find good H/W reference for Atom ISP device - Can
you please share the link to refer document like H/W manual to
develop?) I have tried to clean up the code first. in the meantime, I
will have a look at the document if I have good reference manual.

Thanks.
Regards,
Daeseok.
>
> Alan
>

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

* Re: [PATCH 1/2] staging: atomisp: simplify the if condition in atomisp_freq_scaling()
@ 2017-03-30 15:39     ` DaeSeok Youn
  0 siblings, 0 replies; 6+ messages in thread
From: DaeSeok Youn @ 2017-03-30 15:39 UTC (permalink / raw)
  To: Alan Cox
  Cc: mchehab, Greg KH, Dan Carpenter, SIMRAN SINGHAL, linux-media,
	devel, linux-kernel, kernel-janitors

2017-03-30 19:52 GMT+09:00 Alan Cox <alan@linux.intel.com>:
> On Thu, 2017-03-30 at 15:24 +0900, Daeseok Youn wrote:
>> The condition line in if-statement is needed to be shorthen to
>> improve readability.
>>
>> Signed-off-by: Daeseok Youn <daeseok.youn@gmail.com>
>> ---
>
> How about a define for ATOMISP_IS_CHT(isp) instead - as we will need
hmm.. I think there is another way to get a *device*(unsigned short or
__u32) to mask with "ATOMISP_PCI_DEVICE_SOC_MASK".
In the atomisp_freq_scaling() function, the "device" value is getting
started from "isp" structure.
(isp->pdev->device)

if the function has only "pci_dev" struction as a parameter and it
need to check the CHT. Then we cannot use the definition like
ATOMISP_IS_CHT(isp). it means we have another definition to check the
CHT.

Am I right?

> these tests in other places where there are ISP2400/ISP2401 ifdefs ?
I am not sure whether these tests are needed in other place or not.
(Actually, I didn't find good H/W reference for Atom ISP device - Can
you please share the link to refer document like H/W manual to
develop?) I have tried to clean up the code first. in the meantime, I
will have a look at the document if I have good reference manual.

Thanks.
Regards,
Daeseok.
>
> Alan
>

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

end of thread, other threads:[~2017-03-30 15:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-30  6:24 [PATCH 1/2] staging: atomisp: simplify the if condition in atomisp_freq_scaling() Daeseok Youn
2017-03-30  6:24 ` Daeseok Youn
2017-03-30 10:52 ` Alan Cox
2017-03-30 10:52   ` Alan Cox
2017-03-30 15:39   ` DaeSeok Youn
2017-03-30 15:39     ` DaeSeok Youn

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.