linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Phil Edworthy <phil.edworthy@renesas.com>
Cc: Philipp Zabel <p.zabel@pengutronix.de>,
	Wolfram Sang <wsa@kernel.org>,
	Jarkko Nikula <jarkko.nikula@linux.intel.com>,
	Krzysztof Kozlowski <krzk@kernel.org>,
	Sam Protsenko <semen.protsenko@linaro.org>,
	Rob Herring <robh@kernel.org>, Sven Peter <sven@svenpeter.dev>,
	Jan Dabros <jsd@semihalf.com>,
	Lukas Bulwahn <lukas.bulwahn@gmail.com>,
	Tyrone Ting <kfting@nuvoton.com>, Arnd Bergmann <arnd@arndb.de>,
	Olof Johansson <olof@lixom.net>,
	Biju Das <biju.das.jz@bp.renesas.com>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	linux-i2c@vger.kernel.org, linux-renesas-soc@vger.kernel.org
Subject: Re: [PATCH v3 2/2] i2c: Add Renesas RZ/V2M controller
Date: Sat, 2 Jul 2022 14:51:38 +0300	[thread overview]
Message-ID: <YsAxSrcAk4jtRYx4@smile.fi.intel.com> (raw)
In-Reply-To: <20220701163916.111435-3-phil.edworthy@renesas.com>

On Fri, Jul 01, 2022 at 05:39:16PM +0100, Phil Edworthy wrote:
> Yet another i2c controller from Renesas that is found on the RZ/V2M
> (r9a09g011) SoC. It can support only 100kHz and 400KHz operation.

...

> +		/* 10-bit address
> +		 *   addr_1: 5'b11110 | addr[9:8] | (R/nW)
> +		 *   addr_2: addr[7:0]
> +		 */

/*
 * Multi-line comments should be
 * formatted like in this example.
 * (Of course use as much space up
 * to 80 as possible.)
 */

Ditto for other done in similar way, if any.

...

> +		addr = 0xf0 | ((msg->addr >> 7) & 0x06);

GENMASK() ?

...

> +	if (!ret) {
> +		if (read)
> +			ret = rzv2m_i2c_receive(priv, msg, &count);
> +		else
> +			ret = rzv2m_i2c_send(priv, msg, &count);

> +		if ((!ret) && stop)

Too many parentheses.

> +			ret = rzv2m_i2c_stop_condition(priv);
> +	}

...

> +		ret = rzv2m_i2c_master_xfer1(priv, &msgs[i], (i == (num - 1)));

Too many parentheses.

> +		if (ret < 0)
> +			goto out;

...

> +static const struct of_device_id rzv2m_i2c_ids[] = {
> +	{ .compatible = "renesas,rzv2m-i2c" },
> +	{ }
> +};
> +MODULE_DEVICE_TABLE(of, rzv2m_i2c_ids);

This can be moved after the ->probe() closer to the actual user of the table.

...

> +	priv = devm_kzalloc(dev, sizeof(struct rzv2m_i2c_priv), GFP_KERNEL);

sizeof(*priv)

> +	if (!priv)
> +		return -ENOMEM;

...

> +static int rzv2m_i2c_suspend(struct device *dev)
> +{
> +	struct rzv2m_i2c_priv *priv = dev_get_drvdata(dev);

> +	pm_runtime_get_sync(dev);

Isn't guaranteed by the runtime PM that device is runtime powered on the system
suspend?

> +	bit_clrl(priv->base + IICB0CTL0, IICB0IICE);
> +	pm_runtime_put(dev);
> +
> +	return 0;
> +}

...

> +static int rzv2m_i2c_resume(struct device *dev)
> +{
> +	struct rzv2m_i2c_priv *priv = dev_get_drvdata(dev);
> +	int ret;
> +
> +	ret = rzv2m_i2c_clock_calculate(dev, priv);
> +	if (ret < 0)
> +		return ret;
> +
> +	pm_runtime_get_sync(dev);

I'm not sure how it's suppose to work. Isn't it a no-op here?

> +	rzv2m_i2c_init(priv);
> +	pm_runtime_put(dev);
> +
> +	return 0;
> +}

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2022-07-02 11:51 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-01 16:39 [PATCH v3 0/2] i2c: Add new driver for Renesas RZ/V2M controller Phil Edworthy
2022-07-01 16:39 ` [PATCH v3 1/2] dt-bindings: i2c: Document RZ/V2M I2C controller Phil Edworthy
2022-07-01 16:39 ` [PATCH v3 2/2] i2c: Add Renesas RZ/V2M controller Phil Edworthy
2022-07-02 11:51   ` Andy Shevchenko [this message]
2022-07-03  8:41     ` Geert Uytterhoeven
2022-07-03 15:16       ` Andy Shevchenko
2022-07-07  7:21         ` Phil Edworthy
2022-07-07 16:37           ` Phil Edworthy
2022-07-07 17:45             ` Geert Uytterhoeven
2022-07-07 18:47               ` Phil Edworthy
2022-07-08  7:31                 ` Geert Uytterhoeven

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=YsAxSrcAk4jtRYx4@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=arnd@arndb.de \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=geert+renesas@glider.be \
    --cc=jarkko.nikula@linux.intel.com \
    --cc=jsd@semihalf.com \
    --cc=kfting@nuvoton.com \
    --cc=krzk@kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=lukas.bulwahn@gmail.com \
    --cc=olof@lixom.net \
    --cc=p.zabel@pengutronix.de \
    --cc=phil.edworthy@renesas.com \
    --cc=robh@kernel.org \
    --cc=semen.protsenko@linaro.org \
    --cc=sven@svenpeter.dev \
    --cc=wsa@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;
as well as URLs for NNTP newsgroup(s).