* [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; 15+ 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] 15+ messages in thread
* [PATCH v2 2/3] spi: Add SPI_NO_TX/RX support
2020-11-24 10:21 [PATCH v2 1/3] spi: convert to BIT() all spi_device flags Alexandru Ardelean
@ 2020-11-24 10:21 ` 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
` (3 subsequent siblings)
4 siblings, 0 replies; 15+ 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
From: Dragos Bogdan <dragos.bogdan@analog.com>
Transmit/receive only is a valid SPI mode. For example, the MOSI/TX line
might be missing from an ADC while for a DAC the MISO/RX line may be
optional. This patch adds these two new modes: SPI_NO_TX and
SPI_NO_RX. This way, the drivers will be able to identify if any of
these two lines is missing and to adjust the transfers accordingly.
Signed-off-by: Dragos Bogdan <dragos.bogdan@analog.com>
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/
* convert comment to new multi-line format
drivers/spi/spi.c | 26 +++++++++++++++++++++-----
include/linux/spi/spi.h | 2 ++
2 files changed, 23 insertions(+), 5 deletions(-)
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 0c3f3a962448..5784fa8d9d74 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -1939,6 +1939,9 @@ static int of_spi_parse_dt(struct spi_controller *ctlr, struct spi_device *spi,
/* Device DUAL/QUAD mode */
if (!of_property_read_u32(nc, "spi-tx-bus-width", &value)) {
switch (value) {
+ case 0:
+ spi->mode |= SPI_NO_TX;
+ break;
case 1:
break;
case 2:
@@ -1960,6 +1963,9 @@ static int of_spi_parse_dt(struct spi_controller *ctlr, struct spi_device *spi,
if (!of_property_read_u32(nc, "spi-rx-bus-width", &value)) {
switch (value) {
+ case 0:
+ spi->mode |= SPI_NO_RX;
+ break;
case 1:
break;
case 2:
@@ -3327,12 +3333,17 @@ int spi_setup(struct spi_device *spi)
unsigned bad_bits, ugly_bits;
int status;
- /* check mode to prevent that DUAL and QUAD set at the same time
+ /*
+ * check mode to prevent that any two of DUAL, QUAD and NO_MOSI/MISO
+ * are set at the same time
*/
- if (((spi->mode & SPI_TX_DUAL) && (spi->mode & SPI_TX_QUAD)) ||
- ((spi->mode & SPI_RX_DUAL) && (spi->mode & SPI_RX_QUAD))) {
+ if ((hweight_long(spi->mode &
+ (SPI_TX_DUAL | SPI_TX_QUAD | SPI_NO_TX)) > 1) ||
+ (hweight_long(spi->mode &
+ (SPI_RX_DUAL | SPI_RX_QUAD | SPI_NO_RX)) > 1)) {
dev_err(&spi->dev,
- "setup: can not select dual and quad at the same time\n");
+ "setup: can not select any two of dual, quad and no-rx/tx "
+ "at the same time\n");
return -EINVAL;
}
/* if it is SPI_3WIRE mode, DUAL and QUAD should be forbidden
@@ -3346,7 +3357,8 @@ int spi_setup(struct spi_device *spi)
* SPI_CS_WORD has a fallback software implementation,
* so it is ignored here.
*/
- bad_bits = spi->mode & ~(spi->controller->mode_bits | SPI_CS_WORD);
+ bad_bits = spi->mode & ~(spi->controller->mode_bits | SPI_CS_WORD |
+ SPI_NO_TX | SPI_NO_RX);
/* nothing prevents from working with active-high CS in case if it
* is driven by GPIO.
*/
@@ -3607,6 +3619,8 @@ static int __spi_validate(struct spi_device *spi, struct spi_message *message)
* 2. check tx/rx_nbits match the mode in spi_device
*/
if (xfer->tx_buf) {
+ if (spi->mode & SPI_NO_TX)
+ return -EINVAL;
if (xfer->tx_nbits != SPI_NBITS_SINGLE &&
xfer->tx_nbits != SPI_NBITS_DUAL &&
xfer->tx_nbits != SPI_NBITS_QUAD)
@@ -3620,6 +3634,8 @@ static int __spi_validate(struct spi_device *spi, struct spi_message *message)
}
/* check transfer rx_nbits */
if (xfer->rx_buf) {
+ if (spi->mode & SPI_NO_RX)
+ return -EINVAL;
if (xfer->rx_nbits != SPI_NBITS_SINGLE &&
xfer->rx_nbits != SPI_NBITS_DUAL &&
xfer->rx_nbits != SPI_NBITS_QUAD)
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index 66c7d8e45563..8f3343d3ac27 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -186,6 +186,8 @@ struct spi_device {
#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 */
+#define SPI_NO_TX BIT(16) /* no transmit wire */
+#define SPI_NO_RX BIT(17) /* no receive wire */
int irq;
void *controller_state;
void *controller_data;
--
2.17.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v2 3/3] spi: dt-bindings: document zero value for spi-{rx,tx}-bus-width properties
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 ` Alexandru Ardelean
2020-11-24 11:41 ` kernel test robot
` (2 subsequent siblings)
4 siblings, 0 replies; 15+ 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
Following a change to the SPI framework, providing a value of zero for
'spi-rx-bus-width' and 'spi-tx-bus-width' is now possible and will
essentially mean than no RX or TX is allowed.
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: dt-bindings: document zero value for spi-{rx,tx}-bus-width properties'
Documentation/devicetree/bindings/spi/spi-controller.yaml | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/Documentation/devicetree/bindings/spi/spi-controller.yaml b/Documentation/devicetree/bindings/spi/spi-controller.yaml
index 1b56d5e40f1f..f1aaaf9b3709 100644
--- a/Documentation/devicetree/bindings/spi/spi-controller.yaml
+++ b/Documentation/devicetree/bindings/spi/spi-controller.yaml
@@ -125,8 +125,9 @@ patternProperties:
spi-rx-bus-width:
description:
Bus width to the SPI bus used for read transfers.
+ If 0 is provided, then no RX will be possible on this devices.
$ref: /schemas/types.yaml#/definitions/uint32
- enum: [1, 2, 4, 8]
+ enum: [0, 1, 2, 4, 8]
default: 1
spi-rx-delay-us:
@@ -136,8 +137,9 @@ patternProperties:
spi-tx-bus-width:
description:
Bus width to the SPI bus used for write transfers.
+ If 0 is provided, then no RX will be possible on this devices.
$ref: /schemas/types.yaml#/definitions/uint32
- enum: [1, 2, 4, 8]
+ enum: [0, 1, 2, 4, 8]
default: 1
spi-tx-delay-us:
--
2.17.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH v2 1/3] spi: convert to BIT() all spi_device flags
2020-11-24 10:21 [PATCH v2 1/3] spi: convert to BIT() all spi_device flags Alexandru Ardelean
@ 2020-11-24 11:41 ` kernel test robot
2020-11-24 10:21 ` [PATCH v2 3/3] spi: dt-bindings: document zero value for spi-{rx,tx}-bus-width properties Alexandru Ardelean
` (3 subsequent siblings)
4 siblings, 0 replies; 15+ messages in thread
From: kernel test robot @ 2020-11-24 11:41 UTC (permalink / raw)
To: Alexandru Ardelean, linux-spi, devicetree, linux-kernel
Cc: kbuild-all, broonie, robh+dt, andy.shevchenko, dragos.bogdan,
Alexandru Ardelean
[-- Attachment #1: Type: text/plain, Size: 10298 bytes --]
Hi Alexandru,
I love your patch! Perhaps something to improve:
[auto build test WARNING on spi/for-next]
[also build test WARNING on next-20201123]
[cannot apply to v5.10-rc5]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Alexandru-Ardelean/spi-convert-to-BIT-all-spi_device-flags/20201124-181801
base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next
config: i386-randconfig-a016-20201124 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
# https://github.com/0day-ci/linux/commit/1d45734a72568cc2118c14f912affda571a5f9dc
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Alexandru-Ardelean/spi-convert-to-BIT-all-spi_device-flags/20201124-181801
git checkout 1d45734a72568cc2118c14f912affda571a5f9dc
# save the attached .config to linux build tree
make W=1 ARCH=i386
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
In file included from include/linux/device.h:15,
from include/linux/dmaengine.h:8,
from drivers/spi/spi-stm32.c:11:
drivers/spi/spi-stm32.c: In function 'stm32_spi_prepare_msg':
>> drivers/spi/spi-stm32.c:1030:20: warning: format '%d' expects argument of type 'int', but argument 4 has type 'long unsigned int' [-Wformat=]
1030 | dev_dbg(spi->dev, "cpol=%d cpha=%d lsb_first=%d cs_high=%d\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:19:22: note: in definition of macro 'dev_fmt'
19 | #define dev_fmt(fmt) fmt
| ^~~
drivers/spi/spi-stm32.c:1030:2: note: in expansion of macro 'dev_dbg'
1030 | dev_dbg(spi->dev, "cpol=%d cpha=%d lsb_first=%d cs_high=%d\n",
| ^~~~~~~
drivers/spi/spi-stm32.c:1030:27: note: format string is defined here
1030 | dev_dbg(spi->dev, "cpol=%d cpha=%d lsb_first=%d cs_high=%d\n",
| ~^
| |
| int
| %ld
In file included from include/linux/device.h:15,
from include/linux/dmaengine.h:8,
from drivers/spi/spi-stm32.c:11:
drivers/spi/spi-stm32.c:1030:20: warning: format '%d' expects argument of type 'int', but argument 5 has type 'long unsigned int' [-Wformat=]
1030 | dev_dbg(spi->dev, "cpol=%d cpha=%d lsb_first=%d cs_high=%d\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:19:22: note: in definition of macro 'dev_fmt'
19 | #define dev_fmt(fmt) fmt
| ^~~
drivers/spi/spi-stm32.c:1030:2: note: in expansion of macro 'dev_dbg'
1030 | dev_dbg(spi->dev, "cpol=%d cpha=%d lsb_first=%d cs_high=%d\n",
| ^~~~~~~
drivers/spi/spi-stm32.c:1030:35: note: format string is defined here
1030 | dev_dbg(spi->dev, "cpol=%d cpha=%d lsb_first=%d cs_high=%d\n",
| ~^
| |
| int
| %ld
In file included from include/linux/device.h:15,
from include/linux/dmaengine.h:8,
from drivers/spi/spi-stm32.c:11:
drivers/spi/spi-stm32.c:1030:20: warning: format '%d' expects argument of type 'int', but argument 6 has type 'long unsigned int' [-Wformat=]
1030 | dev_dbg(spi->dev, "cpol=%d cpha=%d lsb_first=%d cs_high=%d\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:19:22: note: in definition of macro 'dev_fmt'
19 | #define dev_fmt(fmt) fmt
| ^~~
drivers/spi/spi-stm32.c:1030:2: note: in expansion of macro 'dev_dbg'
1030 | dev_dbg(spi->dev, "cpol=%d cpha=%d lsb_first=%d cs_high=%d\n",
| ^~~~~~~
drivers/spi/spi-stm32.c:1030:48: note: format string is defined here
1030 | dev_dbg(spi->dev, "cpol=%d cpha=%d lsb_first=%d cs_high=%d\n",
| ~^
| |
| int
| %ld
In file included from include/linux/device.h:15,
from include/linux/dmaengine.h:8,
from drivers/spi/spi-stm32.c:11:
drivers/spi/spi-stm32.c:1030:20: warning: format '%d' expects argument of type 'int', but argument 7 has type 'long unsigned int' [-Wformat=]
1030 | dev_dbg(spi->dev, "cpol=%d cpha=%d lsb_first=%d cs_high=%d\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:19:22: note: in definition of macro 'dev_fmt'
19 | #define dev_fmt(fmt) fmt
| ^~~
drivers/spi/spi-stm32.c:1030:2: note: in expansion of macro 'dev_dbg'
1030 | dev_dbg(spi->dev, "cpol=%d cpha=%d lsb_first=%d cs_high=%d\n",
| ^~~~~~~
drivers/spi/spi-stm32.c:1030:59: note: format string is defined here
1030 | dev_dbg(spi->dev, "cpol=%d cpha=%d lsb_first=%d cs_high=%d\n",
| ~^
| |
| int
| %ld
vim +1030 drivers/spi/spi-stm32.c
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 995
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 996 /**
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 997 * stm32_spi_prepare_msg - set up the controller to transfer a single message
1c52be8bed83e1a Alain Volmat 2020-03-20 998 * @master: controller master interface
1c52be8bed83e1a Alain Volmat 2020-03-20 999 * @msg: pointer to spi message
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1000 */
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1001 static int stm32_spi_prepare_msg(struct spi_master *master,
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1002 struct spi_message *msg)
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1003 {
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1004 struct stm32_spi *spi = spi_master_get_devdata(master);
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1005 struct spi_device *spi_dev = msg->spi;
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1006 struct device_node *np = spi_dev->dev.of_node;
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1007 unsigned long flags;
55166853b2f56ce Cezary Gapinski 2018-12-24 1008 u32 clrb = 0, setb = 0;
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1009
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1010 /* SPI slave device may need time between data frames */
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1011 spi->cur_midi = 0;
042c1c60df7b854 Amelie Delaunay 2017-06-27 1012 if (np && !of_property_read_u32(np, "st,spi-midi-ns", &spi->cur_midi))
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1013 dev_dbg(spi->dev, "%dns inter-data idleness\n", spi->cur_midi);
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1014
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1015 if (spi_dev->mode & SPI_CPOL)
55166853b2f56ce Cezary Gapinski 2018-12-24 1016 setb |= spi->cfg->regs->cpol.mask;
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1017 else
55166853b2f56ce Cezary Gapinski 2018-12-24 1018 clrb |= spi->cfg->regs->cpol.mask;
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1019
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1020 if (spi_dev->mode & SPI_CPHA)
55166853b2f56ce Cezary Gapinski 2018-12-24 1021 setb |= spi->cfg->regs->cpha.mask;
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1022 else
55166853b2f56ce Cezary Gapinski 2018-12-24 1023 clrb |= spi->cfg->regs->cpha.mask;
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1024
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1025 if (spi_dev->mode & SPI_LSB_FIRST)
55166853b2f56ce Cezary Gapinski 2018-12-24 1026 setb |= spi->cfg->regs->lsb_first.mask;
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1027 else
55166853b2f56ce Cezary Gapinski 2018-12-24 1028 clrb |= spi->cfg->regs->lsb_first.mask;
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1029
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 @1030 dev_dbg(spi->dev, "cpol=%d cpha=%d lsb_first=%d cs_high=%d\n",
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1031 spi_dev->mode & SPI_CPOL,
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1032 spi_dev->mode & SPI_CPHA,
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1033 spi_dev->mode & SPI_LSB_FIRST,
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1034 spi_dev->mode & SPI_CS_HIGH);
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1035
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1036 spin_lock_irqsave(&spi->lock, flags);
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1037
55166853b2f56ce Cezary Gapinski 2018-12-24 1038 /* CPOL, CPHA and LSB FIRST bits have common register */
55166853b2f56ce Cezary Gapinski 2018-12-24 1039 if (clrb || setb)
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1040 writel_relaxed(
55166853b2f56ce Cezary Gapinski 2018-12-24 1041 (readl_relaxed(spi->base + spi->cfg->regs->cpol.reg) &
55166853b2f56ce Cezary Gapinski 2018-12-24 1042 ~clrb) | setb,
55166853b2f56ce Cezary Gapinski 2018-12-24 1043 spi->base + spi->cfg->regs->cpol.reg);
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1044
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1045 spin_unlock_irqrestore(&spi->lock, flags);
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1046
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1047 return 0;
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1048 }
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1049
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 41568 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v2 1/3] spi: convert to BIT() all spi_device flags
@ 2020-11-24 11:41 ` kernel test robot
0 siblings, 0 replies; 15+ messages in thread
From: kernel test robot @ 2020-11-24 11:41 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 10463 bytes --]
Hi Alexandru,
I love your patch! Perhaps something to improve:
[auto build test WARNING on spi/for-next]
[also build test WARNING on next-20201123]
[cannot apply to v5.10-rc5]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Alexandru-Ardelean/spi-convert-to-BIT-all-spi_device-flags/20201124-181801
base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next
config: i386-randconfig-a016-20201124 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
# https://github.com/0day-ci/linux/commit/1d45734a72568cc2118c14f912affda571a5f9dc
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Alexandru-Ardelean/spi-convert-to-BIT-all-spi_device-flags/20201124-181801
git checkout 1d45734a72568cc2118c14f912affda571a5f9dc
# save the attached .config to linux build tree
make W=1 ARCH=i386
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
In file included from include/linux/device.h:15,
from include/linux/dmaengine.h:8,
from drivers/spi/spi-stm32.c:11:
drivers/spi/spi-stm32.c: In function 'stm32_spi_prepare_msg':
>> drivers/spi/spi-stm32.c:1030:20: warning: format '%d' expects argument of type 'int', but argument 4 has type 'long unsigned int' [-Wformat=]
1030 | dev_dbg(spi->dev, "cpol=%d cpha=%d lsb_first=%d cs_high=%d\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:19:22: note: in definition of macro 'dev_fmt'
19 | #define dev_fmt(fmt) fmt
| ^~~
drivers/spi/spi-stm32.c:1030:2: note: in expansion of macro 'dev_dbg'
1030 | dev_dbg(spi->dev, "cpol=%d cpha=%d lsb_first=%d cs_high=%d\n",
| ^~~~~~~
drivers/spi/spi-stm32.c:1030:27: note: format string is defined here
1030 | dev_dbg(spi->dev, "cpol=%d cpha=%d lsb_first=%d cs_high=%d\n",
| ~^
| |
| int
| %ld
In file included from include/linux/device.h:15,
from include/linux/dmaengine.h:8,
from drivers/spi/spi-stm32.c:11:
drivers/spi/spi-stm32.c:1030:20: warning: format '%d' expects argument of type 'int', but argument 5 has type 'long unsigned int' [-Wformat=]
1030 | dev_dbg(spi->dev, "cpol=%d cpha=%d lsb_first=%d cs_high=%d\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:19:22: note: in definition of macro 'dev_fmt'
19 | #define dev_fmt(fmt) fmt
| ^~~
drivers/spi/spi-stm32.c:1030:2: note: in expansion of macro 'dev_dbg'
1030 | dev_dbg(spi->dev, "cpol=%d cpha=%d lsb_first=%d cs_high=%d\n",
| ^~~~~~~
drivers/spi/spi-stm32.c:1030:35: note: format string is defined here
1030 | dev_dbg(spi->dev, "cpol=%d cpha=%d lsb_first=%d cs_high=%d\n",
| ~^
| |
| int
| %ld
In file included from include/linux/device.h:15,
from include/linux/dmaengine.h:8,
from drivers/spi/spi-stm32.c:11:
drivers/spi/spi-stm32.c:1030:20: warning: format '%d' expects argument of type 'int', but argument 6 has type 'long unsigned int' [-Wformat=]
1030 | dev_dbg(spi->dev, "cpol=%d cpha=%d lsb_first=%d cs_high=%d\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:19:22: note: in definition of macro 'dev_fmt'
19 | #define dev_fmt(fmt) fmt
| ^~~
drivers/spi/spi-stm32.c:1030:2: note: in expansion of macro 'dev_dbg'
1030 | dev_dbg(spi->dev, "cpol=%d cpha=%d lsb_first=%d cs_high=%d\n",
| ^~~~~~~
drivers/spi/spi-stm32.c:1030:48: note: format string is defined here
1030 | dev_dbg(spi->dev, "cpol=%d cpha=%d lsb_first=%d cs_high=%d\n",
| ~^
| |
| int
| %ld
In file included from include/linux/device.h:15,
from include/linux/dmaengine.h:8,
from drivers/spi/spi-stm32.c:11:
drivers/spi/spi-stm32.c:1030:20: warning: format '%d' expects argument of type 'int', but argument 7 has type 'long unsigned int' [-Wformat=]
1030 | dev_dbg(spi->dev, "cpol=%d cpha=%d lsb_first=%d cs_high=%d\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:19:22: note: in definition of macro 'dev_fmt'
19 | #define dev_fmt(fmt) fmt
| ^~~
drivers/spi/spi-stm32.c:1030:2: note: in expansion of macro 'dev_dbg'
1030 | dev_dbg(spi->dev, "cpol=%d cpha=%d lsb_first=%d cs_high=%d\n",
| ^~~~~~~
drivers/spi/spi-stm32.c:1030:59: note: format string is defined here
1030 | dev_dbg(spi->dev, "cpol=%d cpha=%d lsb_first=%d cs_high=%d\n",
| ~^
| |
| int
| %ld
vim +1030 drivers/spi/spi-stm32.c
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 995
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 996 /**
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 997 * stm32_spi_prepare_msg - set up the controller to transfer a single message
1c52be8bed83e1a Alain Volmat 2020-03-20 998 * @master: controller master interface
1c52be8bed83e1a Alain Volmat 2020-03-20 999 * @msg: pointer to spi message
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1000 */
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1001 static int stm32_spi_prepare_msg(struct spi_master *master,
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1002 struct spi_message *msg)
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1003 {
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1004 struct stm32_spi *spi = spi_master_get_devdata(master);
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1005 struct spi_device *spi_dev = msg->spi;
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1006 struct device_node *np = spi_dev->dev.of_node;
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1007 unsigned long flags;
55166853b2f56ce Cezary Gapinski 2018-12-24 1008 u32 clrb = 0, setb = 0;
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1009
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1010 /* SPI slave device may need time between data frames */
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1011 spi->cur_midi = 0;
042c1c60df7b854 Amelie Delaunay 2017-06-27 1012 if (np && !of_property_read_u32(np, "st,spi-midi-ns", &spi->cur_midi))
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1013 dev_dbg(spi->dev, "%dns inter-data idleness\n", spi->cur_midi);
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1014
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1015 if (spi_dev->mode & SPI_CPOL)
55166853b2f56ce Cezary Gapinski 2018-12-24 1016 setb |= spi->cfg->regs->cpol.mask;
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1017 else
55166853b2f56ce Cezary Gapinski 2018-12-24 1018 clrb |= spi->cfg->regs->cpol.mask;
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1019
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1020 if (spi_dev->mode & SPI_CPHA)
55166853b2f56ce Cezary Gapinski 2018-12-24 1021 setb |= spi->cfg->regs->cpha.mask;
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1022 else
55166853b2f56ce Cezary Gapinski 2018-12-24 1023 clrb |= spi->cfg->regs->cpha.mask;
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1024
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1025 if (spi_dev->mode & SPI_LSB_FIRST)
55166853b2f56ce Cezary Gapinski 2018-12-24 1026 setb |= spi->cfg->regs->lsb_first.mask;
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1027 else
55166853b2f56ce Cezary Gapinski 2018-12-24 1028 clrb |= spi->cfg->regs->lsb_first.mask;
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1029
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 @1030 dev_dbg(spi->dev, "cpol=%d cpha=%d lsb_first=%d cs_high=%d\n",
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1031 spi_dev->mode & SPI_CPOL,
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1032 spi_dev->mode & SPI_CPHA,
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1033 spi_dev->mode & SPI_LSB_FIRST,
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1034 spi_dev->mode & SPI_CS_HIGH);
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1035
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1036 spin_lock_irqsave(&spi->lock, flags);
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1037
55166853b2f56ce Cezary Gapinski 2018-12-24 1038 /* CPOL, CPHA and LSB FIRST bits have common register */
55166853b2f56ce Cezary Gapinski 2018-12-24 1039 if (clrb || setb)
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1040 writel_relaxed(
55166853b2f56ce Cezary Gapinski 2018-12-24 1041 (readl_relaxed(spi->base + spi->cfg->regs->cpol.reg) &
55166853b2f56ce Cezary Gapinski 2018-12-24 1042 ~clrb) | setb,
55166853b2f56ce Cezary Gapinski 2018-12-24 1043 spi->base + spi->cfg->regs->cpol.reg);
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1044
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1045 spin_unlock_irqrestore(&spi->lock, flags);
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1046
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1047 return 0;
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1048 }
dcbe0d84dfa5a3e Amelie Delaunay 2017-06-21 1049
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 41568 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v2 1/3] spi: convert to BIT() all spi_device flags
2020-11-24 10:21 [PATCH v2 1/3] spi: convert to BIT() all spi_device flags Alexandru Ardelean
@ 2020-11-24 11:41 ` kernel test robot
2020-11-24 10:21 ` [PATCH v2 3/3] spi: dt-bindings: document zero value for spi-{rx,tx}-bus-width properties Alexandru Ardelean
` (3 subsequent siblings)
4 siblings, 0 replies; 15+ messages in thread
From: kernel test robot @ 2020-11-24 11:41 UTC (permalink / raw)
To: Alexandru Ardelean, linux-spi, devicetree, linux-kernel
Cc: kbuild-all, broonie, robh+dt, andy.shevchenko, dragos.bogdan,
Alexandru Ardelean
[-- Attachment #1: Type: text/plain, Size: 10593 bytes --]
Hi Alexandru,
I love your patch! Perhaps something to improve:
[auto build test WARNING on spi/for-next]
[also build test WARNING on next-20201123]
[cannot apply to v5.10-rc5]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Alexandru-Ardelean/spi-convert-to-BIT-all-spi_device-flags/20201124-181801
base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next
config: i386-randconfig-a011-20201124 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
# https://github.com/0day-ci/linux/commit/1d45734a72568cc2118c14f912affda571a5f9dc
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Alexandru-Ardelean/spi-convert-to-BIT-all-spi_device-flags/20201124-181801
git checkout 1d45734a72568cc2118c14f912affda571a5f9dc
# save the attached .config to linux build tree
make W=1 ARCH=i386
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
In file included from drivers/spi/spidev.c:26:
>> include/uapi/linux/spi/spidev.h:33: warning: "SPI_CPHA" redefined
33 | #define SPI_CPHA 0x01
|
In file included from drivers/spi/spidev.c:25:
include/linux/spi/spi.h:168: note: this is the location of the previous definition
168 | #define SPI_CPHA BIT(0) /* clock phase */
|
In file included from drivers/spi/spidev.c:26:
>> include/uapi/linux/spi/spidev.h:34: warning: "SPI_CPOL" redefined
34 | #define SPI_CPOL 0x02
|
In file included from drivers/spi/spidev.c:25:
include/linux/spi/spi.h:169: note: this is the location of the previous definition
169 | #define SPI_CPOL BIT(1) /* clock polarity */
|
In file included from drivers/spi/spidev.c:26:
>> include/uapi/linux/spi/spidev.h:41: warning: "SPI_CS_HIGH" redefined
41 | #define SPI_CS_HIGH 0x04
|
In file included from drivers/spi/spidev.c:25:
include/linux/spi/spi.h:175: note: this is the location of the previous definition
175 | #define SPI_CS_HIGH BIT(2) /* chipselect active high? */
|
In file included from drivers/spi/spidev.c:26:
>> include/uapi/linux/spi/spidev.h:42: warning: "SPI_LSB_FIRST" redefined
42 | #define SPI_LSB_FIRST 0x08
|
In file included from drivers/spi/spidev.c:25:
include/linux/spi/spi.h:176: note: this is the location of the previous definition
176 | #define SPI_LSB_FIRST BIT(3) /* per-word bits-on-wire */
|
In file included from drivers/spi/spidev.c:26:
>> include/uapi/linux/spi/spidev.h:43: warning: "SPI_3WIRE" redefined
43 | #define SPI_3WIRE 0x10
|
In file included from drivers/spi/spidev.c:25:
include/linux/spi/spi.h:177: note: this is the location of the previous definition
177 | #define SPI_3WIRE BIT(4) /* SI/SO signals shared */
|
In file included from drivers/spi/spidev.c:26:
>> include/uapi/linux/spi/spidev.h:44: warning: "SPI_LOOP" redefined
44 | #define SPI_LOOP 0x20
|
In file included from drivers/spi/spidev.c:25:
include/linux/spi/spi.h:178: note: this is the location of the previous definition
178 | #define SPI_LOOP BIT(5) /* loopback mode */
|
In file included from drivers/spi/spidev.c:26:
>> include/uapi/linux/spi/spidev.h:45: warning: "SPI_NO_CS" redefined
45 | #define SPI_NO_CS 0x40
|
In file included from drivers/spi/spidev.c:25:
include/linux/spi/spi.h:179: note: this is the location of the previous definition
179 | #define SPI_NO_CS BIT(6) /* 1 dev/bus, no chipselect */
|
In file included from drivers/spi/spidev.c:26:
>> include/uapi/linux/spi/spidev.h:46: warning: "SPI_READY" redefined
46 | #define SPI_READY 0x80
|
In file included from drivers/spi/spidev.c:25:
include/linux/spi/spi.h:180: note: this is the location of the previous definition
180 | #define SPI_READY BIT(7) /* slave pulls low to pause */
|
In file included from drivers/spi/spidev.c:26:
>> include/uapi/linux/spi/spidev.h:47: warning: "SPI_TX_DUAL" redefined
47 | #define SPI_TX_DUAL 0x100
|
In file included from drivers/spi/spidev.c:25:
include/linux/spi/spi.h:181: note: this is the location of the previous definition
181 | #define SPI_TX_DUAL BIT(8) /* transmit with 2 wires */
|
In file included from drivers/spi/spidev.c:26:
>> include/uapi/linux/spi/spidev.h:48: warning: "SPI_TX_QUAD" redefined
48 | #define SPI_TX_QUAD 0x200
|
In file included from drivers/spi/spidev.c:25:
include/linux/spi/spi.h:182: note: this is the location of the previous definition
182 | #define SPI_TX_QUAD BIT(9) /* transmit with 4 wires */
|
In file included from drivers/spi/spidev.c:26:
>> include/uapi/linux/spi/spidev.h:49: warning: "SPI_RX_DUAL" redefined
49 | #define SPI_RX_DUAL 0x400
|
In file included from drivers/spi/spidev.c:25:
include/linux/spi/spi.h:183: note: this is the location of the previous definition
183 | #define SPI_RX_DUAL BIT(10) /* receive with 2 wires */
|
In file included from drivers/spi/spidev.c:26:
>> include/uapi/linux/spi/spidev.h:50: warning: "SPI_RX_QUAD" redefined
50 | #define SPI_RX_QUAD 0x800
|
In file included from drivers/spi/spidev.c:25:
include/linux/spi/spi.h:184: note: this is the location of the previous definition
184 | #define SPI_RX_QUAD BIT(11) /* receive with 4 wires */
|
In file included from drivers/spi/spidev.c:26:
>> include/uapi/linux/spi/spidev.h:51: warning: "SPI_CS_WORD" redefined
51 | #define SPI_CS_WORD 0x1000
|
In file included from drivers/spi/spidev.c:25:
include/linux/spi/spi.h:185: note: this is the location of the previous definition
185 | #define SPI_CS_WORD BIT(12) /* toggle cs after each word */
|
In file included from drivers/spi/spidev.c:26:
>> include/uapi/linux/spi/spidev.h:52: warning: "SPI_TX_OCTAL" redefined
52 | #define SPI_TX_OCTAL 0x2000
|
In file included from drivers/spi/spidev.c:25:
include/linux/spi/spi.h:186: note: this is the location of the previous definition
186 | #define SPI_TX_OCTAL BIT(13) /* transmit with 8 wires */
|
In file included from drivers/spi/spidev.c:26:
>> include/uapi/linux/spi/spidev.h:53: warning: "SPI_RX_OCTAL" redefined
53 | #define SPI_RX_OCTAL 0x4000
|
In file included from drivers/spi/spidev.c:25:
include/linux/spi/spi.h:187: note: this is the location of the previous definition
187 | #define SPI_RX_OCTAL BIT(14) /* receive with 8 wires */
|
In file included from drivers/spi/spidev.c:26:
>> include/uapi/linux/spi/spidev.h:54: warning: "SPI_3WIRE_HIZ" redefined
54 | #define SPI_3WIRE_HIZ 0x8000
|
In file included from drivers/spi/spidev.c:25:
include/linux/spi/spi.h:188: note: this is the location of the previous definition
188 | #define SPI_3WIRE_HIZ BIT(15) /* high impedance turnaround */
|
vim +/SPI_CPHA +33 include/uapi/linux/spi/spidev.h
814a8d50eb1d88c include/linux/spi/spidev.h Andrea Paterniani 2007-05-08 28
814a8d50eb1d88c include/linux/spi/spidev.h Andrea Paterniani 2007-05-08 29 /* User space versions of kernel symbols for SPI clocking modes,
814a8d50eb1d88c include/linux/spi/spidev.h Andrea Paterniani 2007-05-08 30 * matching <linux/spi/spi.h>
814a8d50eb1d88c include/linux/spi/spidev.h Andrea Paterniani 2007-05-08 31 */
814a8d50eb1d88c include/linux/spi/spidev.h Andrea Paterniani 2007-05-08 32
814a8d50eb1d88c include/linux/spi/spidev.h Andrea Paterniani 2007-05-08 @33 #define SPI_CPHA 0x01
814a8d50eb1d88c include/linux/spi/spidev.h Andrea Paterniani 2007-05-08 @34 #define SPI_CPOL 0x02
814a8d50eb1d88c include/linux/spi/spidev.h Andrea Paterniani 2007-05-08 35
814a8d50eb1d88c include/linux/spi/spidev.h Andrea Paterniani 2007-05-08 36 #define SPI_MODE_0 (0|0)
814a8d50eb1d88c include/linux/spi/spidev.h Andrea Paterniani 2007-05-08 37 #define SPI_MODE_1 (0|SPI_CPHA)
814a8d50eb1d88c include/linux/spi/spidev.h Andrea Paterniani 2007-05-08 38 #define SPI_MODE_2 (SPI_CPOL|0)
814a8d50eb1d88c include/linux/spi/spidev.h Andrea Paterniani 2007-05-08 39 #define SPI_MODE_3 (SPI_CPOL|SPI_CPHA)
814a8d50eb1d88c include/linux/spi/spidev.h Andrea Paterniani 2007-05-08 40
6f166e3833d953f include/linux/spi/spidev.h Anton Vorontsov 2007-07-31 @41 #define SPI_CS_HIGH 0x04
6f166e3833d953f include/linux/spi/spidev.h Anton Vorontsov 2007-07-31 @42 #define SPI_LSB_FIRST 0x08
6f166e3833d953f include/linux/spi/spidev.h Anton Vorontsov 2007-07-31 @43 #define SPI_3WIRE 0x10
6f166e3833d953f include/linux/spi/spidev.h Anton Vorontsov 2007-07-31 @44 #define SPI_LOOP 0x20
b55f627feeb9d48 include/linux/spi/spidev.h David Brownell 2009-06-30 @45 #define SPI_NO_CS 0x40
b55f627feeb9d48 include/linux/spi/spidev.h David Brownell 2009-06-30 @46 #define SPI_READY 0x80
dc64d39b54c1e9d include/uapi/linux/spi/spidev.h Geert Uytterhoeven 2014-02-25 @47 #define SPI_TX_DUAL 0x100
dc64d39b54c1e9d include/uapi/linux/spi/spidev.h Geert Uytterhoeven 2014-02-25 @48 #define SPI_TX_QUAD 0x200
dc64d39b54c1e9d include/uapi/linux/spi/spidev.h Geert Uytterhoeven 2014-02-25 @49 #define SPI_RX_DUAL 0x400
dc64d39b54c1e9d include/uapi/linux/spi/spidev.h Geert Uytterhoeven 2014-02-25 @50 #define SPI_RX_QUAD 0x800
7bb64402a092136 include/uapi/linux/spi/spidev.h Qing Zhang 2020-06-11 @51 #define SPI_CS_WORD 0x1000
7bb64402a092136 include/uapi/linux/spi/spidev.h Qing Zhang 2020-06-11 @52 #define SPI_TX_OCTAL 0x2000
7bb64402a092136 include/uapi/linux/spi/spidev.h Qing Zhang 2020-06-11 @53 #define SPI_RX_OCTAL 0x4000
7bb64402a092136 include/uapi/linux/spi/spidev.h Qing Zhang 2020-06-11 @54 #define SPI_3WIRE_HIZ 0x8000
814a8d50eb1d88c include/linux/spi/spidev.h Andrea Paterniani 2007-05-08 55
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 35730 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v2 1/3] spi: convert to BIT() all spi_device flags
@ 2020-11-24 11:41 ` kernel test robot
0 siblings, 0 replies; 15+ messages in thread
From: kernel test robot @ 2020-11-24 11:41 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 10786 bytes --]
Hi Alexandru,
I love your patch! Perhaps something to improve:
[auto build test WARNING on spi/for-next]
[also build test WARNING on next-20201123]
[cannot apply to v5.10-rc5]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Alexandru-Ardelean/spi-convert-to-BIT-all-spi_device-flags/20201124-181801
base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next
config: i386-randconfig-a011-20201124 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
# https://github.com/0day-ci/linux/commit/1d45734a72568cc2118c14f912affda571a5f9dc
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Alexandru-Ardelean/spi-convert-to-BIT-all-spi_device-flags/20201124-181801
git checkout 1d45734a72568cc2118c14f912affda571a5f9dc
# save the attached .config to linux build tree
make W=1 ARCH=i386
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
In file included from drivers/spi/spidev.c:26:
>> include/uapi/linux/spi/spidev.h:33: warning: "SPI_CPHA" redefined
33 | #define SPI_CPHA 0x01
|
In file included from drivers/spi/spidev.c:25:
include/linux/spi/spi.h:168: note: this is the location of the previous definition
168 | #define SPI_CPHA BIT(0) /* clock phase */
|
In file included from drivers/spi/spidev.c:26:
>> include/uapi/linux/spi/spidev.h:34: warning: "SPI_CPOL" redefined
34 | #define SPI_CPOL 0x02
|
In file included from drivers/spi/spidev.c:25:
include/linux/spi/spi.h:169: note: this is the location of the previous definition
169 | #define SPI_CPOL BIT(1) /* clock polarity */
|
In file included from drivers/spi/spidev.c:26:
>> include/uapi/linux/spi/spidev.h:41: warning: "SPI_CS_HIGH" redefined
41 | #define SPI_CS_HIGH 0x04
|
In file included from drivers/spi/spidev.c:25:
include/linux/spi/spi.h:175: note: this is the location of the previous definition
175 | #define SPI_CS_HIGH BIT(2) /* chipselect active high? */
|
In file included from drivers/spi/spidev.c:26:
>> include/uapi/linux/spi/spidev.h:42: warning: "SPI_LSB_FIRST" redefined
42 | #define SPI_LSB_FIRST 0x08
|
In file included from drivers/spi/spidev.c:25:
include/linux/spi/spi.h:176: note: this is the location of the previous definition
176 | #define SPI_LSB_FIRST BIT(3) /* per-word bits-on-wire */
|
In file included from drivers/spi/spidev.c:26:
>> include/uapi/linux/spi/spidev.h:43: warning: "SPI_3WIRE" redefined
43 | #define SPI_3WIRE 0x10
|
In file included from drivers/spi/spidev.c:25:
include/linux/spi/spi.h:177: note: this is the location of the previous definition
177 | #define SPI_3WIRE BIT(4) /* SI/SO signals shared */
|
In file included from drivers/spi/spidev.c:26:
>> include/uapi/linux/spi/spidev.h:44: warning: "SPI_LOOP" redefined
44 | #define SPI_LOOP 0x20
|
In file included from drivers/spi/spidev.c:25:
include/linux/spi/spi.h:178: note: this is the location of the previous definition
178 | #define SPI_LOOP BIT(5) /* loopback mode */
|
In file included from drivers/spi/spidev.c:26:
>> include/uapi/linux/spi/spidev.h:45: warning: "SPI_NO_CS" redefined
45 | #define SPI_NO_CS 0x40
|
In file included from drivers/spi/spidev.c:25:
include/linux/spi/spi.h:179: note: this is the location of the previous definition
179 | #define SPI_NO_CS BIT(6) /* 1 dev/bus, no chipselect */
|
In file included from drivers/spi/spidev.c:26:
>> include/uapi/linux/spi/spidev.h:46: warning: "SPI_READY" redefined
46 | #define SPI_READY 0x80
|
In file included from drivers/spi/spidev.c:25:
include/linux/spi/spi.h:180: note: this is the location of the previous definition
180 | #define SPI_READY BIT(7) /* slave pulls low to pause */
|
In file included from drivers/spi/spidev.c:26:
>> include/uapi/linux/spi/spidev.h:47: warning: "SPI_TX_DUAL" redefined
47 | #define SPI_TX_DUAL 0x100
|
In file included from drivers/spi/spidev.c:25:
include/linux/spi/spi.h:181: note: this is the location of the previous definition
181 | #define SPI_TX_DUAL BIT(8) /* transmit with 2 wires */
|
In file included from drivers/spi/spidev.c:26:
>> include/uapi/linux/spi/spidev.h:48: warning: "SPI_TX_QUAD" redefined
48 | #define SPI_TX_QUAD 0x200
|
In file included from drivers/spi/spidev.c:25:
include/linux/spi/spi.h:182: note: this is the location of the previous definition
182 | #define SPI_TX_QUAD BIT(9) /* transmit with 4 wires */
|
In file included from drivers/spi/spidev.c:26:
>> include/uapi/linux/spi/spidev.h:49: warning: "SPI_RX_DUAL" redefined
49 | #define SPI_RX_DUAL 0x400
|
In file included from drivers/spi/spidev.c:25:
include/linux/spi/spi.h:183: note: this is the location of the previous definition
183 | #define SPI_RX_DUAL BIT(10) /* receive with 2 wires */
|
In file included from drivers/spi/spidev.c:26:
>> include/uapi/linux/spi/spidev.h:50: warning: "SPI_RX_QUAD" redefined
50 | #define SPI_RX_QUAD 0x800
|
In file included from drivers/spi/spidev.c:25:
include/linux/spi/spi.h:184: note: this is the location of the previous definition
184 | #define SPI_RX_QUAD BIT(11) /* receive with 4 wires */
|
In file included from drivers/spi/spidev.c:26:
>> include/uapi/linux/spi/spidev.h:51: warning: "SPI_CS_WORD" redefined
51 | #define SPI_CS_WORD 0x1000
|
In file included from drivers/spi/spidev.c:25:
include/linux/spi/spi.h:185: note: this is the location of the previous definition
185 | #define SPI_CS_WORD BIT(12) /* toggle cs after each word */
|
In file included from drivers/spi/spidev.c:26:
>> include/uapi/linux/spi/spidev.h:52: warning: "SPI_TX_OCTAL" redefined
52 | #define SPI_TX_OCTAL 0x2000
|
In file included from drivers/spi/spidev.c:25:
include/linux/spi/spi.h:186: note: this is the location of the previous definition
186 | #define SPI_TX_OCTAL BIT(13) /* transmit with 8 wires */
|
In file included from drivers/spi/spidev.c:26:
>> include/uapi/linux/spi/spidev.h:53: warning: "SPI_RX_OCTAL" redefined
53 | #define SPI_RX_OCTAL 0x4000
|
In file included from drivers/spi/spidev.c:25:
include/linux/spi/spi.h:187: note: this is the location of the previous definition
187 | #define SPI_RX_OCTAL BIT(14) /* receive with 8 wires */
|
In file included from drivers/spi/spidev.c:26:
>> include/uapi/linux/spi/spidev.h:54: warning: "SPI_3WIRE_HIZ" redefined
54 | #define SPI_3WIRE_HIZ 0x8000
|
In file included from drivers/spi/spidev.c:25:
include/linux/spi/spi.h:188: note: this is the location of the previous definition
188 | #define SPI_3WIRE_HIZ BIT(15) /* high impedance turnaround */
|
vim +/SPI_CPHA +33 include/uapi/linux/spi/spidev.h
814a8d50eb1d88c include/linux/spi/spidev.h Andrea Paterniani 2007-05-08 28
814a8d50eb1d88c include/linux/spi/spidev.h Andrea Paterniani 2007-05-08 29 /* User space versions of kernel symbols for SPI clocking modes,
814a8d50eb1d88c include/linux/spi/spidev.h Andrea Paterniani 2007-05-08 30 * matching <linux/spi/spi.h>
814a8d50eb1d88c include/linux/spi/spidev.h Andrea Paterniani 2007-05-08 31 */
814a8d50eb1d88c include/linux/spi/spidev.h Andrea Paterniani 2007-05-08 32
814a8d50eb1d88c include/linux/spi/spidev.h Andrea Paterniani 2007-05-08 @33 #define SPI_CPHA 0x01
814a8d50eb1d88c include/linux/spi/spidev.h Andrea Paterniani 2007-05-08 @34 #define SPI_CPOL 0x02
814a8d50eb1d88c include/linux/spi/spidev.h Andrea Paterniani 2007-05-08 35
814a8d50eb1d88c include/linux/spi/spidev.h Andrea Paterniani 2007-05-08 36 #define SPI_MODE_0 (0|0)
814a8d50eb1d88c include/linux/spi/spidev.h Andrea Paterniani 2007-05-08 37 #define SPI_MODE_1 (0|SPI_CPHA)
814a8d50eb1d88c include/linux/spi/spidev.h Andrea Paterniani 2007-05-08 38 #define SPI_MODE_2 (SPI_CPOL|0)
814a8d50eb1d88c include/linux/spi/spidev.h Andrea Paterniani 2007-05-08 39 #define SPI_MODE_3 (SPI_CPOL|SPI_CPHA)
814a8d50eb1d88c include/linux/spi/spidev.h Andrea Paterniani 2007-05-08 40
6f166e3833d953f include/linux/spi/spidev.h Anton Vorontsov 2007-07-31 @41 #define SPI_CS_HIGH 0x04
6f166e3833d953f include/linux/spi/spidev.h Anton Vorontsov 2007-07-31 @42 #define SPI_LSB_FIRST 0x08
6f166e3833d953f include/linux/spi/spidev.h Anton Vorontsov 2007-07-31 @43 #define SPI_3WIRE 0x10
6f166e3833d953f include/linux/spi/spidev.h Anton Vorontsov 2007-07-31 @44 #define SPI_LOOP 0x20
b55f627feeb9d48 include/linux/spi/spidev.h David Brownell 2009-06-30 @45 #define SPI_NO_CS 0x40
b55f627feeb9d48 include/linux/spi/spidev.h David Brownell 2009-06-30 @46 #define SPI_READY 0x80
dc64d39b54c1e9d include/uapi/linux/spi/spidev.h Geert Uytterhoeven 2014-02-25 @47 #define SPI_TX_DUAL 0x100
dc64d39b54c1e9d include/uapi/linux/spi/spidev.h Geert Uytterhoeven 2014-02-25 @48 #define SPI_TX_QUAD 0x200
dc64d39b54c1e9d include/uapi/linux/spi/spidev.h Geert Uytterhoeven 2014-02-25 @49 #define SPI_RX_DUAL 0x400
dc64d39b54c1e9d include/uapi/linux/spi/spidev.h Geert Uytterhoeven 2014-02-25 @50 #define SPI_RX_QUAD 0x800
7bb64402a092136 include/uapi/linux/spi/spidev.h Qing Zhang 2020-06-11 @51 #define SPI_CS_WORD 0x1000
7bb64402a092136 include/uapi/linux/spi/spidev.h Qing Zhang 2020-06-11 @52 #define SPI_TX_OCTAL 0x2000
7bb64402a092136 include/uapi/linux/spi/spidev.h Qing Zhang 2020-06-11 @53 #define SPI_RX_OCTAL 0x4000
7bb64402a092136 include/uapi/linux/spi/spidev.h Qing Zhang 2020-06-11 @54 #define SPI_3WIRE_HIZ 0x8000
814a8d50eb1d88c include/linux/spi/spidev.h Andrea Paterniani 2007-05-08 55
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 35730 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v2 1/3] spi: convert to BIT() all spi_device flags
2020-11-24 10:21 [PATCH v2 1/3] spi: convert to BIT() all spi_device flags Alexandru Ardelean
` (3 preceding siblings ...)
2020-11-24 11:41 ` kernel test robot
@ 2020-11-24 11:47 ` Andy Shevchenko
4 siblings, 0 replies; 15+ messages in thread
From: Andy Shevchenko @ 2020-11-24 11:47 UTC (permalink / raw)
To: Alexandru Ardelean
Cc: linux-spi, devicetree, Linux Kernel Mailing List, Mark Brown,
Rob Herring, Bogdan, Dragos
On Tue, Nov 24, 2020 at 12:16 PM Alexandru Ardelean
<alexandru.ardelean@analog.com> wrote:
>
> 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.
...
#include <linux/bits.h>
And honestly I think the entire inclusion block with data type forward
declarations should be revisited here.
...
> +#define SPI_CPHA BIT(0) /* clock phase */
> +#define SPI_CPOL BIT(1) /* clock polarity */
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v2 1/3] spi: convert to BIT() all spi_device flags
2020-11-24 11:41 ` kernel test robot
@ 2020-11-24 11:49 ` Andy Shevchenko
-1 siblings, 0 replies; 15+ messages in thread
From: Andy Shevchenko @ 2020-11-24 11:49 UTC (permalink / raw)
To: kernel test robot
Cc: Alexandru Ardelean, linux-spi, devicetree,
Linux Kernel Mailing List, kbuild-all, Mark Brown, Rob Herring,
Bogdan, Dragos
On Tue, Nov 24, 2020 at 1:42 PM kernel test robot <lkp@intel.com> wrote:
> All warnings (new ones prefixed by >>):
>
> In file included from drivers/spi/spidev.c:26:
> >> include/uapi/linux/spi/spidev.h:33: warning: "SPI_CPHA" redefined
> 33 | #define SPI_CPHA 0x01
Argh! Can we have only one set of flags?
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v2 1/3] spi: convert to BIT() all spi_device flags
@ 2020-11-24 11:49 ` Andy Shevchenko
0 siblings, 0 replies; 15+ messages in thread
From: Andy Shevchenko @ 2020-11-24 11:49 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 370 bytes --]
On Tue, Nov 24, 2020 at 1:42 PM kernel test robot <lkp@intel.com> wrote:
> All warnings (new ones prefixed by >>):
>
> In file included from drivers/spi/spidev.c:26:
> >> include/uapi/linux/spi/spidev.h:33: warning: "SPI_CPHA" redefined
> 33 | #define SPI_CPHA 0x01
Argh! Can we have only one set of flags?
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 15+ messages in thread
* RE: [PATCH v2 1/3] spi: convert to BIT() all spi_device flags
2020-11-24 11:49 ` Andy Shevchenko
(?)
@ 2020-11-24 12:03 ` Ardelean, Alexandru
2020-11-24 13:55 ` Andy Shevchenko
-1 siblings, 1 reply; 15+ messages in thread
From: Ardelean, Alexandru @ 2020-11-24 12:03 UTC (permalink / raw)
To: Andy Shevchenko, kernel test robot
Cc: linux-spi, devicetree, Linux Kernel Mailing List, kbuild-all,
Mark Brown, Rob Herring, Bogdan, Dragos
> -----Original Message-----
> From: Andy Shevchenko <andy.shevchenko@gmail.com>
> Sent: Tuesday, November 24, 2020 1:50 PM
> To: kernel test robot <lkp@intel.com>
> Cc: Ardelean, Alexandru <alexandru.Ardelean@analog.com>; linux-spi <linux-
> spi@vger.kernel.org>; devicetree <devicetree@vger.kernel.org>; Linux Kernel
> Mailing List <linux-kernel@vger.kernel.org>; kbuild-all@lists.01.org; Mark
> Brown <broonie@kernel.org>; Rob Herring <robh+dt@kernel.org>; Bogdan,
> Dragos <Dragos.Bogdan@analog.com>
> Subject: Re: [PATCH v2 1/3] spi: convert to BIT() all spi_device flags
>
> On Tue, Nov 24, 2020 at 1:42 PM kernel test robot <lkp@intel.com> wrote:
>
> > All warnings (new ones prefixed by >>):
> >
> > In file included from drivers/spi/spidev.c:26:
> > >> include/uapi/linux/spi/spidev.h:33: warning: "SPI_CPHA" redefined
> > 33 | #define SPI_CPHA 0x01
>
> Argh! Can we have only one set of flags?
>
My bad here for not catching this earlier.
It might be an idea to create a "include/uapi/linux/spi/spi.h" and include this in " include/uapi/linux/spi/spidev.h "
Then the " include/uapi/linux/spi/spi.h " would also be included in " include/linux/spi/spi.h "
We would naturally drop the BIT() macros for the uapi header.
> --
> With Best Regards,
> Andy Shevchenko
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v2 1/3] spi: convert to BIT() all spi_device flags
2020-11-24 11:49 ` Andy Shevchenko
(?)
(?)
@ 2020-11-24 12:03 ` Ardelean, Alexandru
-1 siblings, 0 replies; 15+ messages in thread
From: Ardelean, Alexandru @ 2020-11-24 12:03 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 1327 bytes --]
> -----Original Message-----
> From: Andy Shevchenko <andy.shevchenko@gmail.com>
> Sent: Tuesday, November 24, 2020 1:50 PM
> To: kernel test robot <lkp@intel.com>
> Cc: Ardelean, Alexandru <alexandru.Ardelean@analog.com>; linux-spi <linux-
> spi(a)vger.kernel.org>; devicetree <devicetree@vger.kernel.org>; Linux Kernel
> Mailing List <linux-kernel@vger.kernel.org>; kbuild-all(a)lists.01.org; Mark
> Brown <broonie@kernel.org>; Rob Herring <robh+dt@kernel.org>; Bogdan,
> Dragos <Dragos.Bogdan@analog.com>
> Subject: Re: [PATCH v2 1/3] spi: convert to BIT() all spi_device flags
>
> On Tue, Nov 24, 2020 at 1:42 PM kernel test robot <lkp@intel.com> wrote:
>
> > All warnings (new ones prefixed by >>):
> >
> > In file included from drivers/spi/spidev.c:26:
> > >> include/uapi/linux/spi/spidev.h:33: warning: "SPI_CPHA" redefined
> > 33 | #define SPI_CPHA 0x01
>
> Argh! Can we have only one set of flags?
>
My bad here for not catching this earlier.
It might be an idea to create a "include/uapi/linux/spi/spi.h" and include this in " include/uapi/linux/spi/spidev.h "
Then the " include/uapi/linux/spi/spi.h " would also be included in " include/linux/spi/spi.h "
We would naturally drop the BIT() macros for the uapi header.
> --
> With Best Regards,
> Andy Shevchenko
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v2 1/3] spi: convert to BIT() all spi_device flags
2020-11-24 12:03 ` Ardelean, Alexandru
@ 2020-11-24 13:55 ` Andy Shevchenko
0 siblings, 0 replies; 15+ messages in thread
From: Andy Shevchenko @ 2020-11-24 13:55 UTC (permalink / raw)
To: Ardelean, Alexandru
Cc: kernel test robot, linux-spi, devicetree,
Linux Kernel Mailing List, kbuild-all, Mark Brown, Rob Herring,
Bogdan, Dragos
On Tue, Nov 24, 2020 at 2:03 PM Ardelean, Alexandru
<alexandru.Ardelean@analog.com> wrote:
> > > In file included from drivers/spi/spidev.c:26:
> > > >> include/uapi/linux/spi/spidev.h:33: warning: "SPI_CPHA" redefined
> > > 33 | #define SPI_CPHA 0x01
> >
> > Argh! Can we have only one set of flags?
> >
>
> My bad here for not catching this earlier.
>
> It might be an idea to create a "include/uapi/linux/spi/spi.h" and include this in " include/uapi/linux/spi/spidev.h "
> Then the " include/uapi/linux/spi/spi.h " would also be included in " include/linux/spi/spi.h "
> We would naturally drop the BIT() macros for the uapi header.
uAPI has its own _BIT*() macros.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v2 1/3] spi: convert to BIT() all spi_device flags
@ 2020-11-24 13:55 ` Andy Shevchenko
0 siblings, 0 replies; 15+ messages in thread
From: Andy Shevchenko @ 2020-11-24 13:55 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 743 bytes --]
On Tue, Nov 24, 2020 at 2:03 PM Ardelean, Alexandru
<alexandru.Ardelean@analog.com> wrote:
> > > In file included from drivers/spi/spidev.c:26:
> > > >> include/uapi/linux/spi/spidev.h:33: warning: "SPI_CPHA" redefined
> > > 33 | #define SPI_CPHA 0x01
> >
> > Argh! Can we have only one set of flags?
> >
>
> My bad here for not catching this earlier.
>
> It might be an idea to create a "include/uapi/linux/spi/spi.h" and include this in " include/uapi/linux/spi/spidev.h "
> Then the " include/uapi/linux/spi/spi.h " would also be included in " include/linux/spi/spi.h "
> We would naturally drop the BIT() macros for the uapi header.
uAPI has its own _BIT*() macros.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v2 1/3] spi: convert to BIT() all spi_device flags
@ 2020-11-24 12:55 kernel test robot
0 siblings, 0 replies; 15+ messages in thread
From: kernel test robot @ 2020-11-24 12:55 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 17071 bytes --]
CC: kbuild-all(a)lists.01.org
In-Reply-To: <20201124102152.16548-1-alexandru.ardelean@analog.com>
References: <20201124102152.16548-1-alexandru.ardelean@analog.com>
TO: Alexandru Ardelean <alexandru.ardelean@analog.com>
TO: linux-spi(a)vger.kernel.org
TO: devicetree(a)vger.kernel.org
TO: linux-kernel(a)vger.kernel.org
CC: broonie(a)kernel.org
CC: robh+dt(a)kernel.org
CC: andy.shevchenko(a)gmail.com
CC: dragos.bogdan(a)analog.com
CC: Alexandru Ardelean <alexandru.ardelean@analog.com>
Hi Alexandru,
I love your patch! Perhaps something to improve:
[auto build test WARNING on spi/for-next]
[also build test WARNING on next-20201124]
[cannot apply to v5.10-rc5]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Alexandru-Ardelean/spi-convert-to-BIT-all-spi_device-flags/20201124-181801
base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next
:::::: branch date: 3 hours ago
:::::: commit date: 3 hours ago
config: i386-randconfig-s001-20201124 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.3-151-g540c2c4b-dirty
# https://github.com/0day-ci/linux/commit/1d45734a72568cc2118c14f912affda571a5f9dc
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Alexandru-Ardelean/spi-convert-to-BIT-all-spi_device-flags/20201124-181801
git checkout 1d45734a72568cc2118c14f912affda571a5f9dc
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
"sparse warnings: (new ones prefixed by >>)"
drivers/spi/spi-topcliff-pch.c: note: in included file:
include/uapi/linux/spi/spidev.h:33:9: sparse: sparse: preprocessor token SPI_CPHA redefined
drivers/spi/spi-topcliff-pch.c: note: in included file:
>> include/linux/spi/spi.h:168:9: sparse: this was the original definition
drivers/spi/spi-topcliff-pch.c: note: in included file:
include/uapi/linux/spi/spidev.h:34:9: sparse: sparse: preprocessor token SPI_CPOL redefined
drivers/spi/spi-topcliff-pch.c: note: in included file:
include/linux/spi/spi.h:169:9: sparse: this was the original definition
drivers/spi/spi-topcliff-pch.c: note: in included file:
include/uapi/linux/spi/spidev.h:41:9: sparse: sparse: preprocessor token SPI_CS_HIGH redefined
drivers/spi/spi-topcliff-pch.c: note: in included file:
include/linux/spi/spi.h:175:9: sparse: this was the original definition
drivers/spi/spi-topcliff-pch.c: note: in included file:
include/uapi/linux/spi/spidev.h:42:9: sparse: sparse: preprocessor token SPI_LSB_FIRST redefined
drivers/spi/spi-topcliff-pch.c: note: in included file:
include/linux/spi/spi.h:176:9: sparse: this was the original definition
drivers/spi/spi-topcliff-pch.c: note: in included file:
include/uapi/linux/spi/spidev.h:43:9: sparse: sparse: preprocessor token SPI_3WIRE redefined
drivers/spi/spi-topcliff-pch.c: note: in included file:
include/linux/spi/spi.h:177:9: sparse: this was the original definition
drivers/spi/spi-topcliff-pch.c: note: in included file:
include/uapi/linux/spi/spidev.h:44:9: sparse: sparse: preprocessor token SPI_LOOP redefined
drivers/spi/spi-topcliff-pch.c: note: in included file:
include/linux/spi/spi.h:178:9: sparse: this was the original definition
drivers/spi/spi-topcliff-pch.c: note: in included file:
include/uapi/linux/spi/spidev.h:45:9: sparse: sparse: preprocessor token SPI_NO_CS redefined
drivers/spi/spi-topcliff-pch.c: note: in included file:
include/linux/spi/spi.h:179:9: sparse: this was the original definition
drivers/spi/spi-topcliff-pch.c: note: in included file:
include/uapi/linux/spi/spidev.h:46:9: sparse: sparse: preprocessor token SPI_READY redefined
drivers/spi/spi-topcliff-pch.c: note: in included file:
include/linux/spi/spi.h:180:9: sparse: this was the original definition
drivers/spi/spi-topcliff-pch.c: note: in included file:
include/uapi/linux/spi/spidev.h:47:9: sparse: sparse: preprocessor token SPI_TX_DUAL redefined
drivers/spi/spi-topcliff-pch.c: note: in included file:
include/linux/spi/spi.h:181:9: sparse: this was the original definition
drivers/spi/spi-topcliff-pch.c: note: in included file:
include/uapi/linux/spi/spidev.h:48:9: sparse: sparse: preprocessor token SPI_TX_QUAD redefined
drivers/spi/spi-topcliff-pch.c: note: in included file:
include/linux/spi/spi.h:182:9: sparse: this was the original definition
drivers/spi/spi-topcliff-pch.c: note: in included file:
include/uapi/linux/spi/spidev.h:49:9: sparse: sparse: preprocessor token SPI_RX_DUAL redefined
drivers/spi/spi-topcliff-pch.c: note: in included file:
include/linux/spi/spi.h:183:9: sparse: this was the original definition
drivers/spi/spi-topcliff-pch.c: note: in included file:
include/uapi/linux/spi/spidev.h:50:9: sparse: sparse: preprocessor token SPI_RX_QUAD redefined
drivers/spi/spi-topcliff-pch.c: note: in included file:
include/linux/spi/spi.h:184:9: sparse: this was the original definition
drivers/spi/spi-topcliff-pch.c: note: in included file:
include/uapi/linux/spi/spidev.h:51:9: sparse: sparse: preprocessor token SPI_CS_WORD redefined
drivers/spi/spi-topcliff-pch.c: note: in included file:
include/linux/spi/spi.h:185:9: sparse: this was the original definition
drivers/spi/spi-topcliff-pch.c: note: in included file:
include/uapi/linux/spi/spidev.h:52:9: sparse: sparse: preprocessor token SPI_TX_OCTAL redefined
drivers/spi/spi-topcliff-pch.c: note: in included file:
include/linux/spi/spi.h:186:9: sparse: this was the original definition
drivers/spi/spi-topcliff-pch.c: note: in included file:
include/uapi/linux/spi/spidev.h:53:9: sparse: sparse: preprocessor token SPI_RX_OCTAL redefined
drivers/spi/spi-topcliff-pch.c: note: in included file:
include/linux/spi/spi.h:187:9: sparse: this was the original definition
drivers/spi/spi-topcliff-pch.c: note: in included file:
include/uapi/linux/spi/spidev.h:54:9: sparse: sparse: preprocessor token SPI_3WIRE_HIZ redefined
drivers/spi/spi-topcliff-pch.c: note: in included file:
include/linux/spi/spi.h:188:9: sparse: this was the original definition
vim +168 include/linux/spi/spi.h
b2c98153f45fc17 Alexandru Ardelean 2019-09-26 108
8ae12a0d85987dc David Brownell 2006-01-08 109 /**
8caab75fd2c2a92 Geert Uytterhoeven 2017-06-13 110 * struct spi_device - Controller side proxy for an SPI slave device
8ae12a0d85987dc David Brownell 2006-01-08 111 * @dev: Driver model representation of the device.
8caab75fd2c2a92 Geert Uytterhoeven 2017-06-13 112 * @controller: SPI controller used with the device.
8caab75fd2c2a92 Geert Uytterhoeven 2017-06-13 113 * @master: Copy of controller, for backwards compatibility.
8ae12a0d85987dc David Brownell 2006-01-08 114 * @max_speed_hz: Maximum clock rate to be used with this chip
8ae12a0d85987dc David Brownell 2006-01-08 115 * (on this board); may be changed by the device's driver.
4cff33f94fefcce Imre Deak 2006-02-17 116 * The spi_transfer.speed_hz can override this for each transfer.
8caab75fd2c2a92 Geert Uytterhoeven 2017-06-13 117 * @chip_select: Chipselect, distinguishing chips handled by @controller.
8ae12a0d85987dc David Brownell 2006-01-08 118 * @mode: The spi mode defines how data is clocked out and in.
8ae12a0d85987dc David Brownell 2006-01-08 119 * This may be changed by the device's driver.
33e34dc6ee2cb2c David Brownell 2007-05-08 120 * The "active low" default for chipselect mode can be overridden
33e34dc6ee2cb2c David Brownell 2007-05-08 121 * (by specifying SPI_CS_HIGH) as can the "MSB first" default for
33e34dc6ee2cb2c David Brownell 2007-05-08 122 * each word in a transfer (by specifying SPI_LSB_FIRST).
8ae12a0d85987dc David Brownell 2006-01-08 123 * @bits_per_word: Data transfers involve one or more words; word sizes
8ae12a0d85987dc David Brownell 2006-01-08 124 * like eight or 12 bits are common. In-memory wordsizes are
8ae12a0d85987dc David Brownell 2006-01-08 125 * powers of two bytes (e.g. 20 bit samples use 32 bits).
ccf77cc4af5b048 David Brownell 2006-04-03 126 * This may be changed by the device's driver, or left at the
ccf77cc4af5b048 David Brownell 2006-04-03 127 * default (0) indicating protocol words are eight bit bytes.
4cff33f94fefcce Imre Deak 2006-02-17 128 * The spi_transfer.bits_per_word can override this for each transfer.
924b5867e7bd6a6 Douglas Anderson 2019-05-15 129 * @rt: Make the pump thread real time priority.
8ae12a0d85987dc David Brownell 2006-01-08 130 * @irq: Negative, or the number passed to request_irq() to receive
8ae12a0d85987dc David Brownell 2006-01-08 131 * interrupts from this device.
8ae12a0d85987dc David Brownell 2006-01-08 132 * @controller_state: Controller's runtime state
b885244eb2628e0 David Brownell 2006-01-08 133 * @controller_data: Board-specific definitions for controller, such as
b885244eb2628e0 David Brownell 2006-01-08 134 * FIFO initialization parameters; from board_info.controller_data
33e34dc6ee2cb2c David Brownell 2007-05-08 135 * @modalias: Name of the driver to use with this device, or an alias
33e34dc6ee2cb2c David Brownell 2007-05-08 136 * for that name. This appears in the sysfs "modalias" attribute
33e34dc6ee2cb2c David Brownell 2007-05-08 137 * for driver coldplugging, and in uevents used for hotplugging
7a86a419ff62c69 Qiujun Huang 2020-03-10 138 * @driver_override: If the name of a driver is written to this attribute, then
7a86a419ff62c69 Qiujun Huang 2020-03-10 139 * the device will bind to the named driver and only the named driver.
f3186dd876697e6 Linus Walleij 2019-01-07 140 * @cs_gpio: LEGACY: gpio number of the chipselect line (optional, -ENOENT when
f3186dd876697e6 Linus Walleij 2019-01-07 141 * not using a GPIO line) use cs_gpiod in new drivers by opting in on
f3186dd876697e6 Linus Walleij 2019-01-07 142 * the spi_master.
f3186dd876697e6 Linus Walleij 2019-01-07 143 * @cs_gpiod: gpio descriptor of the chipselect line (optional, NULL when
8d26fdfcb45dc42 Geert Uytterhoeven 2017-11-30 144 * not using a GPIO line)
6c613f68aabf333 Alexandru Ardelean 2019-09-26 145 * @word_delay: delay to be inserted between consecutive
b7bb367afa4bf9d Jonas Bonn 2019-01-30 146 * words of a transfer
8ae12a0d85987dc David Brownell 2006-01-08 147 *
eca2ebc7e007c9e Martin Sperl 2015-06-22 148 * @statistics: statistics for the spi_device
eca2ebc7e007c9e Martin Sperl 2015-06-22 149 *
33e34dc6ee2cb2c David Brownell 2007-05-08 150 * A @spi_device is used to interchange data between an SPI slave
8ae12a0d85987dc David Brownell 2006-01-08 151 * (usually a discrete chip) and CPU memory.
8ae12a0d85987dc David Brownell 2006-01-08 152 *
33e34dc6ee2cb2c David Brownell 2007-05-08 153 * In @dev, the platform_data is used to hold information about this
8ae12a0d85987dc David Brownell 2006-01-08 154 * device that's meaningful to the device's protocol driver, but not
8ae12a0d85987dc David Brownell 2006-01-08 155 * to its controller. One example might be an identifier for a chip
33e34dc6ee2cb2c David Brownell 2007-05-08 156 * variant with slightly different functionality; another might be
33e34dc6ee2cb2c David Brownell 2007-05-08 157 * information about how this particular board wires the chip's pins.
8ae12a0d85987dc David Brownell 2006-01-08 158 */
8ae12a0d85987dc David Brownell 2006-01-08 159 struct spi_device {
8ae12a0d85987dc David Brownell 2006-01-08 160 struct device dev;
8caab75fd2c2a92 Geert Uytterhoeven 2017-06-13 161 struct spi_controller *controller;
8caab75fd2c2a92 Geert Uytterhoeven 2017-06-13 162 struct spi_controller *master; /* compatibility layer */
8ae12a0d85987dc David Brownell 2006-01-08 163 u32 max_speed_hz;
8ae12a0d85987dc David Brownell 2006-01-08 164 u8 chip_select;
89c1f6074610675 Trent Piepho 2013-12-13 165 u8 bits_per_word;
924b5867e7bd6a6 Douglas Anderson 2019-05-15 166 bool rt;
937e6d756422637 Sowjanya Komatineni 2019-04-15 167 u32 mode;
1d45734a72568cc Alexandru Ardelean 2020-11-24 @168 #define SPI_CPHA BIT(0) /* clock phase */
1d45734a72568cc Alexandru Ardelean 2020-11-24 169 #define SPI_CPOL BIT(1) /* clock polarity */
0c868461fcb8413 David Brownell 2006-01-08 170 #define SPI_MODE_0 (0|0) /* (original MicroWire) */
0c868461fcb8413 David Brownell 2006-01-08 171 #define SPI_MODE_1 (0|SPI_CPHA)
8ae12a0d85987dc David Brownell 2006-01-08 172 #define SPI_MODE_2 (SPI_CPOL|0)
8ae12a0d85987dc David Brownell 2006-01-08 173 #define SPI_MODE_3 (SPI_CPOL|SPI_CPHA)
029b42d8519cef7 Oleksij Rempel 2020-10-27 174 #define SPI_MODE_X_MASK (SPI_CPOL|SPI_CPHA)
1d45734a72568cc Alexandru Ardelean 2020-11-24 175 #define SPI_CS_HIGH BIT(2) /* chipselect active high? */
1d45734a72568cc Alexandru Ardelean 2020-11-24 176 #define SPI_LSB_FIRST BIT(3) /* per-word bits-on-wire */
1d45734a72568cc Alexandru Ardelean 2020-11-24 177 #define SPI_3WIRE BIT(4) /* SI/SO signals shared */
1d45734a72568cc Alexandru Ardelean 2020-11-24 178 #define SPI_LOOP BIT(5) /* loopback mode */
1d45734a72568cc Alexandru Ardelean 2020-11-24 179 #define SPI_NO_CS BIT(6) /* 1 dev/bus, no chipselect */
1d45734a72568cc Alexandru Ardelean 2020-11-24 180 #define SPI_READY BIT(7) /* slave pulls low to pause */
1d45734a72568cc Alexandru Ardelean 2020-11-24 181 #define SPI_TX_DUAL BIT(8) /* transmit with 2 wires */
1d45734a72568cc Alexandru Ardelean 2020-11-24 182 #define SPI_TX_QUAD BIT(9) /* transmit with 4 wires */
1d45734a72568cc Alexandru Ardelean 2020-11-24 183 #define SPI_RX_DUAL BIT(10) /* receive with 2 wires */
1d45734a72568cc Alexandru Ardelean 2020-11-24 184 #define SPI_RX_QUAD BIT(11) /* receive with 4 wires */
1d45734a72568cc Alexandru Ardelean 2020-11-24 185 #define SPI_CS_WORD BIT(12) /* toggle cs after each word */
1d45734a72568cc Alexandru Ardelean 2020-11-24 186 #define SPI_TX_OCTAL BIT(13) /* transmit with 8 wires */
1d45734a72568cc Alexandru Ardelean 2020-11-24 187 #define SPI_RX_OCTAL BIT(14) /* receive with 8 wires */
1d45734a72568cc Alexandru Ardelean 2020-11-24 188 #define SPI_3WIRE_HIZ BIT(15) /* high impedance turnaround */
8ae12a0d85987dc David Brownell 2006-01-08 189 int irq;
8ae12a0d85987dc David Brownell 2006-01-08 190 void *controller_state;
b885244eb2628e0 David Brownell 2006-01-08 191 void *controller_data;
75368bf6c2876d8 Anton Vorontsov 2009-09-22 192 char modalias[SPI_NAME_SIZE];
5039563e7c25ecc Trent Piepho 2018-09-20 193 const char *driver_override;
f3186dd876697e6 Linus Walleij 2019-01-07 194 int cs_gpio; /* LEGACY: chip select gpio */
f3186dd876697e6 Linus Walleij 2019-01-07 195 struct gpio_desc *cs_gpiod; /* chip select gpio desc */
6c613f68aabf333 Alexandru Ardelean 2019-09-26 196 struct spi_delay word_delay; /* inter-word delay */
8ae12a0d85987dc David Brownell 2006-01-08 197
eca2ebc7e007c9e Martin Sperl 2015-06-22 198 /* the statistics */
eca2ebc7e007c9e Martin Sperl 2015-06-22 199 struct spi_statistics statistics;
eca2ebc7e007c9e Martin Sperl 2015-06-22 200
33e34dc6ee2cb2c David Brownell 2007-05-08 201 /*
33e34dc6ee2cb2c David Brownell 2007-05-08 202 * likely need more hooks for more protocol options affecting how
33e34dc6ee2cb2c David Brownell 2007-05-08 203 * the controller talks to each chip, like:
33e34dc6ee2cb2c David Brownell 2007-05-08 204 * - memory packing (12 bit samples into low bits, others zeroed)
33e34dc6ee2cb2c David Brownell 2007-05-08 205 * - priority
33e34dc6ee2cb2c David Brownell 2007-05-08 206 * - chipselect delays
33e34dc6ee2cb2c David Brownell 2007-05-08 207 * - ...
33e34dc6ee2cb2c David Brownell 2007-05-08 208 */
8ae12a0d85987dc David Brownell 2006-01-08 209 };
8ae12a0d85987dc David Brownell 2006-01-08 210
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 36091 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2020-11-24 13:55 UTC | newest]
Thread overview: 15+ 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:41 ` kernel test robot
2020-11-24 11:41 ` kernel test robot
2020-11-24 11:49 ` Andy Shevchenko
2020-11-24 11:49 ` Andy Shevchenko
2020-11-24 12:03 ` Ardelean, Alexandru
2020-11-24 13:55 ` Andy Shevchenko
2020-11-24 13:55 ` Andy Shevchenko
2020-11-24 12:03 ` Ardelean, Alexandru
2020-11-24 11:47 ` Andy Shevchenko
2020-11-24 12:55 kernel test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.