All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/8] STM32 SPI various fixes
@ 2017-06-23 12:55 ` Amelie Delaunay
  0 siblings, 0 replies; 56+ messages in thread
From: Amelie Delaunay @ 2017-06-23 12:55 UTC (permalink / raw)
  To: Mark Brown, Rob Herring, Mark Rutland, Maxime Coquelin, Alexandre Torgue
  Cc: linux-spi, devicetree, linux-arm-kernel, linux-kernel, Amelie Delaunay

This patchset answers to the reviews done after STM32 SPI driver introduction.

Amelie Delaunay (8):
  dt-bindings: spi: stm32: use SoC specific compatible
  spi: stm32: fix compatible to fit with new bindings
  dt-bindings: spi: stm32: fix example with st,spi-midi-ns property
  spi: stm32: replace st,spi-midi with st,spi-midi-ns to fit bindings
  spi: stm32: use normal conditional statements instead of ternary
    operator
  spi: stm32: add runtime PM support
  spi: stm32: enhance DMA error management
  spi: stm32: fix potential dereference null return value

 .../devicetree/bindings/spi/spi-stm32.txt          |   6 +-
 drivers/spi/spi-stm32.c                            | 127 +++++++++++++++------
 2 files changed, 94 insertions(+), 39 deletions(-)

-- 
1.9.1

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

* [PATCH 0/8] STM32 SPI various fixes
@ 2017-06-23 12:55 ` Amelie Delaunay
  0 siblings, 0 replies; 56+ messages in thread
From: Amelie Delaunay @ 2017-06-23 12:55 UTC (permalink / raw)
  To: Mark Brown, Rob Herring, Mark Rutland, Maxime Coquelin, Alexandre Torgue
  Cc: devicetree, Amelie Delaunay, linux-kernel, linux-arm-kernel, linux-spi

This patchset answers to the reviews done after STM32 SPI driver introduction.

Amelie Delaunay (8):
  dt-bindings: spi: stm32: use SoC specific compatible
  spi: stm32: fix compatible to fit with new bindings
  dt-bindings: spi: stm32: fix example with st,spi-midi-ns property
  spi: stm32: replace st,spi-midi with st,spi-midi-ns to fit bindings
  spi: stm32: use normal conditional statements instead of ternary
    operator
  spi: stm32: add runtime PM support
  spi: stm32: enhance DMA error management
  spi: stm32: fix potential dereference null return value

 .../devicetree/bindings/spi/spi-stm32.txt          |   6 +-
 drivers/spi/spi-stm32.c                            | 127 +++++++++++++++------
 2 files changed, 94 insertions(+), 39 deletions(-)

-- 
1.9.1

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

* [PATCH 0/8] STM32 SPI various fixes
@ 2017-06-23 12:55 ` Amelie Delaunay
  0 siblings, 0 replies; 56+ messages in thread
From: Amelie Delaunay @ 2017-06-23 12:55 UTC (permalink / raw)
  To: linux-arm-kernel

This patchset answers to the reviews done after STM32 SPI driver introduction.

Amelie Delaunay (8):
  dt-bindings: spi: stm32: use SoC specific compatible
  spi: stm32: fix compatible to fit with new bindings
  dt-bindings: spi: stm32: fix example with st,spi-midi-ns property
  spi: stm32: replace st,spi-midi with st,spi-midi-ns to fit bindings
  spi: stm32: use normal conditional statements instead of ternary
    operator
  spi: stm32: add runtime PM support
  spi: stm32: enhance DMA error management
  spi: stm32: fix potential dereference null return value

 .../devicetree/bindings/spi/spi-stm32.txt          |   6 +-
 drivers/spi/spi-stm32.c                            | 127 +++++++++++++++------
 2 files changed, 94 insertions(+), 39 deletions(-)

-- 
1.9.1

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

* [PATCH 1/8] dt-bindings: spi: stm32: use SoC specific compatible
  2017-06-23 12:55 ` Amelie Delaunay
  (?)
@ 2017-06-23 12:55   ` Amelie Delaunay
  -1 siblings, 0 replies; 56+ messages in thread
From: Amelie Delaunay @ 2017-06-23 12:55 UTC (permalink / raw)
  To: Mark Brown, Rob Herring, Mark Rutland, Maxime Coquelin, Alexandre Torgue
  Cc: linux-spi, devicetree, linux-arm-kernel, linux-kernel, Amelie Delaunay

This patch replaces st,stm32-spi compatible with st,stm32h7-spi SoC
specific compatible and updates the example accondingly.

Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
---
 Documentation/devicetree/bindings/spi/spi-stm32.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/spi/spi-stm32.txt b/Documentation/devicetree/bindings/spi/spi-stm32.txt
index 3958bf6..415378b 100644
--- a/Documentation/devicetree/bindings/spi/spi-stm32.txt
+++ b/Documentation/devicetree/bindings/spi/spi-stm32.txt
@@ -7,7 +7,7 @@ from 4 to 32-bit data size. Although it can be configured as master or slave,
 only master is supported by the driver.
 
 Required properties:
-- compatible: Must be "st,stm32-spi".
+- compatible: Must be "st,stm32h7-spi".
 - reg: Offset and length of the device's register set.
 - interrupts: Must contain the interrupt id.
 - clocks: Must contain an entry for spiclk (which feeds the internal clock
@@ -38,7 +38,7 @@ Example:
 	spi2: spi@40003800 {
 		#address-cells = <1>;
 		#size-cells = <0>;
-		compatible = "st,stm32-spi";
+		compatible = "st,stm32h7-spi";
 		reg = <0x40003800 0x400>;
 		interrupts = <36>;
 		clocks = <&rcc SPI2_CK>;
-- 
1.9.1

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

* [PATCH 1/8] dt-bindings: spi: stm32: use SoC specific compatible
@ 2017-06-23 12:55   ` Amelie Delaunay
  0 siblings, 0 replies; 56+ messages in thread
From: Amelie Delaunay @ 2017-06-23 12:55 UTC (permalink / raw)
  To: Mark Brown, Rob Herring, Mark Rutland, Maxime Coquelin, Alexandre Torgue
  Cc: devicetree, Amelie Delaunay, linux-kernel, linux-arm-kernel, linux-spi

This patch replaces st,stm32-spi compatible with st,stm32h7-spi SoC
specific compatible and updates the example accondingly.

Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
---
 Documentation/devicetree/bindings/spi/spi-stm32.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/spi/spi-stm32.txt b/Documentation/devicetree/bindings/spi/spi-stm32.txt
index 3958bf6..415378b 100644
--- a/Documentation/devicetree/bindings/spi/spi-stm32.txt
+++ b/Documentation/devicetree/bindings/spi/spi-stm32.txt
@@ -7,7 +7,7 @@ from 4 to 32-bit data size. Although it can be configured as master or slave,
 only master is supported by the driver.
 
 Required properties:
-- compatible: Must be "st,stm32-spi".
+- compatible: Must be "st,stm32h7-spi".
 - reg: Offset and length of the device's register set.
 - interrupts: Must contain the interrupt id.
 - clocks: Must contain an entry for spiclk (which feeds the internal clock
@@ -38,7 +38,7 @@ Example:
 	spi2: spi@40003800 {
 		#address-cells = <1>;
 		#size-cells = <0>;
-		compatible = "st,stm32-spi";
+		compatible = "st,stm32h7-spi";
 		reg = <0x40003800 0x400>;
 		interrupts = <36>;
 		clocks = <&rcc SPI2_CK>;
-- 
1.9.1

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

* [PATCH 1/8] dt-bindings: spi: stm32: use SoC specific compatible
@ 2017-06-23 12:55   ` Amelie Delaunay
  0 siblings, 0 replies; 56+ messages in thread
From: Amelie Delaunay @ 2017-06-23 12:55 UTC (permalink / raw)
  To: linux-arm-kernel

This patch replaces st,stm32-spi compatible with st,stm32h7-spi SoC
specific compatible and updates the example accondingly.

Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
---
 Documentation/devicetree/bindings/spi/spi-stm32.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/spi/spi-stm32.txt b/Documentation/devicetree/bindings/spi/spi-stm32.txt
index 3958bf6..415378b 100644
--- a/Documentation/devicetree/bindings/spi/spi-stm32.txt
+++ b/Documentation/devicetree/bindings/spi/spi-stm32.txt
@@ -7,7 +7,7 @@ from 4 to 32-bit data size. Although it can be configured as master or slave,
 only master is supported by the driver.
 
 Required properties:
-- compatible: Must be "st,stm32-spi".
+- compatible: Must be "st,stm32h7-spi".
 - reg: Offset and length of the device's register set.
 - interrupts: Must contain the interrupt id.
 - clocks: Must contain an entry for spiclk (which feeds the internal clock
@@ -38,7 +38,7 @@ Example:
 	spi2: spi at 40003800 {
 		#address-cells = <1>;
 		#size-cells = <0>;
-		compatible = "st,stm32-spi";
+		compatible = "st,stm32h7-spi";
 		reg = <0x40003800 0x400>;
 		interrupts = <36>;
 		clocks = <&rcc SPI2_CK>;
-- 
1.9.1

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

* [PATCH 2/8] spi: stm32: fix compatible to fit with new bindings
  2017-06-23 12:55 ` Amelie Delaunay
  (?)
@ 2017-06-23 12:55   ` Amelie Delaunay
  -1 siblings, 0 replies; 56+ messages in thread
From: Amelie Delaunay @ 2017-06-23 12:55 UTC (permalink / raw)
  To: Mark Brown, Rob Herring, Mark Rutland, Maxime Coquelin, Alexandre Torgue
  Cc: linux-spi, devicetree, linux-arm-kernel, linux-kernel, Amelie Delaunay

This patch updates of_device_id compatible string to fit with new
bindings.

Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
---
 drivers/spi/spi-stm32.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c
index 82a6616f..ca38c24 100644
--- a/drivers/spi/spi-stm32.c
+++ b/drivers/spi/spi-stm32.c
@@ -1038,7 +1038,7 @@ static int stm32_spi_config(struct stm32_spi *spi)
 }
 
 static const struct of_device_id stm32_spi_of_match[] = {
-	{ .compatible = "st,stm32-spi", },
+	{ .compatible = "st,stm32h7-spi", },
 	{},
 };
 MODULE_DEVICE_TABLE(of, stm32_spi_of_match);
-- 
1.9.1

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

* [PATCH 2/8] spi: stm32: fix compatible to fit with new bindings
@ 2017-06-23 12:55   ` Amelie Delaunay
  0 siblings, 0 replies; 56+ messages in thread
From: Amelie Delaunay @ 2017-06-23 12:55 UTC (permalink / raw)
  To: Mark Brown, Rob Herring, Mark Rutland, Maxime Coquelin, Alexandre Torgue
  Cc: devicetree, Amelie Delaunay, linux-kernel, linux-arm-kernel, linux-spi

This patch updates of_device_id compatible string to fit with new
bindings.

Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
---
 drivers/spi/spi-stm32.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c
index 82a6616f..ca38c24 100644
--- a/drivers/spi/spi-stm32.c
+++ b/drivers/spi/spi-stm32.c
@@ -1038,7 +1038,7 @@ static int stm32_spi_config(struct stm32_spi *spi)
 }
 
 static const struct of_device_id stm32_spi_of_match[] = {
-	{ .compatible = "st,stm32-spi", },
+	{ .compatible = "st,stm32h7-spi", },
 	{},
 };
 MODULE_DEVICE_TABLE(of, stm32_spi_of_match);
-- 
1.9.1

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

* [PATCH 2/8] spi: stm32: fix compatible to fit with new bindings
@ 2017-06-23 12:55   ` Amelie Delaunay
  0 siblings, 0 replies; 56+ messages in thread
From: Amelie Delaunay @ 2017-06-23 12:55 UTC (permalink / raw)
  To: linux-arm-kernel

This patch updates of_device_id compatible string to fit with new
bindings.

Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
---
 drivers/spi/spi-stm32.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c
index 82a6616f..ca38c24 100644
--- a/drivers/spi/spi-stm32.c
+++ b/drivers/spi/spi-stm32.c
@@ -1038,7 +1038,7 @@ static int stm32_spi_config(struct stm32_spi *spi)
 }
 
 static const struct of_device_id stm32_spi_of_match[] = {
-	{ .compatible = "st,stm32-spi", },
+	{ .compatible = "st,stm32h7-spi", },
 	{},
 };
 MODULE_DEVICE_TABLE(of, stm32_spi_of_match);
-- 
1.9.1

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

* [PATCH 3/8] dt-bindings: spi: stm32: fix example with st,spi-midi-ns property
  2017-06-23 12:55 ` Amelie Delaunay
  (?)
@ 2017-06-23 12:55   ` Amelie Delaunay
  -1 siblings, 0 replies; 56+ messages in thread
From: Amelie Delaunay @ 2017-06-23 12:55 UTC (permalink / raw)
  To: Mark Brown, Rob Herring, Mark Rutland, Maxime Coquelin, Alexandre Torgue
  Cc: linux-spi, devicetree, linux-arm-kernel, linux-kernel, Amelie Delaunay

This patch aligns example with the optional property description.

Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
---
 Documentation/devicetree/bindings/spi/spi-stm32.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/spi/spi-stm32.txt b/Documentation/devicetree/bindings/spi/spi-stm32.txt
index 415378b..25d2ed6 100644
--- a/Documentation/devicetree/bindings/spi/spi-stm32.txt
+++ b/Documentation/devicetree/bindings/spi/spi-stm32.txt
@@ -55,6 +55,6 @@ Example:
 			compatible = "spidev";
 			reg = <0>;
 			spi-max-frequency = <4000000>;
-			st,spi-midi = <4000>;
+			st,spi-midi-ns = <4000>;
 		};
 	};
-- 
1.9.1

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

* [PATCH 3/8] dt-bindings: spi: stm32: fix example with st,spi-midi-ns property
@ 2017-06-23 12:55   ` Amelie Delaunay
  0 siblings, 0 replies; 56+ messages in thread
From: Amelie Delaunay @ 2017-06-23 12:55 UTC (permalink / raw)
  To: Mark Brown, Rob Herring, Mark Rutland, Maxime Coquelin, Alexandre Torgue
  Cc: linux-spi, devicetree, linux-arm-kernel, linux-kernel, Amelie Delaunay

This patch aligns example with the optional property description.

Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
---
 Documentation/devicetree/bindings/spi/spi-stm32.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/spi/spi-stm32.txt b/Documentation/devicetree/bindings/spi/spi-stm32.txt
index 415378b..25d2ed6 100644
--- a/Documentation/devicetree/bindings/spi/spi-stm32.txt
+++ b/Documentation/devicetree/bindings/spi/spi-stm32.txt
@@ -55,6 +55,6 @@ Example:
 			compatible = "spidev";
 			reg = <0>;
 			spi-max-frequency = <4000000>;
-			st,spi-midi = <4000>;
+			st,spi-midi-ns = <4000>;
 		};
 	};
-- 
1.9.1

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

* [PATCH 3/8] dt-bindings: spi: stm32: fix example with st, spi-midi-ns property
@ 2017-06-23 12:55   ` Amelie Delaunay
  0 siblings, 0 replies; 56+ messages in thread
From: Amelie Delaunay @ 2017-06-23 12:55 UTC (permalink / raw)
  To: linux-arm-kernel

This patch aligns example with the optional property description.

Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
---
 Documentation/devicetree/bindings/spi/spi-stm32.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/spi/spi-stm32.txt b/Documentation/devicetree/bindings/spi/spi-stm32.txt
index 415378b..25d2ed6 100644
--- a/Documentation/devicetree/bindings/spi/spi-stm32.txt
+++ b/Documentation/devicetree/bindings/spi/spi-stm32.txt
@@ -55,6 +55,6 @@ Example:
 			compatible = "spidev";
 			reg = <0>;
 			spi-max-frequency = <4000000>;
-			st,spi-midi = <4000>;
+			st,spi-midi-ns = <4000>;
 		};
 	};
-- 
1.9.1

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

* [PATCH 4/8] spi: stm32: replace st,spi-midi with st,spi-midi-ns to fit bindings
  2017-06-23 12:55 ` Amelie Delaunay
  (?)
@ 2017-06-23 12:55   ` Amelie Delaunay
  -1 siblings, 0 replies; 56+ messages in thread
From: Amelie Delaunay @ 2017-06-23 12:55 UTC (permalink / raw)
  To: Mark Brown, Rob Herring, Mark Rutland, Maxime Coquelin, Alexandre Torgue
  Cc: linux-spi, devicetree, linux-arm-kernel, linux-kernel, Amelie Delaunay

This patch fixes the optional dt property used to set master inter-data
idleness.

Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
---
 drivers/spi/spi-stm32.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c
index ca38c24..0997d6d 100644
--- a/drivers/spi/spi-stm32.c
+++ b/drivers/spi/spi-stm32.c
@@ -582,7 +582,7 @@ static int stm32_spi_prepare_msg(struct spi_master *master,
 
 	/* SPI slave device may need time between data frames */
 	spi->cur_midi = 0;
-	if (np && !of_property_read_u32(np, "st,spi-midi", &spi->cur_midi))
+	if (np && !of_property_read_u32(np, "st,spi-midi-ns", &spi->cur_midi))
 		dev_dbg(spi->dev, "%dns inter-data idleness\n", spi->cur_midi);
 
 	if (spi_dev->mode & SPI_CPOL)
-- 
1.9.1

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

* [PATCH 4/8] spi: stm32: replace st, spi-midi with st, spi-midi-ns to fit bindings
@ 2017-06-23 12:55   ` Amelie Delaunay
  0 siblings, 0 replies; 56+ messages in thread
From: Amelie Delaunay @ 2017-06-23 12:55 UTC (permalink / raw)
  To: Mark Brown, Rob Herring, Mark Rutland, Maxime Coquelin, Alexandre Torgue
  Cc: devicetree, Amelie Delaunay, linux-kernel, linux-arm-kernel, linux-spi

This patch fixes the optional dt property used to set master inter-data
idleness.

Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
---
 drivers/spi/spi-stm32.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c
