summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Nikitenko <jan.nikitenko@gmail.com>2009-12-07 12:50:30 +0000
committerGrant Likely <grant.likely@secretlab.ca>2009-12-08 18:48:16 -0700
commit04ba24b34ac8ea4885295a7f7f78f719bc8c859b (patch)
tree084b85b31b34445137d8a71efc379891757fc25b
parentb3a08945166adc8515a8c7927fbf0df264db5b63 (diff)
downloadlinux-stable-04ba24b34ac8ea4885295a7f7f78f719bc8c859b.tar.gz
linux-stable-04ba24b34ac8ea4885295a7f7f78f719bc8c859b.tar.bz2
linux-stable-04ba24b34ac8ea4885295a7f7f78f719bc8c859b.zip
spi/au1550_spi: fix setupxfer not to override cfg with zeros
fix setupxfer() not to override generic configuration of speed_hz and bits_per_word with zeros Signed-off-by: Jan Nikitenko <jan.nikitenko@gmail.com> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
-rw-r--r--drivers/spi/au1550_spi.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/spi/au1550_spi.c b/drivers/spi/au1550_spi.c
index 76cbc1a66598..cfd5ff9508fa 100644
--- a/drivers/spi/au1550_spi.c
+++ b/drivers/spi/au1550_spi.c
@@ -237,8 +237,14 @@ static int au1550_spi_setupxfer(struct spi_device *spi, struct spi_transfer *t)
unsigned bpw, hz;
u32 cfg, stat;
- bpw = t ? t->bits_per_word : spi->bits_per_word;
- hz = t ? t->speed_hz : spi->max_speed_hz;
+ bpw = spi->bits_per_word;
+ hz = spi->max_speed_hz;
+ if (t) {
+ if (t->bits_per_word)
+ bpw = t->bits_per_word;
+ if (t->speed_hz)
+ hz = t->speed_hz;
+ }
if (bpw < 4 || bpw > 24) {
dev_err(&spi->dev, "setupxfer: invalid bits_per_word=%d\n",