[PATCH v4 2/3] firmware: mediatek: add adsp ipc protocol interface
Tzung-Bi Shih
tzungbi at google.com
Fri Nov 26 05:43:04 CET 2021
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.
More information about the Alsa-devel
mailing list