index ca38c24..0997d6d 100644
--- a/drivers/spi/spi-stm32.c
+++ b/drivers/spi/spi-stm32.c
@@ -582,7 +582,7 @@ static int stm32_spi_prepare_msg(struct spi_master *master,
 
 	/* SPI slave device may need time between data frames */
 	spi->cur_midi = 0;
-	if (np && !of_property_read_u32(np, "st,spi-midi", &spi->cur_midi))
+	if (np && !of_property_read_u32(np, "st,spi-midi-ns", &spi->cur_midi))
 		dev_dbg(spi->dev, "%dns inter-data idleness\n", spi->cur_midi);
 
 	if (spi_dev->mode & SPI_CPOL)
-- 
1.9.1

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

* [PATCH 4/8] spi: stm32: replace st, spi-midi with st, spi-midi-ns to fit bindings
@ 2017-06-23 12:55   ` Amelie Delaunay
  0 siblings, 0 replies; 56+ messages in thread
From: Amelie Delaunay @ 2017-06-23 12:55 UTC (permalink / raw)
  To: linux-arm-kernel

This patch fixes the optional dt property used to set master inter-data
idleness.

Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
---
 drivers/spi/spi-stm32.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c
index ca38c24..0997d6d 100644
--- a/drivers/spi/spi-stm32.c
+++ b/drivers/spi/spi-stm32.c
@@ -582,7 +582,7 @@ static int stm32_spi_prepare_msg(struct spi_master *master,
 
 	/* SPI slave device may need time between data frames */
 	spi->cur_midi = 0;
-	if (np && !of_property_read_u32(np, "st,spi-midi", &spi->cur_midi))
+	if (np && !of_property_read_u32(np, "st,spi-midi-ns", &spi->cur_midi))
 		dev_dbg(spi->dev, "%dns inter-data idleness\n", spi->cur_midi);
 
 	if (spi_dev->mode & SPI_CPOL)
-- 
1.9.1

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

* [PATCH 5/8] spi: stm32: use normal conditional statements instead of ternary operator
  2017-06-23 12:55 ` Amelie Delaunay
  (?)
@ 2017-06-23 12:55   ` Amelie Delaunay
  -1 siblings, 0 replies; 56+ messages in thread
From: Amelie Delaunay @ 2017-06-23 12:55 UTC (permalink / raw)
  To: Mark Brown, Rob Herring, Mark Rutland, Maxime Coquelin, Alexandre Torgue
  Cc: linux-spi, devicetree, linux-arm-kernel, linux-kernel, Amelie Delaunay

This patch replace ternary operator use by normal condition statements
to ease code reading.
It also removes redundant !!.

Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
---
 drivers/spi/spi-stm32.c | 44 ++++++++++++++++++++++++++++++--------------
 1 file changed, 30 insertions(+), 14 deletions(-)

diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c
index 0997d6d..72efc63 100644
--- a/drivers/spi/spi-stm32.c
+++ b/drivers/spi/spi-stm32.c
@@ -267,7 +267,10 @@ static int stm32_spi_prepare_mbr(struct stm32_spi *spi, u32 speed_hz)
 		return -EINVAL;
 
 	/* Determine the first power of 2 greater than or equal to div */
-	mbrdiv = (div & (div - 1)) ? fls(div) : fls(div) - 1;
+	if (div & (div - 1))
+		mbrdiv = fls(div);
+	else
+		mbrdiv = fls(div) - 1;
 
 	spi->cur_speed = spi->clk_rate / (1 << mbrdiv);
 
@@ -285,9 +288,12 @@ static u32 stm32_spi_prepare_fthlv(struct stm32_spi *spi)
 	/* data packet should not exceed 1/2 of fifo space */
 	half_fifo = (spi->fifo_size / 2);
 
-	fthlv = (spi->cur_bpw <= 8) ? half_fifo :
-		(spi->cur_bpw <= 16) ? (half_fifo / 2) :
-		(half_fifo / 4);
+	if (spi->cur_bpw <= 8)
+		fthlv = half_fifo;
+	else if (spi->cur_bpw <= 16)
+		fthlv = half_fifo / 2;
+	else
+		fthlv = half_fifo / 4;
 
 	/* align packet size with data registers access */
 	if (spi->cur_bpw > 8)
@@ -462,9 +468,9 @@ static bool stm32_spi_can_dma(struct spi_master *master,
 	struct stm32_spi *spi = spi_master_get_devdata(master);
 
 	dev_dbg(spi->dev, "%s: %s\n", __func__,
-		(!!(transfer->len > spi->fifo_size)) ? "true" : "false");
+		(transfer->len > spi->fifo_size) ? "true" : "false");
 
-	return !!(transfer->len > spi->fifo_size);
+	return (transfer->len > spi->fifo_size);
 }
 
 /**
@@ -493,7 +499,8 @@ static irqreturn_t stm32_spi_irq(int irq, void *dev_id)
 	 * Full-Duplex, need to poll RXP event to know if there are remaining
 	 * data, before disabling SPI.
 	 */
-	mask |= ((spi->rx_buf && !spi->cur_usedma) ? SPI_SR_RXP : 0);
+	if (spi->rx_buf && !spi->cur_usedma)
+		mask |= SPI_SR_RXP;
 
 	if (!(sr & mask)) {
 		dev_dbg(spi->dev, "spurious IT (sr=0x%08x, ier=0x%08x)\n",
@@ -656,12 +663,18 @@ static void stm32_spi_dma_config(struct stm32_spi *spi,
 	enum dma_slave_buswidth buswidth;
 	u32 maxburst;
 
-	buswidth = (spi->cur_bpw <= 8) ? DMA_SLAVE_BUSWIDTH_1_BYTE :
-		   (spi->cur_bpw <= 16) ? DMA_SLAVE_BUSWIDTH_2_BYTES :
-		   DMA_SLAVE_BUSWIDTH_4_BYTES;
+	if (spi->cur_bpw <= 8)
+		buswidth = DMA_SLAVE_BUSWIDTH_1_BYTE;
+	else if (spi->cur_bpw <= 16)
+		buswidth = DMA_SLAVE_BUSWIDTH_2_BYTES;
+	else
+		buswidth = DMA_SLAVE_BUSWIDTH_4_BYTES;
 
 	/* Valid for DMA Half or Full Fifo threshold */
-	maxburst = (spi->cur_fthlv == 2) ? 1 : spi->cur_fthlv;
+	if (spi->cur_fthlv == 2)
+		maxburst = 1;
+	else
+		maxburst = spi->cur_fthlv;
 
 	memset(dma_conf, 0, sizeof(struct dma_slave_config));
 	dma_conf->direction = dir;
@@ -920,9 +933,12 @@ static int stm32_spi_transfer_one_setup(struct stm32_spi *spi,
 				~cfg2_clrb) | cfg2_setb,
 			       spi->base + STM32_SPI_CFG2);
 
-	nb_words = DIV_ROUND_UP(transfer->len * 8,
-				(spi->cur_bpw <= 8) ? 8 :
-				(spi->cur_bpw <= 16) ? 16 : 32);
+	if (spi->cur_bpw <= 8)
+		nb_words = transfer->len;
+	else if (spi->cur_bpw <= 16)
+		nb_words = DIV_ROUND_UP(transfer->len * 8, 16);
+	else
+		nb_words = DIV_ROUND_UP(transfer->len * 8, 32);
 	nb_words <<= SPI_CR2_TSIZE_SHIFT;
 
 	if (nb_words <= SPI_CR2_TSIZE) {
-- 
1.9.1

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

* [PATCH 5/8] spi: stm32: use normal conditional statements instead of ternary operator
@ 2017-06-23 12:55   ` Amelie Delaunay
  0 siblings, 0 replies; 56+ messages in thread
From: Amelie Delaunay @ 2017-06-23 12:55 UTC (permalink / raw)
  To: Mark Brown, Rob Herring, Mark Rutland, Maxime Coquelin, Alexandre Torgue
  Cc: linux-spi, devicetree, linux-arm-kernel, linux-kernel, Amelie Delaunay

This patch replace ternary operator use by normal condition statements
to ease code reading.
It also removes redundant !!.

Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
---
 drivers/spi/spi-stm32.c | 44 ++++++++++++++++++++++++++++++--------------
 1 file changed, 30 insertions(+), 14 deletions(-)

diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c
index 0997d6d..72efc63 100644
--- a/drivers/spi/spi-stm32.c
+++ b/drivers/spi/spi-stm32.c
@@ -267,7 +267,10 @@ static int stm32_spi_prepare_mbr(struct stm32_spi *spi, u32 speed_hz)
 		return -EINVAL;
 
 	/* Determine the first power of 2 greater than or equal to div */
-	mbrdiv = (div & (div - 1)) ? fls(div) : fls(div) - 1;
+	if (div & (div - 1))
+		mbrdiv = fls(div);
+	else
+		mbrdiv = fls(div) - 1;
 
 	spi->cur_speed = spi->clk_rate / (1 << mbrdiv);
 
@@ -285,9 +288,12 @@ static u32 stm32_spi_prepare_fthlv(struct stm32_spi *spi)
 	/* data packet should not exceed 1/2 of fifo space */
 	half_fifo = (spi->fifo_size / 2);
 
-	fthlv = (spi->cur_bpw <= 8) ? half_fifo :
-		(spi->cur_bpw <= 16) ? (half_fifo / 2) :
-		(half_fifo / 4);
+	if (spi->cur_bpw <= 8)
+		fthlv = half_fifo;
+	else if (spi->cur_bpw <= 16)
+		fthlv = half_fifo / 2;
+	else
+		fthlv = half_fifo / 4;
 
 	/* align packet size with data registers access */
 	if (spi->cur_bpw > 8)
@@ -462,9 +468,9 @@ static bool stm32_spi_can_dma(struct spi_master *master,
 	struct stm32_spi *spi = spi_master_get_devdata(master);
 
 	dev_dbg(spi->dev, "%s: %s\n", __func__,
-		(!!(transfer->len > spi->fifo_size)) ? "true" : "false");
+		(transfer->len > spi->fifo_size) ? "true" : "false");
 
-	return !!(transfer->len > spi->fifo_size);
+	return (transfer->len > spi->fifo_size);
 }
 
 /**
@@ -493,7 +499,8 @@ static irqreturn_t stm32_spi_irq(int irq, void *dev_id)
 	 * Full-Duplex, need to poll RXP event to know if there are remaining
 	 * data, before disabling SPI.
 	 */
