[PATCH v2 1/3] spi: convert to BIT() all spi_device flags

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---

Changelog v1 -> v2:
* https://lore.kernel.org/linux-spi/20201111141529.98147-1-alexandru.ardelean@xxxxxxxxxx/
* 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




[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux