linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: andy.shevchenko@gmail.com
To: Martin Kurbanov <mmkurbanov@sberdevices.ru>
Cc: Mark Brown <broonie@kernel.org>,
	Neil Armstrong <neil.armstrong@linaro.org>,
	linux-spi@vger.kernel.org, linux-amlogic@lists.infradead.org,
	linux-kernel@vger.kernel.org, kernel@sberdevices.ru
Subject: Re: [PATCH v1 2/2] spi: amlogic-spifc-a1: add support for max_speed_hz
Date: Wed, 5 Jul 2023 13:18:53 +0300	[thread overview]
Message-ID: <ZKVDjTCFAcJxO_Ci@surfacebook> (raw)
In-Reply-To: <20230703094518.53755-3-mmkurbanov@sberdevices.ru>

Mon, Jul 03, 2023 at 12:45:18PM +0300, Martin Kurbanov kirjoitti:
> This patch sets the clock rate (spi_transfer->max_speed_hz) from the
> amlogic_spifc_a1_exec_op().

...

> +static int amlogic_spifc_a1_set_freq(struct amlogic_spifc_a1 *spifc, u32 freq)
> +{
> +	int ret;
> +
> +	if (freq == spifc->curr_speed_hz)
> +		return 0;
> +
> +	ret = clk_set_rate(spifc->clk, freq);
> +	if (!ret)
> +		spifc->curr_speed_hz = freq;
> +
> +	return ret;

The form 

	ret = clk_set_rate(spifc->clk, freq);
	if (ret)
		return ret;

	spifc->curr_speed_hz = freq;
	return 0;

less error prone in case some code is squeezed in between.

> +}

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2023-07-05 10:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-03  9:45 [PATCH v1 0/2] spi: amlogic-spifc-a1: fixes and improvements for amlogic-spifc-a1 Martin Kurbanov
2023-07-03  9:45 ` [PATCH v1 1/2] spi: amlogic-spifc-a1: implement adjust_op_size() Martin Kurbanov
2023-07-05 10:17   ` andy.shevchenko
2023-07-03  9:45 ` [PATCH v1 2/2] spi: amlogic-spifc-a1: add support for max_speed_hz Martin Kurbanov
2023-07-05 10:18   ` andy.shevchenko [this message]
2023-07-11 22:04 ` [PATCH v1 0/2] spi: amlogic-spifc-a1: fixes and improvements for amlogic-spifc-a1 Mark Brown

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=ZKVDjTCFAcJxO_Ci@surfacebook \
    --to=andy.shevchenko@gmail.com \
    --cc=broonie@kernel.org \
    --cc=kernel@sberdevices.ru \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=mmkurbanov@sberdevices.ru \
    --cc=neil.armstrong@linaro.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).