diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2021-11-22 23:06:22 +0300 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2021-11-23 15:09:10 +0300 |
commit | 44ec41b7f7831f91c79a06de5e45f2d7ce6e4fbd (patch) | |
tree | b525b97977cf99f1b6f43553f0814feb7409015d /drivers/spi/spi-pxa2xx.c | |
parent | dd06a0c6b6f64f6610c0bb8f7651df3ebfb0f990 (diff) | |
download | linux-44ec41b7f7831f91c79a06de5e45f2d7ce6e4fbd.tar.xz |
spi: pxa2xx: Remove redundant ->read() and ->write() in struct chip_data
Since the commit 196b0e2cf237 ("spi: pxa2xx: Remove if statement
that is always true in pump_transfers()") the ->read() and ->write()
methods in the struct driver_data are reconfigured for each transfer.
Hence no need to keep the intermediate state in the struct chip_data.
The same applies to n_bytes member of the same data structure.
Get rid of unneeded storage for good.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20211122200622.43305-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi/spi-pxa2xx.c')
-rw-r--r-- | drivers/spi/spi-pxa2xx.c | 35 |
1 files changed, 6 insertions, 29 deletions
diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index 1573f6d8eb48..ee3297dd532e 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c @@ -994,13 +994,10 @@ static int pxa2xx_spi_transfer_one(struct spi_controller *controller, dev_err(&spi->dev, "Flush failed\n"); return -EIO; } - drv_data->n_bytes = chip->n_bytes; drv_data->tx = (void *)transfer->tx_buf; drv_data->tx_end = drv_data->tx + transfer->len; drv_data->rx = transfer->rx_buf; drv_data->rx_end = drv_data->rx + transfer->len; - drv_data->write = drv_data->tx ? chip->write : null_writer; - drv_data->read = drv_data->rx ? chip->read : null_reader; /* Change speed and bit per word on a per transfer */ bits = transfer->bits_per_word; @@ -1010,22 +1007,16 @@ static int pxa2xx_spi_transfer_one(struct spi_controller *controller, if (bits <= 8) { drv_data->n_bytes = 1; - drv_data->read = drv_data->read != null_reader ? - u8_reader : null_reader; - drv_data->write = drv_data->write != null_writer ? - u8_writer : null_writer; + drv_data->read = drv_data->rx ? u8_reader : null_reader; + drv_data->write = drv_data->tx ? u8_writer : null_writer; } else if (bits <= 16) { drv_data->n_bytes = 2; - drv_data->read = drv_data->read != null_reader ? - u16_reader : null_reader; - drv_data->write = drv_data->write != null_writer ? - u16_writer : null_writer; + drv_data->read = drv_data->rx ? u16_reader : null_reader; + drv_data->write = drv_data->tx ? u16_writer : null_writer; } else if (bits <= 32) { drv_data->n_bytes = 4; - drv_data->read = drv_data->read != null_reader ? - u32_reader : null_reader; - drv_data->write = drv_data->write != null_writer ? - u32_writer : null_writer; + drv_data->read = drv_data->rx ? u32_reader : null_reader; + drv_data->write = drv_data->tx ? u32_writer : null_writer; } /* * If bits per word is changed in DMA mode, then must check @@ -1391,20 +1382,6 @@ static int setup(struct spi_device *spi) if (spi->mode & SPI_LOOP) chip->cr1 |= SSCR1_LBM; - if (spi->bits_per_word <= 8) { - chip->n_bytes = 1; - chip->read = u8_reader; - chip->write = u8_writer; - } else if (spi->bits_per_word <= 16) { - chip->n_bytes = 2; - chip->read = u16_reader; - chip->write = u16_writer; - } else if (spi->bits_per_word <= 32) { - chip->n_bytes = 4; - chip->read = u32_reader; - chip->write = u32_writer; - } - spi_set_ctldata(spi, chip); if (drv_data->ssp_type == CE4100_SSP) |