Skip to contentSkip to conversation

spi: Use SPI_MODE_X_MASK

PATCH In review Andy Shevchenko 2 participants 8 messages May 10, 2021 – May 11, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/7 spi: Use SPI_MODE_X_MASK

Use SPI_MODE_X_MASK instead of open coded variant.

While at it, fix format specifier and drop explicit casting.

---
 drivers/spi/spi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/spi/spi.c +2 -2
index 407420977a73..956dce3aafca 100644
@@ -3441,8 +3441,8 @@ int spi_setup(struct spi_device *spi)
 		spi_set_thread_rt(spi->controller);
 	}
 
-	dev_dbg(&spi->dev, "setup mode %d, %s%s%s%s%u bits/w, %u Hz max --> %d\n",
-			(int) (spi->mode & (SPI_CPOL | SPI_CPHA)),
+	dev_dbg(&spi->dev, "setup mode %lu, %s%s%s%s%u bits/w, %u Hz max --> %d\n",
+			spi->mode & SPI_MODE_X_MASK,
 			(spi->mode & SPI_CS_HIGH) ? "cs_high, " : "",
 			(spi->mode & SPI_LSB_FIRST) ? "lsb, " : "",
 			(spi->mode & SPI_3WIRE) ? "3wire, " : "",
Signature · 1 line
2.30.2
#1 lore raw

PATCH 2/7 spi: spidev: Use SPI_MODE_X_MASK

Use SPI_MODE_X_MASK instead of open coded variant.

---
 drivers/spi/spidev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spidev.c +1 -1
index f56e0e975a46..24e9469ea35b 100644
@@ -59,7 +59,7 @@ static DECLARE_BITMAP(minors, N_SPI_MINORS);
  *
  * REVISIT should changing those flags be privileged?
  */
-#define SPI_MODE_MASK		(SPI_CPHA | SPI_CPOL | SPI_CS_HIGH \
+#define SPI_MODE_MASK		(SPI_MODE_X_MASK | SPI_CS_HIGH \
 				| SPI_LSB_FIRST | SPI_3WIRE | SPI_LOOP \
 				| SPI_NO_CS | SPI_READY | SPI_TX_DUAL \
 				| SPI_TX_QUAD | SPI_TX_OCTAL | SPI_RX_DUAL \
Signature · 1 line
2.30.2
#2 lore raw

PATCH 3/7 spi: npcm-pspi: Use SPI_MODE_X_MASK

In reply to Andy Shevchenko

Use SPI_MODE_X_MASK instead of open coded variant.

---
 drivers/spi/spi-npcm-pspi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-npcm-pspi.c +1 -1
index 56d10c4511db..1668a347e003 100644
@@ -105,7 +105,7 @@ static void npcm_pspi_set_mode(struct spi_device *spi)
 	u16 regtemp;
 	u16 mode_val;
 
-	switch (spi->mode & (SPI_CPOL | SPI_CPHA)) {
+	switch (spi->mode & SPI_MODE_X_MASK) {
 	case SPI_MODE_0:
 		mode_val = 0;
 		break;
Signature · 7 lines
2.30.2


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#3 lore raw

PATCH 4/7 spi: oc-tiny: Use SPI_MODE_X_MASK

In reply to Andy Shevchenko

Use SPI_MODE_X_MASK instead of open coded variant.

---
 drivers/spi/spi-oc-tiny.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-oc-tiny.c +1 -1
index f3843f0ff260..38c14c4e4e21 100644
@@ -86,7 +86,7 @@ static int tiny_spi_setup(struct spi_device *spi)
 		hw->speed_hz = spi->max_speed_hz;
 		hw->baud = tiny_spi_baud(spi, hw->speed_hz);
 	}
-	hw->mode = spi->mode & (SPI_CPOL | SPI_CPHA);
+	hw->mode = spi->mode & SPI_MODE_X_MASK;
 	return 0;
 }
 
Signature · 7 lines
2.30.2


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#4 lore raw

PATCH 5/7 spi: omap-uwire: Use SPI_MODE_X_MASK

In reply to Andy Shevchenko

Use SPI_MODE_X_MASK instead of open coded variant.

---
 drivers/spi/spi-omap-uwire.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-omap-uwire.c +1 -1
index 71402f71ddd8..ceb479f5c88f 100644
@@ -330,7 +330,7 @@ static int uwire_setup_transfer(struct spi_device *spi, struct spi_transfer *t)
 	if (spi->mode & SPI_CPOL)
 		flags |= UWIRE_CLK_INVERTED;
 
-	switch (spi->mode & (SPI_CPOL | SPI_CPHA)) {
+	switch (spi->mode & SPI_MODE_X_MASK) {
 	case SPI_MODE_0:
 	case SPI_MODE_3:
 		flags |= UWIRE_WRITE_FALLING_EDGE | UWIRE_READ_RISING_EDGE;
Signature · 1 line
2.30.2
#5 lore raw

PATCH 6/7 spi: ppc4xx: Use SPI_MODE_X_MASK

In reply to Andy Shevchenko

Use SPI_MODE_X_MASK instead of open coded variant.

---
 drivers/spi/spi-ppc4xx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-ppc4xx.c +1 -1
index d8ee363fb714..cb6aaad73f63 100644
@@ -235,7 +235,7 @@ static int spi_ppc4xx_setup(struct spi_device *spi)
 	 */
 	cs->mode = SPI_PPC4XX_MODE_SPE;
 
-	switch (spi->mode & (SPI_CPHA | SPI_CPOL)) {
+	switch (spi->mode & SPI_MODE_X_MASK) {
 	case SPI_MODE_0:
 		cs->mode |= SPI_CLK_MODE0;
 		break;
Signature · 7 lines
2.30.2


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#6 lore raw

PATCH 7/7 spi: uniphier: Use SPI_MODE_X_MASK

In reply to Andy Shevchenko

Use SPI_MODE_X_MASK instead of open coded variant.

---
 drivers/spi/spi-uniphier.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-uniphier.c +1 -1
index 6a9ef8ee3cc9..8900e51e1a1c 100644
@@ -142,7 +142,7 @@ static void uniphier_spi_set_mode(struct spi_device *spi)
 	 * FSTRT    start frame timing
 	 *          0: rising edge of clock, 1: falling edge of clock
 	 */
-	switch (spi->mode & (SPI_CPOL | SPI_CPHA)) {
+	switch (spi->mode & SPI_MODE_X_MASK) {
 	case SPI_MODE_0:
 		/* CKPHS=1, CKINIT=0, CKDLY=1, FSTRT=0 */
 		val1 = SSI_CKS_CKPHS | SSI_CKS_CKDLY;
Signature · 1 line
2.30.2
maintainer
#7 lore raw
In reply to Andy Shevchenko
Quoted 3 lines · Andy Shevchenko

Use SPI_MODE_X_MASK instead of open coded variant.

While at it, fix format specifier and drop explicit casting.

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next

Thanks!

[1/7] spi: Use SPI_MODE_X_MASK

      commit: 40b82c2d9a78593201a3a62dc9239d6405334561
[2/7] spi: spidev: Use SPI_MODE_X_MASK
      commit: dd507b5ec7ba44ab51e1a8404d04e815a91b472f
[3/7] spi: npcm-pspi: Use SPI_MODE_X_MASK
      commit: 56f47edf33fb55ab9381f61d60cf34c7578f3d75
[4/7] spi: oc-tiny: Use SPI_MODE_X_MASK
      commit: a2f2db6b2a8708f6ac592a362e34fb330f874cea
[5/7] spi: omap-uwire: Use SPI_MODE_X_MASK
      commit: fdb217a38808e041f6eca8c550f1b5981e401a45
[6/7] spi: ppc4xx: Use SPI_MODE_X_MASK
      commit: 4ccf05579b9d0f15443a0edc860e2be7472ccfc1
[7/7] spi: uniphier: Use SPI_MODE_X_MASK
      commit: 038b9de42269f33aca3e3741214c863a4e9328d0

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark