RE: [EXT] Re: [PATCH v5 2/4] media: amphion: tell and handle contiguous and non contiguous format

From: Ming Qian
Date: Fri Aug 26 2022 - 03:47:56 EST


[snip]

>> diff --git a/drivers/media/platform/amphion/vpu_helpers.c
>> b/drivers/media/platform/amphion/vpu_helpers.c
>> index e9aeb3453dfc..019c77e84514 100644
>> --- a/drivers/media/platform/amphion/vpu_helpers.c
>> +++ b/drivers/media/platform/amphion/vpu_helpers.c
>> @@ -59,6 +59,36 @@ const struct vpu_format
>*vpu_helper_find_format(struct vpu_inst *inst, u32 type,
>> return NULL;
>> }
>>
>> +const struct vpu_format *vpu_helper_find_sibling(struct vpu_inst
>> +*inst, u32 type, u32 pixelfmt) {
>> + const struct vpu_format *fmt;
>> + const struct vpu_format *sibling;
>> +
>> + fmt = vpu_helper_find_format(inst, type, pixelfmt);
>> + if (!fmt || !fmt->sibling)
>> + return NULL;
>> +
>> + sibling = vpu_helper_find_format(inst, type, fmt->sibling);
>> + if (!sibling || sibling->sibling != fmt->pixfmt ||
>> + sibling->comp_planes != fmt->comp_planes)
>> + return NULL;
>
>I think to preserve code style you need the following solutions on this if
>statement:
>
>if (!sibling || (sibling->sibling != fmt->pixfmt) ||
> (sibling->comp_planes != fmt->comp_planes))
> return NULL;
>
>I think I have suggested to you this solution on the v4. But never mind we
>need this :)
>
>Thanks
>

Hi Tommaso,
The parentheses are unnecessary, the checkpatch.pl will report the following style problems if I add the parentheses:

CHECK: Unnecessary parentheses around 'sibling->sibling != fmt->pixfmt'
#11: FILE: drivers/media/platform/amphion/vpu_helpers.c:72:
+ if (!sibling || (sibling->sibling != fmt->pixfmt) ||
+ (sibling->comp_planes != fmt->comp_planes))

CHECK: Unnecessary parentheses around 'sibling->comp_planes != fmt->comp_planes'
#11: FILE: drivers/media/platform/amphion/vpu_helpers.c:72:
+ if (!sibling || (sibling->sibling != fmt->pixfmt) ||
+ (sibling->comp_planes != fmt->comp_planes))

total: 0 errors, 0 warnings, 2 checks, 10 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.

1.patch has style problems, please review.

NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.