From: Alexandru Ardelean <aardelean@deviqon.com> To: Lars-Peter Clausen <lars@metafoo.de> Cc: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, greybus-dev@lists.linaro.org, devel@driverdev.osuosl.org, linux-tegra@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com, broonie@kernel.org, gregkh@linuxfoundation.org, elder@kernel.org, johan@kernel.org, vireshk@kernel.org, rmfrfs@gmail.com, f.fainelli@gmail.com, ldewangan@nvidia.com, thierry.reding@gmail.com, jonathanh@nvidia.com, linux@deviqon.com Subject: Re: [PATCH 01/10] spi: spi-axi-spi-engine: remove usage of delay_usecs Date: Wed, 10 Mar 2021 09:16:51 +0200 [thread overview] Message-ID: <CAASAkoZ+3T27KK0HN6YikKczUFS15xSpOssaOmx4NtDQKiKvHQ@mail.gmail.com> (raw) In-Reply-To: <8a6ec9a1-71f8-ce1d-600a-66eba9244a54@metafoo.de> On Mon, 8 Mar 2021 at 18:42, Lars-Peter Clausen <lars@metafoo.de> wrote: > > On 3/8/21 3:54 PM, Alexandru Ardelean wrote: > > The 'delay_usecs' field was handled for backwards compatibility in case > > there were some users that still configured SPI delay transfers with > > this field. > > > > They should all be removed by now. > > > > Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com> > > --- > > drivers/spi/spi-axi-spi-engine.c | 12 ++++-------- > > 1 file changed, 4 insertions(+), 8 deletions(-) > > > > diff --git a/drivers/spi/spi-axi-spi-engine.c b/drivers/spi/spi-axi-spi-engine.c > > index af86e6d6e16b..80c3e38f5c1b 100644 > > --- a/drivers/spi/spi-axi-spi-engine.c > > +++ b/drivers/spi/spi-axi-spi-engine.c > > @@ -170,14 +170,10 @@ static void spi_engine_gen_sleep(struct spi_engine_program *p, bool dry, > > unsigned int t; > > int delay; > > > > - if (xfer->delay_usecs) { > > - delay = xfer->delay_usecs; > > - } else { > > - delay = spi_delay_to_ns(&xfer->delay, xfer); > > - if (delay < 0) > > - return; > > - delay /= 1000; > > - } > > + delay = spi_delay_to_ns(&xfer->delay, xfer); > > + if (delay < 0) > > + return; > > Bit of a nit, but this could be `delay <= 0` and then drop the check for > `delay == 0` below. hmm, that's a bit debatable, because the `delay == 0` check comes after `delay /= 1000` ; to do what you're suggesting, it would probably need a DIV_ROUND_UP(delay, 1000) to make sure that even sub-microsecond delays don't become zero; if you're acking this suggestion i'll implement it; i'll wait a few more days to see if there are any other acks or complaints on the set before sending a V2; btw: this new spi_delay struct supports delays in microseconds, nanoseconds and clock cycles; at some point it may be interesting to use a `spi_delay_to_clk_cycles()` for this driver and other similar; > > > + delay /= 1000; > > > > if (delay == 0) > > return; > >
WARNING: multiple messages have this Message-ID (diff)
From: Alexandru Ardelean <aardelean@deviqon.com> To: Lars-Peter Clausen <lars@metafoo.de> Cc: devel@driverdev.osuosl.org, elder@kernel.org, gregkh@linuxfoundation.org, ldewangan@nvidia.com, linux-kernel@vger.kernel.org, jonathanh@nvidia.com, linux-spi@vger.kernel.org, greybus-dev@lists.linaro.org, broonie@kernel.org, bcm-kernel-feedback-list@broadcom.com, vireshk@kernel.org, linux-tegra@vger.kernel.org, f.fainelli@gmail.com, johan@kernel.org, thierry.reding@gmail.com, linux@deviqon.com Subject: Re: [PATCH 01/10] spi: spi-axi-spi-engine: remove usage of delay_usecs Date: Wed, 10 Mar 2021 09:16:51 +0200 [thread overview] Message-ID: <CAASAkoZ+3T27KK0HN6YikKczUFS15xSpOssaOmx4NtDQKiKvHQ@mail.gmail.com> (raw) In-Reply-To: <8a6ec9a1-71f8-ce1d-600a-66eba9244a54@metafoo.de> On Mon, 8 Mar 2021 at 18:42, Lars-Peter Clausen <lars@metafoo.de> wrote: > > On 3/8/21 3:54 PM, Alexandru Ardelean wrote: > > The 'delay_usecs' field was handled for backwards compatibility in case > > there were some users that still configured SPI delay transfers with > > this field. > > > > They should all be removed by now. > > > > Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com> > > --- > > drivers/spi/spi-axi-spi-engine.c | 12 ++++-------- > > 1 file changed, 4 insertions(+), 8 deletions(-) > > > > diff --git a/drivers/spi/spi-axi-spi-engine.c b/drivers/spi/spi-axi-spi-engine.c > > index af86e6d6e16b..80c3e38f5c1b 100644 > > --- a/drivers/spi/spi-axi-spi-engine.c > > +++ b/drivers/spi/spi-axi-spi-engine.c > > @@ -170,14 +170,10 @@ static void spi_engine_gen_sleep(struct spi_engine_program *p, bool dry, > > unsigned int t; > > int delay; > > > > - if (xfer->delay_usecs) { > > - delay = xfer->delay_usecs; > > - } else { > > - delay = spi_delay_to_ns(&xfer->delay, xfer); > > - if (delay < 0) > > - return; > > - delay /= 1000; > > - } > > + delay = spi_delay_to_ns(&xfer->delay, xfer); > > + if (delay < 0) > > + return; > > Bit of a nit, but this could be `delay <= 0` and then drop the check for > `delay == 0` below. hmm, that's a bit debatable, because the `delay == 0` check comes after `delay /= 1000` ; to do what you're suggesting, it would probably need a DIV_ROUND_UP(delay, 1000) to make sure that even sub-microsecond delays don't become zero; if you're acking this suggestion i'll implement it; i'll wait a few more days to see if there are any other acks or complaints on the set before sending a V2; btw: this new spi_delay struct supports delays in microseconds, nanoseconds and clock cycles; at some point it may be interesting to use a `spi_delay_to_clk_cycles()` for this driver and other similar; > > > + delay /= 1000; > > > > if (delay == 0) > > return; > > _______________________________________________ devel mailing list devel@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
next prev parent reply other threads:[~2021-03-10 7:17 UTC|newest] Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-03-08 14:54 [PATCH 00/10] spi: finalize 'delay_usecs' removal/transition Alexandru Ardelean 2021-03-08 14:54 ` Alexandru Ardelean 2021-03-08 14:54 ` [PATCH 01/10] spi: spi-axi-spi-engine: remove usage of delay_usecs Alexandru Ardelean 2021-03-08 14:54 ` Alexandru Ardelean 2021-03-08 16:42 ` Lars-Peter Clausen 2021-03-08 16:42 ` Lars-Peter Clausen 2021-03-10 7:16 ` Alexandru Ardelean [this message] 2021-03-10 7:16 ` Alexandru Ardelean 2021-03-10 7:21 ` Lars-Peter Clausen 2021-03-10 7:21 ` Lars-Peter Clausen 2021-03-08 14:54 ` [PATCH 02/10] spi: bcm63xx-spi: don't check 'delay_usecs' field Alexandru Ardelean 2021-03-08 14:54 ` Alexandru Ardelean 2021-03-08 14:54 ` [PATCH 03/10] spi: spi-bcm-qspi: replace 'delay_usecs' with 'delay.value' check Alexandru Ardelean 2021-03-08 14:54 ` Alexandru Ardelean 2021-03-08 14:54 ` [PATCH 04/10] spi: spi-sh: replace 'delay_usecs' with 'delay.value' in pr_debug Alexandru Ardelean 2021-03-08 14:54 ` Alexandru Ardelean 2021-03-08 14:54 ` [PATCH 05/10] spi: spi-tegra20-flash: don't check 'delay_usecs' field for spi transfer Alexandru Ardelean 2021-03-08 14:54 ` Alexandru Ardelean 2021-03-08 14:54 ` [PATCH 06/10] staging: greybus: spilib: use 'spi_delay_to_ns' for getting xfer delay Alexandru Ardelean 2021-03-08 14:54 ` Alexandru Ardelean 2021-03-09 4:28 ` Viresh Kumar 2021-03-09 4:28 ` Viresh Kumar 2021-03-09 9:29 ` Rui Miguel Silva 2021-03-09 9:29 ` Rui Miguel Silva 2021-03-09 13:05 ` Greg KH 2021-03-09 13:05 ` Greg KH 2021-03-08 14:54 ` [PATCH 07/10] spi: spi-falcon: remove check for 'delay_usecs' Alexandru Ardelean 2021-03-08 14:54 ` Alexandru Ardelean 2021-03-08 14:55 ` [PATCH 08/10] spi: fsl-espi: remove usage of 'delay_usecs' field Alexandru Ardelean 2021-03-08 14:55 ` Alexandru Ardelean 2021-03-08 14:55 ` [PATCH 09/10] spi: core: remove 'delay_usecs' field from spi_transfer Alexandru Ardelean 2021-03-08 14:55 ` Alexandru Ardelean 2021-03-08 14:55 ` [PATCH 10/10] spi: docs: update info about 'delay_usecs' Alexandru Ardelean 2021-03-08 14:55 ` Alexandru Ardelean 2021-03-12 20:25 ` [PATCH 00/10] spi: finalize 'delay_usecs' removal/transition Mark Brown 2021-03-12 20:25 ` 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=CAASAkoZ+3T27KK0HN6YikKczUFS15xSpOssaOmx4NtDQKiKvHQ@mail.gmail.com \ --to=aardelean@deviqon.com \ --cc=bcm-kernel-feedback-list@broadcom.com \ --cc=broonie@kernel.org \ --cc=devel@driverdev.osuosl.org \ --cc=elder@kernel.org \ --cc=f.fainelli@gmail.com \ --cc=gregkh@linuxfoundation.org \ --cc=greybus-dev@lists.linaro.org \ --cc=johan@kernel.org \ --cc=jonathanh@nvidia.com \ --cc=lars@metafoo.de \ --cc=ldewangan@nvidia.com \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-spi@vger.kernel.org \ --cc=linux-tegra@vger.kernel.org \ --cc=linux@deviqon.com \ --cc=rmfrfs@gmail.com \ --cc=thierry.reding@gmail.com \ --cc=vireshk@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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.