* [GIT PULL] arm: Allwinner clocks changes for 4.6
@ 2016-02-26 19:48 Maxime Ripard
2016-03-02 0:20 ` [PATCH] clk: sunxi: Remove use of VLAIS Stephen Boyd
2016-03-02 1:46 ` [GIT PULL] arm: Allwinner clocks changes for 4.6 Stephen Boyd
0 siblings, 2 replies; 14+ messages in thread
From: Maxime Ripard @ 2016-02-26 19:48 UTC (permalink / raw)
To: Mike Turquette, Stephen Boyd; +Cc: linux-clk, linux-arm-kernel, Chen-Yu Tsai
[-- Attachment #1: Type: text/plain, Size: 3648 bytes --]
The following changes since commit 92e963f50fc74041b5e9e744c330dca48e04f08d:
Linux 4.5-rc1 (2016-01-24 13:06:47 -0800)
are available in the git repository at:
https://git.kernel.org/pub/scm/linux/kernel/git/mripard/linux.git tags/sunxi-clocks-for-4.6
for you to fetch changes up to 6e17b4181603d183d20c73f4535529ddf2a2a020:
clk: sunxi: Add apb0 gates for H3 (2016-02-25 11:30:32 -0800)
----------------------------------------------------------------
Allwinner clocks additions for 4.6
A bunch of things, mostly:
- Finally switched everything over to OF_CLK_DECLARE, which should remove
orphans clocks entirely
- Reworked the clk-factors to be able to add new parameters
- Improved the error reporting
- A bunch of new clocks for new SoCs.
----------------------------------------------------------------
Andre Przywara (4):
clk: sunxi: improve error reporting for the mux clock
clk: sunxi: improve mux_clk error handling and reporting
clk: sunxi: improve divider_clk error handling and reporting
clk: sunxi: Improve divs_clk error handling and reporting
Arnd Bergmann (1):
clk: sunxi: don't mark sun6i_ar100_data __initconst
Chen-Yu Tsai (11):
clk: sunxi: usb: Sort clk providers by chip family and name
clk: sunxi: factors: Make struct clk_factors_config table const
clk: sunxi: factors: Add clk cleanup in sunxi_factors_register() error path
clk: sunxi: factors: Add unregister function
clk: sunxi: factors: Consolidate get_factors parameters into a struct
clk: sunxi: factors: Support custom formulas
clk: sunxi: factors: Drop round_rate from clk ops
clk: sunxi: rewrite sun6i-a31-ahb1-clk using factors clk with custom recalc
clk: sunxi: rewrite sun6i-ar100 using factors clk
clk: sunxi: rewrite sun8i-a23-mbus-clk using the simpler composite clk
clk: sunxi: Fix sun8i-a23-apb0-clk divider flags
Krzysztof Adamski (1):
clk: sunxi: Add apb0 gates for H3
Maxime Ripard (5):
clk: sunxi: Make clocks setup functions return their clock
clk: sunxi: Make clocks setup functions take const pointer
clk: sunxi: convert current clocks registration to CLK_OF_DECLARE
clk: sunxi: Remove old probe and protection code
clk: sunxi: Remove clk_register_clkdev calls
Stephen Boyd (1):
clk: sunxi: Drop clk.h include
Vishnu Patekar (2):
clk: sunxi: Add apb0 gates for A83T
clk: sunxi: add bus gates for A83T
Documentation/devicetree/bindings/clock/sunxi.txt | 4 +
drivers/clk/sunxi/clk-a10-hosc.c | 3 +-
drivers/clk/sunxi/clk-a20-gmac.c | 2 -
drivers/clk/sunxi/clk-factors.c | 123 ++-
drivers/clk/sunxi/clk-factors.h | 26 +-
drivers/clk/sunxi/clk-mod0.c | 23 +-
drivers/clk/sunxi/clk-simple-gates.c | 4 +
drivers/clk/sunxi/clk-sun6i-apb0-gates.c | 2 -
drivers/clk/sunxi/clk-sun6i-ar100.c | 235 ++----
drivers/clk/sunxi/clk-sun8i-apb0.c | 2 +-
drivers/clk/sunxi/clk-sun8i-bus-gates.c | 3 +-
drivers/clk/sunxi/clk-sun8i-mbus.c | 127 ++--
drivers/clk/sunxi/clk-sun9i-core.c | 86 +--
drivers/clk/sunxi/clk-sunxi.c | 863 ++++++++++------------
drivers/clk/sunxi/clk-usb.c | 24 +-
15 files changed, 691 insertions(+), 836 deletions(-)
--
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread* [PATCH] clk: sunxi: Remove use of VLAIS 2016-02-26 19:48 [GIT PULL] arm: Allwinner clocks changes for 4.6 Maxime Ripard @ 2016-03-02 0:20 ` Stephen Boyd 2016-03-03 18:07 ` Chen-Yu Tsai 2016-03-08 12:26 ` Mason 2016-03-02 1:46 ` [GIT PULL] arm: Allwinner clocks changes for 4.6 Stephen Boyd 1 sibling, 2 replies; 14+ messages in thread From: Stephen Boyd @ 2016-03-02 0:20 UTC (permalink / raw) To: Michael Turquette, Stephen Boyd Cc: linux-kernel, linux-clk, Chen-Yu Tsai, Maxime Ripard Using an array allocated on the stack may lead to stack overflows and other problems. Furthermore, VLAIS doesn't work well with LLVM compilers, so move the allocation to the heap and avoid the use of VLAIS here. Cc: Chen-Yu Tsai <wens@csie.org> Cc: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> --- drivers/clk/sunxi/clk-sun8i-mbus.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/clk/sunxi/clk-sun8i-mbus.c b/drivers/clk/sunxi/clk-sun8i-mbus.c index 3aaa9cbef791..8e7128e69823 100644 --- a/drivers/clk/sunxi/clk-sun8i-mbus.c +++ b/drivers/clk/sunxi/clk-sun8i-mbus.c @@ -33,7 +33,7 @@ static DEFINE_SPINLOCK(sun8i_a23_mbus_lock); static void __init sun8i_a23_mbus_setup(struct device_node *node) { int num_parents = of_clk_get_parent_count(node); - const char *parents[num_parents]; + const char **parents; const char *clk_name = node->name; struct resource res; struct clk_divider *div; @@ -43,10 +43,14 @@ static void __init sun8i_a23_mbus_setup(struct device_node *node) void __iomem *reg; int err; + parents = kcalloc(num_parents, sizeof(*parents), GFP_KERNEL); + if (!parents) + return; + reg = of_io_request_and_map(node, 0, of_node_full_name(node)); if (!reg) { pr_err("Could not get registers for sun8i-mbus-clk\n"); - return; + goto err_free_parents; } div = kzalloc(sizeof(*div), GFP_KERNEL); @@ -107,6 +111,8 @@ err_free_div: kfree(div); err_unmap: iounmap(reg); +err_free_parents: + kfree(parents); of_address_to_resource(node, 0, &res); release_mem_region(res.start, resource_size(&res)); } -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project ^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH] clk: sunxi: Remove use of VLAIS 2016-03-02 0:20 ` [PATCH] clk: sunxi: Remove use of VLAIS Stephen Boyd @ 2016-03-03 18:07 ` Chen-Yu Tsai 2016-03-03 19:16 ` Stephen Boyd 2016-03-08 12:26 ` Mason 1 sibling, 1 reply; 14+ messages in thread From: Chen-Yu Tsai @ 2016-03-03 18:07 UTC (permalink / raw) To: Stephen Boyd Cc: Michael Turquette, linux-kernel, linux-clk, Chen-Yu Tsai, Maxime Ripard On Tue, Mar 1, 2016 at 4:20 PM, Stephen Boyd <sboyd@codeaurora.org> wrote: > Using an array allocated on the stack may lead to stack overflows > and other problems. Furthermore, VLAIS doesn't work well with > LLVM compilers, so move the allocation to the heap and avoid the > use of VLAIS here. > > Cc: Chen-Yu Tsai <wens@csie.org> > Cc: Maxime Ripard <maxime.ripard@free-electrons.com> > Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> > --- > drivers/clk/sunxi/clk-sun8i-mbus.c | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) > > diff --git a/drivers/clk/sunxi/clk-sun8i-mbus.c b/drivers/clk/sunxi/clk-sun8i-mbus.c > index 3aaa9cbef791..8e7128e69823 100644 > --- a/drivers/clk/sunxi/clk-sun8i-mbus.c > +++ b/drivers/clk/sunxi/clk-sun8i-mbus.c > @@ -33,7 +33,7 @@ static DEFINE_SPINLOCK(sun8i_a23_mbus_lock); > static void __init sun8i_a23_mbus_setup(struct device_node *node) > { > int num_parents = of_clk_get_parent_count(node); > - const char *parents[num_parents]; > + const char **parents; > const char *clk_name = node->name; > struct resource res; > struct clk_divider *div; > @@ -43,10 +43,14 @@ static void __init sun8i_a23_mbus_setup(struct device_node *node) > void __iomem *reg; > int err; > > + parents = kcalloc(num_parents, sizeof(*parents), GFP_KERNEL); > + if (!parents) > + return; > + > reg = of_io_request_and_map(node, 0, of_node_full_name(node)); > if (!reg) { > pr_err("Could not get registers for sun8i-mbus-clk\n"); > - return; > + goto err_free_parents; > } > > div = kzalloc(sizeof(*div), GFP_KERNEL); > @@ -107,6 +111,8 @@ err_free_div: > kfree(div); > err_unmap: > iounmap(reg); > +err_free_parents: > + kfree(parents); AFAIK the CCF makes a deep copy of parents, so you should always free it? I specifically checked it before using VLAIS here. ChenYu > of_address_to_resource(node, 0, &res); > release_mem_region(res.start, resource_size(&res)); > } > -- > The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, > a Linux Foundation Collaborative Project > ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] clk: sunxi: Remove use of VLAIS 2016-03-03 18:07 ` Chen-Yu Tsai @ 2016-03-03 19:16 ` Stephen Boyd 2016-03-04 15:27 ` Maxime Ripard 0 siblings, 1 reply; 14+ messages in thread From: Stephen Boyd @ 2016-03-03 19:16 UTC (permalink / raw) To: Chen-Yu Tsai; +Cc: Michael Turquette, linux-kernel, linux-clk, Maxime Ripard On 03/03, Chen-Yu Tsai wrote: > On Tue, Mar 1, 2016 at 4:20 PM, Stephen Boyd <sboyd@codeaurora.org> wrote: > > div = kzalloc(sizeof(*div), GFP_KERNEL); > > @@ -107,6 +111,8 @@ err_free_div: > > kfree(div); > > err_unmap: > > iounmap(reg); > > +err_free_parents: > > + kfree(parents); > > AFAIK the CCF makes a deep copy of parents, so you should > always free it? I specifically checked it before using > VLAIS here. > Yes. Good catch. Here's the update. --8<--- From: Stephen Boyd <sboyd@codeaurora.org> Subject: [PATCH] clk: sunxi: Remove use of VLAIS Using an array allocated on the stack may lead to stack overflows and other problems. Furthermore, VLAIS doesn't work well with LLVM compilers, so move the allocation to the heap and avoid the use of VLAIS here. Cc: Chen-Yu Tsai <wens@csie.org> Cc: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> --- drivers/clk/sunxi/clk-sun8i-mbus.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/clk/sunxi/clk-sun8i-mbus.c b/drivers/clk/sunxi/clk-sun8i-mbus.c index 3aaa9cbef791..90acc8549d60 100644 --- a/drivers/clk/sunxi/clk-sun8i-mbus.c +++ b/drivers/clk/sunxi/clk-sun8i-mbus.c @@ -33,7 +33,7 @@ static DEFINE_SPINLOCK(sun8i_a23_mbus_lock); static void __init sun8i_a23_mbus_setup(struct device_node *node) { int num_parents = of_clk_get_parent_count(node); - const char *parents[num_parents]; + const char **parents; const char *clk_name = node->name; struct resource res; struct clk_divider *div; @@ -43,10 +43,14 @@ static void __init sun8i_a23_mbus_setup(struct device_node *node) void __iomem *reg; int err; + parents = kcalloc(num_parents, sizeof(*parents), GFP_KERNEL); + if (!parents) + return; + reg = of_io_request_and_map(node, 0, of_node_full_name(node)); if (!reg) { pr_err("Could not get registers for sun8i-mbus-clk\n"); - return; + goto err_free_parents; } div = kzalloc(sizeof(*div), GFP_KERNEL); @@ -90,6 +94,7 @@ static void __init sun8i_a23_mbus_setup(struct device_node *node) if (err) goto err_unregister_clk; + kfree(parents); /* parents is deep copied */ /* The MBUS clocks needs to be always enabled */ __clk_get(clk); clk_prepare_enable(clk); @@ -107,6 +112,8 @@ err_free_div: kfree(div); err_unmap: iounmap(reg); +err_free_parents: + kfree(parents); of_address_to_resource(node, 0, &res); release_mem_region(res.start, resource_size(&res)); } -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project ^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH] clk: sunxi: Remove use of VLAIS 2016-03-03 19:16 ` Stephen Boyd @ 2016-03-04 15:27 ` Maxime Ripard 2016-03-04 17:18 ` Stephen Boyd 0 siblings, 1 reply; 14+ messages in thread From: Maxime Ripard @ 2016-03-04 15:27 UTC (permalink / raw) To: Stephen Boyd; +Cc: Chen-Yu Tsai, Michael Turquette, linux-kernel, linux-clk [-- Attachment #1: Type: text/plain, Size: 3104 bytes --] Hi, On Thu, Mar 03, 2016 at 11:16:04AM -0800, Stephen Boyd wrote: > On 03/03, Chen-Yu Tsai wrote: > > On Tue, Mar 1, 2016 at 4:20 PM, Stephen Boyd <sboyd@codeaurora.org> wrote: > > > div = kzalloc(sizeof(*div), GFP_KERNEL); > > > @@ -107,6 +111,8 @@ err_free_div: > > > kfree(div); > > > err_unmap: > > > iounmap(reg); > > > +err_free_parents: > > > + kfree(parents); > > > > AFAIK the CCF makes a deep copy of parents, so you should > > always free it? I specifically checked it before using > > VLAIS here. > > > > Yes. Good catch. Here's the update. > > --8<--- > From: Stephen Boyd <sboyd@codeaurora.org> > Subject: [PATCH] clk: sunxi: Remove use of VLAIS VLAIS? > Using an array allocated on the stack may lead to stack overflows > and other problems. Furthermore, VLAIS doesn't work well with > LLVM compilers, so move the allocation to the heap and avoid the > use of VLAIS here. > > Cc: Chen-Yu Tsai <wens@csie.org> > Cc: Maxime Ripard <maxime.ripard@free-electrons.com> > Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> > --- > drivers/clk/sunxi/clk-sun8i-mbus.c | 11 +++++++++-- > 1 file changed, 9 insertions(+), 2 deletions(-) > > diff --git a/drivers/clk/sunxi/clk-sun8i-mbus.c b/drivers/clk/sunxi/clk-sun8i-mbus.c > index 3aaa9cbef791..90acc8549d60 100644 > --- a/drivers/clk/sunxi/clk-sun8i-mbus.c > +++ b/drivers/clk/sunxi/clk-sun8i-mbus.c > @@ -33,7 +33,7 @@ static DEFINE_SPINLOCK(sun8i_a23_mbus_lock); > static void __init sun8i_a23_mbus_setup(struct device_node *node) > { > int num_parents = of_clk_get_parent_count(node); > - const char *parents[num_parents]; > + const char **parents; > const char *clk_name = node->name; > struct resource res; > struct clk_divider *div; > @@ -43,10 +43,14 @@ static void __init sun8i_a23_mbus_setup(struct device_node *node) > void __iomem *reg; > int err; > > + parents = kcalloc(num_parents, sizeof(*parents), GFP_KERNEL); > + if (!parents) > + return; > + > reg = of_io_request_and_map(node, 0, of_node_full_name(node)); > if (!reg) { > pr_err("Could not get registers for sun8i-mbus-clk\n"); > - return; > + goto err_free_parents; > } > > div = kzalloc(sizeof(*div), GFP_KERNEL); > @@ -90,6 +94,7 @@ static void __init sun8i_a23_mbus_setup(struct device_node *node) > if (err) > goto err_unregister_clk; > > + kfree(parents); /* parents is deep copied */ > /* The MBUS clocks needs to be always enabled */ > __clk_get(clk); > clk_prepare_enable(clk); > @@ -107,6 +112,8 @@ err_free_div: > kfree(div); > err_unmap: > iounmap(reg); > +err_free_parents: > + kfree(parents); > of_address_to_resource(node, 0, &res); > release_mem_region(res.start, resource_size(&res)); The error path is wrong here, if you jump here from a failing call to of_io_request_and_map, you'll end up releasing a memory region which is not requested. Thanks! Maxime -- Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 819 bytes --] ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] clk: sunxi: Remove use of VLAIS 2016-03-04 15:27 ` Maxime Ripard @ 2016-03-04 17:18 ` Stephen Boyd 2016-03-08 22:13 ` Maxime Ripard 0 siblings, 1 reply; 14+ messages in thread From: Stephen Boyd @ 2016-03-04 17:18 UTC (permalink / raw) To: Maxime Ripard; +Cc: Chen-Yu Tsai, Michael Turquette, linux-kernel, linux-clk On 03/04, Maxime Ripard wrote: > On Thu, Mar 03, 2016 at 11:16:04AM -0800, Stephen Boyd wrote: > > From: Stephen Boyd <sboyd@codeaurora.org> > > Subject: [PATCH] clk: sunxi: Remove use of VLAIS > > VLAIS? Hmm I guess it's just VLA, so llvm won't break. I'll reword commit text. > > > @@ -107,6 +112,8 @@ err_free_div: > > kfree(div); > > err_unmap: > > iounmap(reg); > > +err_free_parents: > > + kfree(parents); > > of_address_to_resource(node, 0, &res); > > release_mem_region(res.start, resource_size(&res)); > > The error path is wrong here, if you jump here from a failing call to > of_io_request_and_map, you'll end up releasing a memory region which > is not requested. > Oh right. Let's hope third time is the last. ---8<--- From: Stephen Boyd <sboyd@codeaurora.org> Subject: [PATCH] clk: sunxi: Remove use of variable length array Using an array allocated on the stack may lead to stack overflows and other problems so let's move the allocation to the heap instead. This silences the following checker warning as well. drivers/clk/sunxi/clk-sun8i-mbus.c:36:29: warning: Variable length array is used. Cc: Chen-Yu Tsai <wens@csie.org> Cc: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> --- drivers/clk/sunxi/clk-sun8i-mbus.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/clk/sunxi/clk-sun8i-mbus.c b/drivers/clk/sunxi/clk-sun8i-mbus.c index 3aaa9cbef791..411d3033a96e 100644 --- a/drivers/clk/sunxi/clk-sun8i-mbus.c +++ b/drivers/clk/sunxi/clk-sun8i-mbus.c @@ -33,7 +33,7 @@ static DEFINE_SPINLOCK(sun8i_a23_mbus_lock); static void __init sun8i_a23_mbus_setup(struct device_node *node) { int num_parents = of_clk_get_parent_count(node); - const char *parents[num_parents]; + const char **parents; const char *clk_name = node->name; struct resource res; struct clk_divider *div; @@ -43,10 +43,14 @@ static void __init sun8i_a23_mbus_setup(struct device_node *node) void __iomem *reg; int err; + parents = kcalloc(num_parents, sizeof(*parents), GFP_KERNEL); + if (!parents) + return; + reg = of_io_request_and_map(node, 0, of_node_full_name(node)); if (!reg) { pr_err("Could not get registers for sun8i-mbus-clk\n"); - return; + goto err_free_parents; } div = kzalloc(sizeof(*div), GFP_KERNEL); @@ -90,6 +94,7 @@ static void __init sun8i_a23_mbus_setup(struct device_node *node) if (err) goto err_unregister_clk; + kfree(parents); /* parents is deep copied */ /* The MBUS clocks needs to be always enabled */ __clk_get(clk); clk_prepare_enable(clk); @@ -109,5 +114,7 @@ err_unmap: iounmap(reg); of_address_to_resource(node, 0, &res); release_mem_region(res.start, resource_size(&res)); +err_free_parents: + kfree(parents); } CLK_OF_DECLARE(sun8i_a23_mbus, "allwinner,sun8i-a23-mbus-clk", sun8i_a23_mbus_setup); -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project ^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH] clk: sunxi: Remove use of VLAIS 2016-03-04 17:18 ` Stephen Boyd @ 2016-03-08 22:13 ` Maxime Ripard 2016-03-15 22:16 ` Stephen Boyd 0 siblings, 1 reply; 14+ messages in thread From: Maxime Ripard @ 2016-03-08 22:13 UTC (permalink / raw) To: Stephen Boyd; +Cc: Chen-Yu Tsai, Michael Turquette, linux-kernel, linux-clk [-- Attachment #1: Type: text/plain, Size: 1643 bytes --] On Fri, Mar 04, 2016 at 09:18:41AM -0800, Stephen Boyd wrote: > On 03/04, Maxime Ripard wrote: > > On Thu, Mar 03, 2016 at 11:16:04AM -0800, Stephen Boyd wrote: > > > From: Stephen Boyd <sboyd@codeaurora.org> > > > Subject: [PATCH] clk: sunxi: Remove use of VLAIS > > > > VLAIS? > > Hmm I guess it's just VLA, so llvm won't break. I'll reword > commit text. > > > > > > @@ -107,6 +112,8 @@ err_free_div: > > > kfree(div); > > > err_unmap: > > > iounmap(reg); > > > +err_free_parents: > > > + kfree(parents); > > > of_address_to_resource(node, 0, &res); > > > release_mem_region(res.start, resource_size(&res)); > > > > The error path is wrong here, if you jump here from a failing call to > > of_io_request_and_map, you'll end up releasing a memory region which > > is not requested. > > > > Oh right. Let's hope third time is the last. > > ---8<--- > From: Stephen Boyd <sboyd@codeaurora.org> > Subject: [PATCH] clk: sunxi: Remove use of variable length array > > Using an array allocated on the stack may lead to stack overflows > and other problems so let's move the allocation to the heap > instead. This silences the following checker warning as well. > > drivers/clk/sunxi/clk-sun8i-mbus.c:36:29: warning: Variable length array is used. > > Cc: Chen-Yu Tsai <wens@csie.org> > Cc: Maxime Ripard <maxime.ripard@free-electrons.com> > Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> Thanks! Maxime -- Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 819 bytes --] ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] clk: sunxi: Remove use of VLAIS 2016-03-08 22:13 ` Maxime Ripard @ 2016-03-15 22:16 ` Stephen Boyd 2016-03-16 8:51 ` Mason 0 siblings, 1 reply; 14+ messages in thread From: Stephen Boyd @ 2016-03-15 22:16 UTC (permalink / raw) To: Maxime Ripard; +Cc: Chen-Yu Tsai, Michael Turquette, linux-kernel, linux-clk On 03/08, Maxime Ripard wrote: > On Fri, Mar 04, 2016 at 09:18:41AM -0800, Stephen Boyd wrote: > > Oh right. Let's hope third time is the last. > > > > ---8<--- > > From: Stephen Boyd <sboyd@codeaurora.org> > > Subject: [PATCH] clk: sunxi: Remove use of variable length array > > > > Using an array allocated on the stack may lead to stack overflows > > and other problems so let's move the allocation to the heap > > instead. This silences the following checker warning as well. > > > > drivers/clk/sunxi/clk-sun8i-mbus.c:36:29: warning: Variable length array is used. > > > > Cc: Chen-Yu Tsai <wens@csie.org> > > Cc: Maxime Ripard <maxime.ripard@free-electrons.com> > > Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> > > Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> > Applied to clk-next. -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] clk: sunxi: Remove use of VLAIS 2016-03-15 22:16 ` Stephen Boyd @ 2016-03-16 8:51 ` Mason 2016-03-16 20:30 ` Stephen Boyd 0 siblings, 1 reply; 14+ messages in thread From: Mason @ 2016-03-16 8:51 UTC (permalink / raw) To: Stephen Boyd, Maxime Ripard; +Cc: Chen-Yu Tsai, Michael Turquette, linux-clk On 15/03/2016 23:16, Stephen Boyd wrote: > On 03/08, Maxime Ripard wrote: > >> On Fri, Mar 04, 2016 at 09:18:41AM -0800, Stephen Boyd wrote: >> >>> Oh right. Let's hope third time is the last. >>> >>> ---8<--- >>> From: Stephen Boyd <sboyd@codeaurora.org> >>> Subject: [PATCH] clk: sunxi: Remove use of variable length array >>> >>> Using an array allocated on the stack may lead to stack overflows >>> and other problems so let's move the allocation to the heap >>> instead. This silences the following checker warning as well. >>> >>> drivers/clk/sunxi/clk-sun8i-mbus.c:36:29: warning: Variable length array is used. >>> >>> Cc: Chen-Yu Tsai <wens@csie.org> >>> Cc: Maxime Ripard <maxime.ripard@free-electrons.com> >>> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> >> >> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> >> > > Applied to clk-next. For the record, I will state again that I find it quite sub-optimal to resort to dynamic allocation for small temporary pointer arrays. A fortiori when one considers that getting the patch right required several attempts. Regards. ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] clk: sunxi: Remove use of VLAIS 2016-03-16 8:51 ` Mason @ 2016-03-16 20:30 ` Stephen Boyd 2016-03-16 20:44 ` Mason 2016-03-18 17:47 ` Maxime Ripard 0 siblings, 2 replies; 14+ messages in thread From: Stephen Boyd @ 2016-03-16 20:30 UTC (permalink / raw) To: Mason; +Cc: Maxime Ripard, Chen-Yu Tsai, Michael Turquette, linux-clk On 03/16, Mason wrote: > On 15/03/2016 23:16, Stephen Boyd wrote: > > > > Applied to clk-next. > > For the record, I will state again that I find it quite sub-optimal > to resort to dynamic allocation for small temporary pointer arrays. > > A fortiori when one considers that getting the patch right required > several attempts. > Feel free to send the patch and then we can discuss and test. For the record, I was waiting for Maxime or Chen-Yu to speak up if they would prefer that approach, but nothing happened. Usually patches spur discussions better than comments. -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] clk: sunxi: Remove use of VLAIS 2016-03-16 20:30 ` Stephen Boyd @ 2016-03-16 20:44 ` Mason 2016-03-18 17:47 ` Maxime Ripard 1 sibling, 0 replies; 14+ messages in thread From: Mason @ 2016-03-16 20:44 UTC (permalink / raw) To: Stephen Boyd; +Cc: Maxime Ripard, Chen-Yu Tsai, Michael Turquette, linux-clk On 16/03/2016 21:30, Stephen Boyd wrote: > On 03/16, Mason wrote: >> On 15/03/2016 23:16, Stephen Boyd wrote: >>> >>> Applied to clk-next. >> >> For the record, I will state again that I find it quite sub-optimal >> to resort to dynamic allocation for small temporary pointer arrays. >> >> A fortiori when one considers that getting the patch right required >> several attempts. > > Feel free to send the patch and then we can discuss and test. For > the record, I was waiting for Maxime or Chen-Yu to speak up if > they would prefer that approach, but nothing happened. Usually > patches spur discussions better than comments. While I didn't provide a formal patch, I did outline the two lines that needed to be changed (and it is obvious that the behavior is strictly equivalent to the VLA solution, as long as num_parents < 8). I do agree with you that, considering the silence from the driver's maintainers, they probably don't care which solution is adopted. I will remember to post an actual patch next time. Regards. ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] clk: sunxi: Remove use of VLAIS 2016-03-16 20:30 ` Stephen Boyd 2016-03-16 20:44 ` Mason @ 2016-03-18 17:47 ` Maxime Ripard 1 sibling, 0 replies; 14+ messages in thread From: Maxime Ripard @ 2016-03-18 17:47 UTC (permalink / raw) To: Stephen Boyd; +Cc: Mason, Chen-Yu Tsai, Michael Turquette, linux-clk [-- Attachment #1: Type: text/plain, Size: 904 bytes --] On Wed, Mar 16, 2016 at 01:30:18PM -0700, Stephen Boyd wrote: > On 03/16, Mason wrote: > > On 15/03/2016 23:16, Stephen Boyd wrote: > > > > > > Applied to clk-next. > > > > For the record, I will state again that I find it quite sub-optimal > > to resort to dynamic allocation for small temporary pointer arrays. > > > > A fortiori when one considers that getting the patch right required > > several attempts. > > > > Feel free to send the patch and then we can discuss and test. For > the record, I was waiting for Maxime or Chen-Yu to speak up if > they would prefer that approach, but nothing happened. Usually > patches spur discussions better than comments. Yeah, I don't really care about which solution you choose, as long as it makes LLVM happy. Maxime -- Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 819 bytes --] ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] clk: sunxi: Remove use of VLAIS 2016-03-02 0:20 ` [PATCH] clk: sunxi: Remove use of VLAIS Stephen Boyd 2016-03-03 18:07 ` Chen-Yu Tsai @ 2016-03-08 12:26 ` Mason 1 sibling, 0 replies; 14+ messages in thread From: Mason @ 2016-03-08 12:26 UTC (permalink / raw) To: Stephen Boyd, Michael Turquette; +Cc: linux-clk, Chen-Yu Tsai, Maxime Ripard On 02/03/2016 01:20, Stephen Boyd wrote: > Using an array allocated on the stack may lead to stack overflows > and other problems. Furthermore, VLAIS doesn't work well with > LLVM compilers, so move the allocation to the heap and avoid the > use of VLAIS here. What are the symptoms of LLVM's incomplete support? > Cc: Chen-Yu Tsai <wens@csie.org> > Cc: Maxime Ripard <maxime.ripard@free-electrons.com> > Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> > --- > drivers/clk/sunxi/clk-sun8i-mbus.c | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) > > diff --git a/drivers/clk/sunxi/clk-sun8i-mbus.c b/drivers/clk/sunxi/clk-sun8i-mbus.c > index 3aaa9cbef791..8e7128e69823 100644 > --- a/drivers/clk/sunxi/clk-sun8i-mbus.c > +++ b/drivers/clk/sunxi/clk-sun8i-mbus.c > @@ -33,7 +33,7 @@ static DEFINE_SPINLOCK(sun8i_a23_mbus_lock); > static void __init sun8i_a23_mbus_setup(struct device_node *node) > { > int num_parents = of_clk_get_parent_count(node); > - const char *parents[num_parents]; > + const char **parents; Is num_parents ever greater than 8? Dynamically allocating such a small array seems wasteful. const char *parents[8]; /* 32 bytes on Cortex A7 */ if (num_parents >= 8) return EINVAL; ... rest of the code unchanged ... Regards. ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [GIT PULL] arm: Allwinner clocks changes for 4.6 2016-02-26 19:48 [GIT PULL] arm: Allwinner clocks changes for 4.6 Maxime Ripard 2016-03-02 0:20 ` [PATCH] clk: sunxi: Remove use of VLAIS Stephen Boyd @ 2016-03-02 1:46 ` Stephen Boyd 1 sibling, 0 replies; 14+ messages in thread From: Stephen Boyd @ 2016-03-02 1:46 UTC (permalink / raw) To: Maxime Ripard; +Cc: Mike Turquette, linux-clk, linux-arm-kernel, Chen-Yu Tsai On 02/26, Maxime Ripard wrote: > The following changes since commit 92e963f50fc74041b5e9e744c330dca48e04f08d: > > Linux 4.5-rc1 (2016-01-24 13:06:47 -0800) > > are available in the git repository at: > > https://git.kernel.org/pub/scm/linux/kernel/git/mripard/linux.git tags/sunxi-clocks-for-4.6 > > for you to fetch changes up to 6e17b4181603d183d20c73f4535529ddf2a2a020: > > clk: sunxi: Add apb0 gates for H3 (2016-02-25 11:30:32 -0800) Thanks. Pulled. -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project ^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2016-03-18 17:47 UTC | newest] Thread overview: 14+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-02-26 19:48 [GIT PULL] arm: Allwinner clocks changes for 4.6 Maxime Ripard 2016-03-02 0:20 ` [PATCH] clk: sunxi: Remove use of VLAIS Stephen Boyd 2016-03-03 18:07 ` Chen-Yu Tsai 2016-03-03 19:16 ` Stephen Boyd 2016-03-04 15:27 ` Maxime Ripard 2016-03-04 17:18 ` Stephen Boyd 2016-03-08 22:13 ` Maxime Ripard 2016-03-15 22:16 ` Stephen Boyd 2016-03-16 8:51 ` Mason 2016-03-16 20:30 ` Stephen Boyd 2016-03-16 20:44 ` Mason 2016-03-18 17:47 ` Maxime Ripard 2016-03-08 12:26 ` Mason 2016-03-02 1:46 ` [GIT PULL] arm: Allwinner clocks changes for 4.6 Stephen Boyd
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).