diff options
author | Stephen Warren <swarren@wwwdotorg.org> | 2013-05-21 22:36:35 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2013-05-29 15:48:17 -0400 |
commit | 24778be20f87d5aadb19624fc768b3159fa43efc (patch) | |
tree | 05124574b6d331f34938bbae09d4014fde7dca76 /drivers/spi/spi-fsl-espi.c | |
parent | 2922a8de996956893bb98e4aa91be9774c958336 (diff) |
spi: convert drivers to use bits_per_word_mask
Fill in the recently added spi_master.bits_per_word_mask field in as
many drivers as possible. Make related cleanups, such as removing any
redundant error-checking, or empty setup callbacks.
Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
Acked-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/spi/spi-fsl-espi.c')
-rw-r--r-- | drivers/spi/spi-fsl-espi.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/drivers/spi/spi-fsl-espi.c b/drivers/spi/spi-fsl-espi.c index 24610ca8955d..0ef05f198f22 100644 --- a/drivers/spi/spi-fsl-espi.c +++ b/drivers/spi/spi-fsl-espi.c | |||
@@ -144,10 +144,6 @@ static int fsl_espi_setup_transfer(struct spi_device *spi, | |||
144 | if (!bits_per_word) | 144 | if (!bits_per_word) |
145 | bits_per_word = spi->bits_per_word; | 145 | bits_per_word = spi->bits_per_word; |
146 | 146 | ||
147 | /* Make sure its a bit width we support [4..16] */ | ||
148 | if ((bits_per_word < 4) || (bits_per_word > 16)) | ||
149 | return -EINVAL; | ||
150 | |||
151 | if (!hz) | 147 | if (!hz) |
152 | hz = spi->max_speed_hz; | 148 | hz = spi->max_speed_hz; |
153 | 149 | ||
@@ -157,12 +153,10 @@ static int fsl_espi_setup_transfer(struct spi_device *spi, | |||
157 | cs->get_tx = mpc8xxx_spi_tx_buf_u32; | 153 | cs->get_tx = mpc8xxx_spi_tx_buf_u32; |
158 | if (bits_per_word <= 8) { | 154 | if (bits_per_word <= 8) { |
159 | cs->rx_shift = 8 - bits_per_word; | 155 | cs->rx_shift = 8 - bits_per_word; |
160 | } else if (bits_per_word <= 16) { | 156 | } else |
161 | cs->rx_shift = 16 - bits_per_word; | 157 | cs->rx_shift = 16 - bits_per_word; |
162 | if (spi->mode & SPI_LSB_FIRST) | 158 | if (spi->mode & SPI_LSB_FIRST) |
163 | cs->get_tx = fsl_espi_tx_buf_lsb; | 159 | cs->get_tx = fsl_espi_tx_buf_lsb; |
164 | } else { | ||
165 | return -EINVAL; | ||
166 | } | 160 | } |
167 | 161 | ||
168 | mpc8xxx_spi->rx_shift = cs->rx_shift; | 162 | mpc8xxx_spi->rx_shift = cs->rx_shift; |
@@ -609,6 +603,7 @@ static struct spi_master * fsl_espi_probe(struct device *dev, | |||
609 | if (ret) | 603 | if (ret) |
610 | goto err_probe; | 604 | goto err_probe; |
611 | 605 | ||
606 | master->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 16); | ||
612 | master->setup = fsl_espi_setup; | 607 | master->setup = fsl_espi_setup; |
613 | 608 | ||
614 | mpc8xxx_spi = spi_master_get_devdata(master); | 609 | mpc8xxx_spi = spi_master_get_devdata(master); |