diff mbox series

[v3,14/19] media: venus: core: Define a pointer to core->res

Message ID 20230911-topic-mars-v3-14-79f23b81c261@linaro.org (mailing list archive)
State Not Applicable
Headers show
Series Venus cleanups | expand

Commit Message

Konrad Dybcio March 27, 2024, 6:08 p.m. UTC
To make the code more concise, define a new variable 'res' pointing to
the abundantly referenced core->res.

Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
---
 drivers/media/platform/qcom/venus/core.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

Comments

Bryan O'Donoghue April 24, 2024, 12:33 a.m. UTC | #1
On 27/03/2024 18:08, Konrad Dybcio wrote:
> To make the code more concise, define a new variable 'res' pointing to
> the abundantly referenced core->res.
> 
> Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>

Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Dikshita Agarwal April 25, 2024, 12:38 p.m. UTC | #2
On 3/27/2024 11:38 PM, Konrad Dybcio wrote:
> To make the code more concise, define a new variable 'res' pointing to
> the abundantly referenced core->res.
> 
> Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
> ---
>  drivers/media/platform/qcom/venus/core.c | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c
> index 5b18b1f41267..e61aa863b7f7 100644
> --- a/drivers/media/platform/qcom/venus/core.c
> +++ b/drivers/media/platform/qcom/venus/core.c
> @@ -285,6 +285,7 @@ static irqreturn_t venus_isr_thread(int irq, void *dev_id)
>  
>  static int venus_probe(struct platform_device *pdev)
>  {
> +	const struct venus_resources *res;
>  	struct device *dev = &pdev->dev;
>  	struct venus_core *core;
>  	int i, ret;
> @@ -315,9 +316,11 @@ static int venus_probe(struct platform_device *pdev)
>  	if (!core->res)
>  		return -ENODEV;
>  
> +	res = core->res;
> +
>  	mutex_init(&core->pm_lock);
>  
> -	core->pm_ops = venus_pm_get(core->res->hfi_version);
> +	core->pm_ops = venus_pm_get(res->hfi_version);
>  	if (!core->pm_ops)
>  		return -ENODEV;
>  
> @@ -325,8 +328,8 @@ static int venus_probe(struct platform_device *pdev)
>  	if (ret)
>  		return ret;
>  
> -	for (i = 0; i < core->res->resets_num; i++) {
> -		core->resets[i] = devm_reset_control_get_exclusive(dev, core->res->resets[i]);
> +	for (i = 0; i < res->resets_num; i++) {
> +		core->resets[i] = devm_reset_control_get_exclusive(dev, res->resets[i]);
>  		if (IS_ERR(core->resets[i]))
>  			return PTR_ERR(core->resets[i]);
>  	}
> @@ -337,7 +340,7 @@ static int venus_probe(struct platform_device *pdev)
>  			return ret;
>  	}
>  
> -	ret = dma_set_mask_and_coherent(dev, core->res->dma_mask);
> +	ret = dma_set_mask_and_coherent(dev, res->dma_mask);
>  	if (ret)
>  		goto err_core_put;
>  
> 
Reviewed-by: Dikshita Agarwal <quic_dikshita@quicinc.com>
diff mbox series

Patch

diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c
index 5b18b1f41267..e61aa863b7f7 100644
--- a/drivers/media/platform/qcom/venus/core.c
+++ b/drivers/media/platform/qcom/venus/core.c
@@ -285,6 +285,7 @@  static irqreturn_t venus_isr_thread(int irq, void *dev_id)
 
 static int venus_probe(struct platform_device *pdev)
 {
+	const struct venus_resources *res;
 	struct device *dev = &pdev->dev;
 	struct venus_core *core;
 	int i, ret;
@@ -315,9 +316,11 @@  static int venus_probe(struct platform_device *pdev)
 	if (!core->res)
 		return -ENODEV;
 
+	res = core->res;
+
 	mutex_init(&core->pm_lock);
 
-	core->pm_ops = venus_pm_get(core->res->hfi_version);
+	core->pm_ops = venus_pm_get(res->hfi_version);
 	if (!core->pm_ops)
 		return -ENODEV;
 
@@ -325,8 +328,8 @@  static int venus_probe(struct platform_device *pdev)
 	if (ret)
 		return ret;
 
-	for (i = 0; i < core->res->resets_num; i++) {
-		core->resets[i] = devm_reset_control_get_exclusive(dev, core->res->resets[i]);
+	for (i = 0; i < res->resets_num; i++) {
+		core->resets[i] = devm_reset_control_get_exclusive(dev, res->resets[i]);
 		if (IS_ERR(core->resets[i]))
 			return PTR_ERR(core->resets[i]);
 	}
@@ -337,7 +340,7 @@  static int venus_probe(struct platform_device *pdev)
 			return ret;
 	}
 
-	ret = dma_set_mask_and_coherent(dev, core->res->dma_mask);
+	ret = dma_set_mask_and_coherent(dev, res->dma_mask);
 	if (ret)
 		goto err_core_put;