From: vladimir.murzin@arm.com (Vladimir Murzin)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: imx6: fix bogus use of irq_get_irq_data
Date: Mon, 01 Dec 2014 17:57:59 +0000 [thread overview]
Message-ID: <547CAC27.2090200@arm.com> (raw)
In-Reply-To: <1417453443-9179-1-git-send-email-marc.zyngier@arm.com>
Hi Marc,
On 01/12/14 17:04, Marc Zyngier wrote:
> The imx6 PM code seems to be quite creative in its use of irq_data,
> using something something that is very much a hardware interrupt
^^^^^^^^^ ^^^^^^^^^
More "something" here! ;)
Vladimir
> number where we expect a virtual one. Yes, it worked so far, but
> that's only cheer luck, and it will definitely explode in 3.19.
>
> Fix it by using a pair of helper functions that deal with the
> actual hardware.
>
> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
> ---
> arch/arm/mach-imx/common.h | 4 ++--
> arch/arm/mach-imx/gpc.c | 34 ++++++++++++++++++++++------------
> arch/arm/mach-imx/pm-imx6.c | 5 ++---
> 3 files changed, 26 insertions(+), 17 deletions(-)
>
> diff --git a/arch/arm/mach-imx/common.h b/arch/arm/mach-imx/common.h
> index 1dabf43..66662a1 100644
> --- a/arch/arm/mach-imx/common.h
> +++ b/arch/arm/mach-imx/common.h
> @@ -108,8 +108,8 @@ void imx_gpc_pre_suspend(bool arm_power_off);
> void imx_gpc_post_resume(void);
> void imx_gpc_mask_all(void);
> void imx_gpc_restore_all(void);
> -void imx_gpc_irq_mask(struct irq_data *d);
> -void imx_gpc_irq_unmask(struct irq_data *d);
> +void imx_gpc_hwirq_mask(unsigned int hwirq);
> +void imx_gpc_hwirq_unmask(unsigned int hwirq);
> void imx_anatop_init(void);
> void imx_anatop_pre_suspend(void);
> void imx_anatop_post_resume(void);
> diff --git a/arch/arm/mach-imx/gpc.c b/arch/arm/mach-imx/gpc.c
> index 1455829..5f3602e 100644
> --- a/arch/arm/mach-imx/gpc.c
> +++ b/arch/arm/mach-imx/gpc.c
> @@ -91,34 +91,44 @@ void imx_gpc_restore_all(void)
> writel_relaxed(gpc_saved_imrs[i], reg_imr1 + i * 4);
> }
>
> -void imx_gpc_irq_unmask(struct irq_data *d)
> +void imx_gpc_hwirq_unmask(unsigned int hwirq)
> {
> void __iomem *reg;
> u32 val;
>
> - /* Sanity check for SPI irq */
> - if (d->hwirq < 32)
> - return;
> -
> - reg = gpc_base + GPC_IMR1 + (d->hwirq / 32 - 1) * 4;
> + reg = gpc_base + GPC_IMR1 + (hwirq / 32 - 1) * 4;
> val = readl_relaxed(reg);
> - val &= ~(1 << d->hwirq % 32);
> + val &= ~(1 << hwirq % 32);
> writel_relaxed(val, reg);
> }
>
> -void imx_gpc_irq_mask(struct irq_data *d)
> +void imx_gpc_hwirq_mask(unsigned int hwirq)
> {
> void __iomem *reg;
> u32 val;
>
> + reg = gpc_base + GPC_IMR1 + (hwirq / 32 - 1) * 4;
> + val = readl_relaxed(reg);
> + val |= 1 << (hwirq % 32);
> + writel_relaxed(val, reg);
> +}
> +
> +static void imx_gpc_irq_unmask(struct irq_data *d)
> +{
> + /* Sanity check for SPI irq */
> + if (d->hwirq < 32)
> + return;
> +
> + imx_gpc_hwirq_unmask(d->hwirq);
> +}
> +
> +static void imx_gpc_irq_mask(struct irq_data *d)
> +{
> /* Sanity check for SPI irq */
> if (d->hwirq < 32)
> return;
>
> - reg = gpc_base + GPC_IMR1 + (d->hwirq / 32 - 1) * 4;
> - val = readl_relaxed(reg);
> - val |= 1 << (d->hwirq % 32);
> - writel_relaxed(val, reg);
> + imx_gpc_hwirq_mask(d->hwirq);
> }
>
> void __init imx_gpc_init(void)
> diff --git a/arch/arm/mach-imx/pm-imx6.c b/arch/arm/mach-imx/pm-imx6.c
> index 5c3af8f..d815d1b 100644
> --- a/arch/arm/mach-imx/pm-imx6.c
> +++ b/arch/arm/mach-imx/pm-imx6.c
> @@ -261,7 +261,6 @@ static void imx6q_enable_wb(bool enable)
>
> int imx6q_set_lpm(enum mxc_cpu_pwr_mode mode)
> {
> - struct irq_data *iomuxc_irq_data = irq_get_irq_data(32);
> u32 val = readl_relaxed(ccm_base + CLPCR);
>
> val &= ~BM_CLPCR_LPM;
> @@ -316,9 +315,9 @@ int imx6q_set_lpm(enum mxc_cpu_pwr_mode mode)
> * 3) Software should mask IRQ #32 right after CCM Low-Power mode
> * is set (set bits 0-1 of CCM_CLPCR).
> */
> - imx_gpc_irq_unmask(iomuxc_irq_data);
> + imx_gpc_hwirq_unmask(32);
> writel_relaxed(val, ccm_base + CLPCR);
> - imx_gpc_irq_mask(iomuxc_irq_data);
> + imx_gpc_hwirq_mask(32);
>
> return 0;
> }
>
next prev parent reply other threads:[~2014-12-01 17:57 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-01 17:04 [PATCH] ARM: imx6: fix bogus use of irq_get_irq_data Marc Zyngier
2014-12-01 17:13 ` Fabio Estevam
2014-12-01 17:15 ` Philipp Zabel
2014-12-01 17:23 ` Marc Zyngier
2014-12-01 17:57 ` Vladimir Murzin [this message]
2014-12-01 18:09 ` Marc Zyngier
2014-12-02 14:48 ` Shawn Guo
2014-12-02 14:53 ` Marc Zyngier
2014-12-02 15:15 ` Shawn Guo
2014-12-02 15:22 ` Marc Zyngier
2014-12-02 15:30 ` Shawn Guo
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=547CAC27.2090200@arm.com \
--to=vladimir.murzin@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
/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: link
Be 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.