* [PATCH] spi: sh-hspi: Remove duplicate code to set default transfer speed
@ 2014-03-02 15:01 Axel Lin
2014-03-02 19:41 ` Geert Uytterhoeven
2014-03-03 1:37 ` Mark Brown
0 siblings, 2 replies; 3+ messages in thread
From: Axel Lin @ 2014-03-02 15:01 UTC (permalink / raw)
To: Mark Brown; +Cc: Kuninori Morimoto, linux-spi-u79uwXL29TY76Z2rM5mHXA
In the implementation of __spi_validate(), spi core will use spi device's max
speed as default transfer speed if it is not set for this transfer.
So we can remove the same logic in hspi_hw_setup().
Signed-off-by: Axel Lin <axel.lin-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org>
---
drivers/spi/spi-sh-hspi.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/drivers/spi/spi-sh-hspi.c b/drivers/spi/spi-sh-hspi.c
index 3c5d3b8..7435626 100644
--- a/drivers/spi/spi-sh-hspi.c
+++ b/drivers/spi/spi-sh-hspi.c
@@ -113,14 +113,9 @@ static void hspi_hw_setup(struct hspi_priv *hspi,
{
struct spi_device *spi = msg->spi;
struct device *dev = hspi->dev;
- u32 target_rate;
u32 spcr, idiv_clk;
u32 rate, best_rate, min, tmp;
- target_rate = t ? t->speed_hz : 0;
- if (!target_rate)
- target_rate = spi->max_speed_hz;
-
/*
* find best IDIV/CLKCx settings
*/
@@ -140,7 +135,7 @@ static void hspi_hw_setup(struct hspi_priv *hspi,
rate /= (((idiv_clk & 0x1F) + 1) * 2);
/* save best settings */
- tmp = abs(target_rate - rate);
+ tmp = abs(t->speed_hz - rate);
if (tmp < min) {
min = tmp;
spcr = idiv_clk;
@@ -153,7 +148,7 @@ static void hspi_hw_setup(struct hspi_priv *hspi,
if (spi->mode & SPI_CPOL)
spcr |= 1 << 6;
- dev_dbg(dev, "speed %d/%d\n", target_rate, best_rate);
+ dev_dbg(dev, "speed %d/%d\n", t->speed_hz, best_rate);
hspi_write(hspi, SPCR, spcr);
hspi_write(hspi, SPSR, 0x0);
--
1.8.1.2
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] spi: sh-hspi: Remove duplicate code to set default transfer speed
2014-03-02 15:01 [PATCH] spi: sh-hspi: Remove duplicate code to set default transfer speed Axel Lin
@ 2014-03-02 19:41 ` Geert Uytterhoeven
2014-03-03 1:37 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Geert Uytterhoeven @ 2014-03-02 19:41 UTC (permalink / raw)
To: Axel Lin; +Cc: Mark Brown, Kuninori Morimoto, linux-spi
On Sun, Mar 2, 2014 at 4:01 PM, Axel Lin <axel.lin-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org> wrote:
> In the implementation of __spi_validate(), spi core will use spi device's max
> speed as default transfer speed if it is not set for this transfer.
> So we can remove the same logic in hspi_hw_setup().
>
> Signed-off-by: Axel Lin <axel.lin-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org>
Acked-by: Geert Uytterhoeven <geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org>
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] spi: sh-hspi: Remove duplicate code to set default transfer speed
2014-03-02 15:01 [PATCH] spi: sh-hspi: Remove duplicate code to set default transfer speed Axel Lin
2014-03-02 19:41 ` Geert Uytterhoeven
@ 2014-03-03 1:37 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2014-03-03 1:37 UTC (permalink / raw)
To: Axel Lin; +Cc: Kuninori Morimoto, linux-spi-u79uwXL29TY76Z2rM5mHXA
[-- Attachment #1: Type: text/plain, Size: 280 bytes --]
On Sun, Mar 02, 2014 at 11:01:50PM +0800, Axel Lin wrote:
> In the implementation of __spi_validate(), spi core will use spi device's max
> speed as default transfer speed if it is not set for this transfer.
> So we can remove the same logic in hspi_hw_setup().
Applied, thanks.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-03-03 1:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-02 15:01 [PATCH] spi: sh-hspi: Remove duplicate code to set default transfer speed Axel Lin
2014-03-02 19:41 ` Geert Uytterhoeven
2014-03-03 1:37 ` Mark Brown
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).