lkml.org 
[lkml]   [2021]   [Nov]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v4 2/3] firmware: mediatek: add adsp ipc protocol interface
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.

\
 
 \ /
  Last update: 2021-11-26 05:46    [W:0.031 / U:0.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site