diff mbox series

[2/4] drm/msm/dpu: remove futile checks from dpu_rm_init()

Message ID 20230430203556.3184252-3-dmitry.baryshkov@linaro.org
State Superseded
Headers show
Series drm/msm/dpu: simplity RM code | expand

Commit Message

Dmitry Baryshkov April 30, 2023, 8:35 p.m. UTC
dpu_rm_init() contains checks for block->id values. These were logical
in the vendor driver, when one can not be sure which values were passed
from DT. In the upstream driver this is not necessary: the catalog is a
part of the driver, we control specified IDs.

Suggested-by: Marijn Suijten <marijn.suijten@somainline.org>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c | 34 --------------------------
 1 file changed, 34 deletions(-)

Comments

Dmitry Baryshkov May 1, 2023, 10:15 p.m. UTC | #1
On 02/05/2023 01:13, Marijn Suijten wrote:
> On 2023-04-30 23:35:54, Dmitry Baryshkov wrote:
>> dpu_rm_init() contains checks for block->id values. These were logical
>> in the vendor driver, when one can not be sure which values were passed
>> from DT. In the upstream driver this is not necessary: the catalog is a
>> part of the driver, we control specified IDs.
>>
>> Suggested-by: Marijn Suijten <marijn.suijten@somainline.org>
>> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> 
> I was going to send this on top of [1] to prevent conflicts, but it
> seems you beat me to it and also based it on top of that series, though
> without mentioning the dependency in the cover letter.

I hoped that you'd include such a change into the mentioned series. But 
after waiting for some time I went and sent this out, as I was not sure 
about your intentions and time budget.

