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.c26
1 files changed, 2 insertions, 24 deletions
diff --git a/drivers/spi/spi_bitbang.c b/drivers/spi/spi_bitbang.c
index 24a330d82395..88425e1af4d3 100644
--- a/drivers/spi/spi_bitbang.c
+++ b/drivers/spi/spi_bitbang.c
@@ -302,10 +302,6 @@ static void bitbang_work(struct work_struct *work)
302 setup_transfer = NULL; 302 setup_transfer = NULL;
303 303
304 list_for_each_entry (t, &m->transfers, transfer_list) { 304 list_for_each_entry (t, &m->transfers, transfer_list) {
305 if (bitbang->shutdown) {
306 status = -ESHUTDOWN;
307 break;
308 }
309 305
310 /* override or restore speed and wordsize */ 306 /* override or restore speed and wordsize */
311 if (t->speed_hz || t->bits_per_word) { 307 if (t->speed_hz || t->bits_per_word) {
@@ -410,8 +406,6 @@ int spi_bitbang_transfer(struct spi_device *spi, struct spi_message *m)
410 m->status = -EINPROGRESS; 406 m->status = -EINPROGRESS;
411 407
412 bitbang = spi_master_get_devdata(spi->master); 408 bitbang = spi_master_get_devdata(spi->master);
413 if (bitbang->shutdown)
414 return -ESHUTDOWN;
415 409
416 spin_lock_irqsave(&bitbang->lock, flags); 410 spin_lock_irqsave(&bitbang->lock, flags);
417 if (!spi->max_speed_hz) 411 if (!spi->max_speed_hz)
@@ -507,28 +501,12 @@ EXPORT_SYMBOL_GPL(spi_bitbang_start);
507 */ 501 */
508int spi_bitbang_stop(struct spi_bitbang *bitbang) 502int spi_bitbang_stop(struct spi_bitbang *bitbang)
509{ 503{
510 unsigned limit = 500; 504 spi_unregister_master(bitbang->master);
511
512 spin_lock_irq(&bitbang->lock);
513 bitbang->shutdown = 0;
514 while (!list_empty(&bitbang->queue) && limit--) {
515 spin_unlock_irq(&bitbang->lock);
516 505
517 dev_dbg(bitbang->master->cdev.dev, "wait for queue\n"); 506 WARN_ON(!list_empty(&bitbang->queue));
518 msleep(10);
519
520 spin_lock_irq(&bitbang->lock);
521 }
522 spin_unlock_irq(&bitbang->lock);
523 if (!list_empty(&bitbang->queue)) {
524 dev_err(bitbang->master->cdev.dev, "queue didn't empty\n");
525 return -EBUSY;
526 }
527 507
528 destroy_workqueue(bitbang->workqueue); 508 destroy_workqueue(bitbang->workqueue);
529 509
530 spi_unregister_master(bitbang->master);
531
532 return 0; 510 return 0;
533} 511}
534EXPORT_SYMBOL_GPL(spi_bitbang_stop); 512EXPORT_SYMBOL_GPL(spi_bitbang_stop);