* [PATCH] spi: sh-msiof: Kill sh_msiof_spi_bits and sh_msiof_spi_hz functions
@ 2014-03-02 14:30 Axel Lin
2014-03-02 19:43 ` Geert Uytterhoeven
2014-03-03 1:47 ` Mark Brown
0 siblings, 2 replies; 3+ messages in thread
From: Axel Lin @ 2014-03-02 14:30 UTC (permalink / raw)
To: Mark Brown
Cc: Geert Uytterhoeven, Magnus Damm, linux-spi-u79uwXL29TY76Z2rM5mHXA
In the implementation of __spi_validate(), spi core will set transfer
bits_per_word and max speed as spi device default if it is not set for
this transfer. So we can remove the same implementation in this driver.
Signed-off-by: Axel Lin <axel.lin-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org>
---
drivers/spi/spi-sh-msiof.c | 25 ++-----------------------
1 file changed, 2 insertions(+), 23 deletions(-)
diff --git a/drivers/spi/spi-sh-msiof.c b/drivers/spi/spi-sh-msiof.c
index 1b59804..739eb2f 100644
--- a/drivers/spi/spi-sh-msiof.c
+++ b/drivers/spi/spi-sh-msiof.c
@@ -416,26 +416,6 @@ static void sh_msiof_spi_read_fifo_s32u(struct sh_msiof_spi_priv *p,
put_unaligned(swab32(sh_msiof_read(p, RFDR) >> fs), &buf_32[k]);
}
-static int sh_msiof_spi_bits(struct spi_device *spi, struct spi_transfer *t)
-{
- int bits;
-
- bits = t ? t->bits_per_word : 0;
- if (!bits)
- bits = spi->bits_per_word;
- return bits;
-}
-
-static u32 sh_msiof_spi_hz(struct spi_device *spi, struct spi_transfer *t)
-{
- u32 hz;
-
- hz = t ? t->speed_hz : 0;
- if (!hz)
- hz = spi->max_speed_hz;
- return hz;
-}
-
static int sh_msiof_spi_setup(struct spi_device *spi)
{
struct device_node *np = spi->master->dev.of_node;
@@ -573,7 +553,7 @@ static int sh_msiof_transfer_one(struct spi_master *master,
int n;
bool swab;
- bits = sh_msiof_spi_bits(spi, t);
+ bits = t->bits_per_word;
if (bits <= 8 && t->len > 15 && !(t->len & 3)) {
bits = 32;
@@ -623,8 +603,7 @@ static int sh_msiof_transfer_one(struct spi_master *master,
}
/* setup clocks (clock already enabled in chipselect()) */
- sh_msiof_spi_set_clk_regs(p, clk_get_rate(p->clk),
- sh_msiof_spi_hz(spi, t));
+ sh_msiof_spi_set_clk_regs(p, clk_get_rate(p->clk), t->speed_hz);
/* transfer in fifo sized chunks */
words = t->len / bytes_per_word;
--
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-msiof: Kill sh_msiof_spi_bits and sh_msiof_spi_hz functions
2014-03-02 14:30 [PATCH] spi: sh-msiof: Kill sh_msiof_spi_bits and sh_msiof_spi_hz functions Axel Lin
@ 2014-03-02 19:43 ` Geert Uytterhoeven
2014-03-03 1:47 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Geert Uytterhoeven @ 2014-03-02 19:43 UTC (permalink / raw)
To: Axel Lin; +Cc: Mark Brown, Geert Uytterhoeven, Magnus Damm, linux-spi
On Sun, Mar 2, 2014 at 3:30 PM, Axel Lin <axel.lin-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org> wrote:
> In the implementation of __spi_validate(), spi core will set transfer
> bits_per_word and max speed as spi device default if it is not set for
> this transfer. So we can remove the same implementation in this driver.
>
> 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-msiof: Kill sh_msiof_spi_bits and sh_msiof_spi_hz functions
2014-03-02 14:30 [PATCH] spi: sh-msiof: Kill sh_msiof_spi_bits and sh_msiof_spi_hz functions Axel Lin
2014-03-02 19:43 ` Geert Uytterhoeven
@ 2014-03-03 1:47 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2014-03-03 1:47 UTC (permalink / raw)
To: Axel Lin
Cc: Geert Uytterhoeven, Magnus Damm, linux-spi-u79uwXL29TY76Z2rM5mHXA
[-- Attachment #1: Type: text/plain, Size: 295 bytes --]
On Sun, Mar 02, 2014 at 10:30:32PM +0800, Axel Lin wrote:
> In the implementation of __spi_validate(), spi core will set transfer
> bits_per_word and max speed as spi device default if it is not set for
> this transfer. So we can remove the same implementation in this driver.
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:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-02 14:30 [PATCH] spi: sh-msiof: Kill sh_msiof_spi_bits and sh_msiof_spi_hz functions Axel Lin
2014-03-02 19:43 ` Geert Uytterhoeven
2014-03-03 1:47 ` 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).