From: Sylwester Nawrocki <s.nawrocki@samsung.com> To: Jingoo Han <jg1.han@samsung.com> Cc: Kukjin Kim <kgene.kim@samsung.com>, Paul Mundt <lethal@linux-sh.org>, linux-samsung-soc@vger.kernel.org, linux-fbdev@vger.kernel.org, Jonghun Han <jonghun.han@samsung.com>, Anand Kumar N <anand.kn@samsung.com>, Thomas Abraham <thomas.ab@samsung.com>, Marek Szyprowski <m.szyprowski@samsung.com>, Kyungmin Park <kmpark@infradead.org>, Inki Dae <inki.dae@samsung.com>, ARM Linux <linux@arm.linux.org.uk>, Ben Dooks <ben-linux@fluff.org> Subject: Re: [PATCH V5 5/5] ARM: EXYNOS4: Add platform data for EXYNOS4 FIMD Date: Wed, 22 Jun 2011 08:56:41 +0000 [thread overview] Message-ID: <4E01AE49.60009@samsung.com> (raw) In-Reply-To: <1308724904-31521-1-git-send-email-jg1.han@samsung.com> Hello, On 06/22/2011 08:41 AM, Jingoo Han wrote: > From: Jonghun Han <jonghun.han@samsung.com> > > This patch adds support EXYNOS4 FIMD0 and LTE480WV LCD pannel. > > Signed-off-by: Jonghun Han <jonghun.han@samsung.com> > Signed-off-by: Jingoo Han <jg1.han@samsung.com> > --- > arch/arm/mach-exynos4/mach-smdkc210.c | 114 +++++++++++++++++++++++++++++++++ > arch/arm/mach-exynos4/mach-smdkv310.c | 114 +++++++++++++++++++++++++++++++++ > 2 files changed, 228 insertions(+), 0 deletions(-) ... > +static int __init smdkc210_fimd0_setup_clock(void) > +{ > + struct clk *sclk = NULL; > + struct clk *mout_mpll = NULL; You don't need initialize to NULL here. > + > + u32 rate = 0; Other than this variable is not really needed I would make it unsigned long. > + > + sclk = clk_get(&s5p_device_fimd0.dev, "sclk_fimd"); > + if (IS_ERR(sclk)) { > + printk(KERN_ERR "failed to get sclk for fimd\n"); > + goto err_clk2; You could just do: return PTR_ERR(sclk); > + } > + > + mout_mpll = clk_get(NULL, "mout_mpll"); > + if (IS_ERR(mout_mpll)) { > + printk(KERN_ERR "failed to get mout_mpll\n"); > + goto err_clk1; > + } > + > + clk_set_parent(sclk, mout_mpll); > + if (!rate) > + rate = 134000000; 134000000UL > + > + clk_set_rate(sclk, rate); > + > + clk_put(sclk); > + clk_put(mout_mpll); > + > + return 0; > + > +err_clk1: > + clk_put(mout_mpll); clk_put is supposed to be used only for clocks that were successfully acquired. > +err_clk2: > + clk_put(sclk); Ditto. > + > + return -EINVAL; > +} ... > +static int __init smdkv310_fimd0_setup_clock(void) > +{ > + struct clk *sclk = NULL; > + struct clk *mout_mpll = NULL; > + > + u32 rate = 0; > + > + sclk = clk_get(&s5p_device_fimd0.dev, "sclk_fimd"); > + if (IS_ERR(sclk)) { > + printk(KERN_ERR "failed to get sclk for fimd\n"); > + goto err_clk2; > + } > + > + mout_mpll = clk_get(NULL, "mout_mpll"); > + if (IS_ERR(mout_mpll)) { > + printk(KERN_ERR "failed to get mout_mpll\n"); > + goto err_clk1; > + } > + > + clk_set_parent(sclk, mout_mpll); > + if (!rate) > + rate = 134000000; > + > + clk_set_rate(sclk, rate); > + > + clk_put(sclk); > + clk_put(mout_mpll); > + > + return 0; > + > +err_clk1: > + clk_put(mout_mpll); > +err_clk2: > + clk_put(sclk); > + > + return -EINVAL; > +} We have multiple copies of same function and I suspect other boards will try to repeat this pattern which is not that good. It would be worth to create common function for all boards if we really must have that, e.g. int __init exynos4_fimd_setup_clock(struct device *dev, const char *parent, unsigned long clk_rate); { struct clk *clk_parent; struct clk *sclk; sclk = clk_get(dev, "sclk_fimd"); if (IS_ERR(sclk)) return PTR_ERR(sclk); clk_parent = clk_get(NULL, parent); if (IS_ERR(parent_clk)) { clk_put(sclk); return PTR_ERR(clk_parent); } clk_set_parent(sclk, clk_parent); if (!rate) rate = 134000000UL; clk_set_rate(sclk, rate); clk_put(sclk); clk_put(clk_parent); return 0; } But I have no idea where to put that... Perhaps we should create common mach-exynos4/setup-fimd.c file for FIMD0, FIMD1. But then it would contain ugly #ifdef for unused FIMD1 setup functions ("#ifdef CONFIG_DEV_FIMD0 ..") if only FIMD0 is used. Maybe someone else has better idea. Regards, -- Sylwester Nawrocki Samsung Poland R&D Center
WARNING: multiple messages have this Message-ID (diff)
From: Sylwester Nawrocki <s.nawrocki@samsung.com> To: Jingoo Han <jg1.han@samsung.com> Cc: Kukjin Kim <kgene.kim@samsung.com>, Paul Mundt <lethal@linux-sh.org>, linux-samsung-soc@vger.kernel.org, linux-fbdev@vger.kernel.org, Jonghun Han <jonghun.han@samsung.com>, Anand Kumar N <anand.kn@samsung.com>, Thomas Abraham <thomas.ab@samsung.com>, Marek Szyprowski <m.szyprowski@samsung.com>, Kyungmin Park <kmpark@infradead.org>, Inki Dae <inki.dae@samsung.com>, ARM Linux <linux@arm.linux.org.uk>, Ben Dooks <ben-linux@fluff.org> Subject: Re: [PATCH V5 5/5] ARM: EXYNOS4: Add platform data for EXYNOS4 FIMD and LTE480WV platform-lcd Date: Wed, 22 Jun 2011 10:56:41 +0200 [thread overview] Message-ID: <4E01AE49.60009@samsung.com> (raw) In-Reply-To: <1308724904-31521-1-git-send-email-jg1.han@samsung.com> Hello, On 06/22/2011 08:41 AM, Jingoo Han wrote: > From: Jonghun Han <jonghun.han@samsung.com> > > This patch adds support EXYNOS4 FIMD0 and LTE480WV LCD pannel. > > Signed-off-by: Jonghun Han <jonghun.han@samsung.com> > Signed-off-by: Jingoo Han <jg1.han@samsung.com> > --- > arch/arm/mach-exynos4/mach-smdkc210.c | 114 +++++++++++++++++++++++++++++++++ > arch/arm/mach-exynos4/mach-smdkv310.c | 114 +++++++++++++++++++++++++++++++++ > 2 files changed, 228 insertions(+), 0 deletions(-) ... > +static int __init smdkc210_fimd0_setup_clock(void) > +{ > + struct clk *sclk = NULL; > + struct clk *mout_mpll = NULL; You don't need initialize to NULL here. > + > + u32 rate = 0; Other than this variable is not really needed I would make it unsigned long. > + > + sclk = clk_get(&s5p_device_fimd0.dev, "sclk_fimd"); > + if (IS_ERR(sclk)) { > + printk(KERN_ERR "failed to get sclk for fimd\n"); > + goto err_clk2; You could just do: return PTR_ERR(sclk); > + } > + > + mout_mpll = clk_get(NULL, "mout_mpll"); > + if (IS_ERR(mout_mpll)) { > + printk(KERN_ERR "failed to get mout_mpll\n"); > + goto err_clk1; > + } > + > + clk_set_parent(sclk, mout_mpll); > + if (!rate) > + rate = 134000000; 134000000UL > + > + clk_set_rate(sclk, rate); > + > + clk_put(sclk); > + clk_put(mout_mpll); > + > + return 0; > + > +err_clk1: > + clk_put(mout_mpll); clk_put is supposed to be used only for clocks that were successfully acquired. > +err_clk2: > + clk_put(sclk); Ditto. > + > + return -EINVAL; > +} ... > +static int __init smdkv310_fimd0_setup_clock(void) > +{ > + struct clk *sclk = NULL; > + struct clk *mout_mpll = NULL; > + > + u32 rate = 0; > + > + sclk = clk_get(&s5p_device_fimd0.dev, "sclk_fimd"); > + if (IS_ERR(sclk)) { > + printk(KERN_ERR "failed to get sclk for fimd\n"); > + goto err_clk2; > + } > + > + mout_mpll = clk_get(NULL, "mout_mpll"); > + if (IS_ERR(mout_mpll)) { > + printk(KERN_ERR "failed to get mout_mpll\n"); > + goto err_clk1; > + } > + > + clk_set_parent(sclk, mout_mpll); > + if (!rate) > + rate = 134000000; > + > + clk_set_rate(sclk, rate); > + > + clk_put(sclk); > + clk_put(mout_mpll); > + > + return 0; > + > +err_clk1: > + clk_put(mout_mpll); > +err_clk2: > + clk_put(sclk); > + > + return -EINVAL; > +} We have multiple copies of same function and I suspect other boards will try to repeat this pattern which is not that good. It would be worth to create common function for all boards if we really must have that, e.g. int __init exynos4_fimd_setup_clock(struct device *dev, const char *parent, unsigned long clk_rate); { struct clk *clk_parent; struct clk *sclk; sclk = clk_get(dev, "sclk_fimd"); if (IS_ERR(sclk)) return PTR_ERR(sclk); clk_parent = clk_get(NULL, parent); if (IS_ERR(parent_clk)) { clk_put(sclk); return PTR_ERR(clk_parent); } clk_set_parent(sclk, clk_parent); if (!rate) rate = 134000000UL; clk_set_rate(sclk, rate); clk_put(sclk); clk_put(clk_parent); return 0; } But I have no idea where to put that... Perhaps we should create common mach-exynos4/setup-fimd.c file for FIMD0, FIMD1. But then it would contain ugly #ifdef for unused FIMD1 setup functions ("#ifdef CONFIG_DEV_FIMD0 ..") if only FIMD0 is used. Maybe someone else has better idea. Regards, -- Sylwester Nawrocki Samsung Poland R&D Center
next prev parent reply other threads:[~2011-06-22 8:56 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-06-22 6:41 [PATCH V5 5/5] ARM: EXYNOS4: Add platform data for EXYNOS4 FIMD and LTE480WV platform-lcd Jingoo Han 2011-06-22 6:41 ` Jingoo Han 2011-06-22 8:56 ` Sylwester Nawrocki [this message] 2011-06-22 8:56 ` Sylwester Nawrocki 2011-06-22 9:47 ` [PATCH V5 5/5] ARM: EXYNOS4: Add platform data for EXYNOS4 FIMD Marek Szyprowski 2011-06-22 9:47 ` [PATCH V5 5/5] ARM: EXYNOS4: Add platform data for EXYNOS4 FIMD and LTE480WV platform-lcd Marek Szyprowski [not found] ` <BANLkTimPjo+WefApQLe=HKbYLCwmo_gGRw@mail.gmail.com> 2011-06-22 13:25 ` Anand Kumar N 2011-06-22 13:37 ` [PATCH V5 5/5] ARM: EXYNOS4: Add platform data for EXYNOS4 FIMD Anand Kumar N 2011-06-22 20:33 ` Sylwester Nawrocki 2011-06-22 20:33 ` [PATCH V5 5/5] ARM: EXYNOS4: Add platform data for EXYNOS4 FIMD and LTE480WV platform-lcd Sylwester Nawrocki 2011-06-23 1:09 JinGoo Han 2011-06-23 1:09 ` Re: [PATCH V5 5/5] ARM: EXYNOS4: Add platform data for EXYNOS4 JinGoo Han 2011-06-23 6:44 RE: [PATCH V5 5/5] ARM: EXYNOS4: Add platform data for EXYNOS4 FIMD and LTE480WV platform-lcd JinGoo Han 2011-06-23 6:44 ` RE: [PATCH V5 5/5] ARM: EXYNOS4: Add platform data for EXYNOS4 JinGoo Han
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=4E01AE49.60009@samsung.com \ --to=s.nawrocki@samsung.com \ --cc=anand.kn@samsung.com \ --cc=ben-linux@fluff.org \ --cc=inki.dae@samsung.com \ --cc=jg1.han@samsung.com \ --cc=jonghun.han@samsung.com \ --cc=kgene.kim@samsung.com \ --cc=kmpark@infradead.org \ --cc=lethal@linux-sh.org \ --cc=linux-fbdev@vger.kernel.org \ --cc=linux-samsung-soc@vger.kernel.org \ --cc=linux@arm.linux.org.uk \ --cc=m.szyprowski@samsung.com \ --cc=thomas.ab@samsung.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.