diff options
author | Heiner Kallweit <hkallweit1@gmail.com> | 2016-09-13 17:15:45 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2016-09-14 13:24:46 -0400 |
commit | d198ebfb75adec5156b07b96dc21b6b9e5144018 (patch) | |
tree | acf2f5c2691596d3795acadc8338ebbb912982f0 | |
parent | 38d003f1a43f3afd6b5e0da728f06dad07a85687 (diff) |
spi: fsl-espi: simplify fsl_espi_setup_transfer
If t is not null then the SPI core takes care that bits_per_word and
speed_hz are populated. This allows to simplify fsl_espi_setup_transfer.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | drivers/spi/spi-fsl-espi.c | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/drivers/spi/spi-fsl-espi.c b/drivers/spi/spi-fsl-espi.c index bef06762a770..060624f45ce0 100644 --- a/drivers/spi/spi-fsl-espi.c +++ b/drivers/spi/spi-fsl-espi.c | |||
@@ -176,23 +176,11 @@ static void fsl_espi_setup_transfer(struct spi_device *spi, | |||
176 | struct spi_transfer *t) | 176 | struct spi_transfer *t) |
177 | { | 177 | { |
178 | struct mpc8xxx_spi *mpc8xxx_spi = spi_master_get_devdata(spi->master); | 178 | struct mpc8xxx_spi *mpc8xxx_spi = spi_master_get_devdata(spi->master); |
179 | int bits_per_word = 0; | 179 | int bits_per_word = t ? t->bits_per_word : spi->bits_per_word; |
180 | u32 hz = t ? t->speed_hz : spi->max_speed_hz; | ||
180 | u8 pm; | 181 | u8 pm; |
181 | u32 hz = 0; | ||
182 | struct spi_mpc8xxx_cs *cs = spi->controller_state; | 182 | struct spi_mpc8xxx_cs *cs = spi->controller_state; |
183 | 183 | ||
184 | if (t) { | ||
185 | bits_per_word = t->bits_per_word; | ||
186 | hz = t->speed_hz; | ||
187 | } | ||
188 | |||
189 | /* spi_transfer level calls that work per-word */ | ||
190 | if (!bits_per_word) | ||
191 | bits_per_word = spi->bits_per_word; | ||
192 | |||
193 | if (!hz) | ||
194 | hz = spi->max_speed_hz; | ||
195 | |||
196 | cs->rx_shift = 0; | 184 | cs->rx_shift = 0; |
197 | cs->tx_shift = 0; | 185 | cs->tx_shift = 0; |
198 | cs->get_rx = mpc8xxx_spi_rx_buf_u32; | 186 | cs->get_rx = mpc8xxx_spi_rx_buf_u32; |