LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* Re: [PATCH v4 2/3] firmware: mediatek: add adsp ipc protocol interface
       [not found] ` <20211125122925.1303-3-allen-kh.cheng@mediatek.com>
@ 2021-11-26  4:43   ` Tzung-Bi Shih
  0 siblings, 0 replies; 2+ messages in thread
From: Tzung-Bi Shih @ 2021-11-26  4:43 UTC (permalink / raw)
  To: allen-kh.cheng
  Cc: Jassi Brar, Rob Herring, Matthias Brugger, devicetree,
	Linux-ALSA, Kai Vehmanen, Liam Girdwood, cujomalainey,
	linux-kernel, Takashi Iwai, Ranjani Sridharan,
	Pierre-Louis Bossart, Project_Global_Chrome_Upstream_Group,
	Mark Brown, linux-mediatek, Daniel Baluta, linux-arm-kernel,
	sound-open-firmware

On Thu, Nov 25, 2021 at 08:29:24PM +0800, allen-kh.cheng wrote:
> diff --git a/drivers/firmware/mediatek/mtk-adsp-ipc.c b/drivers/firmware/mediatek/mtk-adsp-ipc.c
[...]
> +static void adsp_ipc_recv(struct mbox_client *c, void *msg)
> +{
> +	struct mtk_adsp_chan *chan = container_of(c, struct mtk_adsp_chan, cl);
> +
> +	if (chan->idx == MTK_ADSP_MBOX_REPLY)
> +		chan->ipc->ops->handle_reply(chan->ipc);
> +	else
> +		chan->ipc->ops->handle_request(chan->ipc);

Using switch ... case ... makes the intention more clear.

> +static int mtk_adsp_ipc_probe(struct platform_device *pdev)
> +{
[...]
> +	for (i = 0; i < MTK_ADSP_MBOX_NUM; i++) {
> +		chan_name = kasprintf(GFP_KERNEL, "mbox%d", i);
> +		if (!chan_name)
> +			return -ENOMEM;

It needs to go error handling path.

> +static int mtk_adsp_remove(struct platform_device *pdev)
> +{
> +	struct mtk_adsp_chan *dsp_chan;
> +	struct mtk_adsp_ipc *dsp_ipc;
> +	int i;
> +
> +	dsp_ipc = dev_get_drvdata(&pdev->dev);

To be concise, I would prefer dev_get_drvdata() inline to the line where the variable is declared.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v4 3/3] mailbox: mediatek: add support for adsp mailbox controller
       [not found] ` <20211125122925.1303-4-allen-kh.cheng@mediatek.com>
@ 2021-11-26  4:43   ` Tzung-Bi Shih
  0 siblings, 0 replies; 2+ messages in thread
From: Tzung-Bi Shih @ 2021-11-26  4:43 UTC (permalink / raw)
  To: allen-kh.cheng
  Cc: Jassi Brar, Rob Herring, Matthias Brugger, Linux-ALSA,
	cujomalainey, Pierre-Louis Bossart, Liam Girdwood,
	Ranjani Sridharan, Kai Vehmanen, Daniel Baluta, Mark Brown,
	Jaroslav Kysela, Takashi Iwai,
	Project_Global_Chrome_Upstream_Group, linux-kernel, devicetree,
	linux-arm-kernel, linux-mediatek, sound-open-firmware

On Thu, Nov 25, 2021 at 08:29:25PM +0800, allen-kh.cheng wrote:
> diff --git a/drivers/mailbox/mtk-adsp-mailbox.c b/drivers/mailbox/mtk-adsp-mailbox.c
[...]
> +static bool mtk_adsp_mbox_last_tx_done(struct mbox_chan *chan)
> +{
> +	struct adsp_mbox_ch_info *ch_info = chan->con_priv;
> +	void __iomem *reg = ch_info->va_reg;
> +
> +	return (readl(reg + MTK_ADSP_MBOX_IN_CMD) == 0) ? true : false;

To be concise, readl(reg + MTK_ADSP_MBOX_IN_CMD) == 0.

> +static int mtk_adsp_mbox_probe(struct platform_device *pdev)
> +{
[...]
> +	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> +	if (!res) {
> +		dev_err(dev, "no adsp mbox register resource\n");
> +		return -ENXIO;
> +	}
> +
> +	priv->va_mboxreg = devm_platform_ioremap_resource(pdev, 0);
> +	if (IS_ERR(priv->va_mboxreg))
> +		return PTR_ERR(priv->va_mboxreg);

If using devm_platform_ioremap_resource(), it doesn't need to call platform_get_resource().  res is unused.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-11-26  4:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20211125122925.1303-1-allen-kh.cheng@mediatek.com>
     [not found] ` <20211125122925.1303-3-allen-kh.cheng@mediatek.com>
2021-11-26  4:43   ` [PATCH v4 2/3] firmware: mediatek: add adsp ipc protocol interface Tzung-Bi Shih
     [not found] ` <20211125122925.1303-4-allen-kh.cheng@mediatek.com>
2021-11-26  4:43   ` [PATCH v4 3/3] mailbox: mediatek: add support for adsp mailbox controller Tzung-Bi Shih

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).