From: Daniel Baluta <daniel.baluta@nxp.com>
To: shawnguo@kernel.org
Cc: s.hauer@pengutronix.de, linux-kernel@vger.kernel.org,
paul.olaru@nxp.com, linux-imx@nxp.com, kernel@pengutronix.de,
festevam@gmail.com, shengjiu.wang@nxp.com,
linux-arm-kernel@lists.infradead.org
Subject: [PATCH RESEND 1/3] firmware: imx: Introduce imx_dsp_setup_channels
Date: Wed, 11 Nov 2020 13:11:16 +0200 [thread overview]
Message-ID: <20201111111118.21824-2-daniel.baluta@nxp.com> (raw)
In-Reply-To: <20201111111118.21824-1-daniel.baluta@nxp.com>
Create a separate function that sets up DSP mailbox channels
so that imx_dsp_probe function will be easier to read.
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
---
drivers/firmware/imx/imx-dsp.c | 41 +++++++++++++++++++++-------------
1 file changed, 26 insertions(+), 15 deletions(-)
diff --git a/drivers/firmware/imx/imx-dsp.c b/drivers/firmware/imx/imx-dsp.c
index 4265e9dbed84..a3a018c87b52 100644
--- a/drivers/firmware/imx/imx-dsp.c
+++ b/drivers/firmware/imx/imx-dsp.c
@@ -60,22 +60,15 @@ static void imx_dsp_handle_rx(struct mbox_client *c, void *msg)
}
}
-static int imx_dsp_probe(struct platform_device *pdev)
+static int imx_dsp_setup_channels(struct imx_dsp_ipc *dsp_ipc)
{
- struct device *dev = &pdev->dev;
- struct imx_dsp_ipc *dsp_ipc;
+ struct device *dev = dsp_ipc->dev;
struct imx_dsp_chan *dsp_chan;
struct mbox_client *cl;
char *chan_name;
int ret;
int i, j;
- device_set_of_node_from_dev(&pdev->dev, pdev->dev.parent);
-
- dsp_ipc = devm_kzalloc(dev, sizeof(*dsp_ipc), GFP_KERNEL);
- if (!dsp_ipc)
- return -ENOMEM;
-
for (i = 0; i < DSP_MU_CHAN_NUM; i++) {
if (i < 2)
chan_name = kasprintf(GFP_KERNEL, "txdb%d", i);
@@ -108,12 +101,6 @@ static int imx_dsp_probe(struct platform_device *pdev)
kfree(chan_name);
}
- dsp_ipc->dev = dev;
-
- dev_set_drvdata(dev, dsp_ipc);
-
- dev_info(dev, "NXP i.MX DSP IPC initialized\n");
-
return 0;
out:
kfree(chan_name);
@@ -125,6 +112,30 @@ static int imx_dsp_probe(struct platform_device *pdev)
return ret;
}
+static int imx_dsp_probe(struct platform_device *pdev)
+{
+ struct device *dev = &pdev->dev;
+ struct imx_dsp_ipc *dsp_ipc;
+ int ret;
+
+ device_set_of_node_from_dev(&pdev->dev, pdev->dev.parent);
+
+ dsp_ipc = devm_kzalloc(dev, sizeof(*dsp_ipc), GFP_KERNEL);
+ if (!dsp_ipc)
+ return -ENOMEM;
+
+ dsp_ipc->dev = dev;
+ dev_set_drvdata(dev, dsp_ipc);
+
+ ret = imx_dsp_setup_channels(dsp_ipc);
+ if (ret < 0)
+ return ret;
+
+ dev_info(dev, "NXP i.MX DSP IPC initialized\n");
+
+ return 0;
+}
+
static int imx_dsp_remove(struct platform_device *pdev)
{
struct imx_dsp_chan *dsp_chan;
--
2.17.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2020-11-11 11:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-11 11:11 [PATCH RESEND 0/3] Allow on demand channel request / free Daniel Baluta
2020-11-11 11:11 ` Daniel Baluta [this message]
2020-11-11 11:11 ` [PATCH RESEND 2/3] firmware: imx: Save channel name for further use Daniel Baluta
2020-11-11 11:11 ` [PATCH RESEND 3/3] firmware: imx-dsp: Export functions to request/free channels Daniel Baluta
2020-11-16 8:34 ` [PATCH RESEND 0/3] Allow on demand channel request / free Shawn Guo
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=20201111111118.21824-2-daniel.baluta@nxp.com \
--to=daniel.baluta@nxp.com \
--cc=festevam@gmail.com \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-imx@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=paul.olaru@nxp.com \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
--cc=shengjiu.wang@nxp.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