Re: [PATCH v5 2/2] mailbox: mediatek: Add mtk-vcp-mailbox driver
From: Chen-Yu Tsai <wenst@chromium.org>
Date: 2025-09-19 08:31:58
Also in:
linux-devicetree, linux-mediatek, lkml
From: Chen-Yu Tsai <wenst@chromium.org>
Date: 2025-09-19 08:31:58
Also in:
linux-devicetree, linux-mediatek, lkml
On Fri, Sep 19, 2025 at 7:50 AM Jassi Brar [off-list ref] wrote:
On Thu, Aug 21, 2025 at 9:12 PM Jjian Zhou [off-list ref] wrote: .....quoted
+#include <linux/module.h> +#include <linux/of.h> +#include <linux/platform_device.h> +#include <linux/slab.h> + +struct mtk_vcp_mbox_priv {Maybe 'mtk_vcp_mbox' is a more appropriate name ?quoted
+ void __iomem *base; + struct device *dev; + struct mbox_controller mbox; + const struct mtk_vcp_mbox_cfg *cfg; + struct mtk_ipi_info ipi_recv;Maybe also have "struct mbox_chan chan[1]; " so that you don't have to allocate one during the probe.
Also if you have "struct mbox_controller mbox;" as the first member, you could simply typecast that to get this structure. Something like "struct mpfs_mbox" in mailbox-mpfs.c
I read somewhere that this way of subclassing is not recommended. Instead the base class should explicitly not be the first member. And then container_of() should be used. I don't remember where I read this though. But I think the explicit container_of() is easier for understanding the intent. ChenYu
....quoted
+ +static struct mbox_chan *mtk_vcp_mbox_xlate(struct mbox_controller *mbox, + const struct of_phandle_args *sp) +{ + if (sp->args_count) + return NULL; + + return mbox->chans;return &mbox->chans[0] seems better. thnx