linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexandru Ardelean <alexandru.ardelean@analog.com>
To: <linux-spi@vger.kernel.org>, <devicetree@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Cc: <broonie@kernel.org>, <robh+dt@kernel.org>,
	<andy.shevchenko@gmail.com>, <dragos.bogdan@analog.com>,
	Alexandru Ardelean <alexandru.ardelean@analog.com>
Subject: [PATCH v2 1/3] spi: convert to BIT() all spi_device flags
Date: Tue, 24 Nov 2020 12:21:50 +0200	[thread overview]
Message-ID: <20201124102152.16548-1-alexandru.ardelean@analog.com> (raw)

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


             reply	other threads:[~2020-11-24 10:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-24 10:21 Alexandru Ardelean [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201124102152.16548-1-alexandru.ardelean@analog.com \
    --to=alexandru.ardelean@analog.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dragos.bogdan@analog.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).