diff options
author | Grant Likely <grant.likely@secretlab.ca> | 2013-02-05 07:30:13 -0500 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2013-02-05 07:30:13 -0500 |
commit | f305a0a8d7fcd1a600bd0b727cd8137ed223f721 (patch) | |
tree | 982681a7e3c643096b65b9626ae993597155979d /drivers/spi/spi-bitbang.c | |
parent | 766ed70447e0a9cfb23d068a4a929e18e54b0022 (diff) | |
parent | d560040f7d6fbe0a2990b8f6edca1815e19e72f5 (diff) |
Merge branch 'broonie/spi-next' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/misc.git
Minor features and bug fixes for PXA, OMAP and GPIO deivce drivers and a
cosmetic change to the bitbang driver.
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'drivers/spi/spi-bitbang.c')
-rw-r--r-- | drivers/spi/spi-bitbang.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/drivers/spi/spi-bitbang.c b/drivers/spi/spi-bitbang.c index 61beaec7cbed..a63d7da3bfe2 100644 --- a/drivers/spi/spi-bitbang.c +++ b/drivers/spi/spi-bitbang.c | |||
@@ -427,40 +427,41 @@ EXPORT_SYMBOL_GPL(spi_bitbang_transfer); | |||
427 | */ | 427 | */ |
428 | int spi_bitbang_start(struct spi_bitbang *bitbang) | 428 | int spi_bitbang_start(struct spi_bitbang *bitbang) |
429 | { | 429 | { |
430 | int status; | 430 | struct spi_master *master = bitbang->master; |
431 | int status; | ||
431 | 432 | ||
432 | if (!bitbang->master || !bitbang->chipselect) | 433 | if (!master || !bitbang->chipselect) |
433 | return -EINVAL; | 434 | return -EINVAL; |
434 | 435 | ||
435 | INIT_WORK(&bitbang->work, bitbang_work); | 436 | INIT_WORK(&bitbang->work, bitbang_work); |
436 | spin_lock_init(&bitbang->lock); | 437 | spin_lock_init(&bitbang->lock); |
437 | INIT_LIST_HEAD(&bitbang->queue); | 438 | INIT_LIST_HEAD(&bitbang->queue); |
438 | 439 | ||
439 | if (!bitbang->master->mode_bits) | 440 | if (!master->mode_bits) |
440 | bitbang->master->mode_bits = SPI_CPOL | SPI_CPHA | bitbang->flags; | 441 | master->mode_bits = SPI_CPOL | SPI_CPHA | bitbang->flags; |
441 | 442 | ||
442 | if (!bitbang->master->transfer) | 443 | if (!master->transfer) |
443 | bitbang->master->transfer = spi_bitbang_transfer; | 444 | master->transfer = spi_bitbang_transfer; |
444 | if (!bitbang->txrx_bufs) { | 445 | if (!bitbang->txrx_bufs) { |
445 | bitbang->use_dma = 0; | 446 | bitbang->use_dma = 0; |
446 | bitbang->txrx_bufs = spi_bitbang_bufs; | 447 | bitbang->txrx_bufs = spi_bitbang_bufs; |
447 | if (!bitbang->master->setup) { | 448 | if (!master->setup) { |
448 | if (!bitbang->setup_transfer) | 449 | if (!bitbang->setup_transfer) |
449 | bitbang->setup_transfer = | 450 | bitbang->setup_transfer = |
450 | spi_bitbang_setup_transfer; | 451 | spi_bitbang_setup_transfer; |
451 | bitbang->master->setup = spi_bitbang_setup; | 452 | master->setup = spi_bitbang_setup; |
452 | bitbang->master->cleanup = spi_bitbang_cleanup; | 453 | master->cleanup = spi_bitbang_cleanup; |
453 | } | 454 | } |
454 | } else if (!bitbang->master->setup) | 455 | } else if (!master->setup) |
455 | return -EINVAL; | 456 | return -EINVAL; |
456 | if (bitbang->master->transfer == spi_bitbang_transfer && | 457 | if (master->transfer == spi_bitbang_transfer && |
457 | !bitbang->setup_transfer) | 458 | !bitbang->setup_transfer) |
458 | return -EINVAL; | 459 | return -EINVAL; |
459 | 460 | ||
460 | /* this task is the only thing to touch the SPI bits */ | 461 | /* this task is the only thing to touch the SPI bits */ |
461 | bitbang->busy = 0; | 462 | bitbang->busy = 0; |
462 | bitbang->workqueue = create_singlethread_workqueue( | 463 | bitbang->workqueue = create_singlethread_workqueue( |
463 | dev_name(bitbang->master->dev.parent)); | 464 | dev_name(master->dev.parent)); |
464 | if (bitbang->workqueue == NULL) { | 465 | if (bitbang->workqueue == NULL) { |
465 | status = -EBUSY; | 466 | status = -EBUSY; |
466 | goto err1; | 467 | goto err1; |
@@ -469,7 +470,7 @@ int spi_bitbang_start(struct spi_bitbang *bitbang) | |||
469 | /* driver may get busy before register() returns, especially | 470 | /* driver may get busy before register() returns, especially |
470 | * if someone registered boardinfo for devices | 471 | * if someone registered boardinfo for devices |
471 | */ | 472 | */ |
472 | status = spi_register_master(bitbang->master); | 473 | status = spi_register_master(master); |
473 | if (status < 0) | 474 | if (status < 0) |
474 | goto err2; | 475 | goto err2; |
475 | 476 | ||