initial clkdev cleanups
Subsystems (13)
cover initial clkdev cleanups
Here's some initial clkdev cleanups. These are targetted for the next merge window, and while the initial patches can be merged independently, I'd prefer to keep the series together as further work on solving the problems which unique struct clk's has introduced is needed.
The initial cleanups are more about using the correct clkdev function than anything else: there's no point interating over a array of clk_lookup structs, adding each one in turn when we have had a function which does this since forever.
I'm also killing a chunk of seemingly unused code in the omap3isp driver.
Lastly, I'm introducing a clkdev_create() helper, which combines the clkdev_alloc() + clkdev_add() pattern which keeps cropping up.
Individual patches copied to appropriate people, but they will all appear on the mailing lists.
arch/arm/mach-lpc32xx/clock.c | 5 +-- arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c | 12 ++----- arch/arm/mach-omap2/omap_device.c | 24 +++++-------- arch/arm/plat-orion/common.c | 6 +--- arch/sh/kernel/cpu/sh4a/clock-sh7734.c | 3 +- arch/sh/kernel/cpu/sh4a/clock-sh7757.c | 4 +-- arch/sh/kernel/cpu/sh4a/clock-sh7785.c | 4 +-- arch/sh/kernel/cpu/sh4a/clock-sh7786.c | 4 +-- arch/sh/kernel/cpu/sh4a/clock-shx3.c | 4 +-- drivers/clk/clk-s2mps11.c | 4 +-- drivers/clk/clkdev.c | 52 +++++++++++++++++++++------- drivers/clk/versatile/clk-impd1.c | 4 +-- drivers/media/platform/omap3isp/isp.c | 18 ---------- drivers/media/platform/omap3isp/isp.h | 1 - include/linux/clkdev.h | 3 ++ include/media/omap3isp.h | 6 ---- sound/soc/sh/migor.c | 3 +- 17 files changed, 68 insertions(+), 89 deletions(-)
Signature · 2 lines
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up according to speedtest.net.
PATCH 1/10 media: omap3isp: remove unused clkdev
No merged platform supplies xclks via platform data. As we want to slightly change the clkdev interface, rather than fixing this unused code, remove it instead.
--- drivers/media/platform/omap3isp/isp.c | 18 ------------------ drivers/media/platform/omap3isp/isp.h | 1 - include/media/omap3isp.h | 6 ------ 3 files changed, 25 deletions(-)
drivers/media/platform/omap3isp/isp.c +0 -18
@@ -281,7 +281,6 @@ static const struct clk_init_data isp_xclk_init_data = {static int isp_xclk_init (struct isp_device *isp) { -struct isp_platform_data *pdata = isp->pdata;struct clk_init_data init;unsigned int i;
@@ -311,20 +310,6 @@ static int isp_xclk_init(struct isp_device *isp) xclk->clk =clk_register (NULL , &xclk->hw);if (IS_ERR (xclk->clk))return PTR_ERR (xclk->clk); - -if (pdata->xclks[i].con_id ==NULL && - pdata->xclks[i].dev_id ==NULL ) -continue ; - - xclk->lookup =kzalloc (sizeof (*xclk->lookup),GFP_KERNEL ); -if (xclk->lookup ==NULL ) -return -ENOMEM ; - - xclk->lookup->con_id = pdata->xclks[i].con_id; - xclk->lookup->dev_id = pdata->xclks[i].dev_id; - xclk->lookup->clk = xclk->clk; - -clkdev_add (xclk->lookup); }return 0 ;
@@ -339,9 +324,6 @@ static void isp_xclk_cleanup(struct isp_device *isp)if (!IS_ERR (xclk->clk))clk_unregister (xclk->clk); - -if (xclk->lookup) -clkdev_drop (xclk->lookup); } }
drivers/media/platform/omap3isp/isp.h +0 -1
@@ -122,7 +122,6 @@ enum isp_xclk_id {struct isp_xclk {struct isp_device *isp;struct clk_hw hw; -struct clk_lookup *lookup;struct clk *clk;enum isp_xclk_id id;
include/media/omap3isp.h +0 -6
@@ -152,13 +152,7 @@ struct isp_v4l2_subdevs_group { } bus;/* gcc < 4.6.0 chokes on anonymous union initializers */ }; -struct isp_platform_xclk { -const char *dev_id; -const char *con_id; -}; -struct isp_platform_data { -struct isp_platform_xclk xclks[2 ];struct isp_v4l2_subdevs_group *subdevs;void (*set_constraints)(struct isp_device *isp,bool enable); };
Signature · 1 line
1.8.3.1
PATCH 2/10 SH: use clkdev_add_table()
In reply to Russell King - ARM LinuxWe have always had an efficient way of registering a table of clock lookups - it's called clkdev_add_table(). However, some people seem to really love writing inefficient and unnecessary code.
Convert SH to use the correct interface.
--- arch/sh/kernel/cpu/sh4a/clock-sh7734.c | 3 +-- arch/sh/kernel/cpu/sh4a/clock-sh7757.c | 4 ++-- arch/sh/kernel/cpu/sh4a/clock-sh7785.c | 4 ++-- arch/sh/kernel/cpu/sh4a/clock-sh7786.c | 4 ++-- arch/sh/kernel/cpu/sh4a/clock-shx3.c | 4 ++-- 5 files changed, 9 insertions(+), 10 deletions(-)
arch/sh/kernel/cpu/sh4a/clock-sh7734.c +1 -2
@@ -246,8 +246,7 @@ int __init arch_clk_init(void)for (i =0 ; i <ARRAY_SIZE (main_clks); i++) ret |=clk_register (main_clks[i]); -for (i =0 ; i <ARRAY_SIZE (lookups); i++) -clkdev_add (&lookups[i]); +clkdev_add_table (lookups,ARRAY_SIZE (lookups));if (!ret) ret = sh_clk_div4_register(div4_clks, ARRAY_SIZE(div4_clks),
arch/sh/kernel/cpu/sh4a/clock-sh7757.c +2 -2
@@ -141,8 +141,8 @@ int __init arch_clk_init(void)for (i =0 ; i <ARRAY_SIZE (clks); i++) ret |=clk_register (clks[i]); -for (i =0 ; i <ARRAY_SIZE (lookups); i++) -clkdev_add (&lookups[i]); + +clkdev_add_table (lookups,ARRAY_SIZE (lookups));if (!ret) ret = sh_clk_div4_register(div4_clks, ARRAY_SIZE(div4_clks),
arch/sh/kernel/cpu/sh4a/clock-sh7785.c +2 -2
@@ -164,8 +164,8 @@ int __init arch_clk_init(void)for (i =0 ; i <ARRAY_SIZE (clks); i++) ret |=clk_register (clks[i]); -for (i =0 ; i <ARRAY_SIZE (lookups); i++) -clkdev_add (&lookups[i]); + +clkdev_add_table (lookups,ARRAY_SIZE (lookups));if (!ret) ret = sh_clk_div4_register(div4_clks, ARRAY_SIZE(div4_clks),
arch/sh/kernel/cpu/sh4a/clock-sh7786.c +2 -2
@@ -179,8 +179,8 @@ int __init arch_clk_init(void)for (i =0 ; i <ARRAY_SIZE (clks); i++) ret |=clk_register (clks[i]); -for (i =0 ; i <ARRAY_SIZE (lookups); i++) -clkdev_add (&lookups[i]); + +clkdev_add_table (lookups,ARRAY_SIZE (lookups));if (!ret) ret = sh_clk_div4_register(div4_clks, ARRAY_SIZE(div4_clks),
arch/sh/kernel/cpu/sh4a/clock-shx3.c +2 -2
@@ -138,8 +138,8 @@ int __init arch_clk_init(void)for (i =0 ; i <ARRAY_SIZE (clks); i++) ret |=clk_register (clks[i]); -for (i =0 ; i <ARRAY_SIZE (lookups); i++) -clkdev_add (&lookups[i]); + +clkdev_add_table (lookups,ARRAY_SIZE (lookups));if (!ret) ret = sh_clk_div4_register(div4_clks, ARRAY_SIZE(div4_clks),
Signature · 1 line
1.8.3.1
PATCH 3/10 clk: versatile: convert Integrator IM/PD-1 to use clkdev_add_table()
In reply to Russell King - ARM LinuxWe have always had an efficient way of registering a table of clock lookups - it's called clkdev_add_table(). However, some people seem to really love writing inefficient and unnecessary code.
Convert Integrator IM-PD/1 to use the correct interface.
--- drivers/clk/versatile/clk-impd1.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/clk/versatile/clk-impd1.c +1 -3
@@ -89,7 +89,6 @@ void integrator_impd1_clk_init(void __iomem *base, unsigned int id)struct impd1_clk *imc;struct clk *clk;struct clk *pclk; -int i;if (id >3 ) {pr_crit ("no more than 4 LMs can be attached\n" );
@@ -150,8 +149,7 @@ void integrator_impd1_clk_init(void __iomem *base, unsigned int id) imc->clks[13 ] =clkdev_alloc (pclk,"apb_pclk" ,"lm%x:00600" , id); imc->clks[14 ] =clkdev_alloc (clk,NULL ,"lm%x:00600" , id); -for (i =0 ; i <ARRAY_SIZE (imc->clks); i++) -clkdev_add (imc->clks[i]); +clkdev_add_table (imc->clks,ARRAY_SIZE (imc->clks)); }EXPORT_SYMBOL_GPL (integrator_impd1_clk_init);
Signature · 1 line
1.8.3.1
PATCH 4/10 ARM: lpc32xx: convert to use clkdev_add_table()
In reply to Russell King - ARM LinuxWe have always had an efficient way of registering a table of clock lookups - it's called clkdev_add_table(). However, some people seem to really love writing inefficient and unnecessary code.
Convert LPC32xx to use the correct interface.
--- arch/arm/mach-lpc32xx/clock.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
arch/arm/mach-lpc32xx/clock.c +1 -4
@@ -1238,10 +1238,7 @@ static struct clk_lookup lookups[] = {static int __init clk_init (void ) { -int i; - -for (i =0 ; i <ARRAY_SIZE (lookups); i++) -clkdev_add (&lookups[i]); +clkdev_add_table (lookups,ARRAY_SIZE (lookups));/* * Setup muxed SYSCLK for HCLK PLL base -this selects the
Signature · 1 line
1.8.3.1
PATCH 5/10 clkdev: add clkdev_create() helper
In reply to Russell King - ARM LinuxAdd a helper to allocate and add a clk_lookup structure. This can not only be used in several places in clkdev.c to simplify the code, but more importantly, can be used by callers of the clkdev code to simplify their clkdev creation and registration.
--- drivers/clk/clkdev.c | 52 ++++++++++++++++++++++++++++++++++++++------------ include/linux/clkdev.h | 3 +++ 2 files changed, 43 insertions(+), 12 deletions(-)
drivers/clk/clkdev.c +40 -12
@@ -294,6 +294,19 @@ vclkdev_alloc(struct clk *clk, const char *con_id, const char *dev_fmt,return &cla->cl; } +static struct clk_lookup * +vclkdev_create((struct clk *clk, const char *con_id, const char *dev_fmt, +va_list ap) +{ +struct clk_lookup *cl; + + cl =vclkdev_alloc (clk, con_id, dev_fmt, ap); +if (cl) +clkdev_add (cl); + +return cl; +} + struct clk_lookup * __init_refokclkdev_alloc (struct clk *clk,const char *con_id,const char *dev_fmt, ...) {
@@ -308,6 +321,28 @@ clkdev_alloc(struct clk *clk, const char *con_id, const char *dev_fmt, ...) }EXPORT_SYMBOL (clkdev_alloc); +/** +* clkdev_create - allocate and add a clkdev lookup structure +* @clk: struct clk to associate with all clk_lookups +* @con_id: connection ID string on device +* @dev_fmt: format string describing device name +* +* Returns a clk_lookup structure, which can be later unregistered and +* freed. +*/ +struct clk_lookup *clkdev_create (struct clk *clk,const char *con_id, +const char *dev_fmt, ...) +{ +struct clk_lookup *cl; +va_list ap; + +va_start (ap, dev_fmt); + cl =vclkdev_create (clk, con_id, dev_fmt, ap); +va_end (ap); + +return cl; +} +int clk_add_alias (const char *alias,const char *alias_dev_name,char *id,struct device *dev) {
@@ -317,12 +352,10 @@ int clk_add_alias(const char *alias, const char *alias_dev_name, char *id,if (IS_ERR (r))return PTR_ERR (r); - l =clkdev_alloc (r, alias, alias_dev_name); + l =vclkdev_create (r, alias,"%s" , alias_dev_name);clk_put (r); -if (!l) -return -ENODEV ; -clkdev_add (l); -return 0 ; + +return l ?0 : -ENODEV ; }EXPORT_SYMBOL (clk_add_alias);
@@ -362,15 +395,10 @@ int clk_register_clkdev(struct clk *clk, const char *con_id,return PTR_ERR (clk);va_start (ap, dev_fmt); - cl =vclkdev_alloc (clk, con_id, dev_fmt, ap); + cl =vclkdev_create (clk, con_id, dev_fmt, ap);va_end (ap); -if (!cl) -return -ENOMEM ; - -clkdev_add (cl); - -return 0 ; +return cl ?0 : -ENOMEM ; }EXPORT_SYMBOL (clk_register_clkdev);
include/linux/clkdev.h +3 -0
@@ -37,6 +37,9 @@ struct clk_lookup *clkdev_alloc(struct clk *clk, const char *con_id,void clkdev_add (struct clk_lookup *cl);void clkdev_drop (struct clk_lookup *cl); +struct clk_lookup *clkdev_create (struct clk *clk,const char *con_id, +const char *dev_fmt, ...); +void clkdev_add_table (struct clk_lookup *,size_t );int clk_add_alias (const char *,const char *,char *,struct device *);
Signature · 1 line
1.8.3.1
PATCH 6/10 ASOC: migor: use clkdev_create()
In reply to Russell King - ARM Linuxclkdev_create() is a shorter way to write clkdev_alloc() followed by clkdev_add(). Use this instead.
--- sound/soc/sh/migor.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
sound/soc/sh/migor.c +1 -2
@@ -162,12 +162,11 @@ static int __init migor_init(void)if (ret <0 )return ret; - siumckb_lookup =clkdev_alloc (&siumckb_clk,"siumckb_clk" ,NULL ); + siumckb_lookup =clkdev_create (&siumckb_clk,"siumckb_clk" ,NULL );if (!siumckb_lookup) { ret = -ENOMEM ; goto eclkdevalloc; } -clkdev_add (siumckb_lookup);/* Port number used on this machine: port B */ migor_snd_device =platform_device_alloc ("soc-audio" ,1 );
Signature · 1 line
1.8.3.1
PATCH 7/10 clk: s2mps11: use clkdev_create()
In reply to Russell King - ARM Linuxclkdev_create() is a shorter way to write clkdev_alloc() followed by clkdev_add(). Use this instead.
--- drivers/clk/clk-s2mps11.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/clk/clk-s2mps11.c +1 -3
@@ -242,14 +242,12 @@ static int s2mps11_clk_probe(struct platform_device *pdev) goto err_reg; } - s2mps11_clk->lookup =clkdev_alloc (s2mps11_clk->clk, + s2mps11_clk->lookup =clkdev_create (s2mps11_clk->clk,s2mps11_name (s2mps11_clk),NULL );if (!s2mps11_clk->lookup) { ret = -ENOMEM ; goto err_lup; } - -clkdev_add (s2mps11_clk->lookup); }for (i =0 ; i <S2MPS11_CLKS_NUM ; i++) {
Signature · 1 line
1.8.3.1
PATCH 8/10 ARM: orion: use clkdev_create()
In reply to Russell King - ARM Linuxclkdev_create() is a shorter way to write clkdev_alloc() followed by clkdev_add(). Use this instead.
--- arch/arm/plat-orion/common.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
arch/arm/plat-orion/common.c +1 -5
@@ -28,11 +28,7 @@void __init orion_clkdev_add (const char *con_id,const char *dev_id,struct clk *clk) { -struct clk_lookup *cl; - - cl =clkdev_alloc (clk, con_id, dev_id); -if (cl) -clkdev_add (cl); +clkdev_create (clk, con_id,"%s" , dev_id); }/* Create clkdev entries for all orion platforms except kirkwood.
Signature · 1 line
1.8.3.1
PATCH 9/10 ARM: omap2: use clkdev_create()
In reply to Russell King - ARM LinuxRather than open coding the clkdev allocation, initialisation and addition, use the clkdev_create() helper.
--- arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-)
arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c +2 -10
@@ -232,14 +232,12 @@ void omap2xxx_clkt_vps_init(void)struct clk_hw_omap *hw =NULL ;struct clk *clk;const char *parent_name ="mpu_ck" ; -struct clk_lookup *lookup =NULL ;omap2xxx_clkt_vps_late_init ();omap2xxx_clkt_vps_check_bootloader_rates (); hw =kzalloc (sizeof (*hw),GFP_KERNEL ); - lookup =kzalloc (sizeof (*lookup),GFP_KERNEL ); -if (!hw || !lookup) +if (!hw) goto cleanup; init.name ="virt_prcm_set" ; init.ops = &virt_prcm_set_ops;
@@ -249,15 +247,9 @@ void omap2xxx_clkt_vps_init(void) hw->hw.init = &init; clk =clk_register (NULL , &hw->hw); - - lookup->dev_id =NULL ; - lookup->con_id ="cpufreq_ck" ; - lookup->clk = clk; - -clkdev_add (lookup); +clkdev_create (clk,"cpufreq_ck" ,NULL );return ; cleanup: kfree(hw); - kfree(lookup); }#endif
Signature · 1 line
1.8.3.1
PATCH 10/10 ARM: omap2: use clkdev_add_alias()
In reply to Russell King - ARM LinuxWhen creating aliases of existing clkdev clocks, use clkdev_add_alias() isntead of open coding the lookup and clk_lookup creation.
--- arch/arm/mach-omap2/omap_device.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-)
arch/arm/mach-omap2/omap_device.c +9 -15
@@ -47,7 +47,7 @@ static void _add_clkdev(struct omap_device *od, const char *clk_alias, const char *clk_name) {struct clk *r; -struct clk_lookup *l; +int rc;if (!clk_alias || !clk_name)return ;
@@ -62,21 +62,15 @@ static void _add_clkdev(struct omap_device *od, const char *clk_alias,return ; } - r =clk_get (NULL , clk_name); -if (IS_ERR (r)) { -dev_err (&od->pdev->dev, -"clk_get for %s failed\n" , clk_name); -return ; + rc =clk_add_alias (clk_alias,dev_name (&od->pdev->dev), clk_name,NULL ); +if (rc) { +if (rc == -ENODEV || rc == -ENOMEM ) +dev_err (&od->pdev->dev, +"clkdev_alloc for %s failed\n" , clk_alias); +else +dev_err (&od->pdev->dev, +"clk_get for %s failed\n" , clk_name); } - - l =clkdev_alloc (r, clk_alias,dev_name (&od->pdev->dev)); -if (!l) { -dev_err (&od->pdev->dev, -"clkdev_alloc for %s failed\n" , clk_alias); -return ; - } - -clkdev_add (l); }/**
Signature · 1 line
1.8.3.1
Re: [PATCH 02/10] SH: use clkdev_add_table()
In reply to Russell KingQuoted 7 lines · Russell King
We have always had an efficient way of registering a table of clock lookups - it's called
clkdev_add_table(). However, some people seem to really love writing inefficient and unnecessary code.Convert SH to use the correct interface.
Signed-off-by Russell King <[email protected]>
Thanks, looks good.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Re: [PATCH 05/10] clkdev: add clkdev_create() helper
In reply to Russell Kinginclude/linux/clkdev.h struct clk_lookup *clkdev_alloc(struct clk *clk, const char *con_id, · line 41
Quoted 8 lines · Russell King
include/linux/clkdev.h +2
-0@@ -37,6 +37,9 @@ struct clk_lookup *clkdev_alloc(struct clk *clk, const char *con_id,void clkdev_add (struct clk_lookup *cl);void clkdev_drop (struct clk_lookup *cl); +struct clk_lookup *clkdev_create (struct clk *clk,const char *con_id, +const char *dev_fmt, ...);
__printf(3, 4)
While you're at it, can you please also add the __printf attribute to clkdev_alloc() and clk_register_clkdev()?
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Re: [PATCH 06/10] ASOC: migor: use clkdev_create()
In reply to Russell KingQuoted 2 lines · Russell King
clkdev_create()is a shorter way to writeclkdev_alloc()followed byclkdev_add(). Use this instead.
Re: [PATCH 05/10] clkdev: add clkdev_create() helper
In reply to Geert UytterhoevenQuoted 8 lines · Geert Uytterhoeven
Quoted 6 lines · Russell King
include/linux/clkdev.h +0
-0@@ -37,6 +37,9 @@ struct clk_lookup *clkdev_alloc(struct clk *clk, const char *con_id,void clkdev_add (struct clk_lookup *cl);void clkdev_drop (struct clk_lookup *cl);
Quoted 7 lines
include/linux/clkdev.h struct clk_lookup *clkdev_alloc(struct clk *clk, const char *con_id, · line 41
Quoted 2 lines
include/linux/clkdev.h +2
-0+struct clk_lookup *clkdev_create (struct clk *clk,const char *con_id, +const char *dev_fmt, ...);
__printf(3, 4)While you're at it, can you please also add the
__printfattribute toclkdev_alloc()andclk_register_clkdev()?
What's the behaviour of __printf() with a NULL format string? The clkdev interfaces permit that, normal printf() doesn't.
Signature · 2 lines
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up according to speedtest.net.
Re: [PATCH 05/10] clkdev: add clkdev_create() helper
In reply to Russell KingQuoted 37 lines · Russell King
Add a helper to allocate and add a
clk_lookupstructure. This can not only be used in several places inclkdev.cto simplify the code, but more importantly, can be used by callers of the clkdev code to simplify their clkdev creation and registration.Signed-off-by Russell King <[email protected]>--- drivers/clk/clkdev.c | 52 ++++++++++++++++++++++++++++++++++++++------------ include/linux/clkdev.h | 3 +++ 2 files changed, 43 insertions(+), 12 deletions(-)drivers/clk/clkdev.c +13
-0@@ -294,6 +294,19 @@ vclkdev_alloc(struct clk *clk, const char *con_id, const char *dev_fmt,return &cla->cl; } +static struct clk_lookup * +vclkdev_create((struct clk *clk, const char *con_id, const char *dev_fmt, +va_list ap) +{ +struct clk_lookup *cl; + + cl =vclkdev_alloc (clk, con_id, dev_fmt, ap); +if (cl) +clkdev_add (cl); + +return cl; +} + struct clk_lookup * __init_refokclkdev_alloc (struct clk *clk,const char *con_id,const char *dev_fmt, ...) {@@ -308,6 +321,28 @@ clkdev_alloc(struct clk *clk, const char *con_id, const char *dev_fmt, ...) }
drivers/clk/clkdev.c clkdev_alloc(struct clk *clk, const char *con_id, const char *dev_fmt, ...) · line 331
Quoted 10 lines
drivers/clk/clkdev.c +8
-0EXPORT_SYMBOL (clkdev_alloc); +/** +* clkdev_create - allocate and add a clkdev lookup structure +* @clk: struct clk to associate with all clk_lookups +* @con_id: connection ID string on device +* @dev_fmt: format string describing device name +* +* Returns a clk_lookup structure, which can be later unregistered and +* freed.
And returns NULL on failure? Any reason why we don't return an error pointer on failure?
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
Re: [PATCH 05/10] clkdev: add clkdev_create() helper
In reply to Russell King - ARM LinuxQuoted 14 lines · Russell King - ARM Linux
Quoted 13 lines · Geert Uytterhoeven
include/linux/clkdev.h struct clk_lookup *clkdev_alloc(struct clk *clk, const char *con_id, · line 41
Quoted 8 lines · Russell King
include/linux/clkdev.h +2
-0@@ -37,6 +37,9 @@ struct clk_lookup *clkdev_alloc(struct clk *clk, const char *con_id,void clkdev_add (struct clk_lookup *cl);void clkdev_drop (struct clk_lookup *cl); +struct clk_lookup *clkdev_create (struct clk *clk,const char *con_id, +const char *dev_fmt, ...);
__printf(3, 4)
Quoted 5 lines
Quoted 2 lines
While you're at it, can you please also add the
__printfattribute toclkdev_alloc()andclk_register_clkdev()?What's the behaviour of
__printf()with a NULL format string? The clkdev interfaces permit that, normalprintf()doesn't.
As expected: no warning.
Verified with gcc 4.1.2 and 4.8.2.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Re: [PATCH 05/10] clkdev: add clkdev_create() helper
In reply to Stephen BoydQuoted 40 lines · Stephen Boyd
Quoted 39 lines · Russell King
Add a helper to allocate and add a
clk_lookupstructure. This can not only be used in several places inclkdev.cto simplify the code, but more importantly, can be used by callers of the clkdev code to simplify their clkdev creation and registration.Signed-off-by Russell King <[email protected]>--- drivers/clk/clkdev.c | 52 ++++++++++++++++++++++++++++++++++++++------------ include/linux/clkdev.h | 3 +++ 2 files changed, 43 insertions(+), 12 deletions(-)drivers/clk/clkdev.c +13
-0@@ -294,6 +294,19 @@ vclkdev_alloc(struct clk *clk, const char *con_id, const char *dev_fmt,return &cla->cl; } +static struct clk_lookup * +vclkdev_create((struct clk *clk, const char *con_id, const char *dev_fmt, +va_list ap) +{ +struct clk_lookup *cl; + + cl =vclkdev_alloc (clk, con_id, dev_fmt, ap); +if (cl) +clkdev_add (cl); + +return cl; +} + struct clk_lookup * __init_refokclkdev_alloc (struct clk *clk,const char *con_id,const char *dev_fmt, ...) {@@ -308,6 +321,28 @@ clkdev_alloc(struct clk *clk, const char *con_id, const char *dev_fmt, ...) }EXPORT_SYMBOL (clkdev_alloc);
Quoted 11 lines
drivers/clk/clkdev.c clkdev_alloc(struct clk *clk, const char *con_id, const char *dev_fmt, ...) · line 331
Quoted 8 lines
drivers/clk/clkdev.c +8
-0+/** +* clkdev_create - allocate and add a clkdev lookup structure +* @clk: struct clk to associate with all clk_lookups +* @con_id: connection ID string on device +* @dev_fmt: format string describing device name +* +* Returns a clk_lookup structure, which can be later unregistered and +* freed. And returns NULL on failure? Any reason why we don't return an error pointer on failure?
Why should it when it's only error is "no memory" ? It follows the clkdev_alloc() and memory allocator pattern.
It'd also make the error handling in places like clk_add_alias() more difficult (how that happened, I don't know...) though that could probably be fixed as no one seems to bother checking the return value... maybe that's a reason to make it return void ;)
Signature · 2 lines
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up according to speedtest.net.
Quoted 9 lines · Russell King - ARM Linux
Here's some initial clkdev cleanups. These are targetted for the next merge window, and while the initial patches can be merged independently, I'd prefer to keep the series together as further work on solving the problems which unique struct clk's has introduced is needed.
The initial cleanups are more about using the correct clkdev function than anything else: there's no point interating over a array of
clk_lookupstructs, adding each one in turn when we have had a function which does this since forever.
The clkdev_add_table() conversions look good.
Quoted 6 lines
I'm also killing a chunk of seemingly unused code in the omap3isp driver.
Lastly, I'm introducing a
clkdev_create()helper, which combines theclkdev_alloc()+clkdev_add()pattern which keeps cropping up.
We already have a solution to that problem with clk_register_clkdev(). Andy has done some work to make clk_register_clkdev() return a struct clk_lookup pointer[1]. Maybe we can do that instead of introducing a new clkdev_create() function. There is some benefit to having a new function though so that we can avoid a flag day, although it looks like the flag day is small in this case so it might not actually matter.
[1] https://www.marc.info/?l=linux-kernel&m=142469226512289
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
Re: [PATCH 05/10] clkdev: add clkdev_create() helper
In reply to Russell King - ARM LinuxQuoted 51 lines · Russell King - ARM Linux
Quoted 40 lines · Stephen Boyd
Quoted 39 lines · Russell King
Add a helper to allocate and add a
clk_lookupstructure. This can not only be used in several places inclkdev.cto simplify the code, but more importantly, can be used by callers of the clkdev code to simplify their clkdev creation and registration.Signed-off-by Russell King <[email protected]>--- drivers/clk/clkdev.c | 52 ++++++++++++++++++++++++++++++++++++++------------ include/linux/clkdev.h | 3 +++ 2 files changed, 43 insertions(+), 12 deletions(-)drivers/clk/clkdev.c +13
-0@@ -294,6 +294,19 @@ vclkdev_alloc(struct clk *clk, const char *con_id, const char *dev_fmt,return &cla->cl; } +static struct clk_lookup * +vclkdev_create((struct clk *clk, const char *con_id, const char *dev_fmt, +va_list ap) +{ +struct clk_lookup *cl; + + cl =vclkdev_alloc (clk, con_id, dev_fmt, ap); +if (cl) +clkdev_add (cl); + +return cl; +} + struct clk_lookup * __init_refokclkdev_alloc (struct clk *clk,const char *con_id,const char *dev_fmt, ...) {@@ -308,6 +321,28 @@ clkdev_alloc(struct clk *clk, const char *con_id, const char *dev_fmt, ...) }EXPORT_SYMBOL (clkdev_alloc);Quoted 10 lines
drivers/clk/clkdev.c clkdev_alloc(struct clk *clk, const char *con_id, const char *dev_fmt, ...) · line 331
Quoted 8 lines
drivers/clk/clkdev.c +8
-0+/** +* clkdev_create - allocate and add a clkdev lookup structure +* @clk: struct clk to associate with all clk_lookups +* @con_id: connection ID string on device +* @dev_fmt: format string describing device name +* +* Returns a clk_lookup structure, which can be later unregistered and +* freed. And returns NULL on failure? Any reason why we don't return an error pointer on failure?
Quoted 8 lines
Why should it when it's only error is "no memory" ? It follows the
clkdev_alloc()and memory allocator pattern.It'd also make the error handling in places like
clk_add_alias()more difficult (how that happened, I don't know...) though that could probably be fixed as no one seems to bother checking the return value... maybe that's a reason to make it return void ;)
Ok, fair enough. Right now clk_add_alias() leaks if a driver decides to add an alias and then fail probe for something like probe deferral. We should probably make that return the clk_lookup structure too so that drivers can clean up.
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project
Re: [PATCH 01/10] media: omap3isp: remove unused clkdev
In reply to Russell KingHi Russell,
Quoted 5 lines · On Monday 02 March 2015 17:06:06 Russell King wrote:
No merged platform supplies xclks via platform data. As we want to slightly change the clkdev interface, rather than fixing this unused code, remove it instead.
Signed-off-by Russell King <[email protected]>
There are quite a few out of tree users that I know of that might be impacted. On the other hand, out of tree isn't an excuse, and OMAP3 platforms should move to DT. The good news is that DT support for the omap3isp driver is about to get submitted, and hopefully merged in v4.1. I thus have no objection to this patch.
Sakari, does it conflict with the omap3isp DT support ? If so, how would you prefer to resolve the conflict ? Russell, would it be fine to merge this through Mauro's tree ?
Quoted 81 lines
--- drivers/media/platform/omap3isp/isp.c | 18 ------------------ drivers/media/platform/omap3isp/isp.h | 1 - include/media/omap3isp.h | 6 ------ 3 files changed, 25 deletions(-)(quoted diff) +0
-0
b/drivers/media/platform/omap3isp/isp.cindexdeca80903c3a..4d8078b9d010100644drivers/media/platform/omap3isp/isp.c +0
-18@@ -281,7 +281,6 @@ static const struct clk_init_data isp_xclk_init_data = {static int isp_xclk_init (struct isp_device *isp) { -struct isp_platform_data *pdata = isp->pdata;struct clk_init_data init;unsigned int i;@@ -311,20 +310,6 @@ static int isp_xclk_init(struct isp_device *isp) xclk->clk =clk_register (NULL , &xclk->hw);if (IS_ERR (xclk->clk))return PTR_ERR (xclk->clk); - -if (pdata->xclks[i].con_id ==NULL && - pdata->xclks[i].dev_id ==NULL ) -continue ; - - xclk->lookup =kzalloc (sizeof (*xclk->lookup),GFP_KERNEL ); -if (xclk->lookup ==NULL ) -return -ENOMEM ; - - xclk->lookup->con_id = pdata->xclks[i].con_id; - xclk->lookup->dev_id = pdata->xclks[i].dev_id; - xclk->lookup->clk = xclk->clk; - -clkdev_add (xclk->lookup); }return 0 ;@@ -339,9 +324,6 @@ static void isp_xclk_cleanup(struct isp_device *isp)if (!IS_ERR (xclk->clk))clk_unregister (xclk->clk); - -if (xclk->lookup) -clkdev_drop (xclk->lookup); } }(quoted diff) +0
-0
b/drivers/media/platform/omap3isp/isp.hindexcfdfc8714b6b..d41c98bbdfe7100644drivers/media/platform/omap3isp/isp.h +0
-1@@ -122,7 +122,6 @@ enum isp_xclk_id {struct isp_xclk {struct isp_device *isp;struct clk_hw hw; -struct clk_lookup *lookup;struct clk *clk;enum isp_xclk_id id;include/media/omap3isp.h +0
-6@@ -152,13 +152,7 @@ struct isp_v4l2_subdevs_group { } bus;/* gcc < 4.6.0 chokes on anonymous union initializers */ }; -struct isp_platform_xclk { -const char *dev_id; -const char *con_id; -}; -struct isp_platform_data { -struct isp_platform_xclk xclks[2 ];struct isp_v4l2_subdevs_group *subdevs;void (*set_constraints)(struct isp_device *isp,bool enable); };
Signature · 3 lines
Regards, Laurent Pinchart
Re: [PATCH 01/10] media: omap3isp: remove unused clkdev
Hi Laurent and Russell,
Quoted 15 lines · Laurent Pinchart
Hi Russell,
Quoted 5 lines · On Monday 02 March 2015 17:06:06 Russell King wrote:
No merged platform supplies xclks via platform data. As we want to slightly change the clkdev interface, rather than fixing this unused code, remove it instead.
Signed-off-by Russell King <[email protected]>There are quite a few out of tree users that I know of that might be impacted. On the other hand, out of tree isn't an excuse, and OMAP3 platforms should move to DT. The good news is that DT support for the omap3isp driver is about to get submitted, and hopefully merged in v4.1. I thus have no objection to this patch.
Quoted 3 lines
Sakari, does it conflict with the omap3isp DT support ? If so, how would you prefer to resolve the conflict ? Russell, would it be fine to merge this through Mauro's tree ?
I first thought it wouldn't conflict, but apparently it does. The conflicting patches are here:
<URL:http://vihersipuli.retiisi.org.uk/cgi-bin/gitweb.cgi?p=~sailus/linux.git;a=commitdiff;h=a56c38208ee9200e57421b60b770fb8249935b95> <URL:http://vihersipuli.retiisi.org.uk/cgi-bin/gitweb.cgi?p=~sailus/linux.git;a=commitdiff;h=72374c7a69a12afc76f220ef4de983be4583f164> <URL:http://vihersipuli.retiisi.org.uk/cgi-bin/gitweb.cgi?p=~sailus/linux.git;a=commitdiff;h=0f0b86d64a555e308079f985812b011866e2c8f0>
Tne entire set:
I haven't sent that to linux-media yet but I'll do that during the coming couple of days.
Signature · 4 lines
Regards, Sakari Ailus e-mail: [email protected] XMPP: [email protected]
Re: [PATCH 01/10] media: omap3isp: remove unused clkdev
(Combining replies...)
Quoted 6 lines · Sakari Ailus
Hi Laurent and Russell,
Quoted 3 lines · Laurent Pinchart
Sakari, does it conflict with the omap3isp DT support ? If so, how would you prefer to resolve the conflict ? Russell, would it be fine to merge this through Mauro's tree ?
As other changes will depend on this, I'd prefer not to. The whole "make clk_get() return a unique struct clk" wasn't well tested, and several places broke - and currently clk_add_alias() is broken as a result of that.
I'm trying to get to the longer term solution, where clkdev internally uses a struct clk_hw pointer rather than a struct clk pointer, and I want to clean stuff up first.
If omap3isp needs to keep this code, then so be it - I'll come up with a different patch improving its use of clkdev instead.
Signature · 2 lines
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up according to speedtest.net.
Tony Lindgren
maintainerRe: [PATCH 10/10] ARM: omap2: use clkdev_add_alias()
In reply to Russell KingQuoted 2 lines · Russell King
When creating aliases of existing clkdev clocks, use
clkdev_add_alias()isntead of open coding the lookup andclk_lookupcreation.
Gave this series a quick try but I get these build errors:
arch/arm/mach-omap2/omap_device.c: In function ?_add_clkdev?:arch/arm/mach-omap2/omap_device.c:65:58: warning: passing argument 3 of ?clk_add_alias? discards ?const? qualifier from pointer target type
rc = clk_add_alias(clk_alias, dev_name(&od->pdev->dev), clk_name, NULL);
^
In file included from arch/arm/mach-omap2/omap_device.c:34:0:
include/linux/clkdev.h:44:5: note: expected ?char *? but argument is of type ?const char *?
int clk_add_alias(const char *, const char *, char *, struct device *);
^
drivers/clk/clkdev.c:298:16: error: expected declaration specifiers or ?...? before ?(? token
vclkdev_create((struct clk *clk, const char *con_id, const char *dev_fmt,
^
drivers/clk/clkdev.c:322:92: error: storage class specified for parameter ?__crc_clkdev_alloc?
EXPORT_SYMBOL(clkdev_alloc);
^drivers/clk/clkdev.c:322:1: warning: ?weak? attribute ignored [-Wattributes]
EXPORT_SYMBOL(clkdev_alloc);
^drivers/clk/clkdev.c:322:1: warning: ?externally_visible? attribute ignored [-Wattributes] drivers/clk/clkdev.c:322:161: error: storage class specified for parameter ?__kcrctab_clkdev_alloc?
EXPORT_SYMBOL(clkdev_alloc);
^drivers/clk/clkdev.c:322:1: warning: ?__used__? attribute ignored [-Wattributes]
EXPORT_SYMBOL(clkdev_alloc);
^drivers/clk/clkdev.c:322:161: error: section attribute not allowed for ?__kcrctab_clkdev_alloc?
EXPORT_SYMBOL(clkdev_alloc);
^drivers/clk/clkdev.c:322:279: error: expected ?;?, ?,? or ?)? before ?=? token
EXPORT_SYMBOL(clkdev_alloc);
drivers/clk/clkdev.c:274:1: warning: ?vclkdev_alloc? defined but not used [-Wunused-function]
vclkdev_alloc(struct clk *clk, const char *con_id, const char *dev_fmt,
Regards,
Tony
Re: [PATCH 01/10] media: omap3isp: remove unused clkdev
In reply to Russell King - ARM LinuxHi Russell,
Quoted 15 lines · On Monday 02 March 2015 23:54:35 Russell King - ARM Linux wrote:
(Combining replies...)
Quoted 6 lines · Sakari Ailus
Hi Laurent and Russell,
Quoted 3 lines · Laurent Pinchart
Sakari, does it conflict with the omap3isp DT support ? If so, how would you prefer to resolve the conflict ? Russell, would it be fine to merge this through Mauro's tree ?
As other changes will depend on this, I'd prefer not to. The whole "make
clk_get()return a unique struct clk" wasn't well tested, and several places broke - and currentlyclk_add_alias()is broken as a result of that.
Quoted 6 lines
I'm trying to get to the longer term solution, where clkdev internally uses a struct
clk_hwpointer rather than a struct clk pointer, and I want to clean stuff up first.If omap3isp needs to keep this code, then so be it - I'll come up with a different patch improving its use of clkdev instead.
I'm totally fine with removing clkdev from the omap3isp driver if that's easier for you, I'm just concerned about the merge conflict that will result.
Signature · 3 lines
Regards, Laurent Pinchart
Re: [PATCH 08/10] ARM: orion: use clkdev_create()
In reply to Russell KingDear Russell King,
Quoted 15 lines · Russell King
clkdev_create()is a shorter way to writeclkdev_alloc()followed byclkdev_add(). Use this instead.Signed-off-by Russell King <[email protected]>--- arch/arm/plat-orion/common.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)arch/arm/plat-orion/common.c +0
-0@@ -28,11 +28,7 @@void __init orion_clkdev_add (const char *con_id,const char *dev_id,struct clk *clk)
arch/arm/plat-orion/common.c line 34
Quoted 10 lines
arch/arm/plat-orion/common.c +1
-5{ -struct clk_lookup *cl; - - cl =clkdev_alloc (clk, con_id, dev_id); -if (cl) -clkdev_add (cl); +clkdev_create (clk, con_id,"%s" , dev_id); }/* Create clkdev entries for all orion platforms except kirkwood.
Looks good, but instead of having orion_clkdev_add() being just an alias for clkdev_create(), what about going ahead and simply reoving orion_clkdev_add() entirely? Something like the below patch (not even compile tested) :
arch/arm/mach-dove/common.c +22 -22
@@ -109,28 +109,28 @@ static void __init dove_clk_init(void) gephy =dove_register_gate ("gephy" ,"tclk" ,CLOCK_GATING_BIT_GIGA_PHY ); ge =dove_register_gate ("ge" ,"gephy" ,CLOCK_GATING_BIT_GBE ); -orion_clkdev_add (NULL ,"orion_spi.0" , tclk); -orion_clkdev_add (NULL ,"orion_spi.1" , tclk); -orion_clkdev_add (NULL ,"orion_wdt" , tclk); -orion_clkdev_add (NULL ,"mv64xxx_i2c.0" , tclk); - -orion_clkdev_add (NULL ,"orion-ehci.0" , usb0); -orion_clkdev_add (NULL ,"orion-ehci.1" , usb1); -orion_clkdev_add (NULL ,"mv643xx_eth_port.0" , ge); -orion_clkdev_add (NULL ,"sata_mv.0" , sata); -orion_clkdev_add ("0" ,"pcie" , pex0); -orion_clkdev_add ("1" ,"pcie" , pex1); -orion_clkdev_add (NULL ,"sdhci-dove.0" , sdio0); -orion_clkdev_add (NULL ,"sdhci-dove.1" , sdio1); -orion_clkdev_add (NULL ,"orion_nand" , nand); -orion_clkdev_add (NULL ,"cafe1000-ccic.0" , camera); -orion_clkdev_add (NULL ,"mvebu-audio.0" , i2s0); -orion_clkdev_add (NULL ,"mvebu-audio.1" , i2s1); -orion_clkdev_add (NULL ,"mv_crypto" , crypto); -orion_clkdev_add (NULL ,"dove-ac97" , ac97); -orion_clkdev_add (NULL ,"dove-pdma" , pdma); -orion_clkdev_add (NULL ,MV_XOR_NAME ".0" , xor0); -orion_clkdev_add (NULL ,MV_XOR_NAME ".1" , xor1); +clkdev_create (tclk,NULL ,"%s" ,"orion_spi.0" ); +clkdev_create (tclk,NULL ,"%s" ,"orion_spi.1" ); +clkdev_create (tclk,NULL ,"%s" ,"orion_wdt" ); +clkdev_create (tclk,NULL ,"%s" ,"mv64xxx_i2c.0" ); + +clkdev_create (usb0,NULL ,"%s" ,"orion-ehci.0" ); +clkdev_create (usb1,NULL ,"%s" ,"orion-ehci.1" ); +clkdev_create (ge,NULL ,"%s" ,"mv643xx_eth_port.0" ); +clkdev_create (sata,NULL ,"%s" ,"sata_mv.0" ); +clkdev_create (pex0,"0" ,"%s" ,"pcie" ); +clkdev_create (pex1,"1" ,"%s" ,"pcie" ); +clkdev_create (sdio0,NULL ,"%s" ,"sdhci-dove.0" ); +clkdev_create (sdio1,NULL ,"%s" ,"sdhci-dove.1" ); +clkdev_create (nand,NULL ,"%s" ,"orion_nand" ); +clkdev_create (camera,NULL ,"%s" ,"cafe1000-ccic.0" ); +clkdev_create (i2s0,NULL ,"%s" ,"mvebu-audio.0" ); +clkdev_create (i2s1,NULL ,"%s" ,"mvebu-audio.1" ); +clkdev_create (crypto,NULL ,"%s" ,"mv_crypto" ); +clkdev_create (ac97,NULL ,"%s" ,"dove-ac97" ); +clkdev_create (pdma,NULL ,"%s" ,"dove-pdma" ); +clkdev_create (xor0,NULL ,"%s" ,MV_XOR_NAME ".0" ); +clkdev_create (xor1,NULL ,"%s" ,MV_XOR_NAME ".1" ); }/*****************************************************************************
arch/arm/plat-orion/common.c +8 -19
@@ -24,31 +24,20 @@#include <mach/bridge-regs.h> #include <plat/common.h> -/* Create a clkdev entry for a given device/clk */ -void __init orion_clkdev_add (const char *con_id,const char *dev_id, -struct clk *clk) -{ -struct clk_lookup *cl; - - cl =clkdev_alloc (clk, con_id, dev_id); -if (cl) -clkdev_add (cl); -} -/* Create clkdev entries for all orion platforms except kirkwood. Kirkwood has gated clocks for some of its peripherals, so creates its own clkdev entries. For all the other orion devices, create clkdev entries to the tclk. */ void __init orion_clkdev_init (struct clk *tclk) { -orion_clkdev_add (NULL ,"orion_spi.0" , tclk); -orion_clkdev_add (NULL ,"orion_spi.1" , tclk); -orion_clkdev_add (NULL ,MV643XX_ETH_NAME ".0" , tclk); -orion_clkdev_add (NULL ,MV643XX_ETH_NAME ".1" , tclk); -orion_clkdev_add (NULL ,MV643XX_ETH_NAME ".2" , tclk); -orion_clkdev_add (NULL ,MV643XX_ETH_NAME ".3" , tclk); -orion_clkdev_add (NULL ,"orion_wdt" , tclk); -orion_clkdev_add (NULL ,MV64XXX_I2C_CTLR_NAME ".0" , tclk); +clkdev_create (tclk,NULL ,"%s" ,"orion_spi.0" ); +clkdev_create (tclk,NULL ,"%s" ,"orion_spi.1" ); +clkdev_create (tclk,NULL ,"%s" ,MV643XX_ETH_NAME ".0" ); +clkdev_create (tclk,NULL ,"%s" ,MV643XX_ETH_NAME ".1" ); +clkdev_create (tclk,NULL ,"%s" ,MV643XX_ETH_NAME ".2" ); +clkdev_create (tclk,NULL ,"%s" ,MV643XX_ETH_NAME ".3" ); +clkdev_create (tclk,NULL ,"%s" ,"orion_wdt" ); +clkdev_create (tclk,NULL ,"%s" ,MV64XXX_I2C_CTLR_NAME ".0" ); }/* Fill in the resources structure and link it into the platform
arch/arm/plat-orion/include/plat/common.h +0 -3
@@ -106,8 +106,5 @@ void __init orion_crypto_init(unsigned long mapbase,unsigned long sram_size, unsigned long irq); -void __init orion_clkdev_add (const char *con_id,const char *dev_id, -struct clk *clk); -void __init orion_clkdev_init (struct clk *tclk);#endif
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
Quoted 13 lines · Stephen Boyd
Quoted 11 lines · Russell King - ARM Linux
Here's some initial clkdev cleanups. These are targetted for the next merge window, and while the initial patches can be merged independently, I'd prefer to keep the series together as further work on solving the problems which unique struct clk's has introduced is needed.
I'm also killing a chunk of seemingly unused code in the omap3isp driver.
Lastly, I'm introducing a
clkdev_create()helper, which combines theclkdev_alloc()+clkdev_add()pattern which keeps cropping up.
Quoted 8 lines
We already have a solution to that problem with
clk_register_clkdev(). Andy has done some work to makeclk_register_clkdev()return a structclk_lookuppointer[1]. Maybe we can do that instead of introducing a newclkdev_create()function. There is some benefit to having a new function though so that we can avoid a flag day, although it looks like the flag day is small in this case so it might not actually matter.
Agree with Stephen, why should we have the second function doing the same? Just name changing?
I think you may just incorporate that patch into your series.
Signature · 2 lines
Andy Shevchenko <[email protected]> Intel Finland Oy
Re: [PATCH 01/10] media: omap3isp: remove unused clkdev
In reply to Laurent PinchartHi Laurent,
Quoted 22 lines · Laurent Pinchart
Hi Russell,
Quoted 19 lines · On Monday 02 March 2015 23:54:35 Russell King - ARM Linux wrote:
(Combining replies...)
Quoted 6 lines · Sakari Ailus
Hi Laurent and Russell,
Quoted 3 lines · Laurent Pinchart
Sakari, does it conflict with the omap3isp DT support ? If so, how would you prefer to resolve the conflict ? Russell, would it be fine to merge this through Mauro's tree ?
As other changes will depend on this, I'd prefer not to. The whole "make
clk_get()return a unique struct clk" wasn't well tested, and several places broke - and currentlyclk_add_alias()is broken as a result of that.I'm trying to get to the longer term solution, where clkdev internally uses a struct
clk_hwpointer rather than a struct clk pointer, and I want to clean stuff up first.
Quoted 5 lines
Quoted 2 lines
If omap3isp needs to keep this code, then so be it - I'll come up with a different patch improving its use of clkdev instead.
I'm totally fine with removing clkdev from the omap3isp driver if that's easier for you, I'm just concerned about the merge conflict that will result.
There actually appears to be one more dependency, so four patches in total.
What we could also do is to rebase the omap3isp DT support set on top of Russell's single patch. This way there probably would be no merge conflict, assuming the patches are exactly the same, and you have no other patches changing the omap3isp driver.
Alternatively we could postpone the DT support for the omap3isp, but I'd rather want to avoid that.
Signature · 4 lines
Kind regards, Sakari Ailus e-mail: [email protected] XMPP: [email protected]
Re: [PATCH 01/10] media: omap3isp: remove unused clkdev
In reply to Russell King - ARM LinuxHi Russell,
Quoted 15 lines · Russell King - ARM Linux
(Combining replies...)
Quoted 6 lines · Sakari Ailus
Hi Laurent and Russell,
Quoted 3 lines · Laurent Pinchart
Sakari, does it conflict with the omap3isp DT support ? If so, how would you prefer to resolve the conflict ? Russell, would it be fine to merge this through Mauro's tree ?
As other changes will depend on this, I'd prefer not to. The whole "make
clk_get()return a unique struct clk" wasn't well tested, and several places broke - and currentlyclk_add_alias()is broken as a result of that.
Quoted 6 lines
I'm trying to get to the longer term solution, where clkdev internally uses a struct
clk_hwpointer rather than a struct clk pointer, and I want to clean stuff up first.If omap3isp needs to keep this code, then so be it - I'll come up with a different patch improving its use of clkdev instead.
I discussed this with Laurent and the two options we thought are
- You provide a stable branch on which I can rebase the patches, in order to avoid a merge conflict or
- We ignore the conflict and let Stephen Rothwell handle it. The conflict itself is relatively simple to resolve.
Signature · 4 lines
Kind regards, Sakari Ailus e-mail: [email protected] XMPP: [email protected]