diff options
author | David Brownell <dbrownell@users.sourceforge.net> | 2009-06-17 19:26:03 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-18 16:03:42 -0400 |
commit | 7d0771970c51e736758525dd71fb82dd036b823a (patch) | |
tree | 9ff72b89cd06cd67e0db681859606dd77f5cba80 /include/linux/spi/spi.h | |
parent | b4bd2ababd20b6ecdd49cf96e39c875fbedd53af (diff) |
spi: move common spi_setup() functionality into core
Start moving some spi_setup() functionality into the SPI core from the
various spi_master controller drivers:
- Make that function stop being an inline;
- Move two common idioms from drivers into that new function:
* Default bits_per_word to 8 if that field isn't set
* Issue a standardized dev_dbg() message
This is a net minor source code shrink, and supports enhancments found in
some follow-up patches.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/spi/spi.h')
-rw-r--r-- | include/linux/spi/spi.h | 25 |
1 files changed, 1 insertions, 24 deletions
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index a0faa18f7b1b..0db5d64fc5e8 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h | |||
@@ -523,30 +523,7 @@ static inline void spi_message_free(struct spi_message *m) | |||
523 | kfree(m); | 523 | kfree(m); |
524 | } | 524 | } |
525 | 525 | ||
526 | /** | 526 | extern int spi_setup(struct spi_device *spi); |
527 | * spi_setup - setup SPI mode and clock rate | ||
528 | * @spi: the device whose settings are being modified | ||
529 | * Context: can sleep, and no requests are queued to the device | ||
530 | * | ||
531 | * SPI protocol drivers may need to update the transfer mode if the | ||
532 | * device doesn't work with its default. They may likewise need | ||
533 | * to update clock rates or word sizes from initial values. This function | ||
534 | * changes those settings, and must be called from a context that can sleep. | ||
535 | * Except for SPI_CS_HIGH, which takes effect immediately, the changes take | ||
536 | * effect the next time the device is selected and data is transferred to | ||
537 | * or from it. When this function returns, the spi device is deselected. | ||
538 | * | ||
539 | * Note that this call will fail if the protocol driver specifies an option | ||
540 | * that the underlying controller or its driver does not support. For | ||
541 | * example, not all hardware supports wire transfers using nine bit words, | ||
542 | * LSB-first wire encoding, or active-high chipselects. | ||
543 | */ | ||
544 | static inline int | ||
545 | spi_setup(struct spi_device *spi) | ||
546 | { | ||
547 | return spi->master->setup(spi); | ||
548 | } | ||
549 | |||
550 | 527 | ||
551 | /** | 528 | /** |
552 | * spi_async - asynchronous SPI transfer | 529 | * spi_async - asynchronous SPI transfer |