From: Paul Walmsley <paul@pwsan.com> To: Tony Lindgren <tony@atomide.com>, Kevin Hilman <khilman@ti.com> Cc: Joe Woodward <jw@terrafix.co.uk>, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH] ARM: OMAP3: clockdomain: fix accidental duplicate registration Date: Thu, 12 Jul 2012 04:54:49 -0600 (MDT) [thread overview] Message-ID: <alpine.DEB.2.00.1207120448120.25585@utopia.booyaka.com> (raw) Commit 3dd50d0545bd5a8ad83d4339f07935cd3e883271 ("Merge tag 'omap-cleanup-for-v3.6' into tmp-merge") inadvertently caused a clockdomain to be registered twice on OMAP3 boards. This causes warnings on boot, wild pointer dereferences, and PM regressions. Fix the double registration and add some clockdomain code to prevent this from happening again. Reported-by: Joe Woodward <jw@terrafix.co.uk> Cc: Tony Lindgren <tony@atomide.com> Cc: Kevin Hilman <khilman@ti.com> Signed-off-by: Paul Walmsley <paul@pwsan.com> --- Intended for v3.6 merge window. Applies on linux-omap commit 3dd50d0545bd5a8ad83d4339f07935cd3e883271. Boot-tested on 2430 SDP, 3517 EVM, 37xx EVM, 5912 OSK, and CM-T 3517. arch/arm/mach-omap2/clockdomain.c | 19 ++++++++++++++----- arch/arm/mach-omap2/clockdomain.h | 1 + arch/arm/mach-omap2/clockdomains3xxx_data.c | 1 - 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/arch/arm/mach-omap2/clockdomain.c b/arch/arm/mach-omap2/clockdomain.c index 8664f5a..b851ba4 100644 --- a/arch/arm/mach-omap2/clockdomain.c +++ b/arch/arm/mach-omap2/clockdomain.c @@ -63,9 +63,10 @@ static struct clockdomain *_clkdm_lookup(const char *name) * _clkdm_register - register a clockdomain * @clkdm: struct clockdomain * to register * - * Adds a clockdomain to the internal clockdomain list. - * Returns -EINVAL if given a null pointer, -EEXIST if a clockdomain is - * already registered by the provided name, or 0 upon success. + * Adds a clockdomain to the internal clockdomain list. Returns + * -EINVAL if given a null pointer, -EEXIST if a clockdomain is + * already registered by the provided name or if @clkdm has already + * been registered, or 0 upon success. */ static int _clkdm_register(struct clockdomain *clkdm) { @@ -74,6 +75,11 @@ static int _clkdm_register(struct clockdomain *clkdm) if (!clkdm || !clkdm->name) return -EINVAL; + if (clkdm->_flags & _CLKDM_FLAG_REGISTERED) { + pr_err("clockdomain: %s: already registered\n", clkdm->name); + return -EEXIST; + } + pwrdm = pwrdm_lookup(clkdm->pwrdm.name); if (!pwrdm) { pr_err("clockdomain: %s: powerdomain %s does not exist\n", @@ -82,15 +88,18 @@ static int _clkdm_register(struct clockdomain *clkdm) } clkdm->pwrdm.ptr = pwrdm; - /* Verify that the clockdomain is not already registered */ - if (_clkdm_lookup(clkdm->name)) + if (_clkdm_lookup(clkdm->name)) { + pr_err("clockdomain: %s: name already registered\n", + clkdm->name); return -EEXIST; + } list_add(&clkdm->node, &clkdm_list); pwrdm_add_clkdm(pwrdm, clkdm); spin_lock_init(&clkdm->lock); + clkdm->_flags |= _CLKDM_FLAG_REGISTERED; pr_debug("clockdomain: registered %s\n", clkdm->name); diff --git a/arch/arm/mach-omap2/clockdomain.h b/arch/arm/mach-omap2/clockdomain.h index 5601dc1..7b3c1d2 100644 --- a/arch/arm/mach-omap2/clockdomain.h +++ b/arch/arm/mach-omap2/clockdomain.h @@ -86,6 +86,7 @@ struct clkdm_dep { /* Possible flags for struct clockdomain._flags */ #define _CLKDM_FLAG_HWSUP_ENABLED BIT(0) +#define _CLKDM_FLAG_REGISTERED BIT(1) /** * struct clockdomain - OMAP clockdomain diff --git a/arch/arm/mach-omap2/clockdomains3xxx_data.c b/arch/arm/mach-omap2/clockdomains3xxx_data.c index d625844..56089c4 100644 --- a/arch/arm/mach-omap2/clockdomains3xxx_data.c +++ b/arch/arm/mach-omap2/clockdomains3xxx_data.c @@ -454,7 +454,6 @@ static struct clkdm_autodep clkdm_am35x_autodeps[] = { static struct clockdomain *clockdomains_common[] __initdata = { &wkup_common_clkdm, - &mpu_3xxx_clkdm, &neon_clkdm, &core_l3_3xxx_clkdm, &core_l4_3xxx_clkdm, -- 1.7.10
WARNING: multiple messages have this Message-ID (diff)
From: paul@pwsan.com (Paul Walmsley) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH] ARM: OMAP3: clockdomain: fix accidental duplicate registration Date: Thu, 12 Jul 2012 04:54:49 -0600 (MDT) [thread overview] Message-ID: <alpine.DEB.2.00.1207120448120.25585@utopia.booyaka.com> (raw) Commit 3dd50d0545bd5a8ad83d4339f07935cd3e883271 ("Merge tag 'omap-cleanup-for-v3.6' into tmp-merge") inadvertently caused a clockdomain to be registered twice on OMAP3 boards. This causes warnings on boot, wild pointer dereferences, and PM regressions. Fix the double registration and add some clockdomain code to prevent this from happening again. Reported-by: Joe Woodward <jw@terrafix.co.uk> Cc: Tony Lindgren <tony@atomide.com> Cc: Kevin Hilman <khilman@ti.com> Signed-off-by: Paul Walmsley <paul@pwsan.com> --- Intended for v3.6 merge window. Applies on linux-omap commit 3dd50d0545bd5a8ad83d4339f07935cd3e883271. Boot-tested on 2430 SDP, 3517 EVM, 37xx EVM, 5912 OSK, and CM-T 3517. arch/arm/mach-omap2/clockdomain.c | 19 ++++++++++++++----- arch/arm/mach-omap2/clockdomain.h | 1 + arch/arm/mach-omap2/clockdomains3xxx_data.c | 1 - 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/arch/arm/mach-omap2/clockdomain.c b/arch/arm/mach-omap2/clockdomain.c index 8664f5a..b851ba4 100644 --- a/arch/arm/mach-omap2/clockdomain.c +++ b/arch/arm/mach-omap2/clockdomain.c @@ -63,9 +63,10 @@ static struct clockdomain *_clkdm_lookup(const char *name) * _clkdm_register - register a clockdomain * @clkdm: struct clockdomain * to register * - * Adds a clockdomain to the internal clockdomain list. - * Returns -EINVAL if given a null pointer, -EEXIST if a clockdomain is - * already registered by the provided name, or 0 upon success. + * Adds a clockdomain to the internal clockdomain list. Returns + * -EINVAL if given a null pointer, -EEXIST if a clockdomain is + * already registered by the provided name or if @clkdm has already + * been registered, or 0 upon success. */ static int _clkdm_register(struct clockdomain *clkdm) { @@ -74,6 +75,11 @@ static int _clkdm_register(struct clockdomain *clkdm) if (!clkdm || !clkdm->name) return -EINVAL; + if (clkdm->_flags & _CLKDM_FLAG_REGISTERED) { + pr_err("clockdomain: %s: already registered\n", clkdm->name); + return -EEXIST; + } + pwrdm = pwrdm_lookup(clkdm->pwrdm.name); if (!pwrdm) { pr_err("clockdomain: %s: powerdomain %s does not exist\n", @@ -82,15 +88,18 @@ static int _clkdm_register(struct clockdomain *clkdm) } clkdm->pwrdm.ptr = pwrdm; - /* Verify that the clockdomain is not already registered */ - if (_clkdm_lookup(clkdm->name)) + if (_clkdm_lookup(clkdm->name)) { + pr_err("clockdomain: %s: name already registered\n", + clkdm->name); return -EEXIST; + } list_add(&clkdm->node, &clkdm_list); pwrdm_add_clkdm(pwrdm, clkdm); spin_lock_init(&clkdm->lock); + clkdm->_flags |= _CLKDM_FLAG_REGISTERED; pr_debug("clockdomain: registered %s\n", clkdm->name); diff --git a/arch/arm/mach-omap2/clockdomain.h b/arch/arm/mach-omap2/clockdomain.h index 5601dc1..7b3c1d2 100644 --- a/arch/arm/mach-omap2/clockdomain.h +++ b/arch/arm/mach-omap2/clockdomain.h @@ -86,6 +86,7 @@ struct clkdm_dep { /* Possible flags for struct clockdomain._flags */ #define _CLKDM_FLAG_HWSUP_ENABLED BIT(0) +#define _CLKDM_FLAG_REGISTERED BIT(1) /** * struct clockdomain - OMAP clockdomain diff --git a/arch/arm/mach-omap2/clockdomains3xxx_data.c b/arch/arm/mach-omap2/clockdomains3xxx_data.c index d625844..56089c4 100644 --- a/arch/arm/mach-omap2/clockdomains3xxx_data.c +++ b/arch/arm/mach-omap2/clockdomains3xxx_data.c @@ -454,7 +454,6 @@ static struct clkdm_autodep clkdm_am35x_autodeps[] = { static struct clockdomain *clockdomains_common[] __initdata = { &wkup_common_clkdm, - &mpu_3xxx_clkdm, &neon_clkdm, &core_l3_3xxx_clkdm, &core_l4_3xxx_clkdm, -- 1.7.10
next reply other threads:[~2012-07-12 10:54 UTC|newest] Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-07-12 10:54 Paul Walmsley [this message] 2012-07-12 10:54 ` [PATCH] ARM: OMAP3: clockdomain: fix accidental duplicate registration Paul Walmsley 2012-07-12 17:50 ` Kevin Hilman 2012-07-12 17:50 ` Kevin Hilman 2012-07-13 6:47 ` Tony Lindgren 2012-07-13 6:47 ` Tony Lindgren 2012-07-14 8:52 ` Tony Lindgren 2012-07-14 8:52 ` Tony Lindgren 2012-07-14 17:54 ` Paul Walmsley 2012-07-14 17:54 ` Paul Walmsley 2012-07-16 8:36 ` Tony Lindgren 2012-07-16 8:36 ` Tony Lindgren 2012-07-18 9:53 ` Paul Walmsley 2012-07-18 9:53 ` Paul Walmsley 2012-07-19 11:52 ` Tony Lindgren 2012-07-19 11:52 ` Tony Lindgren 2012-07-19 19:12 ` Paul Walmsley 2012-07-19 19:12 ` Paul Walmsley 2012-07-24 8:16 ` Tony Lindgren 2012-07-24 8:16 ` Tony Lindgren 2012-07-24 20:52 ` Paul Walmsley 2012-07-24 20:52 ` Paul Walmsley
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=alpine.DEB.2.00.1207120448120.25585@utopia.booyaka.com \ --to=paul@pwsan.com \ --cc=jw@terrafix.co.uk \ --cc=khilman@ti.com \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-omap@vger.kernel.org \ --cc=tony@atomide.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.