[<prev] [next>] [day] [month] [year] [list]
Message-ID: <c876eda8-1fde-6c40-117a-12dde042780d@linux.intel.com>
Date: Thu, 13 Jan 2022 12:47:19 -0600
From: Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>
To: "allen-kh.cheng" <allen-kh.cheng@...iatek.com>,
Jassi Brar <jassisinghbrar@...il.com>,
Rob Herring <robh+dt@...nel.org>,
Matthias Brugger <matthias.bgg@...il.com>
Cc: Linux-ALSA <alsa-devel@...a-project.org>, tzungbi@...gle.com,
cujomalainey@...gle.com, Liam Girdwood <lgirdwood@...il.com>,
Ranjani Sridharan <ranjani.sridharan@...ux.intel.com>,
Kai Vehmanen <kai.vehmanen@...ux.intel.com>,
Daniel Baluta <daniel.baluta@....com>,
Mark Brown <broonie@...nel.org>,
Jaroslav Kysela <perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>,
Kevin Hilman <khilman@...libre.com>,
Project_Global_Chrome_Upstream_Group@...iatek.com,
linux-kernel@...r.kernel.org, devicetree@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org,
sound-open-firmware@...a-project.org
Subject: Re: [PATCH v13 2/2] mailbox: mediatek: add support for adsp mailbox
controller
> +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);
> +}
Powered by blists - more mailing lists