public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: Neil Armstrong <narmstrong@baylibre.com>
To: Lucas Tanure <tanure@linux.com>,
	Kevin Hilman <khilman@baylibre.com>,
	Jerome Brunet <jbrunet@baylibre.com>,
	Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Cc: linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] i2c: meson: Fix wrong speed use from probe
Date: Mon, 7 Mar 2022 09:46:48 +0100	[thread overview]
Message-ID: <72059eeb-dec6-286d-7006-0a1d4d947d4f@baylibre.com> (raw)
In-Reply-To: <20220301072600.12352-1-tanure@linux.com>

On 01/03/2022 08:26, Lucas Tanure wrote:
> Having meson_i2c_set_clk_div after i2c_add_adapter
> causes issues for client drivers that try to use
> the bus before the requested speed is applied.
> 
> The bus can be used just after i2c_add_adapter, so
> move i2c_add_adapter to the final step as
> meson_i2c_set_clk_div needs to be called before
> the bus is used.
> 
> Signed-off-by: Lucas Tanure <tanure@linux.com>
> ---
>   drivers/i2c/busses/i2c-meson.c | 12 ++++++------
>   1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-meson.c b/drivers/i2c/busses/i2c-meson.c
> index ef73a42577cc..07eb819072c4 100644
> --- a/drivers/i2c/busses/i2c-meson.c
> +++ b/drivers/i2c/busses/i2c-meson.c
> @@ -465,18 +465,18 @@ static int meson_i2c_probe(struct platform_device *pdev)
>   	 */
>   	meson_i2c_set_mask(i2c, REG_CTRL, REG_CTRL_START, 0);
>   
> -	ret = i2c_add_adapter(&i2c->adap);
> -	if (ret < 0) {
> -		clk_disable_unprepare(i2c->clk);
> -		return ret;
> -	}
> -
>   	/* Disable filtering */
>   	meson_i2c_set_mask(i2c, REG_SLAVE_ADDR,
>   			   REG_SLV_SDA_FILTER | REG_SLV_SCL_FILTER, 0);
>   
>   	meson_i2c_set_clk_div(i2c, timings.bus_freq_hz);
>   
> +	ret = i2c_add_adapter(&i2c->adap);
> +	if (ret < 0) {
> +		clk_disable_unprepare(i2c->clk);
> +		return ret;
> +	}
> +
>   	return 0;
>   }
>   

Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>

  reply	other threads:[~2022-03-07  8:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-01  7:26 [PATCH] i2c: meson: Fix wrong speed use from probe Lucas Tanure
2022-03-07  8:46 ` Neil Armstrong [this message]
2022-03-19 23:21 ` Wolfram Sang

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=72059eeb-dec6-286d-7006-0a1d4d947d4f@baylibre.com \
    --to=narmstrong@baylibre.com \
    --cc=jbrunet@baylibre.com \
    --cc=khilman@baylibre.com \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.blumenstingl@googlemail.com \
    --cc=tanure@linux.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