> 
> [1]: https://lore.kernel.org/linux-arm-msm/20230418-dpu-drop-useless-for-lookup-v3-3-e8d869eea455@somainline.org/
> 
> Reviewed-by: Marijn Suijten <marijn.suijten@somainline.org>
> 
>> ---
>>   drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c | 34 --------------------------
>>   1 file changed, 34 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c
>> index dffd3dd0a877..d5a06628885e 100644
>> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c
>> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c
>> @@ -122,10 +122,6 @@ int dpu_rm_init(struct dpu_rm *rm,
>>   			continue;
>>   		}
>>   
>> -		if (lm->id < LM_0 || lm->id >= LM_MAX) {
>> -			DPU_ERROR("skip mixer %d with invalid id\n", lm->id);
>> -			continue;
>> -		}
>>   		hw = dpu_hw_lm_init(lm, mmio);
>>   		if (IS_ERR(hw)) {
>>   			rc = PTR_ERR(hw);
>> @@ -139,10 +135,6 @@ int dpu_rm_init(struct dpu_rm *rm,
>>   		struct dpu_hw_merge_3d *hw;
>>   		const struct dpu_merge_3d_cfg *merge_3d = &cat->merge_3d[i];
>>   
>> -		if (merge_3d->id < MERGE_3D_0 || merge_3d->id >= MERGE_3D_MAX) {
>> -			DPU_ERROR("skip merge_3d %d with invalid id\n", merge_3d->id);
>> -			continue;
>> -		}
>>   		hw = dpu_hw_merge_3d_init(merge_3d, mmio);
>>   		if (IS_ERR(hw)) {
>>   			rc = PTR_ERR(hw);
>> @@ -157,10 +149,6 @@ int dpu_rm_init(struct dpu_rm *rm,
>>   		struct dpu_hw_pingpong *hw;
>>   		const struct dpu_pingpong_cfg *pp = &cat->pingpong[i];
>>   
>> -		if (pp->id < PINGPONG_0 || pp->id >= PINGPONG_MAX) {
>> -			DPU_ERROR("skip pingpong %d with invalid id\n", pp->id);
>> -			continue;
>> -		}
>>   		hw = dpu_hw_pingpong_init(pp, mmio);
>>   		if (IS_ERR(hw)) {
>>   			rc = PTR_ERR(hw);
>> @@ -177,10 +165,6 @@ int dpu_rm_init(struct dpu_rm *rm,
>>   		struct dpu_hw_intf *hw;
>>   		const struct dpu_intf_cfg *intf = &cat->intf[i];
>>   
>> -		if (intf->id < INTF_0 || intf->id >= INTF_MAX) {
>> -			DPU_ERROR("skip intf %d with invalid id\n", intf->id);
>> -			continue;
>> -		}
>>   		hw = dpu_hw_intf_init(intf, mmio);
>>   		if (IS_ERR(hw)) {
>>   			rc = PTR_ERR(hw);
>> @@ -194,11 +178,6 @@ int dpu_rm_init(struct dpu_rm *rm,
>>   		struct dpu_hw_wb *hw;
>>   		const struct dpu_wb_cfg *wb = &cat->wb[i];
>>   
>> -		if (wb->id < WB_0 || wb->id >= WB_MAX) {
>> -			DPU_ERROR("skip intf %d with invalid id\n", wb->id);
>> -			continue;
>> -		}
>> -
>>   		hw = dpu_hw_wb_init(wb, mmio);
>>   		if (IS_ERR(hw)) {
>>   			rc = PTR_ERR(hw);
>> @@ -212,10 +191,6 @@ int dpu_rm_init(struct dpu_rm *rm,
>>   		struct dpu_hw_ctl *hw;
>>   		const struct dpu_ctl_cfg *ctl = &cat->ctl[i];
>>   
>> -		if (ctl->id < CTL_0 || ctl->id >= CTL_MAX) {
>> -			DPU_ERROR("skip ctl %d with invalid id\n", ctl->id);
>> -			continue;
>> -		}
>>   		hw = dpu_hw_ctl_init(ctl, mmio, cat->mixer_count, cat->mixer);
>>   		if (IS_ERR(hw)) {
>>   			rc = PTR_ERR(hw);
>> @@ -229,10 +204,6 @@ int dpu_rm_init(struct dpu_rm *rm,
>>   		struct dpu_hw_dspp *hw;
>>   		const struct dpu_dspp_cfg *dspp = &cat->dspp[i];
>>   
>> -		if (dspp->id < DSPP_0 || dspp->id >= DSPP_MAX) {
>> -			DPU_ERROR("skip dspp %d with invalid id\n", dspp->id);
>> -			continue;
>> -		}
>>   		hw = dpu_hw_dspp_init(dspp, mmio);
>>   		if (IS_ERR(hw)) {
>>   			rc = PTR_ERR(hw);
>> @@ -259,11 +230,6 @@ int dpu_rm_init(struct dpu_rm *rm,
>>   		struct dpu_hw_sspp *hw;
>>   		const struct dpu_sspp_cfg *sspp = &cat->sspp[i];
>>   
>> -		if (sspp->id < SSPP_NONE || sspp->id >= SSPP_MAX) {
>> -			DPU_ERROR("skip intf %d with invalid id\n", sspp->id);
>> -			continue;
>> -		}
>> -
>>   		hw = dpu_hw_sspp_init(sspp, mmio, cat->ubwc);
>>   		if (IS_ERR(hw)) {
>>   			rc = PTR_ERR(hw);
>> -- 
>> 2.39.2
>>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c
index dffd3dd0a877..d5a06628885e 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c
@@ -122,10 +122,6 @@  int dpu_rm_init(struct dpu_rm *rm,
 			continue;
 		}
 
-		if (lm->id < LM_0 || lm->id >= LM_MAX) {
-			DPU_ERROR("skip mixer %d with invalid id\n", lm->id);
-			continue;
-		}
 		hw = dpu_hw_lm_init(lm, mmio);
 		if (IS_ERR(hw)) {
 			rc = PTR_ERR(hw);
@@ -139,10 +135,6 @@  int dpu_rm_init(struct dpu_rm *rm,
 		struct dpu_hw_merge_3d *hw;
 		const struct dpu_merge_3d_cfg *merge_3d = &cat->merge_3d[i];
 
-		if (merge_3d->id < MERGE_3D_0 || merge_3d->id >= MERGE_3D_MAX) {
-			DPU_ERROR("skip merge_3d %d with invalid id\n", merge_3d->id);
-			continue;
-		}
 		hw = dpu_hw_merge_3d_init(merge_3d, mmio);
 		if (IS_ERR(hw)) {
 			rc = PTR_ERR(hw);
@@ -157,10 +149,6 @@  int dpu_rm_init(struct dpu_rm *rm,
 		struct dpu_hw_pingpong *hw;
 		const struct dpu_pingpong_cfg *pp = &cat->pingpong[i];
 
-		if (pp->id < PINGPONG_0 || pp->id >= PINGPONG_MAX) {
-			DPU_ERROR("skip pingpong %d with invalid id\n", pp->id);
-			continue;
-		}
 		hw = dpu_hw_pingpong_init(pp, mmio);
 		if (IS_ERR(hw)) {
 			rc = PTR_ERR(hw);
@@ -177,10 +165,6 @@  int dpu_rm_init(struct dpu_rm *rm,
 		struct dpu_hw_intf *hw;
 		const struct dpu_intf_cfg *intf = &cat->intf[i];
 
-		if (intf->id < INTF_0 || intf->id >= INTF_MAX) {
-			DPU_ERROR("skip intf %d with invalid id\n", intf->id);
-			continue;
-		}
 		hw = dpu_hw_intf_init(intf, mmio);
 		if (IS_ERR(hw)) {
 			rc = PTR_ERR(hw);
@@ -194,11 +178,6 @@  int dpu_rm_init(struct dpu_rm *rm,
 		struct dpu_hw_wb *hw;
 		const struct dpu_wb_cfg *wb = &cat->wb[i];
 
-		if (wb->id < WB_0 || wb->id >= WB_MAX) {
-			DPU_ERROR("skip intf %d with invalid id\n", wb->id);
-			continue;
-		}
-
 		hw = dpu_hw_wb_init(wb, mmio);
 		if (IS_ERR(hw)) {
 			rc = PTR_ERR(hw);
@@ -212,10 +191,6 @@  int dpu_rm_init(struct dpu_rm *rm,
 		struct dpu_hw_ctl *hw;
 		const struct dpu_ctl_cfg *ctl = &cat->ctl[i];
 
-		if (ctl->id < CTL_0 || ctl->id >= CTL_MAX) {
-			DPU_ERROR("skip ctl %d with invalid id\n", ctl->id);
-			continue;
-		}
 		hw = dpu_hw_ctl_init(ctl, mmio, cat->mixer_count, cat->mixer);
 		if (IS_ERR(hw)) {
 			rc = PTR_ERR(hw);
@@ -229,10 +204,6 @@  int dpu_rm_init(struct dpu_rm *rm,
 		struct dpu_hw_dspp *hw;
 		const struct dpu_dspp_cfg *dspp = &cat->dspp[i];
 
-		if (dspp->id < DSPP_0 || dspp->id >= DSPP_MAX) {
-			DPU_ERROR("skip dspp %d with invalid id\n", dspp->id);
-			continue;
-		}
 		hw = dpu_hw_dspp_init(dspp, mmio);
 		if (IS_ERR(hw)) {
 			rc = PTR_ERR(hw);
@@ -259,11 +230,6 @@  int dpu_rm_init(struct dpu_rm *rm,
 		struct dpu_hw_sspp *hw;
 		const struct dpu_sspp_cfg *sspp = &cat->sspp[i];
 
-		if (sspp->id < SSPP_NONE || sspp->id >= SSPP_MAX) {
-			DPU_ERROR("skip intf %d with invalid id\n", sspp->id);
-			continue;
-		}
-
 		hw = dpu_hw_sspp_init(sspp, mmio, cat->ubwc);
 		if (IS_ERR(hw)) {
 			rc = PTR_ERR(hw);