linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding@gmail.com>
To: Dmitry Osipenko <digetx@gmail.com>
Cc: "Jonathan Hunter" <jonathanh@nvidia.com>,
	"Laxman Dewangan" <ldewangan@nvidia.com>,
	"Wolfram Sang" <wsa@the-dreams.de>,
	"Michał Mirosław" <mirq-linux@rere.qmqm.pl>,
	"Andy Shevchenko" <andy.shevchenko@gmail.com>,
	linux-i2c@vger.kernel.org, linux-tegra@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v7 06/34] i2c: tegra: Remove i2c_dev.clk_divisor_non_hs_mode member
Date: Mon, 21 Sep 2020 12:49:20 +0200	[thread overview]
Message-ID: <20200921104920.GB3950626@ulmo> (raw)
In-Reply-To: <716583f1-60df-f576-16d3-dbb72d12fa54@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3244 bytes --]

On Thu, Sep 17, 2020 at 06:27:28PM +0300, Dmitry Osipenko wrote:
> 17.09.2020 14:25, Thierry Reding пишет:
> > On Wed, Sep 09, 2020 at 01:39:38AM +0300, Dmitry Osipenko wrote:
> >> The "non_hs_mode" divisor value is fixed, thus there is no need to have
> >> the variable i2c_dev.clk_divisor_non_hs_mode struct member. Let's remove
> >> it and move the mode selection into tegra_i2c_init() where it can be
> >> united with the timing selection.
> >>
> >> Reviewed-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
> >> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> >> ---
> >>  drivers/i2c/busses/i2c-tegra.c | 46 ++++++++++++++++------------------
> >>  1 file changed, 21 insertions(+), 25 deletions(-)
> >>
> >> diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
> >> index 720a75439e91..85ed0e02d48c 100644
> >> --- a/drivers/i2c/busses/i2c-tegra.c
> >> +++ b/drivers/i2c/busses/i2c-tegra.c
> >> @@ -250,7 +250,6 @@ struct tegra_i2c_hw_feature {
> >>   * @msg_buf_remaining: size of unsent data in the message buffer
> >>   * @msg_read: identifies read transfers
> >>   * @bus_clk_rate: current I2C bus clock rate
> >> - * @clk_divisor_non_hs_mode: clock divider for non-high-speed modes
> >>   * @is_multimaster_mode: track if I2C controller is in multi-master mode
> >>   * @tx_dma_chan: DMA transmit channel
> >>   * @rx_dma_chan: DMA receive channel
> >> @@ -281,7 +280,6 @@ struct tegra_i2c_dev {
> >>  	size_t msg_buf_remaining;
> >>  	int msg_read;
> >>  	u32 bus_clk_rate;
> >> -	u16 clk_divisor_non_hs_mode;
> >>  	bool is_multimaster_mode;
> >>  	struct dma_chan *tx_dma_chan;
> >>  	struct dma_chan *rx_dma_chan;
> >> @@ -783,6 +781,7 @@ static int tegra_i2c_init(struct tegra_i2c_dev *i2c_dev)
> >>  	u32 val;
> >>  	int err;
> >>  	u32 clk_divisor, clk_multiplier;
> >> +	u32 non_hs_mode;
> >>  	u32 tsu_thd;
> >>  	u8 tlow, thigh;
> >>  
> >> @@ -805,24 +804,33 @@ static int tegra_i2c_init(struct tegra_i2c_dev *i2c_dev)
> >>  	if (i2c_dev->is_vi)
> >>  		tegra_i2c_vi_init(i2c_dev);
> >>  
> >> -	/* Make sure clock divisor programmed correctly */
> >> -	clk_divisor = FIELD_PREP(I2C_CLK_DIVISOR_HSMODE,
> >> -				 i2c_dev->hw->clk_divisor_hs_mode) |
> >> -		      FIELD_PREP(I2C_CLK_DIVISOR_STD_FAST_MODE,
> >> -				 i2c_dev->clk_divisor_non_hs_mode);
> >> -	i2c_writel(i2c_dev, clk_divisor, I2C_CLK_DIVISOR);
> >> -
> >> -	if (i2c_dev->bus_clk_rate > I2C_MAX_STANDARD_MODE_FREQ &&
> >> -	    i2c_dev->bus_clk_rate <= I2C_MAX_FAST_MODE_PLUS_FREQ) {
> >> +	switch (i2c_dev->bus_clk_rate) {
> >> +	case I2C_MAX_STANDARD_MODE_FREQ + 1 ... I2C_MAX_FAST_MODE_PLUS_FREQ:
> > 
> > Is there are particular reason for switching the simple conditional to a
> > switch here? The old variant looks much easier to understand to me.
> 
> The reason is make it readable :) For me it's too difficult to read > <=
> && { } + no proper indentation.

Guess this is very subjective then... It would've been nice to avoid the
+ 1 and instead use the correct enumeration value. I think that would've
made it a little bit easier on the eye.

But anyway, no reason to hold up this patch set:

Reviewed-by: Thierry Reding <treding@nvidia.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2020-09-21 10:49 UTC|newest]

Thread overview: 146+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-08 22:39 [PATCH v7 00/34] Improvements for Tegra I2C driver Dmitry Osipenko
2020-09-08 22:39 ` [PATCH v7 01/34] i2c: tegra: Make tegra_i2c_flush_fifos() usable in atomic transfer Dmitry Osipenko
2020-09-17 11:10   ` Thierry Reding
2020-09-17 14:57     ` Dmitry Osipenko
2020-09-21 10:18   ` Thierry Reding
2020-09-08 22:39 ` [PATCH v7 02/34] i2c: tegra: Add missing pm_runtime_put() Dmitry Osipenko
2020-09-17 11:12   ` Thierry Reding
2020-09-21 10:18   ` Thierry Reding
2020-09-08 22:39 ` [PATCH v7 03/34] i2c: tegra: Handle potential error of tegra_i2c_flush_fifos() Dmitry Osipenko
2020-09-17 11:13   ` Thierry Reding
2020-09-21 10:18   ` Thierry Reding
2020-09-08 22:39 ` [PATCH v7 04/34] i2c: tegra: Mask interrupt in tegra_i2c_issue_bus_clear() Dmitry Osipenko
2020-09-17 11:18   ` Thierry Reding
2020-09-21 10:18   ` Thierry Reding
2020-09-08 22:39 ` [PATCH v7 05/34] i2c: tegra: Initialize div-clk rate unconditionally Dmitry Osipenko
2020-09-17 11:20   ` Thierry Reding
2020-09-21 10:18   ` Thierry Reding
2020-09-08 22:39 ` [PATCH v7 06/34] i2c: tegra: Remove i2c_dev.clk_divisor_non_hs_mode member Dmitry Osipenko
2020-09-17 11:25   ` Thierry Reding
2020-09-17 15:27     ` Dmitry Osipenko
2020-09-21 10:49       ` Thierry Reding [this message]
2020-09-21 10:18   ` Thierry Reding
2020-09-08 22:39 ` [PATCH v7 07/34] i2c: tegra: Runtime PM always available on Tegra Dmitry Osipenko
2020-09-17 11:26   ` Thierry Reding
2020-09-21 10:18   ` Thierry Reding
2020-09-08 22:39 ` [PATCH v7 08/34] i2c: tegra: Remove error message used for devm_request_irq() failure Dmitry Osipenko
2020-09-17 11:28   ` Thierry Reding
2020-09-17 14:59     ` Dmitry Osipenko
2020-09-21 10:57       ` Thierry Reding
2020-09-21 10:18   ` Thierry Reding
2020-09-08 22:39 ` [PATCH v7 09/34] i2c: tegra: Use reset_control_reset() Dmitry Osipenko
2020-09-17 12:36   ` Thierry Reding
2020-09-21 10:19   ` Thierry Reding
2020-09-08 22:39 ` [PATCH v7 10/34] i2c: tegra: Use devm_platform_get_and_ioremap_resource() Dmitry Osipenko
2020-09-17 11:31   ` Thierry Reding
2020-09-21 10:19   ` Thierry Reding
2020-09-08 22:39 ` [PATCH v7 11/34] i2c: tegra: Use platform_get_irq() Dmitry Osipenko
2020-09-17 11:31   ` Thierry Reding
2020-09-21 10:19   ` Thierry Reding
2020-09-08 22:39 ` [PATCH v7 12/34] i2c: tegra: Use clk-bulk helpers Dmitry Osipenko
2020-09-17 11:38   ` Thierry Reding
2020-09-17 13:54     ` Andy Shevchenko
2020-09-21 11:01       ` Thierry Reding
2020-09-21 11:15         ` Andy Shevchenko
2020-09-21 11:53           ` Thierry Reding
2020-09-17 15:01     ` Dmitry Osipenko
2020-09-21 11:08       ` Thierry Reding
2020-09-21 11:12       ` Thierry Reding
2020-09-21 14:44         ` Dmitry Osipenko
2020-09-21 10:19   ` Thierry Reding
2020-09-08 22:39 ` [PATCH v7 13/34] i2c: tegra: Move out all device-tree parsing into tegra_i2c_parse_dt() Dmitry Osipenko
2020-09-17 11:35   ` Thierry Reding
2020-09-21 10:19   ` Thierry Reding
2020-09-08 22:39 ` [PATCH v7 14/34] i2c: tegra: Clean up probe function Dmitry Osipenko
2020-09-17 12:37   ` Thierry Reding
2020-09-17 13:46     ` Andy Shevchenko
2020-09-21 11:15       ` Thierry Reding
2020-09-17 15:02     ` Dmitry Osipenko
2020-09-21 11:17       ` Thierry Reding
2020-09-21 10:19   ` Thierry Reding
2020-09-08 22:39 ` [PATCH v7 15/34] i2c: tegra: Reorder location of functions in the code Dmitry Osipenko
2020-09-17 12:38   ` Thierry Reding
2020-09-21 10:19   ` Thierry Reding
2020-09-08 22:39 ` [PATCH v7 16/34] i2c: tegra: Clean up variable types Dmitry Osipenko
2020-09-17 12:39   ` Thierry Reding
2020-09-21 10:19   ` Thierry Reding
2020-09-08 22:39 ` [PATCH v7 17/34] i2c: tegra: Remove outdated barrier() Dmitry Osipenko
2020-09-17 12:39   ` Thierry Reding
2020-09-21 10:19   ` Thierry Reding
2020-09-08 22:39 ` [PATCH v7 18/34] i2c: tegra: Remove likely/unlikely from the code Dmitry Osipenko
2020-09-17 12:41   ` Thierry Reding
2020-09-21 10:19   ` Thierry Reding
2020-09-08 22:39 ` [PATCH v7 19/34] i2c: tegra: Remove redundant check in tegra_i2c_issue_bus_clear() Dmitry Osipenko
2020-09-17 12:42   ` Thierry Reding
2020-09-21 10:19   ` Thierry Reding
2020-09-08 22:39 ` [PATCH v7 20/34] i2c: tegra: Remove "dma" variable from tegra_i2c_xfer_msg() Dmitry Osipenko
2020-09-17 11:44   ` Thierry Reding
2020-09-21 10:19   ` Thierry Reding
2020-09-08 22:39 ` [PATCH v7 21/34] i2c: tegra: Don't fall back to PIO mode if DMA configuration fails Dmitry Osipenko
2020-09-17 11:47   ` Thierry Reding
2020-09-17 15:03     ` Dmitry Osipenko
2020-09-21 11:21       ` Thierry Reding
2020-09-21 10:19   ` Thierry Reding
2020-09-08 22:39 ` [PATCH v7 22/34] i2c: tegra: Rename wait/poll functions Dmitry Osipenko
2020-09-17 11:48   ` Thierry Reding
2020-09-21 10:19   ` Thierry Reding
2020-09-08 22:39 ` [PATCH v7 23/34] i2c: tegra: Factor out error recovery from tegra_i2c_xfer_msg() Dmitry Osipenko
2020-09-17 11:49   ` Thierry Reding
2020-09-21 10:20   ` Thierry Reding
2020-09-08 22:39 ` [PATCH v7 24/34] i2c: tegra: Factor out packet header setup " Dmitry Osipenko
2020-09-17 11:51   ` Thierry Reding
2020-09-21 10:20   ` Thierry Reding
2020-09-08 22:39 ` [PATCH v7 25/34] i2c: tegra: Factor out register polling into separate function Dmitry Osipenko
2020-09-17 11:58   ` Thierry Reding
2020-09-17 15:05     ` Dmitry Osipenko
2020-09-21 11:22       ` Thierry Reding
2020-09-21 10:20   ` Thierry Reding
2020-09-08 22:39 ` [PATCH v7 26/34] i2c: tegra: Factor out hardware initialization " Dmitry Osipenko
2020-09-17 12:06   ` Thierry Reding
2020-09-21 10:20   ` Thierry Reding
2020-09-08 22:39 ` [PATCH v7 27/34] i2c: tegra: Check errors for both positive and negative values Dmitry Osipenko
2020-09-17 12:09   ` Thierry Reding
2020-09-17 13:50     ` Andy Shevchenko
2020-09-21 11:24       ` Thierry Reding
2020-09-21 14:13         ` Dmitry Osipenko
2020-09-21 10:20   ` Thierry Reding
2020-09-08 22:40 ` [PATCH v7 28/34] i2c: tegra: Consolidate error handling in tegra_i2c_xfer_msg() Dmitry Osipenko
2020-09-17 12:12   ` Thierry Reding
2020-09-21 10:20   ` Thierry Reding
2020-09-08 22:40 ` [PATCH v7 29/34] i2c: tegra: Improve formatting of variables Dmitry Osipenko
2020-09-17 12:16   ` Thierry Reding
2020-09-17 15:13     ` Dmitry Osipenko
2020-09-21 11:28       ` Thierry Reding
2020-09-21 10:20   ` Thierry Reding
2020-09-08 22:40 ` [PATCH v7 30/34] i2c: tegra: Clean up variable names Dmitry Osipenko
2020-09-17 12:21   ` Thierry Reding
2020-09-17 15:43     ` Dmitry Osipenko
2020-09-21 11:40       ` Thierry Reding
2020-09-21 15:18         ` Dmitry Osipenko
2020-09-21 15:50           ` Thierry Reding
2020-09-21 16:05             ` Dmitry Osipenko
2020-09-21 10:20   ` Thierry Reding
2020-09-08 22:40 ` [PATCH v7 31/34] i2c: tegra: Clean up printk messages Dmitry Osipenko
2020-09-17 12:22   ` Thierry Reding
2020-09-21 10:20   ` Thierry Reding
2020-09-08 22:40 ` [PATCH v7 32/34] i2c: tegra: Clean up and improve comments Dmitry Osipenko
2020-09-17 12:32   ` Thierry Reding
2020-09-17 15:02     ` Dmitry Osipenko
2020-09-17 15:17       ` Dmitry Osipenko
2020-09-21 11:43         ` Thierry Reding
2020-09-21 11:44           ` Thierry Reding
2020-09-21 10:20   ` Thierry Reding
2020-09-08 22:40 ` [PATCH v7 33/34] i2c: tegra: Clean up whitespaces, newlines and indentation Dmitry Osipenko
2020-09-17 12:35   ` Thierry Reding
2020-09-21 10:20   ` Thierry Reding
2020-09-08 22:40 ` [PATCH v7 34/34] i2c: tegra: Improve driver module description Dmitry Osipenko
2020-09-17 12:35   ` Thierry Reding
2020-09-21 10:20   ` Thierry Reding
2020-09-09  9:11 ` [PATCH v7 00/34] Improvements for Tegra I2C driver Andy Shevchenko
2020-09-09 15:36   ` Dmitry Osipenko
2020-09-09 15:49     ` Wolfram Sang
2020-09-09 17:39       ` Dmitry Osipenko
2020-09-17 12:44       ` Thierry Reding
2020-09-21  9:12         ` Wolfram Sang
2020-09-21 10:18 ` Thierry Reding
2020-09-21 10:42   ` Thierry Reding

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=20200921104920.GB3950626@ulmo \
    --to=thierry.reding@gmail.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=digetx@gmail.com \
    --cc=jonathanh@nvidia.com \
    --cc=ldewangan@nvidia.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=mirq-linux@rere.qmqm.pl \
    --cc=wsa@the-dreams.de \
    /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).