* [PATCH 0/4] arm: make use of common scu_a9_get_base() interface
@ 2013-11-07 3:08 Jisheng Zhang
2013-11-07 3:08 ` [PATCH 1/4] arm: highbank: " Jisheng Zhang
` (7 more replies)
0 siblings, 8 replies; 13+ messages in thread
From: Jisheng Zhang @ 2013-11-07 3:08 UTC (permalink / raw)
To: rob.herring, linux, kernel, baohua, dinguyen
Cc: linux-arm-kernel, linux-kernel, Jisheng Zhang
Commit e9d6b3358ac35901ccc6a4a5a317670fa469db25 adds common APIs to
get scu base address from CP15. This patch series connverts some platforms
to use that interface.
Jisheng Zhang (4):
arm: highbank: make use of common scu_a9_get_base() interface
arm: imx: make use of common scu_a9_get_base() interface
arm: prima2: make use of common scu_a9_get_base() interface
arm: socfgpa: make use of common scu_a9_get_base() interface
arch/arm/mach-highbank/highbank.c | 4 ++--
arch/arm/mach-imx/platsmp.c | 3 +--
arch/arm/mach-prima2/platsmp.c | 3 +--
arch/arm/mach-socfpga/socfpga.c | 4 ++--
4 files changed, 6 insertions(+), 8 deletions(-)
--
1.8.4.2
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 1/4] arm: highbank: make use of common scu_a9_get_base() interface
2013-11-07 3:08 [PATCH 0/4] arm: make use of common scu_a9_get_base() interface Jisheng Zhang
@ 2013-11-07 3:08 ` Jisheng Zhang
2013-11-07 3:08 ` [PATCH v5 1/3] arm: mvebu: add missing of_node_put() to fix reference leak Jisheng Zhang
` (6 subsequent siblings)
7 siblings, 0 replies; 13+ messages in thread
From: Jisheng Zhang @ 2013-11-07 3:08 UTC (permalink / raw)
To: rob.herring, linux, kernel, baohua, dinguyen
Cc: linux-arm-kernel, linux-kernel, Jisheng Zhang
Make use of common scu_a9_get_base() and delete the comment since the
interface is self commented.
Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
---
arch/arm/mach-highbank/highbank.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-highbank/highbank.c b/arch/arm/mach-highbank/highbank.c
index 8e63ccd..7df007b 100644
--- a/arch/arm/mach-highbank/highbank.c
+++ b/arch/arm/mach-highbank/highbank.c
@@ -29,6 +29,7 @@
#include <asm/cacheflush.h>
#include <asm/cputype.h>
#include <asm/smp_plat.h>
+#include <asm/smp_scu.h>
#include <asm/hardware/cache-l2x0.h>
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
@@ -43,8 +44,7 @@ static void __init highbank_scu_map_io(void)
{
unsigned long base;
- /* Get SCU base */
- asm("mrc p15, 4, %0, c15, c0, 0" : "=r" (base));
+ base = scu_a9_get_base();
scu_base_addr = ioremap(base, SZ_4K);
}
--
1.8.4.2
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v5 1/3] arm: mvebu: add missing of_node_put() to fix reference leak
2013-11-07 3:08 [PATCH 0/4] arm: make use of common scu_a9_get_base() interface Jisheng Zhang
2013-11-07 3:08 ` [PATCH 1/4] arm: highbank: " Jisheng Zhang
@ 2013-11-07 3:08 ` Jisheng Zhang
2013-11-07 17:55 ` Gregory CLEMENT
2013-11-07 3:08 ` [PATCH 2/4] arm: imx: make use of common scu_a9_get_base() interface Jisheng Zhang
` (5 subsequent siblings)
7 siblings, 1 reply; 13+ messages in thread
From: Jisheng Zhang @ 2013-11-07 3:08 UTC (permalink / raw)
To: rob.herring, linux, kernel, baohua, dinguyen
Cc: linux-arm-kernel, linux-kernel, Jisheng Zhang
Add of_node_put to properly decrement the refcount when we are
done using a given node.
Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Reviewed-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
---
arch/arm/mach-mvebu/armada-370-xp.c | 1 +
arch/arm/mach-mvebu/coherency.c | 8 +++++++-
arch/arm/mach-mvebu/platsmp.c | 1 +
arch/arm/mach-mvebu/pmsu.c | 1 +
arch/arm/mach-mvebu/system-controller.c | 1 +
5 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-mvebu/armada-370-xp.c b/arch/arm/mach-mvebu/armada-370-xp.c
index 97cbb80..8a1ae83 100644
--- a/arch/arm/mach-mvebu/armada-370-xp.c
+++ b/arch/arm/mach-mvebu/armada-370-xp.c
@@ -64,6 +64,7 @@ static void __init armada_370_xp_mbus_init(void)
ARMADA_370_XP_MBUS_WINS_SIZE,
of_translate_address(dn, &sdram_wins_offs),
ARMADA_370_XP_SDRAM_WINS_SIZE);
+ of_node_put(dn);
}
static void __init armada_370_xp_timer_and_clk_init(void)
diff --git a/arch/arm/mach-mvebu/coherency.c b/arch/arm/mach-mvebu/coherency.c
index 4c24303..58adf2f 100644
--- a/arch/arm/mach-mvebu/coherency.c
+++ b/arch/arm/mach-mvebu/coherency.c
@@ -140,6 +140,7 @@ int __init coherency_init(void)
coherency_base = of_iomap(np, 0);
coherency_cpu_base = of_iomap(np, 1);
set_cpu_coherent(cpu_logical_map(smp_processor_id()), 0);
+ of_node_put(np);
}
return 0;
@@ -147,9 +148,14 @@ int __init coherency_init(void)
static int __init coherency_late_init(void)
{
- if (of_find_matching_node(NULL, of_coherency_table))
+ struct device_node *np;
+
+ np = of_find_matching_node(NULL, of_coherency_table);
+ if (np) {
bus_register_notifier(&platform_bus_type,
&mvebu_hwcc_platform_nb);
+ of_node_put(np);
+ }
return 0;
}
diff --git a/arch/arm/mach-mvebu/platsmp.c b/arch/arm/mach-mvebu/platsmp.c
index ce81d30..e7edb82 100644
--- a/arch/arm/mach-mvebu/platsmp.c
+++ b/arch/arm/mach-mvebu/platsmp.c
@@ -95,6 +95,7 @@ static void __init armada_xp_smp_init_cpus(void)
panic("No 'cpus' node found\n");
ncores = of_get_child_count(np);
+ of_node_put(np);
if (ncores == 0 || ncores > ARMADA_XP_MAX_CPUS)
panic("Invalid number of CPUs in DT\n");
diff --git a/arch/arm/mach-mvebu/pmsu.c b/arch/arm/mach-mvebu/pmsu.c
index 3cc4bef..27fc4f0 100644
--- a/arch/arm/mach-mvebu/pmsu.c
+++ b/arch/arm/mach-mvebu/pmsu.c
@@ -67,6 +67,7 @@ int __init armada_370_xp_pmsu_init(void)
pr_info("Initializing Power Management Service Unit\n");
pmsu_mp_base = of_iomap(np, 0);
pmsu_reset_base = of_iomap(np, 1);
+ of_node_put(np);
}
return 0;
diff --git a/arch/arm/mach-mvebu/system-controller.c b/arch/arm/mach-mvebu/system-controller.c
index f875124..5175083c 100644
--- a/arch/arm/mach-mvebu/system-controller.c
+++ b/arch/arm/mach-mvebu/system-controller.c
@@ -98,6 +98,7 @@ static int __init mvebu_system_controller_init(void)
BUG_ON(!match);
system_controller_base = of_iomap(np, 0);
mvebu_sc = (struct mvebu_system_controller *)match->data;
+ of_node_put(np);
}
return 0;
--
1.8.4.rc3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 2/4] arm: imx: make use of common scu_a9_get_base() interface
2013-11-07 3:08 [PATCH 0/4] arm: make use of common scu_a9_get_base() interface Jisheng Zhang
2013-11-07 3:08 ` [PATCH 1/4] arm: highbank: " Jisheng Zhang
2013-11-07 3:08 ` [PATCH v5 1/3] arm: mvebu: add missing of_node_put() to fix reference leak Jisheng Zhang
@ 2013-11-07 3:08 ` Jisheng Zhang
2013-11-07 3:08 ` [PATCH v5 2/3] bus: mvebu: add missing of_node_put() to fix reference leak Jisheng Zhang
` (4 subsequent siblings)
7 siblings, 0 replies; 13+ messages in thread
From: Jisheng Zhang @ 2013-11-07 3:08 UTC (permalink / raw)
To: rob.herring, linux, kernel, baohua, dinguyen
Cc: linux-arm-kernel, linux-kernel, Jisheng Zhang
Make use of common scu_a9_get_base() and delete the comment since the
interface is self commented.
Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
---
arch/arm/mach-imx/platsmp.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/arch/arm/mach-imx/platsmp.c b/arch/arm/mach-imx/platsmp.c
index 1f24c1f..369a566 100644
--- a/arch/arm/mach-imx/platsmp.c
+++ b/arch/arm/mach-imx/platsmp.c
@@ -35,8 +35,7 @@ void __init imx_scu_map_io(void)
{
unsigned long base;
- /* Get SCU base */
- asm("mrc p15, 4, %0, c15, c0, 0" : "=r" (base));
+ base = scu_a9_get_base();
scu_io_desc.virtual = IMX_IO_P2V(base);
scu_io_desc.pfn = __phys_to_pfn(base);
--
1.8.4.2
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v5 2/3] bus: mvebu: add missing of_node_put() to fix reference leak
2013-11-07 3:08 [PATCH 0/4] arm: make use of common scu_a9_get_base() interface Jisheng Zhang
` (2 preceding siblings ...)
2013-11-07 3:08 ` [PATCH 2/4] arm: imx: make use of common scu_a9_get_base() interface Jisheng Zhang
@ 2013-11-07 3:08 ` Jisheng Zhang
2013-11-07 17:56 ` Gregory CLEMENT
2013-11-07 3:08 ` [PATCH 3/4] arm: prima2: make use of common scu_a9_get_base() interface Jisheng Zhang
` (3 subsequent siblings)
7 siblings, 1 reply; 13+ messages in thread
From: Jisheng Zhang @ 2013-11-07 3:08 UTC (permalink / raw)
To: rob.herring, linux, kernel, baohua, dinguyen
Cc: linux-arm-kernel, linux-kernel, Jisheng Zhang
Add of_node_put to properly decrement the refcount when we are
done using a given node.
Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Reviewed-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
---
drivers/bus/mvebu-mbus.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/bus/mvebu-mbus.c b/drivers/bus/mvebu-mbus.c
index 33c6947..20da90f 100644
--- a/drivers/bus/mvebu-mbus.c
+++ b/drivers/bus/mvebu-mbus.c
@@ -837,6 +837,7 @@ int __init mvebu_mbus_init(const char *soc, phys_addr_t mbuswins_phys_base,
{
struct mvebu_mbus_state *mbus = &mbus_state;
const struct of_device_id *of_id;
+ struct device_node *np;
int win;
for (of_id = of_mvebu_mbus_ids; of_id->compatible; of_id++)
@@ -860,8 +861,11 @@ int __init mvebu_mbus_init(const char *soc, phys_addr_t mbuswins_phys_base,
return -ENOMEM;
}
- if (of_find_compatible_node(NULL, NULL, "marvell,coherency-fabric"))
+ np = of_find_compatible_node(NULL, NULL, "marvell,coherency-fabric");
+ if (np) {
mbus->hw_io_coherency = 1;
+ of_node_put(np);
+ }
for (win = 0; win < mbus->soc->num_wins; win++)
mvebu_mbus_disable_window(mbus, win);
--
1.8.4.rc3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 3/4] arm: prima2: make use of common scu_a9_get_base() interface
2013-11-07 3:08 [PATCH 0/4] arm: make use of common scu_a9_get_base() interface Jisheng Zhang
` (3 preceding siblings ...)
2013-11-07 3:08 ` [PATCH v5 2/3] bus: mvebu: add missing of_node_put() to fix reference leak Jisheng Zhang
@ 2013-11-07 3:08 ` Jisheng Zhang
2013-11-07 3:08 ` [PATCH v5 3/3] pinctrl: mvebu: Convert to use devm_ioremap_resource Jisheng Zhang
` (2 subsequent siblings)
7 siblings, 0 replies; 13+ messages in thread
From: Jisheng Zhang @ 2013-11-07 3:08 UTC (permalink / raw)
To: rob.herring, linux, kernel, baohua, dinguyen
Cc: linux-arm-kernel, linux-kernel, Jisheng Zhang
Make use of common scu_a9_get_base() and delete the comment since the
interface is self commented.
Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
---
arch/arm/mach-prima2/platsmp.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/arch/arm/mach-prima2/platsmp.c b/arch/arm/mach-prima2/platsmp.c
index 3dbcb1a..2d5bcc9 100644
--- a/arch/arm/mach-prima2/platsmp.c
+++ b/arch/arm/mach-prima2/platsmp.c
@@ -34,8 +34,7 @@ void __init sirfsoc_map_scu(void)
{
unsigned long base;
- /* Get SCU base */
- asm("mrc p15, 4, %0, c15, c0, 0" : "=r" (base));
+ base = scu_a9_get_base();
scu_io_desc.virtual = SIRFSOC_VA(base);
scu_io_desc.pfn = __phys_to_pfn(base);
--
1.8.4.2
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v5 3/3] pinctrl: mvebu: Convert to use devm_ioremap_resource
2013-11-07 3:08 [PATCH 0/4] arm: make use of common scu_a9_get_base() interface Jisheng Zhang
` (4 preceding siblings ...)
2013-11-07 3:08 ` [PATCH 3/4] arm: prima2: make use of common scu_a9_get_base() interface Jisheng Zhang
@ 2013-11-07 3:08 ` Jisheng Zhang
2013-11-07 17:57 ` Gregory CLEMENT
2013-11-07 3:08 ` [PATCH 4/4] arm: socfgpa: make use of common scu_a9_get_base() interface Jisheng Zhang
2013-11-07 3:13 ` [PATCH 0/4] arm: " Jisheng Zhang
7 siblings, 1 reply; 13+ messages in thread
From: Jisheng Zhang @ 2013-11-07 3:08 UTC (permalink / raw)
To: rob.herring, linux, kernel, baohua, dinguyen
Cc: linux-arm-kernel, linux-kernel, Jisheng Zhang
The resource mapped by of_iomap() isn't unmapped in error path. This
patch fix the resource leakage by using devm_ioremap_resource() instead
of of_iomap().
Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Reviewed-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Acked-by: Jason Cooper <jason@lakedaemon.net>
---
drivers/pinctrl/mvebu/pinctrl-mvebu.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/drivers/pinctrl/mvebu/pinctrl-mvebu.c b/drivers/pinctrl/mvebu/pinctrl-mvebu.c
index bb7ddb1..1caa45f 100644
--- a/drivers/pinctrl/mvebu/pinctrl-mvebu.c
+++ b/drivers/pinctrl/mvebu/pinctrl-mvebu.c
@@ -579,7 +579,7 @@ static int mvebu_pinctrl_build_functions(struct platform_device *pdev,
int mvebu_pinctrl_probe(struct platform_device *pdev)
{
struct mvebu_pinctrl_soc_info *soc = dev_get_platdata(&pdev->dev);
- struct device_node *np = pdev->dev.of_node;
+ struct resource *res;
struct mvebu_pinctrl *pctl;
void __iomem *base;
struct pinctrl_pin_desc *pdesc;
@@ -591,11 +591,10 @@ int mvebu_pinctrl_probe(struct platform_device *pdev)
return -EINVAL;
}
- base = of_iomap(np, 0);
- if (!base) {
- dev_err(&pdev->dev, "unable to get base address\n");
- return -ENODEV;
- }
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ base = devm_ioremap_resource(&pdev->dev, res);
+ if (IS_ERR(base))
+ return PTR_ERR(base);
pctl = devm_kzalloc(&pdev->dev, sizeof(struct mvebu_pinctrl),
GFP_KERNEL);
--
1.8.4.rc3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 4/4] arm: socfgpa: make use of common scu_a9_get_base() interface
2013-11-07 3:08 [PATCH 0/4] arm: make use of common scu_a9_get_base() interface Jisheng Zhang
` (5 preceding siblings ...)
2013-11-07 3:08 ` [PATCH v5 3/3] pinctrl: mvebu: Convert to use devm_ioremap_resource Jisheng Zhang
@ 2013-11-07 3:08 ` Jisheng Zhang
2013-11-07 3:13 ` [PATCH 0/4] arm: " Jisheng Zhang
7 siblings, 0 replies; 13+ messages in thread
From: Jisheng Zhang @ 2013-11-07 3:08 UTC (permalink / raw)
To: rob.herring, linux, kernel, baohua, dinguyen
Cc: linux-arm-kernel, linux-kernel, Jisheng Zhang
Make use of common scu_a9_get_base() and delete the comment since the
interface is self commented.
Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
---
arch/arm/mach-socfpga/socfpga.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-socfpga/socfpga.c b/arch/arm/mach-socfpga/socfpga.c
index bfce964..b695887 100644
--- a/arch/arm/mach-socfpga/socfpga.c
+++ b/arch/arm/mach-socfpga/socfpga.c
@@ -24,6 +24,7 @@
#include <asm/hardware/cache-l2x0.h>
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
+#include <asm/smp_scu.h>
#include "core.h"
@@ -51,8 +52,7 @@ static void __init socfpga_scu_map_io(void)
{
unsigned long base;
- /* Get SCU base */
- asm("mrc p15, 4, %0, c15, c0, 0" : "=r" (base));
+ base = scu_a9_get_base();
scu_io_desc.pfn = __phys_to_pfn(base);
iotable_init(&scu_io_desc, 1);
--
1.8.4.2
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH 0/4] arm: make use of common scu_a9_get_base() interface
2013-11-07 3:08 [PATCH 0/4] arm: make use of common scu_a9_get_base() interface Jisheng Zhang
` (6 preceding siblings ...)
2013-11-07 3:08 ` [PATCH 4/4] arm: socfgpa: make use of common scu_a9_get_base() interface Jisheng Zhang
@ 2013-11-07 3:13 ` Jisheng Zhang
7 siblings, 0 replies; 13+ messages in thread
From: Jisheng Zhang @ 2013-11-07 3:13 UTC (permalink / raw)
To: Jisheng Zhang
Cc: rob.herring, linux, kernel, baohua, dinguyen, linux-arm-kernel,
linux-kernel
On Wed, 6 Nov 2013 19:08:33 -0800
Jisheng Zhang <jszhang@marvell.com> wrote:
> Commit e9d6b3358ac35901ccc6a4a5a317670fa469db25 adds common APIs to
> get scu base address from CP15. This patch series connverts some platforms
> to use that interface.
OOPS, sorry, I made an mistake when generating patches. Please ignore this
serials. I'll submit V2 soon
Sorry again.
Jisheng
>
> Jisheng Zhang (4):
> arm: highbank: make use of common scu_a9_get_base() interface
> arm: imx: make use of common scu_a9_get_base() interface
> arm: prima2: make use of common scu_a9_get_base() interface
> arm: socfgpa: make use of common scu_a9_get_base() interface
>
> arch/arm/mach-highbank/highbank.c | 4 ++--
> arch/arm/mach-imx/platsmp.c | 3 +--
> arch/arm/mach-prima2/platsmp.c | 3 +--
> arch/arm/mach-socfpga/socfpga.c | 4 ++--
> 4 files changed, 6 insertions(+), 8 deletions(-)
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v5 1/3] arm: mvebu: add missing of_node_put() to fix reference leak
2013-11-07 3:08 ` [PATCH v5 1/3] arm: mvebu: add missing of_node_put() to fix reference leak Jisheng Zhang
@ 2013-11-07 17:55 ` Gregory CLEMENT
0 siblings, 0 replies; 13+ messages in thread
From: Gregory CLEMENT @ 2013-11-07 17:55 UTC (permalink / raw)
To: Jisheng Zhang, rob.herring, linux, kernel, baohua, dinguyen
Cc: linux-kernel, linux-arm-kernel
On 07/11/2013 04:08, Jisheng Zhang wrote:
> Add of_node_put to properly decrement the refcount when we are
> done using a given node.
>
> Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
> Reviewed-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Seems ok for me too
Acked-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Thanks,
Gregory
> ---
> arch/arm/mach-mvebu/armada-370-xp.c | 1 +
> arch/arm/mach-mvebu/coherency.c | 8 +++++++-
> arch/arm/mach-mvebu/platsmp.c | 1 +
> arch/arm/mach-mvebu/pmsu.c | 1 +
> arch/arm/mach-mvebu/system-controller.c | 1 +
> 5 files changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm/mach-mvebu/armada-370-xp.c b/arch/arm/mach-mvebu/armada-370-xp.c
> index 97cbb80..8a1ae83 100644
> --- a/arch/arm/mach-mvebu/armada-370-xp.c
> +++ b/arch/arm/mach-mvebu/armada-370-xp.c
> @@ -64,6 +64,7 @@ static void __init armada_370_xp_mbus_init(void)
> ARMADA_370_XP_MBUS_WINS_SIZE,
> of_translate_address(dn, &sdram_wins_offs),
> ARMADA_370_XP_SDRAM_WINS_SIZE);
> + of_node_put(dn);
> }
>
> static void __init armada_370_xp_timer_and_clk_init(void)
> diff --git a/arch/arm/mach-mvebu/coherency.c b/arch/arm/mach-mvebu/coherency.c
> index 4c24303..58adf2f 100644
> --- a/arch/arm/mach-mvebu/coherency.c
> +++ b/arch/arm/mach-mvebu/coherency.c
> @@ -140,6 +140,7 @@ int __init coherency_init(void)
> coherency_base = of_iomap(np, 0);
> coherency_cpu_base = of_iomap(np, 1);
> set_cpu_coherent(cpu_logical_map(smp_processor_id()), 0);
> + of_node_put(np);
> }
>
> return 0;
> @@ -147,9 +148,14 @@ int __init coherency_init(void)
>
> static int __init coherency_late_init(void)
> {
> - if (of_find_matching_node(NULL, of_coherency_table))
> + struct device_node *np;
> +
> + np = of_find_matching_node(NULL, of_coherency_table);
> + if (np) {
> bus_register_notifier(&platform_bus_type,
> &mvebu_hwcc_platform_nb);
> + of_node_put(np);
> + }
> return 0;
> }
>
> diff --git a/arch/arm/mach-mvebu/platsmp.c b/arch/arm/mach-mvebu/platsmp.c
> index ce81d30..e7edb82 100644
> --- a/arch/arm/mach-mvebu/platsmp.c
> +++ b/arch/arm/mach-mvebu/platsmp.c
> @@ -95,6 +95,7 @@ static void __init armada_xp_smp_init_cpus(void)
> panic("No 'cpus' node found\n");
>
> ncores = of_get_child_count(np);
> + of_node_put(np);
> if (ncores == 0 || ncores > ARMADA_XP_MAX_CPUS)
> panic("Invalid number of CPUs in DT\n");
>
> diff --git a/arch/arm/mach-mvebu/pmsu.c b/arch/arm/mach-mvebu/pmsu.c
> index 3cc4bef..27fc4f0 100644
> --- a/arch/arm/mach-mvebu/pmsu.c
> +++ b/arch/arm/mach-mvebu/pmsu.c
> @@ -67,6 +67,7 @@ int __init armada_370_xp_pmsu_init(void)
> pr_info("Initializing Power Management Service Unit\n");
> pmsu_mp_base = of_iomap(np, 0);
> pmsu_reset_base = of_iomap(np, 1);
> + of_node_put(np);
> }
>
> return 0;
> diff --git a/arch/arm/mach-mvebu/system-controller.c b/arch/arm/mach-mvebu/system-controller.c
> index f875124..5175083c 100644
> --- a/arch/arm/mach-mvebu/system-controller.c
> +++ b/arch/arm/mach-mvebu/system-controller.c
> @@ -98,6 +98,7 @@ static int __init mvebu_system_controller_init(void)
> BUG_ON(!match);
> system_controller_base = of_iomap(np, 0);
> mvebu_sc = (struct mvebu_system_controller *)match->data;
> + of_node_put(np);
> }
>
> return 0;
>
--
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v5 2/3] bus: mvebu: add missing of_node_put() to fix reference leak
2013-11-07 3:08 ` [PATCH v5 2/3] bus: mvebu: add missing of_node_put() to fix reference leak Jisheng Zhang
@ 2013-11-07 17:56 ` Gregory CLEMENT
0 siblings, 0 replies; 13+ messages in thread
From: Gregory CLEMENT @ 2013-11-07 17:56 UTC (permalink / raw)
To: Jisheng Zhang, rob.herring, linux, kernel, baohua, dinguyen
Cc: linux-kernel, linux-arm-kernel
On 07/11/2013 04:08, Jisheng Zhang wrote:
> Add of_node_put to properly decrement the refcount when we are
> done using a given node.
>
> Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
> Reviewed-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Acked-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Thanks,
Gregory
> ---
> drivers/bus/mvebu-mbus.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/bus/mvebu-mbus.c b/drivers/bus/mvebu-mbus.c
> index 33c6947..20da90f 100644
> --- a/drivers/bus/mvebu-mbus.c
> +++ b/drivers/bus/mvebu-mbus.c
> @@ -837,6 +837,7 @@ int __init mvebu_mbus_init(const char *soc, phys_addr_t mbuswins_phys_base,
> {
> struct mvebu_mbus_state *mbus = &mbus_state;
> const struct of_device_id *of_id;
> + struct device_node *np;
> int win;
>
> for (of_id = of_mvebu_mbus_ids; of_id->compatible; of_id++)
> @@ -860,8 +861,11 @@ int __init mvebu_mbus_init(const char *soc, phys_addr_t mbuswins_phys_base,
> return -ENOMEM;
> }
>
> - if (of_find_compatible_node(NULL, NULL, "marvell,coherency-fabric"))
> + np = of_find_compatible_node(NULL, NULL, "marvell,coherency-fabric");
> + if (np) {
> mbus->hw_io_coherency = 1;
> + of_node_put(np);
> + }
>
> for (win = 0; win < mbus->soc->num_wins; win++)
> mvebu_mbus_disable_window(mbus, win);
>
--
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v5 3/3] pinctrl: mvebu: Convert to use devm_ioremap_resource
2013-11-07 3:08 ` [PATCH v5 3/3] pinctrl: mvebu: Convert to use devm_ioremap_resource Jisheng Zhang
@ 2013-11-07 17:57 ` Gregory CLEMENT
0 siblings, 0 replies; 13+ messages in thread
From: Gregory CLEMENT @ 2013-11-07 17:57 UTC (permalink / raw)
To: Jisheng Zhang, rob.herring, linux, kernel, baohua, dinguyen
Cc: linux-kernel, linux-arm-kernel
On 07/11/2013 04:08, Jisheng Zhang wrote:
> The resource mapped by of_iomap() isn't unmapped in error path. This
> patch fix the resource leakage by using devm_ioremap_resource() instead
> of of_iomap().
>
> Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
> Reviewed-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
> Acked-by: Jason Cooper <jason@lakedaemon.net>
Acked-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Thanks,
Gregory
> ---
> drivers/pinctrl/mvebu/pinctrl-mvebu.c | 11 +++++------
> 1 file changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/pinctrl/mvebu/pinctrl-mvebu.c b/drivers/pinctrl/mvebu/pinctrl-mvebu.c
> index bb7ddb1..1caa45f 100644
> --- a/drivers/pinctrl/mvebu/pinctrl-mvebu.c
> +++ b/drivers/pinctrl/mvebu/pinctrl-mvebu.c
> @@ -579,7 +579,7 @@ static int mvebu_pinctrl_build_functions(struct platform_device *pdev,
> int mvebu_pinctrl_probe(struct platform_device *pdev)
> {
> struct mvebu_pinctrl_soc_info *soc = dev_get_platdata(&pdev->dev);
> - struct device_node *np = pdev->dev.of_node;
> + struct resource *res;
> struct mvebu_pinctrl *pctl;
> void __iomem *base;
> struct pinctrl_pin_desc *pdesc;
> @@ -591,11 +591,10 @@ int mvebu_pinctrl_probe(struct platform_device *pdev)
> return -EINVAL;
> }
>
> - base = of_iomap(np, 0);
> - if (!base) {
> - dev_err(&pdev->dev, "unable to get base address\n");
> - return -ENODEV;
> - }
> + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> + base = devm_ioremap_resource(&pdev->dev, res);
> + if (IS_ERR(base))
> + return PTR_ERR(base);
>
> pctl = devm_kzalloc(&pdev->dev, sizeof(struct mvebu_pinctrl),
> GFP_KERNEL);
>
--
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v5 1/3] arm: mvebu: add missing of_node_put() to fix reference leak
2013-08-27 4:41 [PATCH v5 0/3] arm: mvebu: fix resource leak Jisheng Zhang
@ 2013-08-27 4:41 ` Jisheng Zhang
0 siblings, 0 replies; 13+ messages in thread
From: Jisheng Zhang @ 2013-08-27 4:41 UTC (permalink / raw)
To: jszhang, jason, andrew, gregory.clement, thomas.petazzoni,
ezequiel.garcia, mturquette, sebastian.hesselbarth,
linus.walleij
Cc: linux, linux-arm-kernel, linux-kernel
Add of_node_put to properly decrement the refcount when we are
done using a given node.
Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Reviewed-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
---
arch/arm/mach-mvebu/armada-370-xp.c | 1 +
arch/arm/mach-mvebu/coherency.c | 8 +++++++-
arch/arm/mach-mvebu/platsmp.c | 1 +
arch/arm/mach-mvebu/pmsu.c | 1 +
arch/arm/mach-mvebu/system-controller.c | 1 +
5 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-mvebu/armada-370-xp.c b/arch/arm/mach-mvebu/armada-370-xp.c
index 97cbb80..8a1ae83 100644
--- a/arch/arm/mach-mvebu/armada-370-xp.c
+++ b/arch/arm/mach-mvebu/armada-370-xp.c
@@ -64,6 +64,7 @@ static void __init armada_370_xp_mbus_init(void)
ARMADA_370_XP_MBUS_WINS_SIZE,
of_translate_address(dn, &sdram_wins_offs),
ARMADA_370_XP_SDRAM_WINS_SIZE);
+ of_node_put(dn);
}
static void __init armada_370_xp_timer_and_clk_init(void)
diff --git a/arch/arm/mach-mvebu/coherency.c b/arch/arm/mach-mvebu/coherency.c
index 4c24303..58adf2f 100644
--- a/arch/arm/mach-mvebu/coherency.c
+++ b/arch/arm/mach-mvebu/coherency.c
@@ -140,6 +140,7 @@ int __init coherency_init(void)
coherency_base = of_iomap(np, 0);
coherency_cpu_base = of_iomap(np, 1);
set_cpu_coherent(cpu_logical_map(smp_processor_id()), 0);
+ of_node_put(np);
}
return 0;
@@ -147,9 +148,14 @@ int __init coherency_init(void)
static int __init coherency_late_init(void)
{
- if (of_find_matching_node(NULL, of_coherency_table))
+ struct device_node *np;
+
+ np = of_find_matching_node(NULL, of_coherency_table);
+ if (np) {
bus_register_notifier(&platform_bus_type,
&mvebu_hwcc_platform_nb);
+ of_node_put(np);
+ }
return 0;
}
diff --git a/arch/arm/mach-mvebu/platsmp.c b/arch/arm/mach-mvebu/platsmp.c
index ce81d30..e7edb82 100644
--- a/arch/arm/mach-mvebu/platsmp.c
+++ b/arch/arm/mach-mvebu/platsmp.c
@@ -95,6 +95,7 @@ static void __init armada_xp_smp_init_cpus(void)
panic("No 'cpus' node found\n");
ncores = of_get_child_count(np);
+ of_node_put(np);
if (ncores == 0 || ncores > ARMADA_XP_MAX_CPUS)
panic("Invalid number of CPUs in DT\n");
diff --git a/arch/arm/mach-mvebu/pmsu.c b/arch/arm/mach-mvebu/pmsu.c
index 3cc4bef..27fc4f0 100644
--- a/arch/arm/mach-mvebu/pmsu.c
+++ b/arch/arm/mach-mvebu/pmsu.c
@@ -67,6 +67,7 @@ int __init armada_370_xp_pmsu_init(void)
pr_info("Initializing Power Management Service Unit\n");
pmsu_mp_base = of_iomap(np, 0);
pmsu_reset_base = of_iomap(np, 1);
+ of_node_put(np);
}
return 0;
diff --git a/arch/arm/mach-mvebu/system-controller.c b/arch/arm/mach-mvebu/system-controller.c
index f875124..5175083c 100644
--- a/arch/arm/mach-mvebu/system-controller.c
+++ b/arch/arm/mach-mvebu/system-controller.c
@@ -98,6 +98,7 @@ static int __init mvebu_system_controller_init(void)
BUG_ON(!match);
system_controller_base = of_iomap(np, 0);
mvebu_sc = (struct mvebu_system_controller *)match->data;
+ of_node_put(np);
}
return 0;
--
1.8.4.rc3
^ permalink raw reply related [flat|nested] 13+ messages in thread
end of thread, other threads:[~2013-11-07 17:57 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-07 3:08 [PATCH 0/4] arm: make use of common scu_a9_get_base() interface Jisheng Zhang
2013-11-07 3:08 ` [PATCH 1/4] arm: highbank: " Jisheng Zhang
2013-11-07 3:08 ` [PATCH v5 1/3] arm: mvebu: add missing of_node_put() to fix reference leak Jisheng Zhang
2013-11-07 17:55 ` Gregory CLEMENT
2013-11-07 3:08 ` [PATCH 2/4] arm: imx: make use of common scu_a9_get_base() interface Jisheng Zhang
2013-11-07 3:08 ` [PATCH v5 2/3] bus: mvebu: add missing of_node_put() to fix reference leak Jisheng Zhang
2013-11-07 17:56 ` Gregory CLEMENT
2013-11-07 3:08 ` [PATCH 3/4] arm: prima2: make use of common scu_a9_get_base() interface Jisheng Zhang
2013-11-07 3:08 ` [PATCH v5 3/3] pinctrl: mvebu: Convert to use devm_ioremap_resource Jisheng Zhang
2013-11-07 17:57 ` Gregory CLEMENT
2013-11-07 3:08 ` [PATCH 4/4] arm: socfgpa: make use of common scu_a9_get_base() interface Jisheng Zhang
2013-11-07 3:13 ` [PATCH 0/4] arm: " Jisheng Zhang
-- strict thread matches above, loose matches on Subject: below --
2013-08-27 4:41 [PATCH v5 0/3] arm: mvebu: fix resource leak Jisheng Zhang
2013-08-27 4:41 ` [PATCH v5 1/3] arm: mvebu: add missing of_node_put() to fix reference leak Jisheng Zhang
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).