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>
This commit is contained in:

committed by
Mark Brown

parent
2922a8de99
commit
24778be20f
@@ -299,16 +299,15 @@ static int davinci_spi_setup_transfer(struct spi_device *spi,
|
||||
* Assign function pointer to appropriate transfer method
|
||||
* 8bit, 16bit or 32bit transfer
|
||||
*/
|
||||
if (bits_per_word <= 8 && bits_per_word >= 2) {
|
||||
if (bits_per_word <= 8) {
|
||||
dspi->get_rx = davinci_spi_rx_buf_u8;
|
||||
dspi->get_tx = davinci_spi_tx_buf_u8;
|
||||
dspi->bytes_per_word[spi->chip_select] = 1;
|
||||
} else if (bits_per_word <= 16 && bits_per_word >= 2) {
|
||||
} else {
|
||||
dspi->get_rx = davinci_spi_rx_buf_u16;
|
||||
dspi->get_tx = davinci_spi_tx_buf_u16;
|
||||
dspi->bytes_per_word[spi->chip_select] = 2;
|
||||
} else
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (!hz)
|
||||
hz = spi->max_speed_hz;
|
||||
@@ -933,6 +932,7 @@ static int davinci_spi_probe(struct platform_device *pdev)
|
||||
master->dev.of_node = pdev->dev.of_node;
|
||||
master->bus_num = pdev->id;
|
||||
master->num_chipselect = pdata->num_chipselect;
|
||||
master->bits_per_word_mask = SPI_BPW_RANGE_MASK(2, 16);
|
||||
master->setup = davinci_spi_setup;
|
||||
|
||||
dspi->bitbang.chipselect = davinci_spi_chipselect;
|
||||
|
Reference in New Issue
Block a user