-	mask |= ((spi->rx_buf && !spi->cur_usedma) ? SPI_SR_RXP : 0);
+	if (spi->rx_buf && !spi->cur_usedma)
+		mask |= SPI_SR_RXP;
 
 	if (!(sr & mask)) {
 		dev_dbg(spi->dev, "spurious IT (sr=0x%08x, ier=0x%08x)\n",
@@ -656,12 +663,18 @@ static void stm32_spi_dma_config(struct stm32_spi *spi,
 	enum dma_slave_buswidth buswidth;
 	u32 maxburst;
 
-	buswidth = (spi->cur_bpw <= 8) ? DMA_SLAVE_BUSWIDTH_1_BYTE :
-		   (spi->cur_bpw <= 16) ? DMA_SLAVE_BUSWIDTH_2_BYTES :
-		   DMA_SLAVE_BUSWIDTH_4_BYTES;
+	if (spi->cur_bpw <= 8)
+		buswidth = DMA_SLAVE_BUSWIDTH_1_BYTE;
+	else if (spi->cur_bpw <= 16)
+		buswidth = DMA_SLAVE_BUSWIDTH_2_BYTES;
+	else
+		buswidth = DMA_SLAVE_BUSWIDTH_4_BYTES;
 
 	/* Valid for DMA Half or Full Fifo threshold */
-	maxburst = (spi->cur_fthlv == 2) ? 1 : spi->cur_fthlv;
+	if (spi->cur_fthlv == 2)
+		maxburst = 1;
+	else
+		maxburst = spi->cur_fthlv;
 
 	memset(dma_conf, 0, sizeof(struct dma_slave_config));
 	dma_conf->direction = dir;
@@ -920,9 +933,12 @@ static int stm32_spi_transfer_one_setup(struct stm32_spi *spi,
 				~cfg2_clrb) | cfg2_setb,
 			       spi->base + STM32_SPI_CFG2);
 
-	nb_words = DIV_ROUND_UP(transfer->len * 8,
-				(spi->cur_bpw <= 8) ? 8 :
-				(spi->cur_bpw <= 16) ? 16 : 32);
+	if (spi->cur_bpw <= 8)
+		nb_words = transfer->len;
+	else if (spi->cur_bpw <= 16)
+		nb_words = DIV_ROUND_UP(transfer->len * 8, 16);
+	else
+		nb_words = DIV_ROUND_UP(transfer->len * 8, 32);
 	nb_words <<= SPI_CR2_TSIZE_SHIFT;
 
 	if (nb_words <= SPI_CR2_TSIZE) {
-- 
1.9.1

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

* [PATCH 5/8] spi: stm32: use normal conditional statements instead of ternary operator
@ 2017-06-23 12:55   ` Amelie Delaunay
  0 siblings, 0 replies; 56+ messages in thread
From: Amelie Delaunay @ 2017-06-23 12:55 UTC (permalink / raw)
  To: linux-arm-kernel

This patch replace ternary operator use by normal condition statements
to ease code reading.
It also removes redundant !!.

Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
---
 drivers/spi/spi-stm32.c | 44 ++++++++++++++++++++++++++++++--------------
 1 file changed, 30 insertions(+), 14 deletions(-)

diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c
index 0997d6d..72efc63 100644
--- a/drivers/spi/spi-stm32.c
+++ b/drivers/spi/spi-stm32.c
@@ -267,7 +267,10 @@ static int stm32_spi_prepare_mbr(struct stm32_spi *spi, u32 speed_hz)
 		return -EINVAL;
 
 	/* Determine the first power of 2 greater than or equal to div */
-	mbrdiv = (div & (div - 1)) ? fls(div) : fls(div) - 1;
+	if (div & (div - 1))
+		mbrdiv = fls(div);
+	else
+		mbrdiv = fls(div) - 1;
 
 	spi->cur_speed = spi->clk_rate / (1 << mbrdiv);
 
@@ -285,9 +288,12 @@ static u32 stm32_spi_prepare_fthlv(struct stm32_spi *spi)
 	/* data packet should not exceed 1/2 of fifo space */
 	half_fifo = (spi->fifo_size / 2);
 
-	fthlv = (spi->cur_bpw <= 8) ? half_fifo :
-		(spi->cur_bpw <= 16) ? (half_fifo / 2) :
-		(half_fifo / 4);
+	if (spi->cur_bpw <= 8)
+		fthlv = half_fifo;
+	else if (spi->cur_bpw <= 16)
+		fthlv = half_fifo / 2;
+	else
+		fthlv = half_fifo / 4;
 
 	/* align packet size with data registers access */
 	if (spi->cur_bpw > 8)
@@ -462,9 +468,9 @@ static bool stm32_spi_can_dma(struct spi_master *master,
 	struct stm32_spi *spi = spi_master_get_devdata(master);
 
 	dev_dbg(spi->dev, "%s: %s\n", __func__,
-		(!!(transfer->len > spi->fifo_size)) ? "true" : "false");
+		(transfer->len > spi->fifo_size) ? "true" : "false");
 
-	return !!(transfer->len > spi->fifo_size);
+	return (transfer->len > spi->fifo_size);
 }
 
 /**
@@ -493,7 +499,8 @@ static irqreturn_t stm32_spi_irq(int irq, void *dev_id)
 	 * Full-Duplex, need to poll RXP event to know if there are remaining
 	 * data, before disabling SPI.
 	 */
-	mask |= ((spi->rx_buf && !spi->cur_usedma) ? SPI_SR_RXP : 0);
+	if (spi->rx_buf && !spi->cur_usedma)
+		mask |= SPI_SR_RXP;
 
 	if (!(sr & mask)) {
 		dev_dbg(spi->dev, "spurious IT (sr=0x%08x, ier=0x%08x)\n",
@@ -656,12 +663,18 @@ static void stm32_spi_dma_config(struct stm32_spi *spi,
 	enum dma_slave_buswidth buswidth;
 	u32 maxburst;
 
-	buswidth = (spi->cur_bpw <= 8) ? DMA_SLAVE_BUSWIDTH_1_BYTE :
-		   (spi->cur_bpw <= 16) ? DMA_SLAVE_BUSWIDTH_2_BYTES :
-		   DMA_SLAVE_BUSWIDTH_4_BYTES;
+	if (spi->cur_bpw <= 8)
+		buswidth = DMA_SLAVE_BUSWIDTH_1_BYTE;
+	else if (spi->cur_bpw <= 16)
+		buswidth = DMA_SLAVE_BUSWIDTH_2_BYTES;
+	else
+		buswidth = DMA_SLAVE_BUSWIDTH_4_BYTES;
 
 	/* Valid for DMA Half or Full Fifo threshold */
-	maxburst = (spi->cur_fthlv == 2) ? 1 : spi->cur_fthlv;
+	if (spi->cur_fthlv == 2)
+		maxburst = 1;
+	else
+		maxburst = spi->cur_fthlv;
 
 	memset(dma_conf, 0, sizeof(struct dma_slave_config));
 	dma_conf->direction = dir;
@@ -920,9 +933,12 @@ static int stm32_spi_transfer_one_setup(struct stm32_spi *spi,
 				~cfg2_clrb) | cfg2_setb,
 			       spi->base + STM32_SPI_CFG2);
 
-	nb_words = DIV_ROUND_UP(transfer->len * 8,
-				(spi->cur_bpw <= 8) ? 8 :
-				(spi->cur_bpw <= 16) ? 16 : 32);
+	if (spi->cur_bpw <= 8)
+		nb_words = transfer->len;
+	else if (spi->cur_bpw <= 16)
+		nb_words = DIV_ROUND_UP(transfer->len * 8, 16);
+	else
+		nb_words = DIV_ROUND_UP(transfer->len * 8, 32);
 	nb_words <<= SPI_CR2_TSIZE_SHIFT;
 
 	if (nb_words <= SPI_CR2_TSIZE) {
-- 
1.9.1

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

* [PATCH 6/8] spi: stm32: add runtime PM support
  2017-06-23 12:55 ` Amelie Delaunay
  (?)
@ 2017-06-23 12:55   ` Amelie Delaunay
  -1 siblings, 0 replies; 56+ messages in thread
From: Amelie Delaunay @ 2017-06-23 12:55 UTC (permalink / raw)
  To: Mark Brown, Rob Herring, Mark Rutland, Maxime Coquelin, Alexandre Torgue
  Cc: linux-spi, devicetree, linux-arm-kernel, linux-kernel, Amelie Delaunay

This patch reworks suspend and resume callbacks and add runtime_suspend
and runtime_resume callbacks.

Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
---
 drivers/spi/spi-stm32.c | 43 ++++++++++++++++++++++++++++++++++++-------
 1 file changed, 36 insertions(+), 7 deletions(-)

diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c
index 72efc63..209afda 100644
--- a/drivers/spi/spi-stm32.c
+++ b/drivers/spi/spi-stm32.c
@@ -27,6 +27,7 @@
 #include <linux/iopoll.h>
 #include <linux/module.h>
 #include <linux/of_platform.h>
+#include <linux/pm_runtime.h>
 #include <linux/reset.h>
 #include <linux/spi/spi.h>
 
@@ -1164,6 +1165,9 @@ static int stm32_spi_probe(struct platform_device *pdev)
 	if (spi->dma_tx || spi->dma_rx)
 		master->can_dma = stm32_spi_can_dma;
 
+	pm_runtime_set_active(&pdev->dev);
+	pm_runtime_enable(&pdev->dev);
+
 	ret = devm_spi_register_master(&pdev->dev, master);
 	if (ret) {
 		dev_err(&pdev->dev, "spi master registration failed: %d\n",
@@ -1203,6 +1207,8 @@ static int stm32_spi_probe(struct platform_device *pdev)
 		dma_release_channel(spi->dma_tx);
 	if (spi->dma_rx)
 		dma_release_channel(spi->dma_rx);
+
+	pm_runtime_disable(&pdev->dev);
 err_clk_disable:
 	clk_disable_unprepare(spi->clk);
 err_master_put:
@@ -1225,23 +1231,42 @@ static int stm32_spi_remove(struct platform_device *pdev)
 
 	clk_disable_unprepare(spi->clk);
 
+	pm_runtime_disable(&pdev->dev);
+
 	return 0;
 }
 
+#ifdef CONFIG_PM
+static int stm32_spi_runtime_suspend(struct device *dev)
+{
+	struct spi_master *master = dev_get_drvdata(dev);
+	struct stm32_spi *spi = spi_master_get_devdata(master);
+
+	clk_disable_unprepare(spi->clk);
+
+	return 0;
+}
+
+static int stm32_spi_runtime_resume(struct device *dev)
+{
+	struct spi_master *master = dev_get_drvdata(dev);
+	struct stm32_spi *spi = spi_master_get_devdata(master);
+
+	return clk_prepare_enable(spi->clk);
+}
+#endif
+
 #ifdef CONFIG_PM_SLEEP
 static int stm32_spi_suspend(struct device *dev)
 {
 	struct spi_master *master = dev_get_drvdata(dev);
-	struct stm32_spi *spi = spi_master_get_devdata(master);
 	int ret;
 
 	ret = spi_master_suspend(master);
 	if (ret)
 		return ret;
 
-	clk_disable_unprepare(spi->clk);
-
-	return ret;
+	return pm_runtime_force_suspend(dev);
 }
 
 static int stm32_spi_resume(struct device *dev)
@@ -1250,9 +1275,10 @@ static int stm32_spi_resume(struct device *dev)
 	struct stm32_spi *spi = spi_master_get_devdata(master);
 	int ret;
 
-	ret = clk_prepare_enable(spi->clk);
+	ret = pm_runtime_force_resume(dev);
 	if (ret)
 		return ret;
+
 	ret = spi_master_resume(master);
 	if (ret)
 		clk_disable_unprepare(spi->clk);
@@ -1261,8 +1287,11 @@ static int stm32_spi_resume(struct device *dev)
 }
 #endif
 
-static SIMPLE_DEV_PM_OPS(stm32_spi_pm_ops,
-			 stm32_spi_suspend, stm32_spi_resume);
+static const struct dev_pm_ops stm32_spi_pm_ops = {
+	SET_SYSTEM_SLEEP_PM_OPS(stm32_spi_suspend, stm32_spi_resume)
+	SET_RUNTIME_PM_OPS(stm32_spi_runtime_suspend,
+			   stm32_spi_runtime_resume, NULL)
+};
 
 static struct platform_driver stm32_spi_driver = {
 	.probe = stm32_spi_probe,
-- 
1.9.1

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

* [PATCH 6/8] spi: stm32: add runtime PM support
@ 2017-06-23 12:55   ` Amelie Delaunay
  0 siblings, 0 replies; 56+ messages in thread
From: Amelie Delaunay @ 2017-06-23 12:55 UTC (permalink / raw)
  To: Mark Brown, Rob Herring, Mark Rutland, Maxime Coquelin, Alexandre Torgue
  Cc: linux-spi, devicetree, linux-arm-kernel, linux-kernel, Amelie Delaunay

This patch reworks suspend and resume callbacks and add runtime_suspend
and runtime_resume callbacks.

Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
---
 drivers/spi/spi-stm32.c | 43 ++++++++++++++++++++++++++++++++++++-------
 1 file changed, 36 insertions(+), 7 deletions(-)

diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c
index 72efc63..209afda 100644
--- a/drivers/spi/spi-stm32.c
+++ b/drivers/spi/spi-stm32.c
@@ -27,6 +27,7 @@
 #include <linux/iopoll.h>
 #include <linux/module.h>
 #include <linux/of_platform.h>
+#include <linux/pm_runtime.h>
 #include <linux/reset.h>
 #include <linux/spi/spi.h>
 
@@ -1164,6 +1165,9 @@ static int stm32_spi_probe(struct platform_device *pdev)
 	if (spi->dma_tx || spi->dma_rx)
 		master->can_dma = stm32_spi_can_dma;
 
+	pm_runtime_set_active(&pdev->dev);
+	pm_runtime_enable(&pdev->dev);
+
 	ret = devm_spi_register_master(&pdev->dev, master);
 	if (ret) {
 		dev_err(&pdev->dev, "spi master registration failed: %d\n",
@@ -1203,6 +1207,8 @@ static int stm32_spi_probe(struct platform_device *pdev)
 		dma_release_channel(spi->dma_tx);
 	if (spi->dma_rx)
 		dma_release_channel(spi->dma_rx);
+
+	pm_runtime_disable(&pdev->dev);
 err_clk_disable:
 	clk_disable_unprepare(spi->clk);
 err_master_put:
@@ -1225,23 +1231,42 @@ static int stm32_spi_remove(struct platform_device *pdev)
 
 	clk_disable_unprepare(spi->clk);
 
+	pm_runtime_disable(&pdev->dev);
+
 	return 0;
 }
 
+#ifdef CONFIG_PM
+static int stm32_spi_runtime_suspend(struct device *dev)
+{
+	struct spi_master *master = dev_get_drvdata(dev);
+	struct stm32_spi *spi = spi_master_get_devdata(master);
+
+	clk_disable_unprepare(spi->clk);
+
+	return 0;
+}
+
+static int stm32_spi_runtime_resume(struct device *dev)
+{
+	struct spi_master *master = dev_get_drvdata(dev);
+	struct stm32_spi *spi = spi_master_get_devdata(master);
+
+	return clk_prepare_enable(spi->clk);
+}
+#endif
+
 #ifdef CONFIG_PM_SLEEP
 static int stm32_spi_suspend(struct device *dev)
 {
 	struct spi_master *master = dev_get_drvdata(dev);
-	struct stm32_spi *spi = spi_master_get_devdata(master);
 	int ret;
 
 	ret = spi_master_suspend(master);
 	if (ret)
 		return ret;
 
-	clk_disable_unprepare(spi->clk);
-
-	return ret;
+	return pm_runtime_force_suspend(dev);
 }
 
 static int stm32_spi_resume(struct device *dev)
@@ -1250,9 +1275,10 @@ static int stm32_spi_resume(struct device *dev)
 	struct stm32_spi *spi = spi_master_get_devdata(master);
 	int ret;
 
-	ret = clk_prepare_enable(spi->clk);
+	ret = pm_runtime_force_resume(dev);
 	if (ret)
 		return ret;
+
 	ret = spi_master_resume(master);
 	if (ret)
 		clk_disable_unprepare(spi->clk);
@@ -1261,8 +1287,11 @@ static int stm32_spi_resume(struct device *dev)
 }
 #endif
 
-static SIMPLE_DEV_PM_OPS(stm32_spi_pm_ops,
-			 stm32_spi_suspend, stm32_spi_resume);
+static const struct dev_pm_ops stm32_spi_pm_ops = {
+	SET_SYSTEM_SLEEP_PM_OPS(stm32_spi_suspend, stm32_spi_resume)
+	SET_RUNTIME_PM_OPS(stm32_spi_runtime_suspend,
+			   stm32_spi_runtime_resume, NULL)
+};
 
 static struct platform_driver stm32_spi_driver = {
 	.probe = stm32_spi_probe,
-- 
1.9.1

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

* [PATCH 6/8] spi: stm32: add runtime PM support
@ 2017-06-23 12:55   ` Amelie Delaunay
  0 siblings, 0 replies; 56+ messages in thread
From: Amelie Delaunay @ 2017-06-23 12:55 UTC (permalink / raw)
  To: linux-arm-kernel

This patch reworks suspend and resume callbacks and add runtime_suspend
and runtime_resume callbacks.

Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
---
 drivers/spi/spi-stm32.c | 43 ++++++++++++++++++++++++++++++++++++-------
 1 file changed, 36 insertions(+), 7 deletions(-)

diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c
index 72efc63..209afda 100644
--- a/drivers/spi/spi-stm32.c
+++ b/drivers/spi/spi-stm32.c
@@ -27,6 +27,7 @@
 #include <linux/iopoll.h>
 #include <linux/module.h>
 #include <linux/of_platform.h>
+#include <linux/pm_runtime.h>
 #include <linux/reset.h>
 #include <linux/spi/spi.h>
 
@@ -1164,6 +1165,9 @@ static int stm32_spi_probe(struct platform_device *pdev)
 	if (spi->dma_tx || spi->dma_rx)
 		master->can_dma = stm32_spi_can_dma;
 
+	pm_runtime_set_active(&pdev->dev);
+	pm_runtime_enable(&pdev->dev);
+
 	ret = devm_spi_register_master(&pdev->dev, master);
 	if (ret) {
 		dev_err(&pdev->dev, "spi master registration failed: %d\n",
@@ -1203,6 +1207,8 @@ static int stm32_spi_probe(struct platform_device *pdev)
 		dma_release_channel(spi->dma_tx);
 	if (spi->dma_rx)
 		dma_release_channel(spi->dma_rx);
+
+	pm_runtime_disable(&pdev->dev);
 err_clk_disable:
 	clk_disable_unprepare(spi->clk);
 err_master_put:
@@ -1225,23 +1231,42 @@ static int stm32_spi_remove(struct platform_device *pdev)
 
 	clk_disable_unprepare(spi->clk);
 
+	pm_runtime_disable(&pdev->dev);
+
 	return 0;
 }
 
+#ifdef CONFIG_PM
+static int stm32_spi_runtime_suspend(struct device *dev)
+{
+	struct spi_master *master = dev_get_drvdata(dev);
+	struct stm32_spi *spi = spi_master_get_devdata(master);
+
+	clk_disable_unprepare(spi->clk);
+
+	return 0;
+}
+
+static int stm32_spi_runtime_resume(struct device *dev)
+{
+	struct spi_master *master = dev_get_drvdata(dev);
+	struct stm32_spi *spi = spi_master_get_devdata(master);
+
+	return clk_prepare_enable(spi->clk);
+}
+#endif
+
 #ifdef CONFIG_PM_SLEEP
 static int stm32_spi_suspend(struct device *dev)
 {
 	struct spi_master *master = dev_get_drvdata(dev);
-	struct stm32_spi *spi = spi_master_get_devdata(master);
 	int ret;
 
 	ret = spi_master_suspend(master);
 	if (ret)
 		return ret;
 
-	clk_disable_unprepare(spi->clk);
-
-	return ret;
+	return pm_runtime_force_suspend(dev);
 }
 
 static int stm32_spi_resume(struct device *dev)
@@ -1250,9 +1275,10 @@ static int stm32_spi_resume(struct device *dev)
 	struct stm32_spi *spi = spi_master_get_devdata(master);
 	int ret;
 
-	ret = clk_prepare_enable(spi->clk);
+	ret = pm_runtime_force_resume(dev);
 	if (ret)
 		return ret;
+
 	ret = spi_master_resume(master);
 	if (ret)
 		clk_disable_unprepare(spi->clk);
@@ -1261,8 +1287,11 @@ static int stm32_spi_resume(struct device *dev)
 }
 #endif
 
-static SIMPLE_DEV_PM_OPS(stm32_spi_pm_ops,
-			 stm32_spi_suspend, stm32_spi_resume);
+static const struct dev_pm_ops stm32_spi_pm_ops = {
+	SET_SYSTEM_SLEEP_PM_OPS(stm32_spi_suspend, stm32_spi_resume)
+	SET_RUNTIME_PM_OPS(stm32_spi_runtime_suspend,
+			   stm32_spi_runtime_resume, NULL)
+};
 
 static struct platform_driver stm32_spi_driver = {
 	.probe = stm32_spi_probe,
-- 
1.9.1

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

* [PATCH 7/8] spi: stm32: enhance DMA error management
@ 2017-06-23 12:55   ` Amelie Delaunay
  0 siblings, 0 replies; 56+ messages in thread
From: Amelie Delaunay @ 2017-06-23 12:55 UTC (permalink / raw)
  To: Mark Brown, Rob Herring, Mark Rutland, Maxime Coquelin, Alexandre Torgue
  Cc: linux-spi, devicetree, linux-arm-kernel, linux-kernel, Amelie Delaunay

This patch reworks DMA error management. In case the DMA callback is
called while EOT (End Of Transfer) flag is not set, that means that DMA
encountered an error. This error will result in an auto-suspend of SPI
flow, which could also result in an overrun. So, in DMA mode, SUSP and
OVR flags are a condition to stop the current transfer.

Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
---
 drivers/spi/spi-stm32.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c
index 209afda..63af9d9 100644
--- a/drivers/spi/spi-stm32.c
+++ b/drivers/spi/spi-stm32.c
@@ -514,6 +514,12 @@ static irqreturn_t stm32_spi_irq(int irq, void *dev_id)
 		dev_warn(spi->dev, "Communication suspended\n");
 		if (!spi->cur_usedma && (spi->rx_buf && (spi->rx_len > 0)))
 			stm32_spi_read_rxfifo(spi, false);
+		/*
+		 * If communication is suspended while using DMA, it means
+		 * that something went wrong, so stop the current transfer
+		 */
+		if (spi->cur_usedma)
+			end = true;
 	}
 
 	if (sr & SPI_SR_MODF) {
@@ -525,6 +531,12 @@ static irqreturn_t stm32_spi_irq(int irq, void *dev_id)
 		dev_warn(spi->dev, "Overrun: received value discarded\n");
 		if (!spi->cur_usedma && (spi->rx_buf && (spi->rx_len > 0)))
 			stm32_spi_read_rxfifo(spi, false);
+		/*
+		 * If overrun is detected while using DMA, it means that
+		 * something went wrong, so stop the current transfer
+		 */
+		if (spi->cur_usedma)
+			end = true;
 	}
 
 	if (sr & SPI_SR_EOT) {
@@ -645,12 +657,10 @@ static void stm32_spi_dma_cb(void *data)
 
 	spin_unlock_irqrestore(&spi->lock, flags);
 
-	if (!(sr & SPI_SR_EOT)) {
-		dev_warn(spi->dev, "DMA callback (sr=0x%08x)\n", sr);
+	if (!(sr & SPI_SR_EOT))
+		dev_warn(spi->dev, "DMA error (sr=0x%08x)\n", sr);
 
-		spi_finalize_current_transfer(spi->master);
-		stm32_spi_disable(spi);
-	}
+	/* Now wait for EOT, or SUSP or OVR in case of error */
 }
 
 /**
-- 
1.9.1

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

* [PATCH 7/8] spi: stm32: enhance DMA error management
@ 2017-06-23 12:55   ` Amelie Delaunay
  0 siblings, 0 replies; 56+ messages in thread
From: Amelie Delaunay @ 2017-06-23 12:55 UTC (permalink / raw)
  To: Mark Brown, Rob Herring, Mark Rutland, Maxime Coquelin, Alexandre Torgue
  Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Amelie Delaunay

This patch reworks DMA error management. In case the DMA callback is
called while EOT (End Of Transfer) flag is not set, that means that DMA
encountered an error. This error will result in an auto-suspend of SPI
flow, which could also result in an overrun. So, in DMA mode, SUSP and
OVR flags are a condition to stop the current transfer.

Signed-off-by: Amelie Delaunay <amelie.delaunay-qxv4g6HH51o@public.gmane.org>
---
 drivers/spi/spi-stm32.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c
index 209afda..63af9d9 100644
--- a/drivers/spi/spi-stm32.c
+++ b/drivers/spi/spi-stm32.c
@@ -514,6 +514,12 @@ static irqreturn_t stm32_spi_irq(int irq, void *dev_id)
 		dev_warn(spi->dev, "Communication suspended\n");
 		if (!spi->cur_usedma && (spi->rx_buf && (spi->rx_len > 0)))
 			stm32_spi_read_rxfifo(spi, false);
+		/*
+		 * If communication is suspended while using DMA, it means
+		 * that something went wrong, so stop the current transfer
+		 */
+		if (spi->cur_usedma)
+			end = true;
 	}
 
 	if (sr & SPI_SR_MODF) {
@@ -525,6 +531,12 @@ static irqreturn_t stm32_spi_irq(int irq, void *dev_id)
 		dev_warn(spi->dev, "Overrun: received value discarded\n");
 		if (!spi->cur_usedma && (spi->rx_buf && (spi->rx_len > 0)))
 			stm32_spi_read_rxfifo(spi, false);
+		/*
+		 * If overrun is detected while using DMA, it means that
+		 * something went wrong, so stop the current transfer
+		 */
+		if (spi->cur_usedma)
+			end = true;
 	}
 
 	if (sr & SPI_SR_EOT) {
@@ -645,12 +657,10 @@ static void stm32_spi_dma_cb(void *data)
 
 	spin_unlock_irqrestore(&spi->lock, flags);
 
-	if (!(sr & SPI_SR_EOT)) {
-		dev_warn(spi->dev, "DMA callback (sr=0x%08x)\n", sr);
+	if (!(sr & SPI_SR_EOT))
+		dev_warn(spi->dev, "DMA error (sr=0x%08x)\n", sr);
 
-		spi_finalize_current_transfer(spi->master);
-		stm32_spi_disable(spi);
-	}
+	/* Now wait for EOT, or SUSP or OVR in case of error */
 }
 
 /**
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 7/8] spi: stm32: enhance DMA error management
@ 2017-06-23 12:55   ` Amelie Delaunay
  0 siblings, 0 replies; 56+ messages in thread
From: Amelie Delaunay @ 2017-06-23 12:55 UTC (permalink / raw)
  To: Mark Brown, Rob Herring, Mark Rutland, Maxime Coquelin, Alexandre Torgue
  Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Amelie Delaunay

This patch reworks DMA error management. In case the DMA callback is
called while EOT (End Of Transfer) flag is not set, that means that DMA
encountered an error. This error will result in an auto-suspend of SPI
flow, which could also result in an overrun. So, in DMA mode, SUSP and
OVR flags are a condition to stop the current transfer.

Signed-off-by: Amelie Delaunay <amelie.delaunay-qxv4g6HH51o@public.gmane.org>
---
 drivers/spi/spi-stm32.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c
index 209afda..63af9d9 100644
--- a/drivers/spi/spi-stm32.c
+++ b/drivers/spi/spi-stm32.c
@@ -514,6 +514,12 @@ static irqreturn_t stm32_spi_irq(int irq, void *dev_id)
 		dev_warn(spi->dev, "Communication suspended\n");
 		if (!spi->cur_usedma && (spi->rx_buf && (spi->rx_len > 0)))
 			stm32_spi_read_rxfifo(spi, false);
+		/*
+		 * If communication is suspended while using DMA, it means
+		 * that something went wrong, so stop the current transfer
+		 */
+		if (spi->cur_usedma)
+			end = true;
 	}
 
 	if (sr & SPI_SR_MODF) {
@@ -525,6 +531,12 @@ static irqreturn_t stm32_spi_irq(int irq, void *dev_id)
 		dev_warn(spi->dev, "Overrun: received value discarded\n");
 		if (!spi->cur_usedma && (spi->rx_buf && (spi->rx_len > 0)))
 			stm32_spi_read_rxfifo(spi, false);
+		/*
+		 * If overrun is detected while using DMA, it means that
+		 * something went wrong, so stop the current transfer
+		 */
+		if (spi->cur_usedma)
+			end = true;
 	}
 
 	if (sr & SPI_SR_EOT) {
@@ -645,12 +657,10 @@ static void stm32_spi_dma_cb(void *data)
 
 	spin_unlock_irqrestore(&spi->lock, flags);
 
-	if (!(sr & SPI_SR_EOT)) {
-		dev_warn(spi->dev, "DMA callback (sr=0x%08x)\n", sr);
+	if (!(sr & SPI_SR_EOT))
+		dev_warn(spi->dev, "DMA error (sr=0x%08x)\n", sr);
 
-		spi_finalize_current_transfer(spi->master);
-		stm32_spi_disable(spi);
-	}
+	/* Now wait for EOT, or SUSP or OVR in case of error */
 }
 
 /**
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 7/8] spi: stm32: enhance DMA error management
@ 2017-06-23 12:55   ` Amelie Delaunay
  0 siblings, 0 replies; 56+ messages in thread
From: Amelie Delaunay @ 2017-06-23 12:55 UTC (permalink / raw)
  To: linux-arm-kernel

This patch reworks DMA error management. In case the DMA callback is
called while EOT (End Of Transfer) flag is not set, that means that DMA
encountered an error. This error will result in an auto-suspend of SPI
flow, which could also result in an overrun. So, in DMA mode, SUSP and
OVR flags are a condition to stop the current transfer.

Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
---
 drivers/spi/spi-stm32.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c
index 209afda..63af9d9 100644
--- a/drivers/spi/spi-stm32.c
+++ b/drivers/spi/spi-stm32.c
@@ -514,6 +514,12 @@ static irqreturn_t stm32_spi_irq(int irq, void *dev_id)
 		dev_warn(spi->dev, "Communication suspended\n");
 		if (!spi->cur_usedma && (spi->rx_buf && (spi->rx_len > 0)))
 			stm32_spi_read_rxfifo(spi, false);
+		/*
+		 * If communication is suspended while using DMA, it means
+		 * that something went wrong, so stop the current transfer
+		 */
+		if (spi->cur_usedma)
+			end = true;
 	}
 
 	if (sr & SPI_SR_MODF) {
@@ -525,6 +531,12 @@ static irqreturn_t stm32_spi_irq(int irq, void *dev_id)
 		dev_warn(spi->dev, "Overrun: received value discarded\n");
 		if (!spi->cur_usedma && (spi->rx_buf && (spi->rx_len > 0)))
 			stm32_spi_read_rxfifo(spi, false);
+		/*
+		 * If overrun is detected while using DMA, it means that
+		 * something went wrong, so stop the current transfer
+		 */
+		if (spi->cur_usedma)
+			end = true;
 	}
 
 	if (sr & SPI_SR_EOT) {
@@ -645,12 +657,10 @@ static void stm32_spi_dma_cb(void *data)
 
 	spin_unlock_irqrestore(&spi->lock, flags);
 
-	if (!(sr & SPI_SR_EOT)) {
-		dev_warn(spi->dev, "DMA callback (sr=0x%08x)\n", sr);
+	if (!(sr & SPI_SR_EOT))
+		dev_warn(spi->dev, "DMA error (sr=0x%08x)\n", sr);
 
-		spi_finalize_current_transfer(spi->master);
-		stm32_spi_disable(spi);
-	}
+	/* Now wait for EOT, or SUSP or OVR in case of error */
 }
 
 /**
-- 
1.9.1

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

* [PATCH 8/8] spi: stm32: fix potential dereference null return value
  2017-06-23 12:55 ` Amelie Delaunay
  (?)
@ 2017-06-23 12:55   ` Amelie Delaunay
  -1 siblings, 0 replies; 56+ messages in thread
From: Amelie Delaunay @ 2017-06-23 12:55 UTC (permalink / raw)
  To: Mark Brown, Rob Herring, Mark Rutland, Maxime Coquelin, Alexandre Torgue
  Cc: linux-spi, devicetree, linux-arm-kernel, linux-kernel, Amelie Delaunay

This patch fixes the usage of rx_dma_desc and tx_dma_desc pointers
returned by dmaengine_prep_slave_sg, which can be null.

Detected by CoverityScan, CID#1446587 ("Dereference null return value")

Reported-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
---
 drivers/spi/spi-stm32.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c
index 63af9d9..076a720 100644
--- a/drivers/spi/spi-stm32.c
+++ b/drivers/spi/spi-stm32.c
@@ -775,9 +775,6 @@ static int stm32_spi_transfer_one_dma(struct stm32_spi *spi,
 					xfer->rx_sg.nents,
 					rx_dma_conf.direction,
 					DMA_PREP_INTERRUPT);
-
-		rx_dma_desc->callback = stm32_spi_dma_cb;
-		rx_dma_desc->callback_param = spi;
 	}
 
 	tx_dma_desc = NULL;
@@ -790,11 +787,6 @@ static int stm32_spi_transfer_one_dma(struct stm32_spi *spi,
 					xfer->tx_sg.nents,
 					tx_dma_conf.direction,
 					DMA_PREP_INTERRUPT);
-
-		if (spi->cur_comm == SPI_SIMPLEX_TX) {
-			tx_dma_desc->callback = stm32_spi_dma_cb;
-			tx_dma_desc->callback_param = spi;
-		}
 	}
 
 	if ((spi->tx_buf && !tx_dma_desc) ||
@@ -802,6 +794,9 @@ static int stm32_spi_transfer_one_dma(struct stm32_spi *spi,
 		goto dma_desc_error;
 
 	if (rx_dma_desc) {
+		rx_dma_desc->callback = stm32_spi_dma_cb;
+		rx_dma_desc->callback_param = spi;
+
 		if (dma_submit_error(dmaengine_submit(rx_dma_desc))) {
 			dev_err(spi->dev, "Rx DMA submit failed\n");
 			goto dma_desc_error;
@@ -811,6 +806,11 @@ static int stm32_spi_transfer_one_dma(struct stm32_spi *spi,
 	}
 
 	if (tx_dma_desc) {
+		if (spi->cur_comm == SPI_SIMPLEX_TX) {
+			tx_dma_desc->callback = stm32_spi_dma_cb;
+			tx_dma_desc->callback_param = spi;
+		}
+
 		if (dma_submit_error(dmaengine_submit(tx_dma_desc))) {
 			dev_err(spi->dev, "Tx DMA submit failed\n");
 			goto dma_submit_error;
-- 
1.9.1

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

* [PATCH 8/8] spi: stm32: fix potential dereference null return value
@ 2017-06-23 12:55   ` Amelie Delaunay
  0 siblings, 0 replies; 56+ messages in thread
From: Amelie Delaunay @ 2017-06-23 12:55 UTC (permalink / raw)
  To: Mark Brown, Rob Herring, Mark Rutland, Maxime Coquelin, Alexandre Torgue
  Cc: linux-spi, devicetree, linux-arm-kernel, linux-kernel, Amelie Delaunay

This patch fixes the usage of rx_dma_desc and tx_dma_desc pointers
returned by dmaengine_prep_slave_sg, which can be null.

Detected by CoverityScan, CID#1446587 ("Dereference null return value")

Reported-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
---
 drivers/spi/spi-stm32.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c
index 63af9d9..076a720 100644
--- a/drivers/spi/spi-stm32.c
+++ b/drivers/spi/spi-stm32.c
@@ -775,9 +775,6 @@ static int stm32_spi_transfer_one_dma(struct stm32_spi *spi,
 					xfer->rx_sg.nents,
 					rx_dma_conf.direction,
 					DMA_PREP_INTERRUPT);
-
-		rx_dma_desc->callback = stm32_spi_dma_cb;
-		rx_dma_desc->callback_param = spi;
 	}
 
 	tx_dma_desc = NULL;
@@ -790,11 +787,6 @@ static int stm32_spi_transfer_one_dma(struct stm32_spi *spi,
 					xfer->tx_sg.nents,
 					tx_dma_conf.direction,
 					DMA_PREP_INTERRUPT);
-
-		if (spi->cur_comm == SPI_SIMPLEX_TX) {
-			tx_dma_desc->callback = stm32_spi_dma_cb;
-			tx_dma_desc->callback_param = spi;
-		}
 	}
 
 	if ((spi->tx_buf && !tx_dma_desc) ||
@@ -802,6 +794,9 @@ static int stm32_spi_transfer_one_dma(struct stm32_spi *spi,
 		goto dma_desc_error;
 
 	if (rx_dma_desc) {
+		rx_dma_desc->callback = stm32_spi_dma_cb;
+		rx_dma_desc->callback_param = spi;
+
 		if (dma_submit_error(dmaengine_submit(rx_dma_desc))) {
 			dev_err(spi->dev, "Rx DMA submit failed\n");
 			goto dma_desc_error;
@@ -811,6 +806,11 @@ static int stm32_spi_transfer_one_dma(struct stm32_spi *spi,
 	}
 
 	if (tx_dma_desc) {
+		if (spi->cur_comm == SPI_SIMPLEX_TX) {
+			tx_dma_desc->callback = stm32_spi_dma_cb;
+			tx_dma_desc->callback_param = spi;
+		}
+
 		if (dma_submit_error(dmaengine_submit(tx_dma_desc))) {
 			dev_err(spi->dev, "Tx DMA submit failed\n");
 			goto dma_submit_error;
-- 
1.9.1

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

* [PATCH 8/8] spi: stm32: fix potential dereference null return value
@ 2017-06-23 12:55   ` Amelie Delaunay
  0 siblings, 0 replies; 56+ messages in thread
From: Amelie Delaunay @ 2017-06-23 12:55 UTC (permalink / raw)
  To: linux-arm-kernel

This patch fixes the usage of rx_dma_desc and tx_dma_desc pointers
returned by dmaengine_prep_slave_sg, which can be null.

Detected by CoverityScan, CID#1446587 ("Dereference null return value")

Reported-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
---
 drivers/spi/spi-stm32.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c
index 63af9d9..076a720 100644
--- a/drivers/spi/spi-stm32.c
+++ b/drivers/spi/spi-stm32.c
@@ -775,9 +775,6 @@ static int stm32_spi_transfer_one_dma(struct stm32_spi *spi,
 					xfer->rx_sg.nents,
 					rx_dma_conf.direction,
 					DMA_PREP_INTERRUPT);
-
-		rx_dma_desc->callback = stm32_spi_dma_cb;
-		rx_dma_desc->callback_param = spi;
 	}
 
 	tx_dma_desc = NULL;
@@ -790,11 +787,6 @@ static int stm32_spi_transfer_one_dma(struct stm32_spi *spi,
 					xfer->tx_sg.nents,
 					tx_dma_conf.direction,
 					DMA_PREP_INTERRUPT);
-
-		if (spi->cur_comm == SPI_SIMPLEX_TX) {
-			tx_dma_desc->callback = stm32_spi_dma_cb;
-			tx_dma_desc->callback_param = spi;
-		}
 	}
 
 	if ((spi->tx_buf && !tx_dma_desc) ||
@@ -802,6 +794,9 @@ static int stm32_spi_transfer_one_dma(struct stm32_spi *spi,
 		goto dma_desc_error;
 
 	if (rx_dma_desc) {
+		rx_dma_desc->callback = stm32_spi_dma_cb;
+		rx_dma_desc->callback_param = spi;
+
 		if (dma_submit_error(dmaengine_submit(rx_dma_desc))) {
 			dev_err(spi->dev, "Rx DMA submit failed\n");
 			goto dma_desc_error;
@@ -811,6 +806,11 @@ static int stm32_spi_transfer_one_dma(struct stm32_spi *spi,
 	}
 
 	if (tx_dma_desc) {
+		if (spi->cur_comm == SPI_SIMPLEX_TX) {
+			tx_dma_desc->callback = stm32_spi_dma_cb;
+			tx_dma_desc->callback_param = spi;
+		}
+
 		if (dma_submit_error(dmaengine_submit(tx_dma_desc))) {
 			dev_err(spi->dev, "Tx DMA submit failed\n");
 			goto dma_submit_error;
-- 
1.9.1

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

* Re: [PATCH 1/8] dt-bindings: spi: stm32: use SoC specific compatible
@ 2017-06-26 19:08     ` Rob Herring
  0 siblings, 0 replies; 56+ messages in thread
From: Rob Herring @ 2017-06-26 19:08 UTC (permalink / raw)
  To: Amelie Delaunay
  Cc: Mark Brown, Mark Rutland, Maxime Coquelin, Alexandre Torgue,
	linux-spi, devicetree, linux-arm-kernel, linux-kernel

On Fri, Jun 23, 2017 at 02:55:43PM +0200, Amelie Delaunay wrote:
> This patch replaces st,stm32-spi compatible with st,stm32h7-spi SoC
> specific compatible and updates the example accondingly.
> 
> Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
> ---
>  Documentation/devicetree/bindings/spi/spi-stm32.txt | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Acked-by: Rob Herring <robh@kernel.org>

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

* Re: [PATCH 1/8] dt-bindings: spi: stm32: use SoC specific compatible
@ 2017-06-26 19:08     ` Rob Herring
  0 siblings, 0 replies; 56+ messages in thread
From: Rob Herring @ 2017-06-26 19:08 UTC (permalink / raw)
  To: Amelie Delaunay
  Cc: Mark Brown, Mark Rutland, Maxime Coquelin, Alexandre Torgue,
	linux-spi-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

On Fri, Jun 23, 2017 at 02:55:43PM +0200, Amelie Delaunay wrote:
> This patch replaces st,stm32-spi compatible with st,stm32h7-spi SoC
> specific compatible and updates the example accondingly.
> 
> Signed-off-by: Amelie Delaunay <amelie.delaunay-qxv4g6HH51o@public.gmane.org>
> ---
>  Documentation/devicetree/bindings/spi/spi-stm32.txt | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 1/8] dt-bindings: spi: stm32: use SoC specific compatible
@ 2017-06-26 19:08     ` Rob Herring
  0 siblings, 0 replies; 56+ messages in thread
From: Rob Herring @ 2017-06-26 19:08 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Jun 23, 2017 at 02:55:43PM +0200, Amelie Delaunay wrote:
> This patch replaces st,stm32-spi compatible with st,stm32h7-spi SoC
> specific compatible and updates the example accondingly.
> 
> Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
> ---
>  Documentation/devicetree/bindings/spi/spi-stm32.txt | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Acked-by: Rob Herring <robh@kernel.org>

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

* Re: [PATCH 3/8] dt-bindings: spi: stm32: fix example with st,spi-midi-ns property
@ 2017-06-26 19:12     ` Rob Herring
  0 siblings, 0 replies; 56+ messages in thread
From: Rob Herring @ 2017-06-26 19:12 UTC (permalink / raw)
  To: Amelie Delaunay
  Cc: Mark Brown, Mark Rutland, Maxime Coquelin, Alexandre Torgue,
	linux-spi, devicetree, linux-arm-kernel, linux-kernel

On Fri, Jun 23, 2017 at 02:55:45PM +0200, Amelie Delaunay wrote:
> This patch aligns example with the optional property description.
> 
> Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
> ---
>  Documentation/devicetree/bindings/spi/spi-stm32.txt | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/spi/spi-stm32.txt b/Documentation/devicetree/bindings/spi/spi-stm32.txt
> index 415378b..25d2ed6 100644
> --- a/Documentation/devicetree/bindings/spi/spi-stm32.txt
> +++ b/Documentation/devicetree/bindings/spi/spi-stm32.txt
> @@ -55,6 +55,6 @@ Example:
>  			compatible = "spidev";

As I mentioned in the original patch, please use a real compatible.

>  			reg = <0>;
>  			spi-max-frequency = <4000000>;
> -			st,spi-midi = <4000>;
> +			st,spi-midi-ns = <4000>;
>  		};
>  	};
> -- 
> 1.9.1
> 

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

* Re: [PATCH 3/8] dt-bindings: spi: stm32: fix example with st,spi-midi-ns property
@ 2017-06-26 19:12     ` Rob Herring
  0 siblings, 0 replies; 56+ messages in thread
From: Rob Herring @ 2017-06-26 19:12 UTC (permalink / raw)
  To: Amelie Delaunay
  Cc: Mark Brown, Mark Rutland, Maxime Coquelin, Alexandre Torgue,
	linux-spi-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

On Fri, Jun 23, 2017 at 02:55:45PM +0200, Amelie Delaunay wrote:
> This patch aligns example with the optional property description.
> 
> Signed-off-by: Amelie Delaunay <amelie.delaunay-qxv4g6HH51o@public.gmane.org>
> ---
>  Documentation/devicetree/bindings/spi/spi-stm32.txt | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/spi/spi-stm32.txt b/Documentation/devicetree/bindings/spi/spi-stm32.txt
> index 415378b..25d2ed6 100644
> --- a/Documentation/devicetree/bindings/spi/spi-stm32.txt
> +++ b/Documentation/devicetree/bindings/spi/spi-stm32.txt
> @@ -55,6 +55,6 @@ Example:
>  			compatible = "spidev";

As I mentioned in the original patch, please use a real compatible.

>  			reg = <0>;
>  			spi-max-frequency = <4000000>;
> -			st,spi-midi = <4000>;
> +			st,spi-midi-ns = <4000>;
>  		};
>  	};
> -- 
> 1.9.1
> 
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 3/8] dt-bindings: spi: stm32: fix example with st,spi-midi-ns property
@ 2017-06-26 19:12     ` Rob Herring
  0 siblings, 0 replies; 56+ messages in thread
From: Rob Herring @ 2017-06-26 19:12 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Jun 23, 2017 at 02:55:45PM +0200, Amelie Delaunay wrote:
> This patch aligns example with the optional property description.
> 
> Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
> ---
>  Documentation/devicetree/bindings/spi/spi-stm32.txt | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/spi/spi-stm32.txt b/Documentation/devicetree/bindings/spi/spi-stm32.txt
> index 415378b..25d2ed6 100644
> --- a/Documentation/devicetree/bindings/spi/spi-stm32.txt
> +++ b/Documentation/devicetree/bindings/spi/spi-stm32.txt
> @@ -55,6 +55,6 @@ Example:
>  			compatible = "spidev";

As I mentioned in the original patch, please use a real compatible.

>  			reg = <0>;
>  			spi-max-frequency = <4000000>;
> -			st,spi-midi = <4000>;
> +			st,spi-midi-ns = <4000>;
>  		};
>  	};
> -- 
> 1.9.1
> 

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

* Applied "spi: stm32: fix potential dereference null return value" to the spi tree
  2017-06-23 12:55   ` Amelie Delaunay
  (?)
@ 2017-06-28 19:25     ` Mark Brown
  -1 siblings, 0 replies; 56+ messages in thread
From: Mark Brown @ 2017-06-28 19:25 UTC (permalink / raw)
  To: Amelie Delaunay
  Cc: Colin Ian King, Mark Brown, Mark Brown, Rob Herring,
	Mark Rutland, Maxime Coquelin, Alexandre Torgue, linux-spi,
	devicetree, linux-arm-kernel, linux-kernel, linux-spi

The patch

   spi: stm32: fix potential dereference null return value

has been applied to the spi tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git 

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

>From 7b821a6485c943edc752a94260a29116237f9153 Mon Sep 17 00:00:00 2001
From: Amelie Delaunay <amelie.delaunay@st.com>
Date: Tue, 27 Jun 2017 17:45:20 +0200
Subject: [PATCH] spi: stm32: fix potential dereference null return value

This patch fixes the usage of rx_dma_desc and tx_dma_desc pointers
returned by dmaengine_prep_slave_sg, which can be null.

Detected by CoverityScan, CID#1446587 ("Dereference null return value")

Reported-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/spi/spi-stm32.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c
index 8a6bff379b21..75644bcd938b 100644
--- a/drivers/spi/spi-stm32.c
+++ b/drivers/spi/spi-stm32.c
@@ -775,9 +775,6 @@ static int stm32_spi_transfer_one_dma(struct stm32_spi *spi,
 					xfer->rx_sg.nents,
 					rx_dma_conf.direction,
 					DMA_PREP_INTERRUPT);
-
-		rx_dma_desc->callback = stm32_spi_dma_cb;
-		rx_dma_desc->callback_param = spi;
 	}
 
 	tx_dma_desc = NULL;
@@ -790,11 +787,6 @@ static int stm32_spi_transfer_one_dma(struct stm32_spi *spi,
 					xfer->tx_sg.nents,
 					tx_dma_conf.direction,
 					DMA_PREP_INTERRUPT);
-
-		if (spi->cur_comm == SPI_SIMPLEX_TX) {
-			tx_dma_desc->callback = stm32_spi_dma_cb;
-			tx_dma_desc->callback_param = spi;
-		}
 	}
 
 	if ((spi->tx_buf && !tx_dma_desc) ||
@@ -802,6 +794,9 @@ static int stm32_spi_transfer_one_dma(struct stm32_spi *spi,
 		goto dma_desc_error;
 
 	if (rx_dma_desc) {
+		rx_dma_desc->callback = stm32_spi_dma_cb;
+		rx_dma_desc->callback_param = spi;
+
 		if (dma_submit_error(dmaengine_submit(rx_dma_desc))) {
 			dev_err(spi->dev, "Rx DMA submit failed\n");
 			goto dma_desc_error;
@@ -811,6 +806,11 @@ static int stm32_spi_transfer_one_dma(struct stm32_spi *spi,
 	}
 
 	if (tx_dma_desc) {
+		if (spi->cur_comm == SPI_SIMPLEX_TX) {
+			tx_dma_desc->callback = stm32_spi_dma_cb;
+			tx_dma_desc->callback_param = spi;
+		}
+
 		if (dma_submit_error(dmaengine_submit(tx_dma_desc))) {
 			dev_err(spi->dev, "Tx DMA submit failed\n");
 			goto dma_submit_error;
-- 
2.13.2

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

* Applied "spi: stm32: fix potential dereference null return value" to the spi tree
@ 2017-06-28 19:25     ` Mark Brown
  0 siblings, 0 replies; 56+ messages in thread
From: Mark Brown @ 2017-06-28 19:25 UTC (permalink / raw)
  To: Amelie Delaunay; +Cc: Colin Ian King, Mark Brown

The patch

   spi: stm32: fix potential dereference null return value

has been applied to the spi tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git 

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

>From 7b821a6485c943edc752a94260a29116237f9153 Mon Sep 17 00:00:00 2001
From: Amelie Delaunay <amelie.delaunay@st.com>
Date: Tue, 27 Jun 2017 17:45:20 +0200
Subject: [PATCH] spi: stm32: fix potential dereference null return value

This patch fixes the usage of rx_dma_desc and tx_dma_desc pointers
returned by dmaengine_prep_slave_sg, which can be null.

Detected by CoverityScan, CID#1446587 ("Dereference null return value")

Reported-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/spi/spi-stm32.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c
index 8a6bff379b21..75644bcd938b 100644
--- a/drivers/spi/spi-stm32.c
+++ b/drivers/spi/spi-stm32.c
@@ -775,9 +775,6 @@ static int stm32_spi_transfer_one_dma(struct stm32_spi *spi,
 					xfer->rx_sg.nents,
 					rx_dma_conf.direction,
 					DMA_PREP_INTERRUPT);
-
-		rx_dma_desc->callback = stm32_spi_dma_cb;
-		rx_dma_desc->callback_param = spi;
 	}
 
 	tx_dma_desc = NULL;
@@ -790,11 +787,6 @@ static int stm32_spi_transfer_one_dma(struct stm32_spi *spi,
 					xfer->tx_sg.nents,
 					tx_dma_conf.direction,
 					DMA_PREP_INTERRUPT);
-
-		if (spi->cur_comm == SPI_SIMPLEX_TX) {
-			tx_dma_desc->callback = stm32_spi_dma_cb;
-			tx_dma_desc->callback_param = spi;
-		}
 	}
 
 	if ((spi->tx_buf && !tx_dma_desc) ||
@@ -802,6 +794,9 @@ static int stm32_spi_transfer_one_dma(struct stm32_spi *spi,
 		goto dma_desc_error;
 
 	if (rx_dma_desc) {
+		rx_dma_desc->callback = stm32_spi_dma_cb;
+		rx_dma_desc->callback_param = spi;
+
 		if (dma_submit_error(dmaengine_submit(rx_dma_desc))) {
 			dev_err(spi->dev, "Rx DMA submit failed\n");
 			goto dma_desc_error;
@@ -811,6 +806,11 @@ static int stm32_spi_transfer_one_dma(struct stm32_spi *spi,
 	}
 
 	if (tx_dma_desc) {
+		if (spi->cur_comm == SPI_SIMPLEX_TX) {
+			tx_dma_desc->callback = stm32_spi_dma_cb;
+			tx_dma_desc->callback_param = spi;
+		}
+
 		if (dma_submit_error(dmaengine_submit(tx_dma_desc))) {
 			dev_err(spi->dev, "Tx DMA submit failed\n");
 			goto dma_submit_error;
-- 
2.13.2

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

* Applied "spi: stm32: fix potential dereference null return value" to the spi tree
@ 2017-06-28 19:25     ` Mark Brown
  0 siblings, 0 replies; 56+ messages in thread
From: Mark Brown @ 2017-06-28 19:25 UTC (permalink / raw)
  To: linux-arm-kernel

The patch

   spi: stm32: fix potential dereference null return value

has been applied to the spi tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git 

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

>From 7b821a6485c943edc752a94260a29116237f9153 Mon Sep 17 00:00:00 2001
From: Amelie Delaunay <amelie.delaunay@st.com>
Date: Tue, 27 Jun 2017 17:45:20 +0200
Subject: [PATCH] spi: stm32: fix potential dereference null return value

This patch fixes the usage of rx_dma_desc and tx_dma_desc pointers
returned by dmaengine_prep_slave_sg, which can be null.

Detected by CoverityScan, CID#1446587 ("Dereference null return value")

Reported-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/spi/spi-stm32.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c
index 8a6bff379b21..75644bcd938b 100644
--- a/drivers/spi/spi-stm32.c
+++ b/drivers/spi/spi-stm32.c
@@ -775,9 +775,6 @@ static int stm32_spi_transfer_one_dma(struct stm32_spi *spi,
 					xfer->rx_sg.nents,
 					rx_dma_conf.direction,
 					DMA_PREP_INTERRUPT);
-
-		rx_dma_desc->callback = stm32_spi_dma_cb;
-		rx_dma_desc->callback_param = spi;
 	}
 
 	tx_dma_desc = NULL;
@@ -790,11 +787,6 @@ static int stm32_spi_transfer_one_dma(struct stm32_spi *spi,
 					xfer->tx_sg.nents,
 					tx_dma_conf.direction,
 					DMA_PREP_INTERRUPT);
-
-		if (spi->cur_comm == SPI_SIMPLEX_TX) {
-			tx_dma_desc->callback = stm32_spi_dma_cb;
-			tx_dma_desc->callback_param = spi;
-		}
 	}
 
 	if ((spi->tx_buf && !tx_dma_desc) ||
@@ -802,6 +794,9 @@ static int stm32_spi_transfer_one_dma(struct stm32_spi *spi,
 		goto dma_desc_error;
 
 	if (rx_dma_desc) {
+		rx_dma_desc->callback = stm32_spi_dma_cb;
+		rx_dma_desc->callback_param = spi;
+
 		if (dma_submit_error(dmaengine_submit(rx_dma_desc))) {
 			dev_err(spi->dev, "Rx DMA submit failed\n");
 			goto dma_desc_error;
@@ -811,6 +806,11 @@ static int stm32_spi_transfer_one_dma(struct stm32_spi *spi,
 	}
 
 	if (tx_dma_desc) {
+		if (spi->cur_comm == SPI_SIMPLEX_TX) {
+			tx_dma_desc->callback = stm32_spi_dma_cb;
+			tx_dma_desc->callback_param = spi;
+		}
+
 		if (dma_submit_error(dmaengine_submit(tx_dma_desc))) {
 			dev_err(spi->dev, "Tx DMA submit failed\n");
 			goto dma_submit_error;
-- 
2.13.2

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

* Applied "spi: stm32: add runtime PM support" to the spi tree
  2017-06-23 12:55   ` Amelie Delaunay
  (?)
@ 2017-06-28 19:25     ` Mark Brown
  -1 siblings, 0 replies; 56+ messages in thread
From: Mark Brown @ 2017-06-28 19:25 UTC (permalink / raw)
  To: Amelie Delaunay
  Cc: Mark Brown, Mark Brown, Rob Herring, Mark Rutland,
	Maxime Coquelin, Alexandre Torgue, linux-spi, devicetree,
	linux-arm-kernel, linux-kernel, linux-spi

The patch

   spi: stm32: add runtime PM support

has been applied to the spi tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git 

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

>From 038ac869c9d27fceb6197e775d780ad6aeb45b1f Mon Sep 17 00:00:00 2001
From: Amelie Delaunay <amelie.delaunay@st.com>
Date: Tue, 27 Jun 2017 17:45:18 +0200
Subject: [PATCH] spi: stm32: add runtime PM support

This patch reworks suspend and resume callbacks and add runtime_suspend
and runtime_resume callbacks.

Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/spi/spi-stm32.c | 43 ++++++++++++++++++++++++++++++++++++-------
 1 file changed, 36 insertions(+), 7 deletions(-)

diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c
index 123529a1b40d..392c9453c2e6 100644
--- a/drivers/spi/spi-stm32.c
+++ b/drivers/spi/spi-stm32.c
@@ -27,6 +27,7 @@
 #include <linux/iopoll.h>
 #include <linux/module.h>
 #include <linux/of_platform.h>
+#include <linux/pm_runtime.h>
 #include <linux/reset.h>
 #include <linux/spi/spi.h>
 
@@ -1164,6 +1165,9 @@ static int stm32_spi_probe(struct platform_device *pdev)
 	if (spi->dma_tx || spi->dma_rx)
 		master->can_dma = stm32_spi_can_dma;
 
+	pm_runtime_set_active(&pdev->dev);
+	pm_runtime_enable(&pdev->dev);
+
 	ret = devm_spi_register_master(&pdev->dev, master);
 	if (ret) {
 		dev_err(&pdev->dev, "spi master registration failed: %d\n",
@@ -1203,6 +1207,8 @@ static int stm32_spi_probe(struct platform_device *pdev)
 		dma_release_channel(spi->dma_tx);
 	if (spi->dma_rx)
 		dma_release_channel(spi->dma_rx);
+
+	pm_runtime_disable(&pdev->dev);
 err_clk_disable:
 	clk_disable_unprepare(spi->clk);
 err_master_put:
@@ -1225,23 +1231,42 @@ static int stm32_spi_remove(struct platform_device *pdev)
 
 	clk_disable_unprepare(spi->clk);
 
+	pm_runtime_disable(&pdev->dev);
+
 	return 0;
 }
 
+#ifdef CONFIG_PM
+static int stm32_spi_runtime_suspend(struct device *dev)
+{
+	struct spi_master *master = dev_get_drvdata(dev);
+	struct stm32_spi *spi = spi_master_get_devdata(master);
+
+	clk_disable_unprepare(spi->clk);
+
+	return 0;
+}
+
+static int stm32_spi_runtime_resume(struct device *dev)
+{
+	struct spi_master *master = dev_get_drvdata(dev);
+	struct stm32_spi *spi = spi_master_get_devdata(master);
+
+	return clk_prepare_enable(spi->clk);
+}
+#endif
+
 #ifdef CONFIG_PM_SLEEP
 static int stm32_spi_suspend(struct device *dev)
 {
 	struct spi_master *master = dev_get_drvdata(dev);
-	struct stm32_spi *spi = spi_master_get_devdata(master);
 	int ret;
 
 	ret = spi_master_suspend(master);
 	if (ret)
 		return ret;
 
-	clk_disable_unprepare(spi->clk);
-
-	return ret;
+	return pm_runtime_force_suspend(dev);
 }
 
 static int stm32_spi_resume(struct device *dev)
@@ -1250,9 +1275,10 @@ static int stm32_spi_resume(struct device *dev)
 	struct stm32_spi *spi = spi_master_get_devdata(master);
 	int ret;
 
-	ret = clk_prepare_enable(spi->clk);
+	ret = pm_runtime_force_resume(dev);
 	if (ret)
 		return ret;
+
 	ret = spi_master_resume(master);
 	if (ret)
 		clk_disable_unprepare(spi->clk);
@@ -1261,8 +1287,11 @@ static int stm32_spi_resume(struct device *dev)
 }
 #endif
 
-static SIMPLE_DEV_PM_OPS(stm32_spi_pm_ops,
-			 stm32_spi_suspend, stm32_spi_resume);
+static const struct dev_pm_ops stm32_spi_pm_ops = {
+	SET_SYSTEM_SLEEP_PM_OPS(stm32_spi_suspend, stm32_spi_resume)
+	SET_RUNTIME_PM_OPS(stm32_spi_runtime_suspend,
+			   stm32_spi_runtime_resume, NULL)
+};
 
 static struct platform_driver stm32_spi_driver = {
 	.probe = stm32_spi_probe,
-- 
2.13.2

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

* Applied "spi: stm32: add runtime PM support" to the spi tree
@ 2017-06-28 19:25     ` Mark Brown
  0 siblings, 0 replies; 56+ messages in thread
From: Mark Brown @ 2017-06-28 19:25 UTC (permalink / raw)
  To: Amelie Delaunay
  Cc: Mark Rutland, devicetree, Alexandre Torgue, linux-kernel,
	Rob Herring, linux-spi, Mark Brown, Maxime Coquelin,
	linux-arm-kernel

The patch

   spi: stm32: add runtime PM support

has been applied to the spi tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git 

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

>From 038ac869c9d27fceb6197e775d780ad6aeb45b1f Mon Sep 17 00:00:00 2001
From: Amelie Delaunay <amelie.delaunay@st.com>
Date: Tue, 27 Jun 2017 17:45:18 +0200
Subject: [PATCH] spi: stm32: add runtime PM support

This patch reworks suspend and resume callbacks and add runtime_suspend
and runtime_resume callbacks.

Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/spi/spi-stm32.c | 43 ++++++++++++++++++++++++++++++++++++-------
 1 file changed, 36 insertions(+), 7 deletions(-)

diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c
index 123529a1b40d..392c9453c2e6 100644
--- a/drivers/spi/spi-stm32.c
+++ b/drivers/spi/spi-stm32.c
@@ -27,6 +27,7 @@
 #include <linux/iopoll.h>
 #include <linux/module.h>
 #include <linux/of_platform.h>
+#include <linux/pm_runtime.h>
 #include <linux/reset.h>
 #include <linux/spi/spi.h>
 
@@ -1164,6 +1165,9 @@ static int stm32_spi_probe(struct platform_device *pdev)
 	if (spi->dma_tx || spi->dma_rx)
 		master->can_dma = stm32_spi_can_dma;
 
+	pm_runtime_set_active(&pdev->dev);
+	pm_runtime_enable(&pdev->dev);
+
 	ret = devm_spi_register_master(&pdev->dev, master);
 	if (ret) {
 		dev_err(&pdev->dev, "spi master registration failed: %d\n",
@@ -1203,6 +1207,8 @@ static int stm32_spi_probe(struct platform_device *pdev)
 		dma_release_channel(spi->dma_tx);
 	if (spi->dma_rx)
 		dma_release_channel(spi->dma_rx);
+
+	pm_runtime_disable(&pdev->dev);
 err_clk_disable:
 	clk_disable_unprepare(spi->clk);
 err_master_put:
@@ -1225,23 +1231,42 @@ static int stm32_spi_remove(struct platform_device *pdev)
 
 	clk_disable_unprepare(spi->clk);
 
+	pm_runtime_disable(&pdev->dev);
+
 	return 0;
 }
 
+#ifdef CONFIG_PM
+static int stm32_spi_runtime_suspend(struct device *dev)
+{
+	struct spi_master *master = dev_get_drvdata(dev);
+	struct stm32_spi *spi = spi_master_get_devdata(master);
+
+	clk_disable_unprepare(spi->clk);
+
+	return 0;
+}
+
+static int stm32_spi_runtime_resume(struct device *dev)
+{
+	struct spi_master *master = dev_get_drvdata(dev);
+	struct stm32_spi *spi = spi_master_get_devdata(master);
+
+	return clk_prepare_enable(spi->clk);
+}
+#endif
+
 #ifdef CONFIG_PM_SLEEP
 static int stm32_spi_suspend(struct device *dev)
 {
 	struct spi_master *master = dev_get_drvdata(dev);
-	struct stm32_spi *spi = spi_master_get_devdata(master);
 	int ret;
 
 	ret = spi_master_suspend(master);
 	if (ret)
 		return ret;
 
-	clk_disable_unprepare(spi->clk);
-
-	return ret;
+	return pm_runtime_force_suspend(dev);
 }
 
 static int stm32_spi_resume(struct device *dev)
@@ -1250,9 +1275,10 @@ static int stm32_spi_resume(struct device *dev)
 	struct stm32_spi *spi = spi_master_get_devdata(master);
 	int ret;
 
-	ret = clk_prepare_enable(spi->clk);
+	ret = pm_runtime_force_resume(dev);
 	if (ret)
 		return ret;
+
 	ret = spi_master_resume(master);
 	if (ret)
 		clk_disable_unprepare(spi->clk);
@@ -1261,8 +1287,11 @@ static int stm32_spi_resume(struct device *dev)
 }
 #endif
 
-static SIMPLE_DEV_PM_OPS(stm32_spi_pm_ops,
-			 stm32_spi_suspend, stm32_spi_resume);
+static const struct dev_pm_ops stm32_spi_pm_ops = {
+	SET_SYSTEM_SLEEP_PM_OPS(stm32_spi_suspend, stm32_spi_resume)
+	SET_RUNTIME_PM_OPS(stm32_spi_runtime_suspend,
+			   stm32_spi_runtime_resume, NULL)
+};
 
 static struct platform_driver stm32_spi_driver = {
 	.probe = stm32_spi_probe,
-- 
2.13.2

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

* Applied "spi: stm32: add runtime PM support" to the spi tree
@ 2017-06-28 19:25     ` Mark Brown
  0 siblings, 0 replies; 56+ messages in thread
From: Mark Brown @ 2017-06-28 19:25 UTC (permalink / raw)
  To: linux-arm-kernel

The patch

   spi: stm32: add runtime PM support

has been applied to the spi tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git 

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

>From 038ac869c9d27fceb6197e775d780ad6aeb45b1f Mon Sep 17 00:00:00 2001
From: Amelie Delaunay <amelie.delaunay@st.com>
Date: Tue, 27 Jun 2017 17:45:18 +0200
Subject: [PATCH] spi: stm32: add runtime PM support

This patch reworks suspend and resume callbacks and add runtime_suspend
and runtime_resume callbacks.

Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/spi/spi-stm32.c | 43 ++++++++++++++++++++++++++++++++++++-------
 1 file changed, 36 insertions(+), 7 deletions(-)

diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c
index 123529a1b40d..392c9453c2e6 100644
--- a/drivers/spi/spi-stm32.c
+++ b/drivers/spi/spi-stm32.c
@@ -27,6 +27,7 @@
 #include <linux/iopoll.h>
 #include <linux/module.h>
 #include <linux/of_platform.h>
+#include <linux/pm_runtime.h>
 #include <linux/reset.h>
 #include <linux/spi/spi.h>
 
@@ -1164,6 +1165,9 @@ static int stm32_spi_probe(struct platform_device *pdev)
 	if (spi->dma_tx || spi->dma_rx)
 		master->can_dma = stm32_spi_can_dma;
 
+	pm_runtime_set_active(&pdev->dev);
+	pm_runtime_enable(&pdev->dev);
+
 	ret = devm_spi_register_master(&pdev->dev, master);
 	if (ret) {
 		dev_err(&pdev->dev, "spi master registration failed: %d\n",
@@ -1203,6 +1207,8 @@ static int stm32_spi_probe(struct platform_device *pdev)
 		dma_release_channel(spi->dma_tx);
 	if (spi->dma_rx)
 		dma_release_channel(spi->dma_rx);
+
+	pm_runtime_disable(&pdev->dev);
 err_clk_disable:
 	clk_disable_unprepare(spi->clk);
 err_master_put:
@@ -1225,23 +1231,42 @@ static int stm32_spi_remove(struct platform_device *pdev)
 
 	clk_disable_unprepare(spi->clk);
 
+	pm_runtime_disable(&pdev->dev);
+
 	return 0;
 }
 
+#ifdef CONFIG_PM
+static int stm32_spi_runtime_suspend(struct device *dev)
+{
+	struct spi_master *master = dev_get_drvdata(dev);
+	struct stm32_spi *spi = spi_master_get_devdata(master);
+
+	clk_disable_unprepare(spi->clk);
+
+	return 0;
+}
+
+static int stm32_spi_runtime_resume(struct device *dev)
+{
+	struct spi_master *master = dev_get_drvdata(dev);
+	struct stm32_spi *spi = spi_master_get_devdata(master);
+
+	return clk_prepare_enable(spi->clk);
+}
+#endif
+
 #ifdef CONFIG_PM_SLEEP
 static int stm32_spi_suspend(struct device *dev)
 {
 	struct spi_master *master = dev_get_drvdata(dev);
-	struct stm32_spi *spi = spi_master_get_devdata(master);
 	int ret;
 
 	ret = spi_master_suspend(master);
 	if (ret)
 		return ret;
 
-	clk_disable_unprepare(spi->clk);
-
-	return ret;
+	return pm_runtime_force_suspend(dev);
 }
 
 static int stm32_spi_resume(struct device *dev)
@@ -1250,9 +1275,10 @@ static int stm32_spi_resume(struct device *dev)
 	struct stm32_spi *spi = spi_master_get_devdata(master);
 	int ret;
 
-	ret = clk_prepare_enable(spi->clk);
+	ret = pm_runtime_force_resume(dev);
 	if (ret)
 		return ret;
+
 	ret = spi_master_resume(master);
 	if (ret)
 		clk_disable_unprepare(spi->clk);
@@ -1261,8 +1287,11 @@ static int stm32_spi_resume(struct device *dev)
 }
 #endif
 
-static SIMPLE_DEV_PM_OPS(stm32_spi_pm_ops,
-			 stm32_spi_suspend, stm32_spi_resume);
+static const struct dev_pm_ops stm32_spi_pm_ops = {
+	SET_SYSTEM_SLEEP_PM_OPS(stm32_spi_suspend, stm32_spi_resume)
+	SET_RUNTIME_PM_OPS(stm32_spi_runtime_suspend,
+			   stm32_spi_runtime_resume, NULL)
+};
 
 static struct platform_driver stm32_spi_driver = {
 	.probe = stm32_spi_probe,
-- 
2.13.2

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

* Applied "spi: stm32: use normal conditional statements instead of ternary operator" to the spi tree
@ 2017-06-28 19:25     ` Mark Brown
  0 siblings, 0 replies; 56+ messages in thread
From: Mark Brown @ 2017-06-28 19:25 UTC (permalink / raw)
  To: Amelie Delaunay
  Cc: Mark Brown, Mark Brown, Rob Herring, Mark Rutland,
	Maxime Coquelin, Alexandre Torgue, linux-spi, devicetree,
	linux-arm-kernel, linux-kernel, linux-spi

The patch

   spi: stm32: use normal conditional statements instead of ternary operator

has been applied to the spi tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git 

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

>From 128ebb89c50e5452704de82d78845baeb3333c24 Mon Sep 17 00:00:00 2001
From: Amelie Delaunay <amelie.delaunay@st.com>
Date: Tue, 27 Jun 2017 17:45:17 +0200
Subject: [PATCH] spi: stm32: use normal conditional statements instead of
 ternary operator

This patch replace ternary operator use by normal condition statements
to ease code reading.
It also removes redundant !!.

Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/spi/spi-stm32.c | 44 ++++++++++++++++++++++++++++++--------------
 1 file changed, 30 insertions(+), 14 deletions(-)

diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c
index 3df4baa68d63..123529a1b40d 100644
--- a/drivers/spi/spi-stm32.c
+++ b/drivers/spi/spi-stm32.c
@@ -267,7 +267,10 @@ static int stm32_spi_prepare_mbr(struct stm32_spi *spi, u32 speed_hz)
 		return -EINVAL;
 
 	/* Determine the first power of 2 greater than or equal to div */
