Skip to contentSkip to conversation

patches for FPGA

PATCH In review Alan Tull 1 participant 5 messages Jan 24, 2019 – Jan 26, 2019 FPGA manager framework

lore
Share & tools
lore
author
#1 lore raw

PATCH 1/3 fpga: stratix10-soc: fix wrong of_node_put() in init function

In reply to Alan Tull

From: Nicolas Saenz Julienne <[email protected]>

After finding a "firmware" dt node stratix10 tries to match it's compatible string with it. To do so it's calling of_find_matching_node() which already takes care of decreasing the refcount on the "firmware" node. We are then incorrectly decreasing the refcount on that node again.

This patch removes the unwarranted call to of_node_put().

Fixes e7eef1d7633a ("fpga: add intel stratix10 soc fpga manager driver")
---
 drivers/fpga/stratix10-soc.c | 2 --
 1 file changed, 2 deletions(-)
drivers/fpga/stratix10-soc.c +0 -2
index a1a09e0..e75dbe5 100644
@@ -509,13 +509,11 @@ static int __init s10_init(void)
 
 	np = of_find_matching_node(fw_np, s10_of_match);
 	if (!np) {
-		of_node_put(fw_np);
 		return -ENODEV;
 	}
 
 	of_node_put(np);
 	ret = of_platform_populate(fw_np, s10_of_match, NULL, NULL);
-	of_node_put(fw_np);
 	if (ret)
 		return ret;
 
Signature · 1 line
2.7.4
author
#3 lore raw

PATCH 2/3 fpga: altera_freeze_bridge: remove restriction to socfpga

In reply to Alan Tull

The Altera Freeze Bridge should not be restricted to ARCH_SOCFPGA since it can be used on other platforms such as Stratix10.

---
 drivers/fpga/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/fpga/Kconfig +1 -1
index 0bb7b5c..c20445b 100644
@@ -104,7 +104,7 @@ config SOCFPGA_FPGA_BRIDGE
 
 config ALTERA_FREEZE_BRIDGE
 	tristate "Altera FPGA Freeze Bridge"
-	depends on ARCH_SOCFPGA && FPGA_BRIDGE
+	depends on FPGA_BRIDGE && HAS_IOMEM
 	help
 	  Say Y to enable drivers for Altera FPGA Freeze bridges.  A
 	  freeze bridge is a bridge that exists in the FPGA fabric to
Signature · 1 line
2.7.4
author
#4 lore raw

PATCH 3/3 fpga: mgr: altera-ps-spi: make array dummy static, shrinks object size

In reply to Alan Tull

From: Colin Ian King <[email protected]>

Don't populate the const array dummy on the stack but instead make it static. Makes the object code smaller by 26 bytes:

Before:
text data bss dec hex filename
7371 2032 0 9403 24bb drivers/fpga/altera-ps-spi.o

After:
text data bss dec hex filename
7281 2096 0 9377 24a1 drivers/fpga/altera-ps-spi.o

(gcc version 8.2.0 x86_64)

---
 drivers/fpga/altera-ps-spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/fpga/altera-ps-spi.c +1 -1
index 8c18bee..678d011 100644
@@ -205,7 +205,7 @@ static int altera_ps_write_complete(struct fpga_manager *mgr,
 				    struct fpga_image_info *info)
 {
 	struct altera_ps_conf *conf = mgr->priv;
-	const char dummy[] = {0};
+	static const char dummy[] = {0};
 	int ret;
 
 	if (gpiod_get_value_cansleep(conf->status)) {
Signature · 1 line
2.7.4

Alan Tull

author
#0 lore raw

cover patches for FPGA

Hi Greg,

Please take these patches for fpga. They have been reviewed on the mailing list and apply cleanly on current linux-next.

The "fpga: stratix10-soc: fix wrong of_node_put() in init function" is a bug fix, sorry it's late. It will only affect the Stratix10 platform.

The other two can go in whenever is appropriate.

Thanks,
Alan

Alan Tull (1):
fpga: altera_freeze_bridge: remove restriction to socfpga

Colin Ian King (1):
fpga: mgr: altera-ps-spi: make array dummy static, shrinks object size

Nicolas Saenz Julienne (1):
fpga: stratix10-soc: fix wrong of_node_put() in init function

 drivers/fpga/Kconfig         | 2 +-
 drivers/fpga/altera-ps-spi.c | 2 +-
 drivers/fpga/stratix10-soc.c | 2 --
 3 files changed, 2 insertions(+), 4 deletions(-)
Signature · 1 line
2.7.4
author
#2 lore raw

Re: [PATCH 1/3] fpga: stratix10-soc: fix wrong of_node_put() in init function

In reply to Alan Tull
Quoted 24 lines · Alan Tull

From: Nicolas Saenz Julienne <[email protected]>

After finding a "firmware" dt node stratix10 tries to match it's compatible string with it. To do so it's calling of_find_matching_node() which already takes care of decreasing the refcount on the "firmware" node. We are then incorrectly decreasing the refcount on that node again.

This patch removes the unwarranted call to of_node_put().

Fixes e7eef1d7633a ("fpga: add intel stratix10 soc fpga manager driver")
---
 drivers/fpga/stratix10-soc.c | 2 --
 1 file changed, 2 deletions(-)
drivers/fpga/stratix10-soc.c +0 -0
index a1a09e0..e75dbe5 100644

drivers/fpga/stratix10-soc.c static int __init s10_init(void) · line 513

Quoted 6 lines
drivers/fpga/stratix10-soc.c +0 -1
@@ -509,13 +509,11 @@ static int __init s10_init(void)
 
        np = of_find_matching_node(fw_np, s10_of_match);
        if (!np) {
-               of_node_put(fw_np);
                return -ENODEV;
        }

This leaves unnecessary braces around a single statement. I had said in the code review that I was going to clean that up. Arg! I'll resubmit this patch.

Alan

Quoted 10 lines
drivers/fpga/stratix10-soc.c +0 -2
        of_node_put(np);
        ret = of_platform_populate(fw_np, s10_of_match, NULL, NULL);
-       of_node_put(fw_np);
        if (ret)
                return ret;
 
--

2.7.4