[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZKVDjTCFAcJxO_Ci@surfacebook>
Date: Wed, 5 Jul 2023 13:18:53 +0300
From: andy.shevchenko@...il.com
To: Martin Kurbanov <mmkurbanov@...rdevices.ru>
Cc: Mark Brown <broonie@...nel.org>,
Neil Armstrong <neil.armstrong@...aro.org>,
linux-spi@...r.kernel.org, linux-amlogic@...ts.infradead.org,
linux-kernel@...r.kernel.org, kernel@...rdevices.ru
Subject: Re: [PATCH v1 2/2] spi: amlogic-spifc-a1: add support for
max_speed_hz
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
Powered by blists - more mailing lists