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-txx9.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-txx9.c')
-rw-r--r-- | drivers/spi/spi-txx9.c | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/drivers/spi/spi-txx9.c b/drivers/spi/spi-txx9.c index adb853047926..cefd9568f098 100644 --- a/drivers/spi/spi-txx9.c +++ b/drivers/spi/spi-txx9.c | |||
@@ -116,17 +116,12 @@ static void txx9spi_cs_func(struct spi_device *spi, struct txx9spi *c, | |||
116 | static int txx9spi_setup(struct spi_device *spi) | 116 | static int txx9spi_setup(struct spi_device *spi) |
117 | { | 117 | { |
118 | struct txx9spi *c = spi_master_get_devdata(spi->master); | 118 | struct txx9spi *c = spi_master_get_devdata(spi->master); |
119 | u8 bits_per_word; | ||
120 | 119 | ||
121 | if (!spi->max_speed_hz | 120 | if (!spi->max_speed_hz |
122 | || spi->max_speed_hz > c->max_speed_hz | 121 | || spi->max_speed_hz > c->max_speed_hz |
123 | || spi->max_speed_hz < c->min_speed_hz) | 122 | || spi->max_speed_hz < c->min_speed_hz) |
124 | return -EINVAL; | 123 | return -EINVAL; |
125 | 124 | ||
126 | bits_per_word = spi->bits_per_word; | ||
127 | if (bits_per_word != 8 && bits_per_word != 16) | ||
128 | return -EINVAL; | ||
129 | |||
130 | if (gpio_direction_output(spi->chip_select, | 125 | if (gpio_direction_output(spi->chip_select, |
131 | !(spi->mode & SPI_CS_HIGH))) { | 126 | !(spi->mode & SPI_CS_HIGH))) { |
132 | dev_err(&spi->dev, "Cannot setup GPIO for chipselect.\n"); | 127 | dev_err(&spi->dev, "Cannot setup GPIO for chipselect.\n"); |
@@ -319,8 +314,6 @@ static int txx9spi_transfer(struct spi_device *spi, struct spi_message *m) | |||
319 | 314 | ||
320 | if (!t->tx_buf && !t->rx_buf && t->len) | 315 | if (!t->tx_buf && !t->rx_buf && t->len) |
321 | return -EINVAL; | 316 | return -EINVAL; |
322 | if (bits_per_word != 8 && bits_per_word != 16) | ||
323 | return -EINVAL; | ||
324 | if (t->len & ((bits_per_word >> 3) - 1)) | 317 | if (t->len & ((bits_per_word >> 3) - 1)) |
325 | return -EINVAL; | 318 | return -EINVAL; |
326 | if (speed_hz < c->min_speed_hz || speed_hz > c->max_speed_hz) | 319 | if (speed_hz < c->min_speed_hz || speed_hz > c->max_speed_hz) |
@@ -411,6 +404,7 @@ static int txx9spi_probe(struct platform_device *dev) | |||
411 | master->setup = txx9spi_setup; | 404 | master->setup = txx9spi_setup; |
412 | master->transfer = txx9spi_transfer; | 405 | master->transfer = txx9spi_transfer; |
413 | master->num_chipselect = (u16)UINT_MAX; /* any GPIO numbers */ | 406 | master->num_chipselect = (u16)UINT_MAX; /* any GPIO numbers */ |
407 | master->bits_per_word_mask = SPI_BPW_MASK(8) | SPI_BPW_MASK(16); | ||
414 | 408 | ||
415 | ret = spi_register_master(master); | 409 | ret = spi_register_master(master); |
416 | if (ret) | 410 | if (ret) |