* Re: [PATCH v13 2/2] mailbox: mediatek: add support for adsp mailbox controller
[not found] ` <20220113082103.27911-3-allen-kh.cheng@mediatek.com>
@ 2022-01-13 18:47 ` Pierre-Louis Bossart
0 siblings, 0 replies; only message in thread
From: Pierre-Louis Bossart @ 2022-01-13 18:47 UTC (permalink / raw)
To: allen-kh.cheng, Jassi Brar, Rob Herring, Matthias Brugger
Cc: Linux-ALSA, tzungbi, cujomalainey, Liam Girdwood,
Ranjani Sridharan, Kai Vehmanen, Daniel Baluta, Mark Brown,
Jaroslav Kysela, Takashi Iwai, Kevin Hilman,
Project_Global_Chrome_Upstream_Group, linux-kernel, devicetree,
linux-arm-kernel, linux-mediatek, sound-open-firmware
> +static int mtk_adsp_mbox_probe(struct platform_device *pdev)
> +{
> + struct device *dev = &pdev->dev;
> + struct mtk_adsp_mbox_priv *priv;
> + const struct mtk_adsp_mbox_cfg *cfg;
> + struct mbox_controller *mbox;
> + int ret, irq;
> +
> + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
> + if (!priv)
> + return -ENOMEM;
> +
> + mbox = &priv->mbox;
> + mbox->dev = dev;
> + mbox->ops = &mtk_adsp_mbox_chan_ops;
> + mbox->txdone_irq = false;
> + mbox->txdone_poll = true;
> + mbox->of_xlate = mtk_adsp_mbox_xlate;
> + mbox->num_chans = 1;
> + mbox->chans = devm_kzalloc(dev, sizeof(*mbox->chans), GFP_KERNEL);
> + if (!mbox->chans)
> + return -ENOMEM;
> +
> + priv->va_mboxreg = devm_platform_ioremap_resource(pdev, 0);
> + if (IS_ERR(priv->va_mboxreg))
> + return PTR_ERR(priv->va_mboxreg);
> +
> + priv->cfg = of_device_get_match_data(dev);
question: is any error handling needed here? some drivers do, others
don't, but that function can return NULL.
> +
> + irq = platform_get_irq(pdev, 0);
> + if (irq < 0)
> + return irq;
> +
> + ret = devm_request_threaded_irq(dev, irq, mtk_adsp_mbox_irq,
> + mtk_adsp_mbox_isr, IRQF_TRIGGER_NONE,
> + dev_name(dev), mbox->chans);
> + if (ret < 0)
> + return ret;
> +
> + platform_set_drvdata(pdev, priv);
> +
> + return devm_mbox_controller_register(dev, &priv->mbox);
> +}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-01-13 18:47 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20220113082103.27911-1-allen-kh.cheng@mediatek.com>
[not found] ` <20220113082103.27911-3-allen-kh.cheng@mediatek.com>
2022-01-13 18:47 ` [PATCH v13 2/2] mailbox: mediatek: add support for adsp mailbox controller Pierre-Louis Bossart
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).