From: Harry Wentland <harry.wentland-5C7GfCeVMHo@public.gmane.org>
To: Nathan Chancellor
<natechancellor-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Nick Desaulniers
<ndesaulniers-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
Cc: David1.Zhou-5C7GfCeVMHo@public.gmane.org,
sunpeng.li-5C7GfCeVMHo@public.gmane.org,
LKML <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
alexander.deucher-5C7GfCeVMHo@public.gmane.org,
christian.koenig-5C7GfCeVMHo@public.gmane.org
Subject: Re: [PATCH] drm/amd/display: Change status's type in aux_reply_transaction_data
Date: Thu, 27 Sep 2018 06:03:56 -0400 [thread overview]
Message-ID: <0840a13f-bd9d-35d1-1bca-9fb0cda32317@amd.com> (raw)
In-Reply-To: <20180924222225.GA26613@flashbox>
On 2018-09-24 06:22 PM, Nathan Chancellor wrote:
> On Mon, Sep 24, 2018 at 03:07:16PM -0700, Nick Desaulniers wrote:
>> On Fri, Sep 21, 2018 at 2:55 PM Nathan Chancellor
>> <natechancellor@gmail.com> wrote:
>>>
>>> Clang warns when one enumerated type is implicitly converted to another.
>>>
>>> drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dce_aux.c:315:19: warning:
>>> implicit conversion from enumeration type 'enum
>>> aux_channel_operation_result' to different enumeration type 'enum
>>> aux_transaction_reply' [-Wenum-conversion]
>>> reply->status = AUX_CHANNEL_OPERATION_FAILED_HPD_DISCON;
>>> ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>> drivers/gpu/drm/amd/amdgpu/../display/dc/i2caux/dce110/aux_engine_dce110.c:349:19:
>>> warning: implicit conversion from enumeration type 'enum
>>> aux_channel_operation_result' to different enumeration type 'enum
>>> aux_transaction_reply' [-Wenum-conversion]
>>> reply->status = AUX_CHANNEL_OPERATION_FAILED_HPD_DISCON;
>>> ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>
>> I think the enum is actually wrong here. I think the correct fix would be:
>>
>> - reply->status = AUX_CHANNEL_OPERATION_FAILED_HPD_DISCON;
>> + reply->status = AUX_TRANSACTION_REPLY_HPD_DISCON;
>>
>> The identifiers are so similar, my guess was that it was easy to mix
>> them up. This looks like an actual bug to me, since the identifiers
>> have different values between the 2 different enums.
>>
>
> Hmmm interesting... I will be happy to send a v2 with your suggestion if
> one of the maintainers could confirm that to be the case (given DRM code
> is rather dense).
>
Nick is correct. We should keep the enum but assign AUX_TRANSACTION_REPLY_HPD_DISCON in dce_aux.c and aux_engine_dce110.c.
Thanks for spotting this.
Harry
> Thanks for the review!
> Nathan
>
>>>
>>> Instead of implicitly or explicitly converting between types, just
>>> change status to type uint8_t (since its max size is 255) which avoids
>>> this construct altogether.
>>>
>>> Reported-by: Nick Desaulniers <ndesaulniers@google.com>
>>> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
>>> ---
>>> drivers/gpu/drm/amd/display/dc/dc_ddc_types.h | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/gpu/drm/amd/display/dc/dc_ddc_types.h b/drivers/gpu/drm/amd/display/dc/dc_ddc_types.h
>>> index 05c8c31d8b31..97e1d4d19263 100644
>>> --- a/drivers/gpu/drm/amd/display/dc/dc_ddc_types.h
>>> +++ b/drivers/gpu/drm/amd/display/dc/dc_ddc_types.h
>>> @@ -79,7 +79,7 @@ enum aux_transaction_reply {
>>> };
>>>
>>> struct aux_reply_transaction_data {
>>> - enum aux_transaction_reply status;
>>> + uint8_t status;
>>> uint32_t length;
>>> uint8_t *data;
>>> };
>>> --
>>> 2.19.0
>>>
>>
>>
>> --
>> Thanks,
>> ~Nick Desaulniers
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next prev parent reply other threads:[~2018-09-27 10:03 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-21 21:55 [PATCH] drm/amd/display: Change status's type in aux_reply_transaction_data Nathan Chancellor
2018-09-24 22:07 ` Nick Desaulniers
2018-09-24 22:22 ` Nathan Chancellor
2018-09-27 10:03 ` Harry Wentland [this message]
2018-09-27 18:06 ` [PATCH v2] drm/amd/display: Use proper enums in process_channel_reply Nathan Chancellor
2018-09-27 18:08 ` Nathan Chancellor
2018-09-27 18:11 ` Nick Desaulniers
2018-10-02 14:55 ` Harry Wentland
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0840a13f-bd9d-35d1-1bca-9fb0cda32317@amd.com \
--to=harry.wentland-5c7gfcevmho@public.gmane.org \
--cc=David1.Zhou-5C7GfCeVMHo@public.gmane.org \
--cc=alexander.deucher-5C7GfCeVMHo@public.gmane.org \
--cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=christian.koenig-5C7GfCeVMHo@public.gmane.org \
--cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=natechancellor-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=ndesaulniers-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
--cc=sunpeng.li-5C7GfCeVMHo@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox