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 /drivers/spi/spi_bitbang.c | |
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 'drivers/spi/spi_bitbang.c')
-rw-r--r-- | drivers/spi/spi_bitbang.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/drivers/spi/spi_bitbang.c b/drivers/spi/spi_bitbang.c index 85e61f451218..855b0b06e625 100644 --- a/drivers/spi/spi_bitbang.c +++ b/drivers/spi/spi_bitbang.c | |||
@@ -201,9 +201,6 @@ int spi_bitbang_setup(struct spi_device *spi) | |||
201 | spi->controller_state = cs; | 201 | spi->controller_state = cs; |
202 | } | 202 | } |
203 | 203 | ||
204 | if (!spi->bits_per_word) | ||
205 | spi->bits_per_word = 8; | ||
206 | |||
207 | /* per-word shift register access, in hardware or bitbanging */ | 204 | /* per-word shift register access, in hardware or bitbanging */ |
208 | cs->txrx_word = bitbang->txrx_word[spi->mode & (SPI_CPOL|SPI_CPHA)]; | 205 | cs->txrx_word = bitbang->txrx_word[spi->mode & (SPI_CPOL|SPI_CPHA)]; |
209 | if (!cs->txrx_word) | 206 | if (!cs->txrx_word) |
@@ -213,9 +210,7 @@ int spi_bitbang_setup(struct spi_device *spi) | |||
213 | if (retval < 0) | 210 | if (retval < 0) |
214 | return retval; | 211 | return retval; |
215 | 212 | ||
216 | dev_dbg(&spi->dev, "%s, mode %d, %u bits/w, %u nsec/bit\n", | 213 | dev_dbg(&spi->dev, "%s, %u nsec/bit\n", __func__, 2 * cs->nsecs); |
217 | __func__, spi->mode & (SPI_CPOL | SPI_CPHA), | ||
218 | spi->bits_per_word, 2 * cs->nsecs); | ||
219 | 214 | ||
220 | /* NOTE we _need_ to call chipselect() early, ideally with adapter | 215 | /* NOTE we _need_ to call chipselect() early, ideally with adapter |
221 | * setup, unless the hardware defaults cooperate to avoid confusion | 216 | * setup, unless the hardware defaults cooperate to avoid confusion |