From: Andy Shevchenko <andy@kernel.org>
To: Binbin Zhou <zhoubinbin@loongson.cn>
Cc: Wolfram Sang <wsa@kernel.org>,
Wolfram Sang <wsa+renesas@sang-engineering.com>,
Mika Westerberg <mika.westerberg@linux.intel.com>,
linux-i2c@vger.kernel.org, loongarch@lists.linux.dev,
devicetree@vger.kernel.org, Huacai Chen <chenhuacai@loongson.cn>,
WANG Xuerui <kernel@xen0n.name>, Arnd Bergmann <arnd@arndb.de>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Jianmin Lv <lvjianmin@loongson.cn>
Subject: Re: [PATCH V7 3/4] i2c: ls2x: Add driver for Loongson-2K/LS7A I2C controller
Date: Mon, 19 Dec 2022 15:04:06 +0200 [thread overview]
Message-ID: <Y6BhRsPAU30Dqbdv@smile.fi.intel.com> (raw)
In-Reply-To: <d44eb07245020431f98fd08e0c05b6926fb31b24.1671451604.git.zhoubinbin@loongson.cn>
On Mon, Dec 19, 2022 at 08:28:33PM +0800, Binbin Zhou wrote:
> This I2C module is integrated into the Loongson-2K SoCs and Loongson
> LS7A bridge chip.
Almost there, see my comments below (note, you have ~1w of time before this
can be applied anyway, so take you time for carefully addressing comments,
(re-)testing, etc.).
...
> @@ -888,6 +888,17 @@ config I2C_OWL
> Say Y here if you want to use the I2C bus controller on
> the Actions Semiconductor Owl SoC's.
>
> +config I2C_LS2X
I believe in Latin alphabet L goes before O...
> + tristate "Loongson LS2X I2C adapter"
> + depends on MACH_LOONGSON64 || COMPILE_TEST
> + help
> + If you say yes to this option, support will be included for the
> + I2C interface on the Loongson-2K SoCs and Loongson LS7A bridge
> + chip.
> +
> + This driver can also be built as a module. If so, the module
> + will be called i2c-ls2x.
> +
> config I2C_PASEMI
> tristate "PA Semi SMBus interface"
> depends on PPC_PASEMI && PCI
...
> obj-$(CONFIG_I2C_MXS) += i2c-mxs.o
> obj-$(CONFIG_I2C_NOMADIK) += i2c-nomadik.o
> obj-$(CONFIG_I2C_NPCM) += i2c-npcm7xx.o
> +obj-$(CONFIG_I2C_LS2X) += i2c-ls2x.o
...and even before n and m.
> obj-$(CONFIG_I2C_OCORES) += i2c-ocores.o
> obj-$(CONFIG_I2C_OMAP) += i2c-omap.o
> obj-$(CONFIG_I2C_OWL) += i2c-owl.o
...
> +static int ls2x_i2c_xfer_one(struct i2c_adapter *adap,
> + struct i2c_msg *msg, bool stop)
> +{
> + int ret;
> + bool is_read = msg->flags & I2C_M_RD;
> + struct ls2x_i2c_priv *priv = i2c_get_adapdata(adap);
> +
> + /* Contains steps to send start condition and address */
> + ret = ls2x_i2c_start(adap, msg);
> + if (!ret) {
> + if (is_read)
> + ret = ls2x_i2c_rx(adap, msg->buf, msg->len);
> + else
> + ret = ls2x_i2c_tx(adap, msg->buf, msg->len);
> + if (!ret && stop)
> + ret = ls2x_i2c_stop(adap);
So, we will send stop here...
> + }
> + if (ret == -ENXIO)
> + ls2x_i2c_stop(adap);
...and if it fails, we send it again here. Is it okay?
> + else if (ret < 0)
> + ls2x_i2c_init(priv);
> +
> + return ret;
> +}
...
> + ret = ls2x_i2c_xfer_one(adap, msg, msg == (emsg - 1));
Too many parentheses, isn't it?
> + if (ret)
> + return ret;
...
> + r = devm_request_irq(dev, irq, ls2x_i2c_isr, IRQF_SHARED, "ls2x-i2c",
> + priv);
Everywhere else you use 'ret', why is 'r' here?
> + if (r < 0)
> + return dev_err_probe(dev, r, "Unable to request irq %d\n", irq);
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2022-12-19 13:04 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-19 12:28 [PATCH V7 0/4] i2c: ls2x: Add support for the Loongson-2K/LS7A I2C controller Binbin Zhou
2022-12-19 12:28 ` [PATCH V7 1/4] i2c: gpio: Add support on ACPI-based system Binbin Zhou
2022-12-19 12:28 ` [PATCH V7 2/4] dt-bindings: i2c: add Loongson LS2X I2C controller Binbin Zhou
2022-12-19 12:28 ` [PATCH V7 3/4] i2c: ls2x: Add driver for Loongson-2K/LS7A " Binbin Zhou
2022-12-19 13:04 ` Andy Shevchenko [this message]
2022-12-20 11:47 ` Binbin Zhou
2022-12-20 13:48 ` Andy Shevchenko
2022-12-19 12:29 ` [PATCH V7 4/4] LoongArch: Enable LS2X I2C in loongson3_defconfig Binbin Zhou
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=Y6BhRsPAU30Dqbdv@smile.fi.intel.com \
--to=andy@kernel.org \
--cc=arnd@arndb.de \
--cc=chenhuacai@loongson.cn \
--cc=devicetree@vger.kernel.org \
--cc=kernel@xen0n.name \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-i2c@vger.kernel.org \
--cc=loongarch@lists.linux.dev \
--cc=lvjianmin@loongson.cn \
--cc=mika.westerberg@linux.intel.com \
--cc=robh+dt@kernel.org \
--cc=wsa+renesas@sang-engineering.com \
--cc=wsa@kernel.org \
--cc=zhoubinbin@loongson.cn \
/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