-	mbrdiv = (div & (div - 1)) ? fls(div) : fls(div) - 1;
+	if (div & (div - 1))
+		mbrdiv = fls(div);
+	else
+		mbrdiv = fls(div) - 1;
 
 	spi->cur_speed = spi->clk_rate / (1 << mbrdiv);
 
@@ -285,9 +288,12 @@ static u32 stm32_spi_prepare_fthlv(struct stm32_spi *spi)
 	/* data packet should not exceed 1/2 of fifo space */
 	half_fifo = (spi->fifo_size / 2);
 
-	fthlv = (spi->cur_bpw <= 8) ? half_fifo :
-		(spi->cur_bpw <= 16) ? (half_fifo / 2) :
-		(half_fifo / 4);
+	if (spi->cur_bpw <= 8)
+		fthlv = half_fifo;
+	else if (spi->cur_bpw <= 16)
+		fthlv = half_fifo / 2;
+	else
+		fthlv = half_fifo / 4;
 
 	/* align packet size with data registers access */
 	if (spi->cur_bpw > 8)
@@ -462,9 +468,9 @@ static bool stm32_spi_can_dma(struct spi_master *master,
 	struct stm32_spi *spi = spi_master_get_devdata(master);
 
 	dev_dbg(spi->dev, "%s: %s\n", __func__,
-		(!!(transfer->len > spi->fifo_size)) ? "true" : "false");
+		(transfer->len > spi->fifo_size) ? "true" : "false");
 
