[PATCH v4 5/6] drm/msm/dpu: Refactor printing of main blocks in device core dump

Abhinav Kumar quic_abhinavk at quicinc.com
Fri Jul 7 02:24:35 UTC 2023



On 7/6/2023 7:19 PM, Dmitry Baryshkov wrote:
> On 07/07/2023 03:16, Abhinav Kumar wrote:
>>
>>
>> On 7/6/2023 5:07 PM, Dmitry Baryshkov wrote:
>>> On 06/07/2023 23:48, Ryan McCann wrote:
>>>> Currently, the names of main blocks are hardcoded into the
>>>> msm_disp_snapshot_add_block function rather than using the name that
>>>> already exists in the catalog. Change this to take the name directly 
>>>> from
>>>> the catalog instead of hardcoding it.
>>>>
>>>> Signed-off-by: Ryan McCann <quic_rmccann at quicinc.com>
>>>> ---
>>>>   drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 32 
>>>> ++++++++++++++++----------------
>>>>   1 file changed, 16 insertions(+), 16 deletions(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c 
>>>> b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
>>>> index aa8499de1b9f..70dbb1204e6c 100644
>>>> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
>>>> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
>>>> @@ -899,38 +899,38 @@ static void dpu_kms_mdp_snapshot(struct 
>>>> msm_disp_state *disp_state, struct msm_k
>>>>       /* dump CTL sub-blocks HW regs info */
>>>>       for (i = 0; i < cat->ctl_count; i++)
>>>> -        msm_disp_snapshot_add_block(disp_state, cat->ctl[i].len,
>>>> -                dpu_kms->mmio + cat->ctl[i].base, "ctl_%d", i);
>>>> +        msm_disp_snapshot_add_block(disp_state, cat->ctl[i].len, 
>>>> dpu_kms->mmio +
>>>> +                        cat->ctl[i].base, cat->ctl[i].name);
>>>
>>> Splitting on the `+' sign is a bad idea. It makes it harder to read 
>>> the code. Please keep the first line as is, it is perfectly fine on 
>>> its own, and do just what you have stated in the commit message: 
>>> change printed block name.
>>>
>>
>> Actually, I asked Ryan to fix the indent here in the same patch as he 
>> was touching this code anyway.
>>
>> So you would prefer thats left untouched?
> 
> Yes. The current one was definitely better than splitting in the middle 
> of a statement.
> 

Certainly Yes. Splitting across '+' was the last resort. For some 
reason, I thought any other option of splitting was breaking checkpatch 
for ryan so we had to do that. But, for this change it seems like even 
if we had done like below checkpatch didnt complain.

@@ -900,7 +900,7 @@ static void dpu_kms_mdp_snapshot(struct 
msm_disp_state *disp_state, struct msm_k
         /* dump CTL sub-blocks HW regs info */
         for (i = 0; i < cat->ctl_count; i++)
                 msm_disp_snapshot_add_block(disp_state, cat->ctl[i].len,
-                               dpu_kms->mmio + cat->ctl[i].base, 
"ctl_%d", i);
+                                           dpu_kms->mmio + 
cat->ctl[i].base, "ctl_%d", i);

But anyway, we can just take care of fixing indentation separately to 
avoid the hassle.

>>
>>>>       /* dump DSPP sub-blocks HW regs info */
>>>>       for (i = 0; i < cat->dspp_count; i++)
>>>> -        msm_disp_snapshot_add_block(disp_state, cat->dspp[i].len,
>>>> -                dpu_kms->mmio + cat->dspp[i].base, "dspp_%d", i);
>>>> +        msm_disp_snapshot_add_block(disp_state, cat->dspp[i].len, 
>>>> dpu_kms->mmio +
>>>> +                        cat->dspp[i].base, cat->dspp[i].name);
>>>>       /* dump INTF sub-blocks HW regs info */
>>>>       for (i = 0; i < cat->intf_count; i++)
>>>> -        msm_disp_snapshot_add_block(disp_state, cat->intf[i].len,
>>>> -                dpu_kms->mmio + cat->intf[i].base, "intf_%d", i);
>>>> +        msm_disp_snapshot_add_block(disp_state, cat->intf[i].len, 
>>>> dpu_kms->mmio +
>>>> +                        cat->intf[i].base, cat->intf[i].name);
>>>>       /* dump PP sub-blocks HW regs info */
>>>>       for (i = 0; i < cat->pingpong_count; i++)
>>>> -        msm_disp_snapshot_add_block(disp_state, cat->pingpong[i].len,
>>>> -                dpu_kms->mmio + cat->pingpong[i].base, 
>>>> "pingpong_%d", i);
>>>> +        msm_disp_snapshot_add_block(disp_state, 
>>>> cat->pingpong[i].len, dpu_kms->mmio +
>>>> +                        cat->pingpong[i].base, cat->pingpong[i].name);
>>>>       /* dump SSPP sub-blocks HW regs info */
>>>>       for (i = 0; i < cat->sspp_count; i++)
>>>> -        msm_disp_snapshot_add_block(disp_state, cat->sspp[i].len,
>>>> -                dpu_kms->mmio + cat->sspp[i].base, "sspp_%d", i);
>>>> +        msm_disp_snapshot_add_block(disp_state, cat->sspp[i].len, 
>>>> dpu_kms->mmio +
>>>> +                        cat->sspp[i].base, cat->sspp[i].name);
>>>>       /* dump LM sub-blocks HW regs info */
>>>>       for (i = 0; i < cat->mixer_count; i++)
>>>> -        msm_disp_snapshot_add_block(disp_state, cat->mixer[i].len,
>>>> -                dpu_kms->mmio + cat->mixer[i].base, "lm_%d", i);
>>>> +        msm_disp_snapshot_add_block(disp_state, cat->mixer[i].len, 
>>>> dpu_kms->mmio +
>>>> +                        cat->mixer[i].base, cat->mixer[i].name);
>>>>       /* dump WB sub-blocks HW regs info */
>>>>       for (i = 0; i < cat->wb_count; i++)
>>>> -        msm_disp_snapshot_add_block(disp_state, cat->wb[i].len,
>>>> -                dpu_kms->mmio + cat->wb[i].base, "wb_%d", i);
>>>> +        msm_disp_snapshot_add_block(disp_state, cat->wb[i].len, 
>>>> dpu_kms->mmio +
>>>> +                        cat->wb[i].base, cat->wb[i].name);
>>>>       if (cat->mdp[0].features & BIT(DPU_MDP_PERIPH_0_REMOVED)) {
>>>>           msm_disp_snapshot_add_block(disp_state, MDP_PERIPH_TOP0,
>>>> @@ -944,8 +944,8 @@ static void dpu_kms_mdp_snapshot(struct 
>>>> msm_disp_state *disp_state, struct msm_k
>>>>       /* dump DSC sub-blocks HW regs info */
>>>>       for (i = 0; i < cat->dsc_count; i++)
>>>> -        msm_disp_snapshot_add_block(disp_state, cat->dsc[i].len,
>>>> -                dpu_kms->mmio + cat->dsc[i].base, "dsc_%d", i);
>>>> +        msm_disp_snapshot_add_block(disp_state, cat->dsc[i].len, 
>>>> dpu_kms->mmio +
>>>> +                        cat->dsc[i].base, cat->dsc[i].name);
>>>>       pm_runtime_put_sync(&dpu_kms->pdev->dev);
>>>>   }
>>>>
>>>
> 


More information about the dri-devel mailing list