From: "CK Hu (胡俊光)" <ck.hu@mediatek.com>
To: "dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
"rosenp@gmail.com" <rosenp@gmail.com>
Cc: "chunkuang.hu@kernel.org" <chunkuang.hu@kernel.org>,
"simona@ffwll.ch" <simona@ffwll.ch>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
"airlied@gmail.com" <airlied@gmail.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"p.zabel@pengutronix.de" <p.zabel@pengutronix.de>,
"linux-mediatek@lists.infradead.org"
<linux-mediatek@lists.infradead.org>,
"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>
Subject: Re: [PATCH] drm/mediatek: simplify mtk_crtc allocation
Date: Fri, 8 May 2026 06:43:47 +0000 [thread overview]
Message-ID: <7ed306d2942bfcff6a9fa23db37350c29c23c20b.camel@mediatek.com> (raw)
In-Reply-To: <20260331002357.7995-1-rosenp@gmail.com>
On Mon, 2026-03-30 at 17:23 -0700, Rosen Penev wrote:
> External email : Please do not click links or open attachments until you have verified the sender or the content.
>
>
> Use a flexible array member to combine allocations.
Reviewed-by: CK Hu <ck.hu@mediatek.com>
>
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
> ---
> drivers/gpu/drm/mediatek/mtk_crtc.c | 13 ++++---------
> 1 file changed, 4 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_crtc.c b/drivers/gpu/drm/mediatek/mtk_crtc.c
> index fcb16f3f7b23..914841d2396e 100644
> --- a/drivers/gpu/drm/mediatek/mtk_crtc.c
> +++ b/drivers/gpu/drm/mediatek/mtk_crtc.c
> @@ -62,7 +62,6 @@ struct mtk_crtc {
> struct device *dma_dev;
> struct mtk_mutex *mutex;
> unsigned int ddp_comp_nr;
> - struct mtk_ddp_comp **ddp_comp;
> unsigned int num_conn_routes;
> const struct mtk_drm_route *conn_routes;
>
> @@ -71,6 +70,8 @@ struct mtk_crtc {
> bool config_updating;
> /* lock for config_updating to cmd buffer */
> spinlock_t config_lock;
> +
> + struct mtk_ddp_comp *ddp_comp[];
> };
>
> struct mtk_crtc_state {
> @@ -1048,18 +1049,12 @@ int mtk_crtc_create(struct drm_device *drm_dev, const unsigned int *path,
> }
> }
>
> - mtk_crtc = devm_kzalloc(dev, sizeof(*mtk_crtc), GFP_KERNEL);
> + mtk_crtc = devm_kzalloc(dev, struct_size(mtk_crtc, ddp_comp, path_len + (conn_routes ? 1 : 0)), GFP_KERNEL);
> if (!mtk_crtc)
> return -ENOMEM;
>
> - mtk_crtc->mmsys_dev = priv->mmsys_dev;
> mtk_crtc->ddp_comp_nr = path_len;
> - mtk_crtc->ddp_comp = devm_kcalloc(dev,
> - mtk_crtc->ddp_comp_nr + (conn_routes ? 1 : 0),
> - sizeof(*mtk_crtc->ddp_comp),
> - GFP_KERNEL);
> - if (!mtk_crtc->ddp_comp)
> - return -ENOMEM;
> + mtk_crtc->mmsys_dev = priv->mmsys_dev;
>
> mtk_crtc->mutex = mtk_mutex_get(priv->mutex_dev);
> if (IS_ERR(mtk_crtc->mutex)) {
> --
> 2.53.0
>
prev parent reply other threads:[~2026-05-08 6:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-31 0:23 [PATCH] drm/mediatek: simplify mtk_crtc allocation Rosen Penev
2026-05-08 6:43 ` CK Hu (胡俊光) [this message]
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=7ed306d2942bfcff6a9fa23db37350c29c23c20b.camel@mediatek.com \
--to=ck.hu@mediatek.com \
--cc=airlied@gmail.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=chunkuang.hu@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=p.zabel@pengutronix.de \
--cc=rosenp@gmail.com \
--cc=simona@ffwll.ch \
/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