-	return !!(transfer->len > spi->fifo_size);
+	return (transfer->len > spi->fifo_size);
 }
 
 /**
@@ -493,7 +499,8 @@ static irqreturn_t stm32_spi_irq(int irq, void *dev_id)
 	 * Full-Duplex, need to poll RXP event to know if there are remaining
 	 * data, before disabling SPI.
 	 */
-	mask |= ((spi->rx_buf && !spi->cur_usedma) ? SPI_SR_RXP : 0);
+	if (spi->rx_buf && !spi->cur_usedma)
+		mask |= SPI_SR_RXP;
 
 	if (!(sr & mask)) {
 		dev_dbg(spi->dev, "spurious IT (sr=0x%08x, ier=0x%08x)\n",
@@ -656,12 +663,18 @@ static void stm32_spi_dma_config(struct stm32_spi *spi,
 	enum dma_slave_buswidth buswidth;
 	u32 maxburst;
 
-	buswidth = (spi->cur_bpw <= 8) ? DMA_SLAVE_BUSWIDTH_1_BYTE :
-		   (spi->cur_bpw <= 16) ? DMA_SLAVE_BUSWIDTH_2_BYTES :
-		   DMA_SLAVE_BUSWIDTH_4_BYTES;
+	if (spi->cur_bpw <= 8)
+		buswidth = DMA_SLAVE_BUSWIDTH_1_BYTE;
+	else if (spi->cur_bpw <= 16)
+		buswidth = DMA_SLAVE_BUSWIDTH_2_BYTES;
+	else
+		buswidth = DMA_SLAVE_BUSWIDTH_4_BYTES;
 
 	/* Valid for DMA Half or Full Fifo threshold */
-	maxburst = (spi->cur_fthlv == 2) ? 1 : spi->cur_fthlv;
+	if (spi->cur_fthlv == 2)
+		maxburst = 1;
+	else
+		maxburst = spi->cur_fthlv;
 
 	memset(dma_conf, 0, sizeof(struct dma_slave_config));
 	dma_conf->direction = dir;
@@ -920,9 +933,12 @@ static int stm32_spi_transfer_one_setup(struct stm32_spi *spi,
 				~cfg2_clrb) | cfg2_setb,
 			       spi->base + STM32_SPI_CFG2);
 
-	nb_words = DIV_ROUND_UP(transfer->len * 8,
-				(spi->cur_bpw <= 8) ? 8 :
-				(spi->cur_bpw <= 16) ? 16 : 32);
+	if (spi->cur_bpw <= 8)
+		nb_words = transfer->len;
+	else if (spi->cur_bpw <= 16)
+		nb_words = DIV_ROUND_UP(transfer->len * 8, 16);
+	else
+		nb_words = DIV_ROUND_UP(transfer->len * 8, 32);
 	nb_words <<= SPI_CR2_TSIZE_SHIFT;
 
 	if (nb_words <= SPI_CR2_TSIZE) {
-- 
2.13.2

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

* Applied "spi: stm32: use normal conditional statements instead of ternary operator" to the spi tree
@ 2017-06-28 19:25     ` Mark Brown
  0 siblings, 0 replies; 56+ messages in thread
From: Mark Brown @ 2017-06-28 19:25 UTC (permalink / raw)
  To: Amelie Delaunay; +Cc: Mark Brown

The patch

   spi: stm32: use normal conditional statements instead of ternary operator

has been applied to the spi tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git 

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

>From 128ebb89c50e5452704de82d78845baeb3333c24 Mon Sep 17 00:00:00 2001
From: Amelie Delaunay <amelie.delaunay-qxv4g6HH51o@public.gmane.org>
Date: Tue, 27 Jun 2017 17:45:17 +0200
Subject: [PATCH] spi: stm32: use normal conditional statements instead of
 ternary operator

This patch replace ternary operator use by normal condition statements
to ease code reading.
It also removes redundant !!.

Signed-off-by: Amelie Delaunay <amelie.delaunay-qxv4g6HH51o@public.gmane.org>
Signed-off-by: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
---
 drivers/spi/spi-stm32.c | 44 ++++++++++++++++++++++++++++++--------------
 1 file changed, 30 insertions(+), 14 deletions(-)

diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c
index 3df4baa68d63..123529a1b40d 100644
--- a/drivers/spi/spi-stm32.c
+++ b/drivers/spi/spi-stm32.c
@@ -267,7 +267,10 @@ static int stm32_spi_prepare_mbr(struct stm32_spi *spi, u32 speed_hz)
 		return -EINVAL;
 
 	/* Determine the first power of 2 greater than or equal to div */
-	mbrdiv = (div & (div - 1)) ? fls(div) : fls(div) - 1;
+	if (div & (div - 1))
+		mbrdiv = fls(div);
+	else
+		mbrdiv = fls(div) - 1;
 
 	spi->cur_speed = spi->clk_rate / (1 << mbrdiv);
 
@@ -285,9 +288,12 @@ static u32 stm32_spi_prepare_fthlv(struct stm32_spi *spi)
 	/* data packet should not exceed 1/2 of fifo space */
 	half_fifo = (spi->fifo_size / 2);
 
-	fthlv = (spi->cur_bpw <= 8) ? half_fifo :
-		(spi->cur_bpw <= 16) ? (half_fifo / 2) :
-		(half_fifo / 4);
+	if (spi->cur_bpw <= 8)
+		fthlv = half_fifo;
+	else if (spi->cur_bpw <= 16)
+		fthlv = half_fifo / 2;
+	else
+		fthlv = half_fifo / 4;
 
 	/* align packet size with data registers access */
 	if (spi->cur_bpw > 8)
@@ -462,9 +468,9 @@ static bool stm32_spi_can_dma(struct spi_master *master,
 	struct stm32_spi *spi = spi_master_get_devdata(master);
 
 	dev_dbg(spi->dev, "%s: %s\n", __func__,
-		(!!(transfer->len > spi->fifo_size)) ? "true" : "false");
+		(transfer->len > spi->fifo_size) ? "true" : "false");
 
-	return !!(transfer->len > spi->fifo_size);
+	return (transfer->len > spi->fifo_size);
 }
 
 /**
@@ -493,7 +499,8 @@ static irqreturn_t stm32_spi_irq(int irq, void *dev_id)
 	 * Full-Duplex, need to poll RXP event to know if there are remaining
 	 * data, before disabling SPI.
 	 */
-	mask |= ((spi->rx_buf && !spi->cur_usedma) ? SPI_SR_RXP : 0);
+	if (spi->rx_buf && !spi->cur_usedma)
+		mask |= SPI_SR_RXP;
 
 	if (!(sr & mask)) {
 		dev_dbg(spi->dev, "spurious IT (sr=0x%08x, ier=0x%08x)\n",
@@ -656,12 +663,18 @@ static void stm32_spi_dma_config(struct stm32_spi *spi,
 	enum dma_slave_buswidth buswidth;
 	u32 maxburst;
 
-	buswidth = (spi->cur_bpw <= 8) ? DMA_SLAVE_BUSWIDTH_1_BYTE :
-		   (spi->cur_bpw <= 16) ? DMA_SLAVE_BUSWIDTH_2_BYTES :
-		   DMA_SLAVE_BUSWIDTH_4_BYTES;
+	if (spi->cur_bpw <= 8)
+		buswidth = DMA_SLAVE_BUSWIDTH_1_BYTE;
+	else if (spi->cur_bpw <= 16)
+		buswidth = DMA_SLAVE_BUSWIDTH_2_BYTES;
+	else
+		buswidth = DMA_SLAVE_BUSWIDTH_4_BYTES;
 
 	/* Valid for DMA Half or Full Fifo threshold */
-	maxburst = (spi->cur_fthlv == 2) ? 1 : spi->cur_fthlv;
+	if (spi->cur_fthlv == 2)
+		maxburst = 1;
+	else
+		maxburst = spi->cur_fthlv;
 
 	memset(dma_conf, 0, sizeof(struct dma_slave_config));
 	dma_conf->direction = dir;
@@ -920,9 +933,12 @@ static int stm32_spi_transfer_one_setup(struct stm32_spi *spi,
 				~cfg2_clrb) | cfg2_setb,
 			       spi->base + STM32_SPI_CFG2);
 
-	nb_words = DIV_ROUND_UP(transfer->len * 8,
-				(spi->cur_bpw <= 8) ? 8 :
-				(spi->cur_bpw <= 16) ? 16 : 32);
+	if (spi->cur_bpw <= 8)
+		nb_words = transfer->len;
+	else if (spi->cur_bpw <= 16)
+		nb_words = DIV_ROUND_UP(transfer->len * 8, 16);
+	else
+		nb_words = DIV_ROUND_UP(transfer->len * 8, 32);
 	nb_words <<= SPI_CR2_TSIZE_SHIFT;
 
 	if (nb_words <= SPI_CR2_TSIZE) {
-- 
2.13.2

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Applied "spi: stm32: use normal conditional statements instead of ternary operator" to the spi tree
@ 2017-06-28 19:25     ` Mark Brown
  0 siblings, 0 replies; 56+ messages in thread
From: Mark Brown @ 2017-06-28 19:25 UTC (permalink / raw)
  To: Amelie Delaunay
  Cc: Mark Brown, Mark Brown, Rob Herring, Mark Rutland,
	Maxime Coquelin, Alexandre Torgue,
	linux-spi-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-spi-u79uwXL29TY76Z2rM5mHXA

The patch

   spi: stm32: use normal conditional statements instead of ternary operator

has been applied to the spi tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git 

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

>From 128ebb89c50e5452704de82d78845baeb3333c24 Mon Sep 17 00:00:00 2001
From: Amelie Delaunay <amelie.delaunay-qxv4g6HH51o@public.gmane.org>
Date: Tue, 27 Jun 2017 17:45:17 +0200
Subject: [PATCH] spi: stm32: use normal conditional statements instead of
 ternary operator

This patch replace ternary operator use by normal condition statements
to ease code reading.
It also removes redundant !!.

Signed-off-by: Amelie Delaunay <amelie.delaunay-qxv4g6HH51o@public.gmane.org>
Signed-off-by: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
---
 drivers/spi/spi-stm32.c | 44 ++++++++++++++++++++++++++++++--------------
 1 file changed, 30 insertions(+), 14 deletions(-)

diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c
index 3df4baa68d63..123529a1b40d 100644
--- a/drivers/spi/spi-stm32.c
+++ b/drivers/spi/spi-stm32.c
@@ -267,7 +267,10 @@ static int stm32_spi_prepare_mbr(struct stm32_spi *spi, u32 speed_hz)
 		return -EINVAL;
 
 	/* Determine the first power of 2 greater than or equal to div */
-	mbrdiv = (div & (div - 1)) ? fls(div) : fls(div) - 1;
+	if (div & (div - 1))
+		mbrdiv = fls(div);
+	else
+		mbrdiv = fls(div) - 1;
 
 	spi->cur_speed = spi->clk_rate / (1 << mbrdiv);
 
@@ -285,9 +288,12 @@ static u32 stm32_spi_prepare_fthlv(struct stm32_spi *spi)
 	/* data packet should not exceed 1/2 of fifo space */
 	half_fifo = (spi->fifo_size / 2);
 
-	fthlv = (spi->cur_bpw <= 8) ? half_fifo :
-		(spi->cur_bpw <= 16) ? (half_fifo / 2) :
-		(half_fifo / 4);
+	if (spi->cur_bpw <= 8)
+		fthlv = half_fifo;
+	else if (spi->cur_bpw <= 16)
+		fthlv = half_fifo / 2;
+	else
+		fthlv = half_fifo / 4;
 
 	/* align packet size with data registers access */
 	if (spi->cur_bpw > 8)
@@ -462,9 +468,9 @@ static bool stm32_spi_can_dma(struct spi_master *master,
 	struct stm32_spi *spi = spi_master_get_devdata(master);
 
 	dev_dbg(spi->dev, "%s: %s\n", __func__,
-		(!!(transfer->len > spi->fifo_size)) ? "true" : "false");
+		(transfer->len > spi->fifo_size) ? "true" : "false");
 
-	return !!(transfer->len > spi->fifo_size);
+	return (transfer->len > spi->fifo_size);
 }
 
 /**
@@ -493,7 +499,8 @@ static irqreturn_t stm32_spi_irq(int irq, void *dev_id)
 	 * Full-Duplex, need to poll RXP event to know if there are remaining
 	 * data, before disabling SPI.
 	 */
-	mask |= ((spi->rx_buf && !spi->cur_usedma) ? SPI_SR_RXP : 0);
+	if (spi->rx_buf && !spi->cur_usedma)
+		mask |= SPI_SR_RXP;
 
 	if (!(sr & mask)) {
 		dev_dbg(spi->dev, "spurious IT (sr=0x%08x, ier=0x%08x)\n",
@@ -656,12 +663,18 @@ static void stm32_spi_dma_config(struct stm32_spi *spi,
 	enum dma_slave_buswidth buswidth;
 	u32 maxburst;
 
-	buswidth = (spi->cur_bpw <= 8) ? DMA_SLAVE_BUSWIDTH_1_BYTE :
-		   (spi->cur_bpw <= 16) ? DMA_SLAVE_BUSWIDTH_2_BYTES :
-		   DMA_SLAVE_BUSWIDTH_4_BYTES;
+	if (spi->cur_bpw <= 8)
+		buswidth = DMA_SLAVE_BUSWIDTH_1_BYTE;
+	else if (spi->cur_bpw <= 16)
+		buswidth = DMA_SLAVE_BUSWIDTH_2_BYTES;
+	else
+		buswidth = DMA_SLAVE_BUSWIDTH_4_BYTES;
 
 	/* Valid for DMA Half or Full Fifo threshold */
-	maxburst = (spi->cur_fthlv == 2) ? 1 : spi->cur_fthlv;
+	if (spi->cur_fthlv == 2)
+		maxburst = 1;
+	else
+		maxburst = spi->cur_fthlv;
 
 	memset(dma_conf, 0, sizeof(struct dma_slave_config));
 	dma_conf->direction = dir;
@@ -920,9 +933,12 @@ static int stm32_spi_transfer_one_setup(struct stm32_spi *spi,
 				~cfg2_clrb) | cfg2_setb,
 			       spi->base + STM32_SPI_CFG2);
 
-	nb_words = DIV_ROUND_UP(transfer->len * 8,
-				(spi->cur_bpw <= 8) ? 8 :
-				(spi->cur_bpw <= 16) ? 16 : 32);
+	if (spi->cur_bpw <= 8)
+		nb_words = transfer->len;
+	else if (spi->cur_bpw <= 16)
+		nb_words = DIV_ROUND_UP(transfer->len * 8, 16);
+	else
+		nb_words = DIV_ROUND_UP(transfer->len * 8, 32);
 	nb_words <<= SPI_CR2_TSIZE_SHIFT;
 
 	if (nb_words <= SPI_CR2_TSIZE) {
-- 
2.13.2

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Applied "spi: stm32: use normal conditional statements instead of ternary operator" to the spi tree
@ 2017-06-28 19:25     ` Mark Brown
  0 siblings, 0 replies; 56+ messages in thread
From: Mark Brown @ 2017-06-28 19:25 UTC (permalink / raw)
  To: linux-arm-kernel

The patch

   spi: stm32: use normal conditional statements instead of ternary operator

has been applied to the spi tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git 

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

>From 128ebb89c50e5452704de82d78845baeb3333c24 Mon Sep 17 00:00:00 2001
From: Amelie Delaunay <amelie.delaunay@st.com>
Date: Tue, 27 Jun 2017 17:45:17 +0200
Subject: [PATCH] spi: stm32: use normal conditional statements instead of
 ternary operator

This patch replace ternary operator use by normal condition statements
to ease code reading.
It also removes redundant !!.

Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/spi/spi-stm32.c | 44 ++++++++++++++++++++++++++++++--------------
 1 file changed, 30 insertions(+), 14 deletions(-)

diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c
index 3df4baa68d63..123529a1b40d 100644
--- a/drivers/spi/spi-stm32.c
+++ b/drivers/spi/spi-stm32.c
@@ -267,7 +267,10 @@ static int stm32_spi_prepare_mbr(struct stm32_spi *spi, u32 speed_hz)
 		return -EINVAL;
 
 	/* Determine the first power of 2 greater than or equal to div */
-	mbrdiv = (div & (div - 1)) ? fls(div) : fls(div) - 1;
+	if (div & (div - 1))
+		mbrdiv = fls(div);
+	else
+		mbrdiv = fls(div) - 1;
 
 	spi->cur_speed = spi->clk_rate / (1 << mbrdiv);
 
@@ -285,9 +288,12 @@ static u32 stm32_spi_prepare_fthlv(struct stm32_spi *spi)
 	/* data packet should not exceed 1/2 of fifo space */
 	half_fifo = (spi->fifo_size / 2);
 
-	fthlv = (spi->cur_bpw <= 8) ? half_fifo :
-		(spi->cur_bpw <= 16) ? (half_fifo / 2) :
-		(half_fifo / 4);
+	if (spi->cur_bpw <= 8)
+		fthlv = half_fifo;
+	else if (spi->cur_bpw <= 16)
+		fthlv = half_fifo / 2;
+	else
+		fthlv = half_fifo / 4;
 
 	/* align packet size with data registers access */
 	if (spi->cur_bpw > 8)
@@ -462,9 +468,9 @@ static bool stm32_spi_can_dma(struct spi_master *master,
 	struct stm32_spi *spi = spi_master_get_devdata(master);
 
 	dev_dbg(spi->dev, "%s: %s\n", __func__,
-		(!!(transfer->len > spi->fifo_size)) ? "true" : "false");
+		(transfer->len > spi->fifo_size) ? "true" : "false");
 
-	return !!(transfer->len > spi->fifo_size);
+	return (transfer->len > spi->fifo_size);
 }
 
 /**
@@ -493,7 +499,8 @@ static irqreturn_t stm32_spi_irq(int irq, void *dev_id)
 	 * Full-Duplex, need to poll RXP event to know if there are remaining
 	 * data, before disabling SPI.
 	 */
-	mask |= ((spi->rx_buf && !spi->cur_usedma) ? SPI_SR_RXP : 0);
+	if (spi->rx_buf && !spi->cur_usedma)
+		mask |= SPI_SR_RXP;
 
 	if (!(sr & mask)) {
 		dev_dbg(spi->dev, "spurious IT (sr=0x%08x, ier=0x%08x)\n",
@@ -656,12 +663,18 @@ static void stm32_spi_dma_config(struct stm32_spi *spi,
 	enum dma_slave_buswidth buswidth;
 	u32 maxburst;
 
-	buswidth = (spi->cur_bpw <= 8) ? DMA_SLAVE_BUSWIDTH_1_BYTE :
-		   (spi->cur_bpw <= 16) ? DMA_SLAVE_BUSWIDTH_2_BYTES :
-		   DMA_SLAVE_BUSWIDTH_4_BYTES;
+	if (spi->cur_bpw <= 8)
+		buswidth = DMA_SLAVE_BUSWIDTH_1_BYTE;
+	else if (spi->cur_bpw <= 16)
+		buswidth = DMA_SLAVE_BUSWIDTH_2_BYTES;
+	else
+		buswidth = DMA_SLAVE_BUSWIDTH_4_BYTES;
 
 	/* Valid for DMA Half or Full Fifo threshold */
-	maxburst = (spi->cur_fthlv == 2) ? 1 : spi->cur_fthlv;
+	if (spi->cur_fthlv == 2)
+		maxburst = 1;
+	else
+		maxburst = spi->cur_fthlv;
 
 	memset(dma_conf, 0, sizeof(struct dma_slave_config));
 	dma_conf->direction = dir;
@@ -920,9 +933,12 @@ static int stm32_spi_transfer_one_setup(struct stm32_spi *spi,
 				~cfg2_clrb) | cfg2_setb,
 			       spi->base + STM32_SPI_CFG2);
 
-	nb_words = DIV_ROUND_UP(transfer->len * 8,
-				(spi->cur_bpw <= 8) ? 8 :
-				(spi->cur_bpw <= 16) ? 16 : 32);
+	if (spi->cur_bpw <= 8)
+		nb_words = transfer->len;
+	else if (spi->cur_bpw <= 16)
+		nb_words = DIV_ROUND_UP(transfer->len * 8, 16);
+	else
+		nb_words = DIV_ROUND_UP(transfer->len * 8, 32);
 	nb_words <<= SPI_CR2_TSIZE_SHIFT;
 
 	if (nb_words <= SPI_CR2_TSIZE) {
-- 
2.13.2

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

* Applied "spi: stm32: replace st, spi-midi with st, spi-midi-ns to fit bindings" to the spi tree
@ 2017-06-28 19:25     ` Mark Brown
  0 siblings, 0 replies; 56+ messages in thread
From: Mark Brown @ 2017-06-28 19:25 UTC (permalink / raw)
  To: Amelie Delaunay
  Cc: Mark Brown, Mark Brown, Rob Herring, Mark Rutland,
	Maxime Coquelin, Alexandre Torgue, linux-spi, devicetree,
	linux-arm-kernel, linux-kernel, linux-spi

The patch

   spi: stm32: replace st, spi-midi with st, spi-midi-ns to fit bindings

has been applied to the spi tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git 

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

>From 042c1c60df7b85488de28574e7917b7977be3b00 Mon Sep 17 00:00:00 2001
From: Amelie Delaunay <amelie.delaunay@st.com>
Date: Tue, 27 Jun 2017 17:45:16 +0200
Subject: [PATCH] spi: stm32: replace st, spi-midi with st, spi-midi-ns to fit
 bindings

This patch fixes the optional dt property used to set master inter-data
idleness.

Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/spi/spi-stm32.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c
index 1eb07bef043e..3df4baa68d63 100644
--- a/drivers/spi/spi-stm32.c
+++ b/drivers/spi/spi-stm32.c
@@ -582,7 +582,7 @@ static int stm32_spi_prepare_msg(struct spi_master *master,
 
 	/* SPI slave device may need time between data frames */
 	spi->cur_midi = 0;
-	if (np && !of_property_read_u32(np, "st,spi-midi", &spi->cur_midi))
+	if (np && !of_property_read_u32(np, "st,spi-midi-ns", &spi->cur_midi))
 		dev_dbg(spi->dev, "%dns inter-data idleness\n", spi->cur_midi);
 
 	if (spi_dev->mode & SPI_CPOL)
-- 
2.13.2

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

* Applied "spi: stm32: replace st, spi-midi with st, spi-midi-ns to fit bindings" to the spi tree
@ 2017-06-28 19:25     ` Mark Brown
  0 siblings, 0 replies; 56+ messages in thread
From: Mark Brown @ 2017-06-28 19:25 UTC (permalink / raw)
  To: Amelie Delaunay; +Cc: Mark Brown

The patch

   spi: stm32: replace st, spi-midi with st, spi-midi-ns to fit bindings

has been applied to the spi tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git 

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

>From 042c1c60df7b85488de28574e7917b7977be3b00 Mon Sep 17 00:00:00 2001
From: Amelie Delaunay <amelie.delaunay-qxv4g6HH51o@public.gmane.org>
Date: Tue, 27 Jun 2017 17:45:16 +0200
Subject: [PATCH] spi: stm32: replace st, spi-midi with st, spi-midi-ns to fit
 bindings

This patch fixes the optional dt property used to set master inter-data
idleness.

Signed-off-by: Amelie Delaunay <amelie.delaunay-qxv4g6HH51o@public.gmane.org>
Signed-off-by: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
---
 drivers/spi/spi-stm32.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c
index 1eb07bef043e..3df4baa68d63 100644
--- a/drivers/spi/spi-stm32.c
+++ b/drivers/spi/spi-stm32.c
@@ -582,7 +582,7 @@ static int stm32_spi_prepare_msg(struct spi_master *master,
 
 	/* SPI slave device may need time between data frames */
 	spi->cur_midi = 0;
-	if (np && !of_property_read_u32(np, "st,spi-midi", &spi->cur_midi))
+	if (np && !of_property_read_u32(np, "st,spi-midi-ns", &spi->cur_midi))
 		dev_dbg(spi->dev, "%dns inter-data idleness\n", spi->cur_midi);
 
 	if (spi_dev->mode & SPI_CPOL)
-- 
2.13.2

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Applied "spi: stm32: replace st, spi-midi with st, spi-midi-ns to fit bindings" to the spi tree
@ 2017-06-28 19:25     ` Mark Brown
  0 siblings, 0 replies; 56+ messages in thread
From: Mark Brown @ 2017-06-28 19:25 UTC (permalink / raw)
  To: Amelie Delaunay
  Cc: Mark Brown, Mark Brown, Rob Herring, Mark Rutland,
	Maxime Coquelin, Alexandre Torgue,
	linux-spi-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-spi-u79uwXL29TY76Z2rM5mHXA

The patch

   spi: stm32: replace st, spi-midi with st, spi-midi-ns to fit bindings

has been applied to the spi tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git 

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

>From 042c1c60df7b85488de28574e7917b7977be3b00 Mon Sep 17 00:00:00 2001
From: Amelie Delaunay <amelie.delaunay-qxv4g6HH51o@public.gmane.org>
Date: Tue, 27 Jun 2017 17:45:16 +0200
Subject: [PATCH] spi: stm32: replace st, spi-midi with st, spi-midi-ns to fit
 bindings

This patch fixes the optional dt property used to set master inter-data
idleness.

Signed-off-by: Amelie Delaunay <amelie.delaunay-qxv4g6HH51o@public.gmane.org>
Signed-off-by: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
---
 drivers/spi/spi-stm32.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c
index 1eb07bef043e..3df4baa68d63 100644
--- a/drivers/spi/spi-stm32.c
+++ b/drivers/spi/spi-stm32.c
@@ -582,7 +582,7 @@ static int stm32_spi_prepare_msg(struct spi_master *master,
 
 	/* SPI slave device may need time between data frames */
 	spi->cur_midi = 0;
-	if (np && !of_property_read_u32(np, "st,spi-midi", &spi->cur_midi))
+	if (np && !of_property_read_u32(np, "st,spi-midi-ns", &spi->cur_midi))
 		dev_dbg(spi->dev, "%dns inter-data idleness\n", spi->cur_midi);
 
 	if (spi_dev->mode & SPI_CPOL)
-- 
2.13.2

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Applied "spi: stm32: replace st, spi-midi with st, spi-midi-ns to fit bindings" to the spi tree
@ 2017-06-28 19:25     ` Mark Brown
  0 siblings, 0 replies; 56+ messages in thread
From: Mark Brown @ 2017-06-28 19:25 UTC (permalink / raw)
  To: linux-arm-kernel

The patch

   spi: stm32: replace st, spi-midi with st, spi-midi-ns to fit bindings

has been applied to the spi tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git 

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

>From 042c1c60df7b85488de28574e7917b7977be3b00 Mon Sep 17 00:00:00 2001
From: Amelie Delaunay <amelie.delaunay@st.com>
Date: Tue, 27 Jun 2017 17:45:16 +0200
Subject: [PATCH] spi: stm32: replace st, spi-midi with st, spi-midi-ns to fit
 bindings

This patch fixes the optional dt property used to set master inter-data
idleness.

Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/spi/spi-stm32.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c
index 1eb07bef043e..3df4baa68d63 100644
--- a/drivers/spi/spi-stm32.c
+++ b/drivers/spi/spi-stm32.c
@@ -582,7 +582,7 @@ static int stm32_spi_prepare_msg(struct spi_master *master,
 
 	/* SPI slave device may need time between data frames */
 	spi->cur_midi = 0;
-	if (np && !of_property_read_u32(np, "st,spi-midi", &spi->cur_midi))
+	if (np && !of_property_read_u32(np, "st,spi-midi-ns", &spi->cur_midi))
 		dev_dbg(spi->dev, "%dns inter-data idleness\n", spi->cur_midi);
 
 	if (spi_dev->mode & SPI_CPOL)
-- 
2.13.2

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

* Applied "spi: stm32: fix compatible to fit with new bindings" to the spi tree
@ 2017-06-28 19:25     ` Mark Brown
  0 siblings, 0 replies; 56+ messages in thread
From: Mark Brown @ 2017-06-28 19:25 UTC (permalink / raw)
  To: Amelie Delaunay
  Cc: Mark Brown, Mark Brown, Rob Herring, Mark Rutland,
	Maxime Coquelin, Alexandre Torgue, linux-spi, devicetree,
	linux-arm-kernel, linux-kernel, linux-spi

The patch

   spi: stm32: fix compatible to fit with new bindings

has been applied to the spi tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git 

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

>From c5fe2faabad41737fa36cedc1c6e15cbc9ddff11 Mon Sep 17 00:00:00 2001
From: Amelie Delaunay <amelie.delaunay@st.com>
Date: Tue, 27 Jun 2017 17:45:14 +0200
Subject: [PATCH] spi: stm32: fix compatible to fit with new bindings

This patch updates of_device_id compatible string to fit with new
bindings.

Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/spi/spi-stm32.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c
index 305ecd5334fc..1eb07bef043e 100644
--- a/drivers/spi/spi-stm32.c
+++ b/drivers/spi/spi-stm32.c
@@ -1038,7 +1038,7 @@ static int stm32_spi_config(struct stm32_spi *spi)
 }
 
 static const struct of_device_id stm32_spi_of_match[] = {
-	{ .compatible = "st,stm32-spi", },
+	{ .compatible = "st,stm32h7-spi", },
 	{},
 };
 MODULE_DEVICE_TABLE(of, stm32_spi_of_match);
-- 
2.13.2

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

* Applied "spi: stm32: fix compatible to fit with new bindings" to the spi tree
@ 2017-06-28 19:25     ` Mark Brown
  0 siblings, 0 replies; 56+ messages in thread
From: Mark Brown @ 2017-06-28 19:25 UTC (permalink / raw)
  To: Amelie Delaunay; +Cc: Mark Brown

The patch

   spi: stm32: fix compatible to fit with new bindings

has been applied to the spi tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git 

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

>From c5fe2faabad41737fa36cedc1c6e15cbc9ddff11 Mon Sep 17 00:00:00 2001
From: Amelie Delaunay <amelie.delaunay-qxv4g6HH51o@public.gmane.org>
Date: Tue, 27 Jun 2017 17:45:14 +0200
Subject: [PATCH] spi: stm32: fix compatible to fit with new bindings

This patch updates of_device_id compatible string to fit with new
bindings.

Signed-off-by: Amelie Delaunay <amelie.delaunay-qxv4g6HH51o@public.gmane.org>
Signed-off-by: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
---
 drivers/spi/spi-stm32.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c
index 305ecd5334fc..1eb07bef043e 100644
--- a/drivers/spi/spi-stm32.c
+++ b/drivers/spi/spi-stm32.c
@@ -1038,7 +1038,7 @@ static int stm32_spi_config(struct stm32_spi *spi)
 }
 
 static const struct of_device_id stm32_spi_of_match[] = {
-	{ .compatible = "st,stm32-spi", },
+	{ .compatible = "st,stm32h7-spi", },
 	{},
 };
 MODULE_DEVICE_TABLE(of, stm32_spi_of_match);
-- 
2.13.2

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Applied "spi: stm32: fix compatible to fit with new bindings" to the spi tree
@ 2017-06-28 19:25     ` Mark Brown
  0 siblings, 0 replies; 56+ messages in thread
From: Mark Brown @ 2017-06-28 19:25 UTC (permalink / raw)
  To: Amelie Delaunay
  Cc: Mark Brown, Mark Brown, Rob Herring, Mark Rutland,
	Maxime Coquelin, Alexandre Torgue,
	linux-spi-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-spi-u79uwXL29TY76Z2rM5mHXA

The patch

   spi: stm32: fix compatible to fit with new bindings

has been applied to the spi tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git 

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

>From c5fe2faabad41737fa36cedc1c6e15cbc9ddff11 Mon Sep 17 00:00:00 2001
From: Amelie Delaunay <amelie.delaunay-qxv4g6HH51o@public.gmane.org>
Date: Tue, 27 Jun 2017 17:45:14 +0200
Subject: [PATCH] spi: stm32: fix compatible to fit with new bindings

This patch updates of_device_id compatible string to fit with new
bindings.

Signed-off-by: Amelie Delaunay <amelie.delaunay-qxv4g6HH51o@public.gmane.org>
Signed-off-by: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
---
 drivers/spi/spi-stm32.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c
index 305ecd5334fc..1eb07bef043e 100644
--- a/drivers/spi/spi-stm32.c
+++ b/drivers/spi/spi-stm32.c
@@ -1038,7 +1038,7 @@ static int stm32_spi_config(struct stm32_spi *spi)
 }
 
 static const struct of_device_id stm32_spi_of_match[] = {
-	{ .compatible = "st,stm32-spi", },
+	{ .compatible = "st,stm32h7-spi", },
 	{},
 };
 MODULE_DEVICE_TABLE(of, stm32_spi_of_match);
-- 
2.13.2

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Applied "spi: stm32: fix compatible to fit with new bindings" to the spi tree
@ 2017-06-28 19:25     ` Mark Brown
  0 siblings, 0 replies; 56+ messages in thread
From: Mark Brown @ 2017-06-28 19:25 UTC (permalink / raw)
  To: linux-arm-kernel

The patch

   spi: stm32: fix compatible to fit with new bindings

has been applied to the spi tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git 

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

>From c5fe2faabad41737fa36cedc1c6e15cbc9ddff11 Mon Sep 17 00:00:00 2001
From: Amelie Delaunay <amelie.delaunay@st.com>
Date: Tue, 27 Jun 2017 17:45:14 +0200
Subject: [PATCH] spi: stm32: fix compatible to fit with new bindings

This patch updates of_device_id compatible string to fit with new
bindings.

Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 drivers/spi/spi-stm32.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c
index 305ecd5334fc..1eb07bef043e 100644
--- a/drivers/spi/spi-stm32.c
+++ b/drivers/spi/spi-stm32.c
@@ -1038,7 +1038,7 @@ static int stm32_spi_config(struct stm32_spi *spi)
 }
 
 static const struct of_device_id stm32_spi_of_match[] = {
-	{ .compatible = "st,stm32-spi", },
+	{ .compatible = "st,stm32h7-spi", },
 	{},
 };
 MODULE_DEVICE_TABLE(of, stm32_spi_of_match);
-- 
2.13.2

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

* Applied "spi: stm32: use SoC specific compatible" to the spi tree
@ 2017-06-28 19:25     ` Mark Brown
  0 siblings, 0 replies; 56+ messages in thread
From: Mark Brown @ 2017-06-28 19:25 UTC (permalink / raw)
  To: Amelie Delaunay
  Cc: Rob Herring, Mark Brown, Mark Brown, Rob Herring, Mark Rutland,
	Maxime Coquelin, Alexandre Torgue, linux-spi, devicetree,
	linux-arm-kernel, linux-kernel, linux-spi

The patch

   spi: stm32: use SoC specific compatible

has been applied to the spi tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git 

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

>From 567300d11ef54f7779aa7324510fd4dbd470f73e Mon Sep 17 00:00:00 2001
From: Amelie Delaunay <amelie.delaunay@st.com>
Date: Tue, 27 Jun 2017 17:45:13 +0200
Subject: [PATCH] spi: stm32: use SoC specific compatible

This patch replaces st,stm32-spi compatible with st,stm32h7-spi SoC
specific compatible and updates the example accondingly.

Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 Documentation/devicetree/bindings/spi/spi-stm32.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/spi/spi-stm32.txt b/Documentation/devicetree/bindings/spi/spi-stm32.txt
index 3958bf6e8b37..415378bca480 100644
--- a/Documentation/devicetree/bindings/spi/spi-stm32.txt
+++ b/Documentation/devicetree/bindings/spi/spi-stm32.txt
@@ -7,7 +7,7 @@ from 4 to 32-bit data size. Although it can be configured as master or slave,
 only master is supported by the driver.
 
 Required properties:
-- compatible: Must be "st,stm32-spi".
+- compatible: Must be "st,stm32h7-spi".
 - reg: Offset and length of the device's register set.
 - interrupts: Must contain the interrupt id.
 - clocks: Must contain an entry for spiclk (which feeds the internal clock
@@ -38,7 +38,7 @@ Example:
 	spi2: spi@40003800 {
 		#address-cells = <1>;
 		#size-cells = <0>;
-		compatible = "st,stm32-spi";
+		compatible = "st,stm32h7-spi";
 		reg = <0x40003800 0x400>;
 		interrupts = <36>;
 		clocks = <&rcc SPI2_CK>;
-- 
2.13.2

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

* Applied "spi: stm32: use SoC specific compatible" to the spi tree
@ 2017-06-28 19:25     ` Mark Brown
  0 siblings, 0 replies; 56+ messages in thread
From: Mark Brown @ 2017-06-28 19:25 UTC (permalink / raw)
  To: Amelie Delaunay; +Cc: Rob Herring, Mark Brown

The patch

   spi: stm32: use SoC specific compatible

has been applied to the spi tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git 

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

>From 567300d11ef54f7779aa7324510fd4dbd470f73e Mon Sep 17 00:00:00 2001
From: Amelie Delaunay <amelie.delaunay-qxv4g6HH51o@public.gmane.org>
Date: Tue, 27 Jun 2017 17:45:13 +0200
Subject: [PATCH] spi: stm32: use SoC specific compatible

This patch replaces st,stm32-spi compatible with st,stm32h7-spi SoC
specific compatible and updates the example accondingly.

Signed-off-by: Amelie Delaunay <amelie.delaunay-qxv4g6HH51o@public.gmane.org>
Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Signed-off-by: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
---
 Documentation/devicetree/bindings/spi/spi-stm32.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/spi/spi-stm32.txt b/Documentation/devicetree/bindings/spi/spi-stm32.txt
index 3958bf6e8b37..415378bca480 100644
--- a/Documentation/devicetree/bindings/spi/spi-stm32.txt
+++ b/Documentation/devicetree/bindings/spi/spi-stm32.txt
@@ -7,7 +7,7 @@ from 4 to 32-bit data size. Although it can be configured as master or slave,
 only master is supported by the driver.
 
 Required properties:
-- compatible: Must be "st,stm32-spi".
+- compatible: Must be "st,stm32h7-spi".
 - reg: Offset and length of the device's register set.
 - interrupts: Must contain the interrupt id.
 - clocks: Must contain an entry for spiclk (which feeds the internal clock
@@ -38,7 +38,7 @@ Example:
 	spi2: spi@40003800 {
 		#address-cells = <1>;
 		#size-cells = <0>;
-		compatible = "st,stm32-spi";
+		compatible = "st,stm32h7-spi";
 		reg = <0x40003800 0x400>;
 		interrupts = <36>;
 		clocks = <&rcc SPI2_CK>;
-- 
2.13.2

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Applied "spi: stm32: use SoC specific compatible" to the spi tree
@ 2017-06-28 19:25     ` Mark Brown
  0 siblings, 0 replies; 56+ messages in thread
From: Mark Brown @ 2017-06-28 19:25 UTC (permalink / raw)
  To: Amelie Delaunay
  Cc: Rob Herring, Mark Brown, Mark Brown, Rob Herring, Mark Rutland,
	Maxime Coquelin, Alexandre Torgue,
	linux-spi-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-spi-u79uwXL29TY76Z2rM5mHXA

The patch

   spi: stm32: use SoC specific compatible

has been applied to the spi tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git 

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

>From 567300d11ef54f7779aa7324510fd4dbd470f73e Mon Sep 17 00:00:00 2001
From: Amelie Delaunay <amelie.delaunay-qxv4g6HH51o@public.gmane.org>
Date: Tue, 27 Jun 2017 17:45:13 +0200
Subject: [PATCH] spi: stm32: use SoC specific compatible

This patch replaces st,stm32-spi compatible with st,stm32h7-spi SoC
specific compatible and updates the example accondingly.

Signed-off-by: Amelie Delaunay <amelie.delaunay-qxv4g6HH51o@public.gmane.org>
Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Signed-off-by: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
---
 Documentation/devicetree/bindings/spi/spi-stm32.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/spi/spi-stm32.txt b/Documentation/devicetree/bindings/spi/spi-stm32.txt
index 3958bf6e8b37..415378bca480 100644
--- a/Documentation/devicetree/bindings/spi/spi-stm32.txt
+++ b/Documentation/devicetree/bindings/spi/spi-stm32.txt
@@ -7,7 +7,7 @@ from 4 to 32-bit data size. Although it can be configured as master or slave,
 only master is supported by the driver.
 
 Required properties:
-- compatible: Must be "st,stm32-spi".
+- compatible: Must be "st,stm32h7-spi".
 - reg: Offset and length of the device's register set.
 - interrupts: Must contain the interrupt id.
 - clocks: Must contain an entry for spiclk (which feeds the internal clock
@@ -38,7 +38,7 @@ Example:
 	spi2: spi@40003800 {
 		#address-cells = <1>;
 		#size-cells = <0>;
-		compatible = "st,stm32-spi";
+		compatible = "st,stm32h7-spi";
 		reg = <0x40003800 0x400>;
 		interrupts = <36>;
 		clocks = <&rcc SPI2_CK>;
-- 
2.13.2

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Applied "spi: stm32: use SoC specific compatible" to the spi tree
@ 2017-06-28 19:25     ` Mark Brown
  0 siblings, 0 replies; 56+ messages in thread
From: Mark Brown @ 2017-06-28 19:25 UTC (permalink / raw)
  To: linux-arm-kernel

The patch

   spi: stm32: use SoC specific compatible

has been applied to the spi tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git 

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

>From 567300d11ef54f7779aa7324510fd4dbd470f73e Mon Sep 17 00:00:00 2001
From: Amelie Delaunay <amelie.delaunay@st.com>
Date: Tue, 27 Jun 2017 17:45:13 +0200
Subject: [PATCH] spi: stm32: use SoC specific compatible

This patch replaces st,stm32-spi compatible with st,stm32h7-spi SoC
specific compatible and updates the example accondingly.

Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 Documentation/devicetree/bindings/spi/spi-stm32.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/spi/spi-stm32.txt b/Documentation/devicetree/bindings/spi/spi-stm32.txt
index 3958bf6e8b37..415378bca480 100644
--- a/Documentation/devicetree/bindings/spi/spi-stm32.txt
+++ b/Documentation/devicetree/bindings/spi/spi-stm32.txt
@@ -7,7 +7,7 @@ from 4 to 32-bit data size. Although it can be configured as master or slave,
 only master is supported by the driver.
 
 Required properties:
-- compatible: Must be "st,stm32-spi".
+- compatible: Must be "st,stm32h7-spi".
 - reg: Offset and length of the device's register set.
 - interrupts: Must contain the interrupt id.
 - clocks: Must contain an entry for spiclk (which feeds the internal clock
@@ -38,7 +38,7 @@ Example:
 	spi2: spi at 40003800 {
 		#address-cells = <1>;
 		#size-cells = <0>;
-		compatible = "st,stm32-spi";
+		compatible = "st,stm32h7-spi";
 		reg = <0x40003800 0x400>;
 		interrupts = <36>;
 		clocks = <&rcc SPI2_CK>;
-- 
2.13.2

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

end of thread, other threads:[~2017-06-28 19:29 UTC | newest]

Thread overview: 56+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-23 12:55 [PATCH 0/8] STM32 SPI various fixes Amelie Delaunay
2017-06-23 12:55 ` Amelie Delaunay
2017-06-23 12:55 ` Amelie Delaunay
2017-06-23 12:55 ` [PATCH 1/8] dt-bindings: spi: stm32: use SoC specific compatible Amelie Delaunay
2017-06-23 12:55   ` Amelie Delaunay
2017-06-23 12:55   ` Amelie Delaunay
2017-06-26 19:08   ` Rob Herring
2017-06-26 19:08     ` Rob Herring
2017-06-26 19:08     ` Rob Herring
2017-06-28 19:25   ` Applied "spi: stm32: use SoC specific compatible" to the spi tree Mark Brown
2017-06-28 19:25     ` Mark Brown
2017-06-28 19:25     ` Mark Brown
2017-06-28 19:25     ` Mark Brown
2017-06-23 12:55 ` [PATCH 2/8] spi: stm32: fix compatible to fit with new bindings Amelie Delaunay
2017-06-23 12:55   ` Amelie Delaunay
2017-06-23 12:55   ` Amelie Delaunay
2017-06-28 19:25   ` Applied "spi: stm32: fix compatible to fit with new bindings" to the spi tree Mark Brown
2017-06-28 19:25     ` Mark Brown
2017-06-28 19:25     ` Mark Brown
2017-06-28 19:25     ` Mark Brown
2017-06-23 12:55 ` [PATCH 3/8] dt-bindings: spi: stm32: fix example with st,spi-midi-ns property Amelie Delaunay
2017-06-23 12:55   ` [PATCH 3/8] dt-bindings: spi: stm32: fix example with st, spi-midi-ns property Amelie Delaunay
2017-06-23 12:55   ` [PATCH 3/8] dt-bindings: spi: stm32: fix example with st,spi-midi-ns property Amelie Delaunay
2017-06-26 19:12   ` Rob Herring
2017-06-26 19:12     ` Rob Herring
2017-06-26 19:12     ` Rob Herring
2017-06-23 12:55 ` [PATCH 4/8] spi: stm32: replace st,spi-midi with st,spi-midi-ns to fit bindings Amelie Delaunay
2017-06-23 12:55   ` [PATCH 4/8] spi: stm32: replace st, spi-midi with st, spi-midi-ns " Amelie Delaunay
2017-06-23 12:55   ` Amelie Delaunay
2017-06-28 19:25   ` Applied "spi: stm32: replace st, spi-midi with st, spi-midi-ns to fit bindings" to the spi tree Mark Brown
2017-06-28 19:25     ` Mark Brown
2017-06-28 19:25     ` Mark Brown
2017-06-28 19:25     ` Mark Brown
2017-06-23 12:55 ` [PATCH 5/8] spi: stm32: use normal conditional statements instead of ternary operator Amelie Delaunay
2017-06-23 12:55   ` Amelie Delaunay
2017-06-23 12:55   ` Amelie Delaunay
2017-06-28 19:25   ` Applied "spi: stm32: use normal conditional statements instead of ternary operator" to the spi tree Mark Brown
2017-06-28 19:25     ` Mark Brown
2017-06-28 19:25     ` Mark Brown
2017-06-28 19:25     ` Mark Brown
2017-06-23 12:55 ` [PATCH 6/8] spi: stm32: add runtime PM support Amelie Delaunay
2017-06-23 12:55   ` Amelie Delaunay
2017-06-23 12:55   ` Amelie Delaunay
2017-06-28 19:25   ` Applied "spi: stm32: add runtime PM support" to the spi tree Mark Brown
2017-06-28 19:25     ` Mark Brown
2017-06-28 19:25     ` Mark Brown
2017-06-23 12:55 ` [PATCH 7/8] spi: stm32: enhance DMA error management Amelie Delaunay
2017-06-23 12:55   ` Amelie Delaunay
2017-06-23 12:55   ` Amelie Delaunay
2017-06-23 12:55   ` Amelie Delaunay
2017-06-23 12:55 ` [PATCH 8/8] spi: stm32: fix potential dereference null return value Amelie Delaunay
2017-06-23 12:55   ` Amelie Delaunay
2017-06-23 12:55   ` Amelie Delaunay
2017-06-28 19:25   ` Applied "spi: stm32: fix potential dereference null return value" to the spi tree Mark Brown
2017-06-28 19:25     ` Mark Brown
2017-06-28 19:25     ` Mark Brown

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.