From: Krzysztof Kozlowski <krzk@kernel.org>
To: Guomin Chen <guomin.chen@cixtech.com>,
Jassi Brar <jassisinghbrar@gmail.com>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>
Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
cix-kernel-upstream@cixtech.com,
Peter Chen <peter.chen@cixtech.com>,
Lihua Liu <Lihua.Liu@cixtech.com>
Subject: Re: [PATCH v2 2/2] mailbox: add Cixtech mailbox driver
Date: Tue, 25 Mar 2025 11:39:34 +0100 [thread overview]
Message-ID: <410f05ba-73e2-45fd-9d31-0c07d648cdd5@kernel.org> (raw)
In-Reply-To: <20250325101807.2202758-3-guomin.chen@cixtech.com>
On 25/03/2025 11:18, Guomin Chen wrote:
> +
> +static int cix_mbox_startup(struct mbox_chan *chan)
> +{
> + struct cix_mbox_priv *priv = to_cix_mbox_priv(chan->mbox);
> + struct cix_mbox_con_priv *cp = chan->con_priv;
> + int ret;
> + int index = cp->index;
> + u32 val_32;
> +
> + ret = request_irq(priv->irq, cix_mbox_isr, 0,
> + dev_name(priv->dev), chan);
> + if (ret) {
> + dev_err(priv->dev,
> + "Unable to acquire IRQ %d\n",
> + priv->irq);
Odd wrapping. All over the code. See coding style. Please follow it
precisely.
> + return ret;
> + }
> +
> + dev_info(priv->dev, "%s, irq %d, dir %d, type %d, index %d\n",
> + __func__, priv->irq, priv->dir, cp->type, cp->index);
Drop or dev_dbg.
> +
> + switch (cp->type) {
> + case CIX_MBOX_TYPE_DB:
> + /* Overwrite txdone_method for DB channel */
> + chan->txdone_method = TXDONE_BY_ACK;
> + fallthrough;
> + case CIX_MBOX_TYPE_REG:
> + if (priv->dir == MBOX_TX) {
> + /* Enable ACK interrupt */
> + val_32 = cix_mbox_read(priv, INT_ENABLE);
> + val_32 |= ACK_INT;
> + cix_mbox_write(priv, val_32, INT_ENABLE);
> + } else {
> + /* Enable Doorbell interrupt */
> + val_32 = cix_mbox_read(priv, INT_ENABLE_SIDE_B);
> + val_32 |= DB_INT;
> + cix_mbox_write(priv, val_32, INT_ENABLE_SIDE_B);
> + }
> + break;
> + case CIX_MBOX_TYPE_FIFO:
> + /* reset fifo */
> + cix_mbox_write(priv, FIFO_RST_BIT, FIFO_RST);
> + /* set default watermark */
> + cix_mbox_write(priv, FIFO_WM_DEFAULT, FIFO_WM);
> + if (priv->dir == MBOX_TX) {
> + /* Enable fifo overflow interrupt */
> + val_32 = cix_mbox_read(priv, INT_ENABLE);
> + val_32 |= FIFO_OFLOW_INT;
> + cix_mbox_write(priv, val_32, INT_ENABLE);
> + } else {
> + /* Enable fifo full/underflow interrupt */
> + val_32 = cix_mbox_read(priv, INT_ENABLE_SIDE_B);
> + val_32 |= FIFO_UFLOW_INT|FIFO_WM01_INT;
> + cix_mbox_write(priv, val_32, INT_ENABLE_SIDE_B);
> + }
> + break;
> + case CIX_MBOX_TYPE_FAST:
...
> +
> +static int cix_mbox_probe(struct platform_device *pdev)
> +{
> + struct device *dev = &pdev->dev;
> + struct cix_mbox_priv *priv;
> + int ret;
> + u32 dir;
> +
> + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
> + if (!priv)
> + return -ENOMEM;
> +
> + priv->dev = dev;
> + priv->base = devm_platform_ioremap_resource(pdev, 0);
> + if (IS_ERR(priv->base))
> + return PTR_ERR(priv->base);
> +
> + priv->irq = platform_get_irq(pdev, 0);
> + if (priv->irq < 0)
> + return priv->irq;
> +
> + if (device_property_read_u32(dev, "cix,mbox-dir", &dir)) {
> + dev_err(priv->dev, "cix,mbox_dir property not found\n");
> + return -EINVAL;
> + }
> +
> + if ((dir != MBOX_TX)
> + && (dir != MBOX_RX)) {
Odd style. Please follow Linux kernel coding style. There is no wrapping
after 20 characters.
> + dev_err(priv->dev, "Dir value is not expected! dir %d\n", dir);
> + return -EINVAL;
> + }
> +
> + cix_mbox_init(priv);
> +
> + priv->dir = (int)dir;
> + priv->mbox.dev = dev;
> + priv->mbox.ops = &cix_mbox_chan_ops;
> + priv->mbox.chans = priv->mbox_chans;
> + priv->mbox.txdone_irq = true;
> + priv->mbox.num_chans = CIX_MBOX_CHANS;
> + priv->mbox.of_xlate = NULL;
> + dev_info(priv->dev, "%s, irq %d, dir %d\n",
> + __func__, priv->irq, priv->dir);
Drop, your driver is supposed to be silent on success.
> +
> + platform_set_drvdata(pdev, priv);
> + ret = devm_mbox_controller_register(dev, &priv->mbox);
> + if (ret)
> + dev_err(dev, "Failed to register mailbox %d\n", ret);
> +
Best regards,
Krzysztof
next prev parent reply other threads:[~2025-03-25 10:39 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-25 10:18 [PATCH v2 0/2] " Guomin Chen
2025-03-25 10:18 ` [PATCH v2 1/2] dt-bindings: mailbox: add cix,sky1-mbox Guomin Chen
2025-03-25 10:36 ` Krzysztof Kozlowski
2025-03-28 3:13 ` Guomin chen
2025-03-28 7:12 ` Krzysztof Kozlowski
2025-03-28 8:49 ` Guomin chen
2025-03-25 12:55 ` Rob Herring (Arm)
2025-03-25 13:35 ` Guomin chen
2025-03-25 14:01 ` Rob Herring
2025-03-25 10:18 ` [PATCH v2 2/2] mailbox: add Cixtech mailbox driver Guomin Chen
2025-03-25 10:39 ` Krzysztof Kozlowski [this message]
2025-03-25 13:44 ` Guomin chen
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=410f05ba-73e2-45fd-9d31-0c07d648cdd5@kernel.org \
--to=krzk@kernel.org \
--cc=Lihua.Liu@cixtech.com \
--cc=cix-kernel-upstream@cixtech.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=guomin.chen@cixtech.com \
--cc=jassisinghbrar@gmail.com \
--cc=krzk+dt@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peter.chen@cixtech.com \
--cc=robh@kernel.org \
/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
all inboxes | Powered by JetHome®