linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] spi: rb4xx: null pointer bug fix
@ 2020-05-21 18:36 Christopher Hill
  2020-05-21 18:36 ` [PATCH 2/3] spi: rb4xx: update driver to be device tree aware Christopher Hill
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Christopher Hill @ 2020-05-21 18:36 UTC (permalink / raw)
  To: Mark Brown; +Cc: Christopher Hill, linux-spi, linux-kernel

This patch fixes a null pointer bug in the spi driver spi-rb4xx.c by
moving the private data initialization to earlier in probe

Signed-off-by: Christopher Hill <ch6574@gmail.com>
---
 drivers/spi/spi-rb4xx.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/spi/spi-rb4xx.c b/drivers/spi/spi-rb4xx.c
index 4c9620e0d18c..17e1a77dc132 100644
--- a/drivers/spi/spi-rb4xx.c
+++ b/drivers/spi/spi-rb4xx.c
@@ -158,6 +158,11 @@ static int rb4xx_spi_probe(struct platform_device *pdev)
 	master->transfer_one = rb4xx_transfer_one;
 	master->set_cs = rb4xx_set_cs;
 
+	rbspi = spi_master_get_devdata(master);
+	rbspi->base = spi_base;
+	rbspi->clk = ahb_clk;
+	platform_set_drvdata(pdev, rbspi);
+
 	err = devm_spi_register_master(&pdev->dev, master);
 	if (err) {
 		dev_err(&pdev->dev, "failed to register SPI master\n");
@@ -168,11 +173,6 @@ static int rb4xx_spi_probe(struct platform_device *pdev)
 	if (err)
 		return err;
 
-	rbspi = spi_master_get_devdata(master);
-	rbspi->base = spi_base;
-	rbspi->clk = ahb_clk;
-	platform_set_drvdata(pdev, rbspi);
-
 	/* Enable SPI */
 	rb4xx_write(rbspi, AR71XX_SPI_REG_FS, AR71XX_SPI_FS_GPIO);
 
-- 
2.25.1


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

* [PATCH 2/3] spi: rb4xx: update driver to be device tree aware
  2020-05-21 18:36 [PATCH 1/3] spi: rb4xx: null pointer bug fix Christopher Hill
@ 2020-05-21 18:36 ` Christopher Hill
  2020-05-21 18:36 ` [PATCH 3/3] spi: rb4xx: add corresponding device tree documentation Christopher Hill
  2020-05-22 19:00 ` [PATCH 1/3] spi: rb4xx: null pointer bug fix Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Christopher Hill @ 2020-05-21 18:36 UTC (permalink / raw)
  To: Mark Brown; +Cc: Christopher Hill, linux-spi, linux-kernel

This patch updates the spi driver spi-rb4xx.c to be device tree aware

Signed-off-by: Christopher Hill <ch6574@gmail.com>
---
 drivers/spi/spi-rb4xx.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/spi/spi-rb4xx.c b/drivers/spi/spi-rb4xx.c
index 17e1a77dc132..8aa51beb4ff3 100644
--- a/drivers/spi/spi-rb4xx.c
+++ b/drivers/spi/spi-rb4xx.c
@@ -14,6 +14,7 @@
 #include <linux/platform_device.h>
 #include <linux/clk.h>
 #include <linux/spi/spi.h>
+#include <linux/of.h>
 
 #include <asm/mach-ath79/ar71xx_regs.h>
 
@@ -150,6 +151,7 @@ static int rb4xx_spi_probe(struct platform_device *pdev)
 	if (IS_ERR(ahb_clk))
 		return PTR_ERR(ahb_clk);
 
+	master->dev.of_node = pdev->dev.of_node;
 	master->bus_num = 0;
 	master->num_chipselect = 3;
 	master->mode_bits = SPI_TX_DUAL;
@@ -188,11 +190,18 @@ static int rb4xx_spi_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static const struct of_device_id rb4xx_spi_dt_match[] = {
+	{ .compatible = "mikrotik,rb4xx-spi" },
+	{ },
+};
+MODULE_DEVICE_TABLE(of, rb4xx_spi_dt_match);
+
 static struct platform_driver rb4xx_spi_drv = {
 	.probe = rb4xx_spi_probe,
 	.remove = rb4xx_spi_remove,
 	.driver = {
 		.name = "rb4xx-spi",
+		.of_match_table = of_match_ptr(rb4xx_spi_dt_match),
 	},
 };
 
-- 
2.25.1


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

