aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi_bitbang.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/spi/spi_bitbang.c')
-rw-r--r--drivers/spi/spi_bitbang.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/drivers/spi/spi_bitbang.c b/drivers/spi/spi_bitbang.c
index 8b55724d5f39..14a63f6010d1 100644
--- a/drivers/spi/spi_bitbang.c
+++ b/drivers/spi/spi_bitbang.c
@@ -259,10 +259,6 @@ static void bitbang_work(struct work_struct *work)
259 struct spi_bitbang *bitbang = 259 struct spi_bitbang *bitbang =
260 container_of(work, struct spi_bitbang, work); 260 container_of(work, struct spi_bitbang, work);
261 unsigned long flags; 261 unsigned long flags;
262 int (*setup_transfer)(struct spi_device *,
263 struct spi_transfer *);
264
265 setup_transfer = bitbang->setup_transfer;
266 262
267 spin_lock_irqsave(&bitbang->lock, flags); 263 spin_lock_irqsave(&bitbang->lock, flags);
268 bitbang->busy = 1; 264 bitbang->busy = 1;
@@ -300,11 +296,7 @@ static void bitbang_work(struct work_struct *work)
300 296
301 /* init (-1) or override (1) transfer params */ 297 /* init (-1) or override (1) transfer params */
302 if (do_setup != 0) { 298 if (do_setup != 0) {
303 if (!setup_transfer) { 299 status = bitbang->setup_transfer(spi, t);
304 status = -ENOPROTOOPT;
305 break;
306 }
307 status = setup_transfer(spi, t);
308 if (status < 0) 300 if (status < 0)
309 break; 301 break;
310 if (do_setup == -1) 302 if (do_setup == -1)
@@ -465,6 +457,9 @@ int spi_bitbang_start(struct spi_bitbang *bitbang)
465 } 457 }
466 } else if (!bitbang->master->setup) 458 } else if (!bitbang->master->setup)
467 return -EINVAL; 459 return -EINVAL;
460 if (bitbang->master->transfer == spi_bitbang_transfer &&
461 !bitbang->setup_transfer)
462 return -EINVAL;
468 463
469 /* this task is the only thing to touch the SPI bits */ 464 /* this task is the only thing to touch the SPI bits */
470 bitbang->busy = 0; 465 bitbang->busy = 0;