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/pxa2xx_spi.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/pxa2xx_spi.c')
-rw-r--r-- | drivers/spi/pxa2xx_spi.c | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/drivers/spi/pxa2xx_spi.c b/drivers/spi/pxa2xx_spi.c index 3f3c08c6ba4..c7365e0b22d 100644 --- a/drivers/spi/pxa2xx_spi.c +++ b/drivers/spi/pxa2xx_spi.c | |||
@@ -1236,9 +1236,6 @@ static int setup(struct spi_device *spi) | |||
1236 | uint tx_thres = TX_THRESH_DFLT; | 1236 | uint tx_thres = TX_THRESH_DFLT; |
1237 | uint rx_thres = RX_THRESH_DFLT; | 1237 | uint rx_thres = RX_THRESH_DFLT; |
1238 | 1238 | ||
1239 | if (!spi->bits_per_word) | ||
1240 | spi->bits_per_word = 8; | ||
1241 | |||
1242 | if (drv_data->ssp_type != PXA25x_SSP | 1239 | if (drv_data->ssp_type != PXA25x_SSP |
1243 | && (spi->bits_per_word < 4 || spi->bits_per_word > 32)) { | 1240 | && (spi->bits_per_word < 4 || spi->bits_per_word > 32)) { |
1244 | dev_err(&spi->dev, "failed setup: ssp_type=%d, bits/wrd=%d " | 1241 | dev_err(&spi->dev, "failed setup: ssp_type=%d, bits/wrd=%d " |
@@ -1328,18 +1325,14 @@ static int setup(struct spi_device *spi) | |||
1328 | 1325 | ||
1329 | /* NOTE: PXA25x_SSP _could_ use external clocking ... */ | 1326 | /* NOTE: PXA25x_SSP _could_ use external clocking ... */ |
1330 | if (drv_data->ssp_type != PXA25x_SSP) | 1327 | if (drv_data->ssp_type != PXA25x_SSP) |
1331 | dev_dbg(&spi->dev, "%d bits/word, %ld Hz, mode %d, %s\n", | 1328 | dev_dbg(&spi->dev, "%ld Hz actual, %s\n", |
1332 | spi->bits_per_word, | ||
1333 | clk_get_rate(ssp->clk) | 1329 | clk_get_rate(ssp->clk) |
1334 | / (1 + ((chip->cr0 & SSCR0_SCR) >> 8)), | 1330 | / (1 + ((chip->cr0 & SSCR0_SCR) >> 8)), |
1335 | spi->mode & 0x3, | ||
1336 | chip->enable_dma ? "DMA" : "PIO"); | 1331 | chip->enable_dma ? "DMA" : "PIO"); |
1337 | else | 1332 | else |
1338 | dev_dbg(&spi->dev, "%d bits/word, %ld Hz, mode %d, %s\n", | 1333 | dev_dbg(&spi->dev, "%ld Hz actual, %s\n", |
1339 | spi->bits_per_word, | ||
1340 | clk_get_rate(ssp->clk) / 2 | 1334 | clk_get_rate(ssp->clk) / 2 |
1341 | / (1 + ((chip->cr0 & SSCR0_SCR) >> 8)), | 1335 | / (1 + ((chip->cr0 & SSCR0_SCR) >> 8)), |
1342 | spi->mode & 0x3, | ||
1343 | chip->enable_dma ? "DMA" : "PIO"); | 1336 | chip->enable_dma ? "DMA" : "PIO"); |
1344 | 1337 | ||
1345 | if (spi->bits_per_word <= 8) { | 1338 | if (spi->bits_per_word <= 8) { |