* [PATCH 3/3] spi: rb4xx: add corresponding device tree documentation
  2020-05-21 18:36 [PATCH 1/3] spi: rb4xx: null pointer bug fix Christopher Hill
  2020-05-21 18:36 ` [PATCH 2/3] spi: rb4xx: update driver to be device tree aware Christopher Hill
@ 2020-05-21 18:36 ` Christopher Hill
  2020-05-22 19:00 ` [PATCH 1/3] spi: rb4xx: null pointer bug fix Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Christopher Hill @ 2020-05-21 18:36 UTC (permalink / raw)
  To: Mark Brown
  Cc: Christopher Hill, Rob Herring, Sam Ravnborg, Maxime Ripard,
	Heiko Stuebner, Linus Walleij, Stephan Gerhold, linux-spi,
	devicetree, linux-kernel

This patch adds the correcsponding MikroTik vendor and device tree
documentation

Signed-off-by: Christopher Hill <ch6574@gmail.com>
---
 .../bindings/spi/mikrotik,rb4xx-spi.yaml      | 36 +++++++++++++++++++
 .../devicetree/bindings/vendor-prefixes.yaml  |  2 ++
 2 files changed, 38 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/spi/mikrotik,rb4xx-spi.yaml

diff --git a/Documentation/devicetree/bindings/spi/mikrotik,rb4xx-spi.yaml b/Documentation/devicetree/bindings/spi/mikrotik,rb4xx-spi.yaml
new file mode 100644
index 000000000000..4ddb42a4ae05
--- /dev/null
+++ b/Documentation/devicetree/bindings/spi/mikrotik,rb4xx-spi.yaml
@@ -0,0 +1,36 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/spi/mikrotik,rb4xx-spi.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: MikroTik RB4xx series SPI master
+
+maintainers:
+  - Gabor Juhos <juhosg@openwrt.org>
+  - Bert Vermeulen <bert@biot.com>
+
+allOf:
+  - $ref: "spi-controller.yaml#"
+
+properties:
+  compatible:
+    const: mikrotik,rb4xx-spi
+
+  reg:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+
+examples:
+  - |
+    spi: spi@1f000000 {
+        #address-cells = <1>;
+        #size-cells = <0>;
+        compatible = "mikrotik,rb4xx-spi";
+        reg = <0x1f000000 0x10>;
+    };
+
+...
\ No newline at end of file
diff --git a/Documentation/devicetree/bindings/vendor-prefixes.yaml b/Documentation/devicetree/bindings/vendor-prefixes.yaml
index d3891386d671..d3277fe6640b 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.yaml
+++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml
@@ -633,6 +633,8 @@ patternProperties:
     description: Microsoft Corporation
   "^mikroe,.*":
     description: MikroElektronika d.o.o.
+  "^mikrotik,.*":
+    description: MikroTik
   "^miniand,.*":
     description: Miniand Tech
   "^minix,.*":
-- 
2.25.1


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

* Re: [PATCH 1/3] spi: rb4xx: null pointer bug fix
  2020-05-21 18:36 [PATCH 1/3] spi: rb4xx: null pointer bug fix Christopher Hill
  2020-05-21 18:36 ` [PATCH 2/3] spi: rb4xx: update driver to be device tree aware Christopher Hill
  2020-05-21 18:36 ` [PATCH 3/3] spi: rb4xx: add corresponding device tree documentation Christopher Hill
@ 2020-05-22 19:00 ` Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2020-05-22 19:00 UTC (permalink / raw)
  To: Christopher Hill; +Cc: linux-kernel, linux-spi

On Thu, 21 May 2020 14:36:29 -0400, Christopher Hill wrote:
> This patch fixes a null pointer bug in the spi driver spi-rb4xx.c by
> moving the private data initialization to earlier in probe

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next

Thanks!

[1/3] spi: rb4xx: null pointer bug fix
      commit: 678e5e1e42d74f77a6e2e9feb6f95ed72a996251
[2/3] spi: rb4xx: update driver to be device tree aware
      commit: 9a436c62fbb4c57c6f0be01e4fc368ed5da6b730
[3/3] spi: rb4xx: add corresponding device tree documentation
      commit: 39690c8d1fa3cda70aaed9afc8cba3c0a8eb1f53

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

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

end of thread, other threads:[~2020-05-22 19:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-21 18:36 [PATCH 1/3] spi: rb4xx: null pointer bug fix Christopher Hill
2020-05-21 18:36 ` [PATCH 2/3] spi: rb4xx: update driver to be device tree aware Christopher Hill
2020-05-21 18:36 ` [PATCH 3/3] spi: rb4xx: add corresponding device tree documentation Christopher Hill
2020-05-22 19:00 ` [PATCH 1/3] spi: rb4xx: null pointer bug fix Mark Brown

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