Skip to content

Commit 99aebb3

Browse files
chleroybroonie
authored andcommitted
spi: fsl-spi: Change mspi_apply_cpu_mode_quirks() to void
mspi_apply_cpu_mode_quirks() always returns the passed bits_per_word unmodified. Make it return void, then don't check bits_per_word anymore on return as it doesn't change. bits_per_word is already checked by __spi_validate() so no risk to have bits_per_word higher than 32. Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu> Link: https://lore.kernel.org/r/3142a7c40af12a160f4e134764f2c34da3d8e1e2.1680371809.git.christophe.leroy@csgroup.eu Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent fc96ec8 commit 99aebb3

1 file changed

Lines changed: 6 additions & 14 deletions

File tree

drivers/spi/spi-fsl-spi.c

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,10 @@ static void fsl_spi_grlib_set_shifts(u32 *rx_shift, u32 *tx_shift,
145145
}
146146
}
147147

148-
static int mspi_apply_cpu_mode_quirks(struct spi_mpc8xxx_cs *cs,
149-
struct spi_device *spi,
150-
struct mpc8xxx_spi *mpc8xxx_spi,
151-
int bits_per_word)
148+
static void mspi_apply_cpu_mode_quirks(struct spi_mpc8xxx_cs *cs,
149+
struct spi_device *spi,
150+
struct mpc8xxx_spi *mpc8xxx_spi,
151+
int bits_per_word)
152152
{
153153
cs->rx_shift = 0;
154154
cs->tx_shift = 0;
@@ -161,8 +161,7 @@ static int mspi_apply_cpu_mode_quirks(struct spi_mpc8xxx_cs *cs,
161161
} else if (bits_per_word <= 32) {
162162
cs->get_rx = mpc8xxx_spi_rx_buf_u32;
163163
cs->get_tx = mpc8xxx_spi_tx_buf_u32;
164-
} else
165-
return -EINVAL;
164+
}
166165

167166
if (mpc8xxx_spi->set_shifts)
168167
mpc8xxx_spi->set_shifts(&cs->rx_shift, &cs->tx_shift,
@@ -173,8 +172,6 @@ static int mspi_apply_cpu_mode_quirks(struct spi_mpc8xxx_cs *cs,
173172
mpc8xxx_spi->tx_shift = cs->tx_shift;
174173
mpc8xxx_spi->get_rx = cs->get_rx;
175174
mpc8xxx_spi->get_tx = cs->get_tx;
176-
177-
return bits_per_word;
178175
}
179176

180177
static int fsl_spi_setup_transfer(struct spi_device *spi,
@@ -201,12 +198,7 @@ static int fsl_spi_setup_transfer(struct spi_device *spi,
201198
hz = spi->max_speed_hz;
202199

203200
if (!(mpc8xxx_spi->flags & SPI_CPM_MODE))
204-
bits_per_word = mspi_apply_cpu_mode_quirks(cs, spi,
205-
mpc8xxx_spi,
206-
bits_per_word);
207-
208-
if (bits_per_word < 0)
209-
return bits_per_word;
201+
mspi_apply_cpu_mode_quirks(cs, spi, mpc8xxx_spi, bits_per_word);
210202

211203
if (bits_per_word == 32)
212204
bits_per_word = 0;

0 commit comments

Comments
 (0)