Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 766ed704 authored by Laxman Dewangan's avatar Laxman Dewangan Committed by Grant Likely
Browse files

spi: remove check for bits_per_word on transfer from low level driver



The spi core make sure that each transfer structure have the proper
setting for bits_per_word before calling low level transfer APIs.

Hence it is no more require to check again in low level driver for
this field whether this is set correct or not. Removing such code
from low level driver.

The txx9 change also removes a test for bits_per_word set to 0, and
forcing it to 8 in that case. This can also be removed now since
spi_setup() ensures spi->bits_per_word is not zero.

	if (!spi->bits_per_word)
		spi->bits_per_word = 8;

Signed-off-by: default avatarLaxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: default avatarGrant Likely <grant.likely@secretlab.ca>
parent bb29785e
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -134,7 +134,7 @@ static int altera_spi_txrx(struct spi_device *spi, struct spi_transfer *t)
	hw->tx = t->tx_buf;
	hw->tx = t->tx_buf;
	hw->rx = t->rx_buf;
	hw->rx = t->rx_buf;
	hw->count = 0;
	hw->count = 0;
	hw->bytes_per_word = (t->bits_per_word ? : spi->bits_per_word) / 8;
	hw->bytes_per_word = t->bits_per_word / 8;
	hw->len = t->len / hw->bytes_per_word;
	hw->len = t->len / hw->bytes_per_word;


	if (hw->irq >= 0) {
	if (hw->irq >= 0) {
+1 −2
Original line number Original line Diff line number Diff line
@@ -416,8 +416,7 @@ bfin_sport_spi_pump_transfers(unsigned long data)
	drv_data->cs_change = transfer->cs_change;
	drv_data->cs_change = transfer->cs_change;


	/* Bits per word setup */
	/* Bits per word setup */
	bits_per_word = transfer->bits_per_word ? :
	bits_per_word = transfer->bits_per_word;
		message->spi->bits_per_word ? : 8;
	if (bits_per_word % 16 == 0)
	if (bits_per_word % 16 == 0)
		drv_data->ops = &bfin_sport_transfer_ops_u16;
		drv_data->ops = &bfin_sport_transfer_ops_u16;
	else
	else
+1 −2
Original line number Original line Diff line number Diff line
@@ -642,8 +642,7 @@ static void bfin_spi_pump_transfers(unsigned long data)
	drv_data->cs_change = transfer->cs_change;
	drv_data->cs_change = transfer->cs_change;


	/* Bits per word setup */
	/* Bits per word setup */
	bits_per_word = transfer->bits_per_word ? :
	bits_per_word = transfer->bits_per_word;
		message->spi->bits_per_word ? : 8;
	if (bits_per_word % 16 == 0) {
	if (bits_per_word % 16 == 0) {
		drv_data->n_bytes = bits_per_word/8;
		drv_data->n_bytes = bits_per_word/8;
		drv_data->len = (transfer->len) >> 1;
		drv_data->len = (transfer->len) >> 1;
+3 −3
Original line number Original line Diff line number Diff line
@@ -69,7 +69,7 @@ static unsigned bitbang_txrx_8(
	unsigned		ns,
	unsigned		ns,
	struct spi_transfer	*t
	struct spi_transfer	*t
) {
) {
	unsigned		bits = t->bits_per_word ? : spi->bits_per_word;
	unsigned		bits = t->bits_per_word;
	unsigned		count = t->len;
	unsigned		count = t->len;
	const u8		*tx = t->tx_buf;
	const u8		*tx = t->tx_buf;
	u8			*rx = t->rx_buf;
	u8			*rx = t->rx_buf;
@@ -95,7 +95,7 @@ static unsigned bitbang_txrx_16(
	unsigned		ns,
	unsigned		ns,
	struct spi_transfer	*t
	struct spi_transfer	*t
) {
) {
	unsigned		bits = t->bits_per_word ? : spi->bits_per_word;
	unsigned		bits = t->bits_per_word;
	unsigned		count = t->len;
	unsigned		count = t->len;
	const u16		*tx = t->tx_buf;
	const u16		*tx = t->tx_buf;
	u16			*rx = t->rx_buf;
	u16			*rx = t->rx_buf;
@@ -121,7 +121,7 @@ static unsigned bitbang_txrx_32(
	unsigned		ns,
	unsigned		ns,
	struct spi_transfer	*t
	struct spi_transfer	*t
) {
) {
	unsigned		bits = t->bits_per_word ? : spi->bits_per_word;
	unsigned		bits = t->bits_per_word;
	unsigned		count = t->len;
	unsigned		count = t->len;
	const u32		*tx = t->tx_buf;
	const u32		*tx = t->tx_buf;
	u32			*rx = t->rx_buf;
	u32			*rx = t->rx_buf;
+1 −1
Original line number Original line Diff line number Diff line
@@ -68,7 +68,7 @@ static int spi_clps711x_setup_xfer(struct spi_device *spi,
				   struct spi_transfer *xfer)
				   struct spi_transfer *xfer)
{
{
	u32 speed = xfer->speed_hz ? : spi->max_speed_hz;
	u32 speed = xfer->speed_hz ? : spi->max_speed_hz;
	u8 bpw = xfer->bits_per_word ? : spi->bits_per_word;
	u8 bpw = xfer->bits_per_word;
	struct spi_clps711x_data *hw = spi_master_get_devdata(spi->master);
	struct spi_clps711x_data *hw = spi_master_get_devdata(spi->master);


	if (bpw != 8) {
	if (bpw != 8) {
Loading