diff options
author | Jarkko Nikula <jarkko.nikula@linux.intel.com> | 2015-09-15 09:26:18 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-09-16 15:54:54 -0400 |
commit | 0beb0a6da8896da14287b1caa77596057690901a (patch) | |
tree | 4aea9aea6f83397a879574845dd88c6c2bab8751 | |
parent | 6ff33f3902c3b1c5d0db6b1e2c70b6d76fba357f (diff) |
spi: au1550: Simplify au1550_spi_setupxfer()
SPI core validates both bits_per_word and speed_hz transfer parameters and
defaults to spi->bits_per_word and spi->max_speed_hz in case these per
transfer parameters are not set. This can simplify a little the
au1550_spi_setupxfer() as there is need to check only for valid
"struct spi_transfer" pointer.
Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | drivers/spi/spi-au1550.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/spi/spi-au1550.c b/drivers/spi/spi-au1550.c index f45e085c01a6..afd239d6dec1 100644 --- a/drivers/spi/spi-au1550.c +++ b/drivers/spi/spi-au1550.c | |||
@@ -233,13 +233,12 @@ static int au1550_spi_setupxfer(struct spi_device *spi, struct spi_transfer *t) | |||
233 | unsigned bpw, hz; | 233 | unsigned bpw, hz; |
234 | u32 cfg, stat; | 234 | u32 cfg, stat; |
235 | 235 | ||
236 | bpw = spi->bits_per_word; | ||
237 | hz = spi->max_speed_hz; | ||
238 | if (t) { | 236 | if (t) { |
239 | if (t->bits_per_word) | 237 | bpw = t->bits_per_word; |
240 | bpw = t->bits_per_word; | 238 | hz = t->speed_hz; |
241 | if (t->speed_hz) | 239 | } else { |
242 | hz = t->speed_hz; | 240 | bpw = spi->bits_per_word; |
241 | hz = spi->max_speed_hz; | ||
243 | } | 242 | } |
244 | 243 | ||
245 | if (!hz) | 244 | if (!hz) |