linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/3] spi: convert to BIT() all spi_device flags
@ 2020-11-24 10:21 Alexandru Ardelean
  2020-11-24 10:21 ` [PATCH v2 2/3] spi: Add SPI_NO_TX/RX support Alexandru Ardelean
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Alexandru Ardelean @ 2020-11-24 10:21 UTC (permalink / raw)
  To: linux-spi, devicetree, linux-kernel
  Cc: broonie, robh+dt, andy.shevchenko, dragos.bogdan, Alexandru Ardelean

This change converts all bit flags for the 'struct spi_device' mode to the
BIT() macro. The change is mostly for readability. Since adding more bit
fields, might as well convert it now.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
---

Changelog v1 -> v2:
* https://lore.kernel.org/linux-spi/20201111141529.98147-1-alexandru.ardelean@analog.com/
* add patch 'spi: convert to BIT() all spi_device flags'
* for patch 'spi: Add SPI_NO_TX/RX support'
  convert comment to new multi-line format
* add patch 'spi: dt-bindings: document zero value for spi-{rx,tx}-bus-width properties'

 include/linux/spi/spi.h | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index aa09fdc8042d..66c7d8e45563 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -165,27 +165,27 @@ struct spi_device {
 	u8			bits_per_word;
 	bool			rt;
 	u32			mode;
-#define	SPI_CPHA	0x01			/* clock phase */
-#define	SPI_CPOL	0x02			/* clock polarity */
+#define	SPI_CPHA	BIT(0)			/* clock phase */
+#define	SPI_CPOL	BIT(1)			/* clock polarity */
 #define	SPI_MODE_0	(0|0)			/* (original MicroWire) */
 #define	SPI_MODE_1	(0|SPI_CPHA)
 #define	SPI_MODE_2	(SPI_CPOL|0)
 #define	SPI_MODE_3	(SPI_CPOL|SPI_CPHA)
 #define	SPI_MODE_X_MASK	(SPI_CPOL|SPI_CPHA)
-#define	SPI_CS_HIGH	0x04			/* chipselect active high? */
-#define	SPI_LSB_FIRST	0x08			/* per-word bits-on-wire */
-#define	SPI_3WIRE	0x10			/* SI/SO signals shared */
-#define	SPI_LOOP	0x20			/* loopback mode */
-#define	SPI_NO_CS	0x40			/* 1 dev/bus, no chipselect */
-#define	SPI_READY	0x80			/* slave pulls low to pause */
-#define	SPI_TX_DUAL	0x100			/* transmit with 2 wires */
-#define	SPI_TX_QUAD	0x200			/* transmit with 4 wires */
-#define	SPI_RX_DUAL	0x400			/* receive with 2 wires */
-#define	SPI_RX_QUAD	0x800			/* receive with 4 wires */
-#define	SPI_CS_WORD	0x1000			/* toggle cs after each word */
-#define	SPI_TX_OCTAL	0x2000			/* transmit with 8 wires */
-#define	SPI_RX_OCTAL	0x4000			/* receive with 8 wires */
-#define	SPI_3WIRE_HIZ	0x8000			/* high impedance turnaround */
+#define	SPI_CS_HIGH	BIT(2)			/* chipselect active high? */
+#define	SPI_LSB_FIRST	BIT(3)			/* per-word bits-on-wire */
+#define	SPI_3WIRE	BIT(4)			/* SI/SO signals shared */
+#define	SPI_LOOP	BIT(5)			/* loopback mode */
+#define	SPI_NO_CS	BIT(6)			/* 1 dev/bus, no chipselect */
+#define	SPI_READY	BIT(7)			/* slave pulls low to pause */
+#define	SPI_TX_DUAL	BIT(8)			/* transmit with 2 wires */
+#define	SPI_TX_QUAD	BIT(9)			/* transmit with 4 wires */
+#define	SPI_RX_DUAL	BIT(10)			/* receive with 2 wires */
+#define	SPI_RX_QUAD	BIT(11)			/* receive with 4 wires */
+#define	SPI_CS_WORD	BIT(12)			/* toggle cs after each word */
+#define	SPI_TX_OCTAL	BIT(13)			/* transmit with 8 wires */
+#define	SPI_RX_OCTAL	BIT(14)			/* receive with 8 wires */
+#define	SPI_3WIRE_HIZ	BIT(15)			/* high impedance turnaround */
 	int			irq;
 	void			*controller_state;
 	void			*controller_data;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-11-24 13:55 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-24 10:21 [PATCH v2 1/3] spi: convert to BIT() all spi_device flags Alexandru Ardelean
2020-11-24 10:21 ` [PATCH v2 2/3] spi: Add SPI_NO_TX/RX support Alexandru Ardelean
2020-11-24 10:21 ` [PATCH v2 3/3] spi: dt-bindings: document zero value for spi-{rx,tx}-bus-width properties Alexandru Ardelean
2020-11-24 11:41 ` [PATCH v2 1/3] spi: convert to BIT() all spi_device flags kernel test robot
2020-11-24 11:41 ` kernel test robot
2020-11-24 11:49   ` Andy Shevchenko
2020-11-24 12:03     ` Ardelean, Alexandru
2020-11-24 13:55       ` Andy Shevchenko
2020-11-24 11:47 ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).