diff mbox

spi: Eliminate 3WIRE spi_transfer check

Message ID 1388123466-7525-1-git-send-email-tpiepho@gmail.com (mailing list archive)
State Accepted
Commit 368ca4e0c75612c0a4d6bbcef7efb944604340c2
Headers show

Commit Message

Trent Piepho Dec. 27, 2013, 5:51 a.m. UTC
Checking for SPI_3WIRE isn't needed.  spi_setup() already prevents 3WIRE
mode from being combined with DUAL or QUAD mode support.  So there is no
need to differentiate between a single bit device with SPI_3WIRE set and
one with without.  It doesn't change the allowed bit widths.

Signed-off-by: Trent Piepho <tpiepho@gmail.com>
---
Extracted from "spi: Simplify bit width checking code" as there seemed
to be no debate about this part.

 drivers/spi/spi.c |    6 ------
 1 file changed, 6 deletions(-)

Comments

Mark Brown Dec. 30, 2013, 12:44 p.m. UTC | #1
On Thu, Dec 26, 2013 at 09:51:06PM -0800, Trent Piepho wrote:
> Checking for SPI_3WIRE isn't needed.  spi_setup() already prevents 3WIRE
> mode from being combined with DUAL or QUAD mode support.  So there is no
> need to differentiate between a single bit device with SPI_3WIRE set and
> one with without.  It doesn't change the allowed bit widths.

Applied, thanks.
diff mbox

Patch

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 98f4b77..302ffac 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -1678,9 +1678,6 @@  static int __spi_validate(struct spi_device *spi, struct spi_message *message)
 			if ((xfer->tx_nbits == SPI_NBITS_QUAD) &&
 				!(spi->mode & SPI_TX_QUAD))
 				return -EINVAL;
-			if ((spi->mode & SPI_3WIRE) &&
-				(xfer->tx_nbits != SPI_NBITS_SINGLE))
-				return -EINVAL;
 		}
 		/* check transfer rx_nbits */
 		if (xfer->rx_buf) {
@@ -1694,9 +1691,6 @@  static int __spi_validate(struct spi_device *spi, struct spi_message *message)
 			if ((xfer->rx_nbits == SPI_NBITS_QUAD) &&
 				!(spi->mode & SPI_RX_QUAD))
 				return -EINVAL;
-			if ((spi->mode & SPI_3WIRE) &&
-				(xfer->rx_nbits != SPI_NBITS_SINGLE))
-				return -EINVAL;
 		}
 	}