aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi
diff options
context:
space:
mode:
authorBen Dooks <ben@simtec.co.uk>2009-08-18 17:11:17 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-08-18 19:31:13 -0400
commit191529756633052680dd9d23ad63744ca5aa02a1 (patch)
tree94f4f35d042dbbf3fb0a3692d98d117ce9ade130 /drivers/spi
parentb8978784544e8b4e8fbacb558df8580957d4f8a5 (diff)
spi_s3c24xx: fix transfer setup code
Since the changes to the bitbang driver, there is the possibility we will be called with either the speed_hz or bpw values zero. We take these to mean that the default values (8 bits per word, or maximum bus speed). Signed-off-by: Ben Dooks <ben@simtec.co.uk> Cc: David Brownell <david-b@pacbell.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/spi_s3c24xx.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/spi/spi_s3c24xx.c b/drivers/spi/spi_s3c24xx.c
index 590be85c8f3d..3f3119d760db 100644
--- a/drivers/spi/spi_s3c24xx.c
+++ b/drivers/spi/spi_s3c24xx.c
@@ -116,6 +116,12 @@ static int s3c24xx_spi_setupxfer(struct spi_device *spi,
116 bpw = t ? t->bits_per_word : spi->bits_per_word; 116 bpw = t ? t->bits_per_word : spi->bits_per_word;
117 hz = t ? t->speed_hz : spi->max_speed_hz; 117 hz = t ? t->speed_hz : spi->max_speed_hz;
118 118
119 if (!bpw)
120 bpw = 8;
121
122 if (!hz)
123 hz = spi->max_speed_hz;
124
119 if (bpw != 8) { 125 if (bpw != 8) {
120 dev_err(&spi->dev, "invalid bits-per-word (%d)\n", bpw); 126 dev_err(&spi->dev, "invalid bits-per-word (%d)\n", bpw);
121 return -EINVAL; 127 return -EINVAL;