alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: allen-kh.cheng <allen-kh.cheng@mediatek.com>
To: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
	Jassi Brar <jassisinghbrar@gmail.com>,
	Rob Herring <robh+dt@kernel.org>,
	"Matthias Brugger" <matthias.bgg@gmail.com>
Cc: devicetree@vger.kernel.org,
	Linux-ALSA <alsa-devel@alsa-project.org>,
	Kai Vehmanen <kai.vehmanen@linux.intel.com>,
	cujomalainey@google.com, Kevin Hilman <khilman@baylibre.com>,
	Takashi Iwai <tiwai@suse.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Ranjani Sridharan <ranjani.sridharan@linux.intel.com>,
	Project_Global_Chrome_Upstream_Group@mediatek.com,
	tzungbi@google.com, Mark Brown <broonie@kernel.org>,
	linux-mediatek@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org,
	Daniel Baluta <daniel.baluta@nxp.com>,
	linux-kernel@vger.kernel.org,
	sound-open-firmware@alsa-project.org
Subject: Re: [PATCH v13 2/2] mailbox: mediatek: add support for adsp mailbox controller
Date: Fri, 14 Jan 2022 11:16:21 +0800	[thread overview]
Message-ID: <bc5f284872c44c6fa9f5eb6bb7a49db5ff6e0794.camel@mediatek.com> (raw)
In-Reply-To: <c876eda8-1fde-6c40-117a-12dde042780d@linux.intel.com>

On Thu, 2022-01-13 at 12:47 -0600, Pierre-Louis Bossart wrote:
> > +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.
> 

Hi Pierre,

Thanks for your question.

I prefer my previous version which check NULL from
of_device_get_match_data.

I will revert this part in the next version.

Thanks.

> > +
> > +	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);
> > +}
> 
> 


      reply	other threads:[~2022-01-14  3:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-13  8:21 [PATCH v13 0/2] Mediatek ADSP mailbox controller support for MT8195 allen-kh.cheng
2022-01-13  8:21 ` [PATCH v13 1/2] dt-bindings: mediatek: add adsp-mbox document allen-kh.cheng
2022-01-13  8:21 ` [PATCH v13 2/2] mailbox: mediatek: add support for adsp mailbox controller allen-kh.cheng
2022-01-13 18:47   ` Pierre-Louis Bossart
2022-01-14  3:16     ` allen-kh.cheng [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bc5f284872c44c6fa9f5eb6bb7a49db5ff6e0794.camel@mediatek.com \
    --to=allen-kh.cheng@mediatek.com \
    --cc=Project_Global_Chrome_Upstream_Group@mediatek.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=cujomalainey@google.com \
    --cc=daniel.baluta@nxp.com \
    --cc=devicetree@vger.kernel.org \
    --cc=jassisinghbrar@gmail.com \
    --cc=kai.vehmanen@linux.intel.com \
    --cc=khilman@baylibre.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=ranjani.sridharan@linux.intel.com \
    --cc=robh+dt@kernel.org \
    --cc=sound-open-firmware@alsa-project.org \
    --cc=tiwai@suse.com \
    --cc=tzungbi@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).