[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <AJcAtgBECILBSP4ZwkKFT4o9.3.1588767258295.Hmail.bernard@vivo.com>
Date: Wed, 6 May 2020 20:14:18 +0800 (GMT+08:00)
From: Bernard <bernard@...o.com>
To: Chun-Kuang Hu <chunkuang.hu@...nel.org>
Cc: Chun-Kuang Hu <chunkuang.hu@...nel.org>,
Philipp Zabel <p.zabel@...gutronix.de>,
opensource.kernel@...o.com, David Airlie <airlied@...ux.ie>,
linux-kernel <linux-kernel@...r.kernel.org>,
DRI Development <dri-devel@...ts.freedesktop.org>,
"moderated list:ARM/Mediatek SoC support"
<linux-mediatek@...ts.infradead.org>,
Daniel Vetter <daniel@...ll.ch>,
Matthias Brugger <matthias.bgg@...il.com>,
Linux ARM <linux-arm-kernel@...ts.infradead.org>
Subject: Re:Re: Re: [PATCH] drm/mediatek: cleanup coding style in mediatek a bit
发件人:Chun-Kuang Hu <chunkuang.hu@...nel.org>
发送日期:2020-04-30 23:50:38
收件人:Bernard <bernard@...o.com>
抄送人:Chun-Kuang Hu <chunkuang.hu@...nel.org>,Philipp Zabel <p.zabel@...gutronix.de>,opensource.kernel@...o.com,David Airlie <airlied@...ux.ie>,linux-kernel <linux-kernel@...r.kernel.org>,DRI Development <dri-devel@...ts.freedesktop.org>,"moderated list:ARM/Mediatek SoC support" <linux-mediatek@...ts.infradead.org>,Daniel Vetter <daniel@...ll.ch>,Matthias Brugger <matthias.bgg@...il.com>,Linux ARM <linux-arm-kernel@...ts.infradead.org>
主题:Re: Re: [PATCH] drm/mediatek: cleanup coding style in mediatek a bit>Hi, Bernard:
>
>Bernard <bernard@...o.com> 於 2020年4月30日 週四 下午2:32寫道:
>>
>>
>>
>> 发件人:Chun-Kuang Hu <chunkuang.hu@...nel.org>
>> 发送日期:2020-04-29 22:22:50
>> 收件人:Bernard Zhao <bernard@...o.com>
>> 抄送人:Chun-Kuang Hu <chunkuang.hu@...nel.org>,Philipp Zabel <p.zabel@...gutronix.de>,David Airlie <airlied@...ux.ie>,Daniel Vetter <daniel@...ll.ch>,Matthias Brugger <matthias.bgg@...il.com>,DRI Development <dri-devel@...ts.freedesktop.org>,Linux ARM <linux-arm-kernel@...ts.infradead.org>,"moderated list:ARM/Mediatek SoC support" <linux-mediatek@...ts.infradead.org>,linux-kernel <linux-kernel@...r.kernel.org>,opensource.kernel@...o.com
>> 主题:Re: [PATCH] drm/mediatek: cleanup coding style in mediatek a bit>Hi, Bernard:
>> >
>> >Bernard Zhao <bernard@...o.com> 於 2020年4月27日 週一 下午3:53寫道:
>> >>
>> >> This code change is to make code bit more readable.
>> >> Optimise array size align to HDMI macro define.
>> >> Add check if len is overange.
>> >
>> >One patch should just do one thing, but this do three things.
>> >So break this into three patches.
>> >
>> >Regards,
>> >Chun-Kuang.
>>
>> Hi
>> This optimization is mainly to make the code a bit readable.
>> These modifications are related, main in several related function calls in the same file.
>> I was a bit confused that if it is really necessary to change to three separate patch submissions?
>>
>> Regards
>> Bernard
>>
>> >>
>> >> Signed-off-by: Bernard Zhao <bernard@...o.com>
>> >> ---
>> >> drivers/gpu/drm/mediatek/mtk_hdmi.c | 22 +++++++++++-----------
>> >> 1 file changed, 11 insertions(+), 11 deletions(-)
>> >>
>> >> diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c b/drivers/gpu/drm/mediatek/mtk_hdmi.c
>> >> index ff43a3d80410..40fb5154ed5d 100644
>> >> --- a/drivers/gpu/drm/mediatek/mtk_hdmi.c
>> >> +++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c
>> >> @@ -311,15 +311,15 @@ static void mtk_hdmi_hw_send_info_frame(struct mtk_hdmi *hdmi, u8 *buffer,
>> >> u8 checksum;
>> >> int ctrl_frame_en = 0;
>> >>
>> >> - frame_type = *buffer;
>> >> - buffer += 1;
>> >> - frame_ver = *buffer;
>> >> - buffer += 1;
>> >> - frame_len = *buffer;
>> >> - buffer += 1;
>> >> - checksum = *buffer;
>> >> - buffer += 1;
>> >> + frame_type = *buffer++;
>> >> + frame_ver = *buffer++;
>> >> + frame_len = *buffer++;
>> >> + checksum = *buffer++;
>
>This part looks like cleanup, so keep in this patch.
>
>> >> frame_data = buffer;
>> >> + if ((frame_len + HDMI_INFOFRAME_HEADER_SIZE) > len) {
>> >> + dev_err(hdmi->dev, "Wrong frame len: %d\n", frame_len;
>> >> + return;
>
>This is error checking, not cleanup the coding style, so move this to
>another patch.
>
>> >> + }
>> >>
>> >> dev_dbg(hdmi->dev,
>> >> "frame_type:0x%x,frame_ver:0x%x,frame_len:0x%x,checksum:0x%x\n",
>> >> @@ -982,7 +982,7 @@ static int mtk_hdmi_setup_avi_infoframe(struct mtk_hdmi *hdmi,
>> >> struct drm_display_mode *mode)
>> >> {
>> >> struct hdmi_avi_infoframe frame;
>> >> - u8 buffer[17];
>> >> + u8 buffer[HDMI_INFOFRAME_HEADER_SIZE + HDMI_AVI_INFOFRAME_SIZE];
>
>This is to symbolize the number, symbolization is more than cleanup.
>
>Regards,
>Chun-Kuang.
>
Hi
Sure, I get the picture, i will resubmit, thank you!
Regards,
Bernard
>> >> ssize_t err;
>> >>
>> >> err = drm_hdmi_avi_infoframe_from_display_mode(&frame,
>> >> @@ -1008,7 +1008,7 @@ static int mtk_hdmi_setup_spd_infoframe(struct mtk_hdmi *hdmi,
>> >> const char *product)
>> >> {
>> >> struct hdmi_spd_infoframe frame;
>> >> - u8 buffer[29];
>> >> + u8 buffer[HDMI_INFOFRAME_HEADER_SIZE + HDMI_SPD_INFOFRAME_SIZE];
>> >> ssize_t err;
>> >>
>> >> err = hdmi_spd_infoframe_init(&frame, vendor, product);
>> >> @@ -1031,7 +1031,7 @@ static int mtk_hdmi_setup_spd_infoframe(struct mtk_hdmi *hdmi,
>> >> static int mtk_hdmi_setup_audio_infoframe(struct mtk_hdmi *hdmi)
>> >> {
>> >> struct hdmi_audio_infoframe frame;
>> >> - u8 buffer[14];
>> >> + u8 buffer[HDMI_INFOFRAME_HEADER_SIZE + HDMI_AUDIO_INFOFRAME_SIZE];
>> >> ssize_t err;
>> >>
>> >> err = hdmi_audio_infoframe_init(&frame);
>> >> --
>> >> 2.26.2
>> >>
>> >>
>> >> _______________________________________________
>> >> Linux-mediatek mailing list
>> >> Linux-mediatek@...ts.infradead.org
>> >> http://lists.infradead.org/mailman/listinfo/linux-mediatek
>>
>>
>> _______________________________________________
>> Linux-mediatek mailing list
>> Linux-mediatek@...ts.infradead.org
>> http://lists.infradead.org/mailman/listinfo/linux-mediatek
Powered by blists - more mailing lists