From: Lucas Stach <l.stach@pengutronix.de>
To: Andrey Smirnov <andrew.smirnov@gmail.com>,
Marc Zyngier <marc.zyngier@arm.com>
Cc: "A.s. Dong" <aisheng.dong@nxp.com>,
Richard Zhu <hongxing.zhu@nxp.com>,
Jason Cooper <jason@lakedaemon.net>,
linux-kernel@vger.kernel.org, linux-imx@nxp.com,
Thomas Gleixner <tglx@linutronix.de>,
Leonard Crestez <leonard.crestez@nxp.com>,
cphealy@gmail.com, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 2/5] irqchip/irq-imx-gpcv2: Share reg offset calculation code
Date: Thu, 06 Dec 2018 12:11:29 +0100 [thread overview]
Message-ID: <1544094689.3709.59.camel@pengutronix.de> (raw)
In-Reply-To: <20181206073125.7255-3-andrew.smirnov@gmail.com>
Am Mittwoch, den 05.12.2018, 23:31 -0800 schrieb Andrey Smirnov:
> Move identical offset calculation code into a small helper function
> and make use of it in the rest of the code.
>
> > Cc: Thomas Gleixner <tglx@linutronix.de>
> > Cc: Jason Cooper <jason@lakedaemon.net>
> > Cc: Marc Zyngier <marc.zyngier@arm.com>
> Cc: cphealy@gmail.com
> Cc: l.stach@pengutronix.de
> > Cc: Leonard Crestez <leonard.crestez@nxp.com>
> > Cc: "A.s. Dong" <aisheng.dong@nxp.com>
> > Cc: Richard Zhu <hongxing.zhu@nxp.com>
> Cc: linux-imx@nxp.com
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Nice cleanup!
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
> ---
> drivers/irqchip/irq-imx-gpcv2.c | 18 ++++++++++--------
> 1 file changed, 10 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/irqchip/irq-imx-gpcv2.c b/drivers/irqchip/irq-imx-gpcv2.c
> index cbed00319315..b262ba8b2652 100644
> --- a/drivers/irqchip/irq-imx-gpcv2.c
> +++ b/drivers/irqchip/irq-imx-gpcv2.c
> @@ -28,6 +28,11 @@ struct gpcv2_irqchip_data {
>
> static struct gpcv2_irqchip_data *imx_gpcv2_instance;
>
> +static void __iomem *gpcv2_idx_to_reg(struct gpcv2_irqchip_data *cd, int i)
> +{
> > + return cd->gpc_base + cd->cpu2wakeup + i * 4;
> +}
> +
> static int gpcv2_wakeup_source_save(void)
> {
> > struct gpcv2_irqchip_data *cd;
> @@ -39,7 +44,7 @@ static int gpcv2_wakeup_source_save(void)
> > return 0;
>
> > for (i = 0; i < IMR_NUM; i++) {
> > - reg = cd->gpc_base + cd->cpu2wakeup + i * 4;
> > + reg = gpcv2_idx_to_reg(cd, i);
> > cd->saved_irq_mask[i] = readl_relaxed(reg);
> > writel_relaxed(cd->wakeup_sources[i], reg);
> > }
> @@ -50,17 +55,14 @@ static int gpcv2_wakeup_source_save(void)
> static void gpcv2_wakeup_source_restore(void)
> {
> > struct gpcv2_irqchip_data *cd;
> > - void __iomem *reg;
> > int i;
>
> > cd = imx_gpcv2_instance;
> > if (!cd)
> > return;
>
> > - for (i = 0; i < IMR_NUM; i++) {
> > - reg = cd->gpc_base + cd->cpu2wakeup + i * 4;
> > - writel_relaxed(cd->saved_irq_mask[i], reg);
> > - }
> > + for (i = 0; i < IMR_NUM; i++)
> > + writel_relaxed(cd->saved_irq_mask[i], gpcv2_idx_to_reg(cd, i));
> }
>
> static struct syscore_ops imx_gpcv2_syscore_ops = {
> @@ -97,7 +99,7 @@ static void imx_gpcv2_irq_unmask(struct irq_data *d)
> > u32 val;
>
> > raw_spin_lock(&cd->rlock);
> > - reg = cd->gpc_base + cd->cpu2wakeup + d->hwirq / 32 * 4;
> > + reg = gpcv2_idx_to_reg(cd, d->hwirq / 32);
> > val = readl_relaxed(reg);
> > val &= ~(1 << d->hwirq % 32);
> > writel_relaxed(val, reg);
> @@ -113,7 +115,7 @@ static void imx_gpcv2_irq_mask(struct irq_data *d)
> > u32 val;
>
> > raw_spin_lock(&cd->rlock);
> > - reg = cd->gpc_base + cd->cpu2wakeup + d->hwirq / 32 * 4;
> > + reg = gpcv2_idx_to_reg(cd, d->hwirq / 32);
> > val = readl_relaxed(reg);
> > val |= 1 << (d->hwirq % 32);
> > writel_relaxed(val, reg);
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2018-12-06 11:11 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-06 7:31 [PATCH 0/5] i.MX8MQ support for GPCv2 irqchip driver Andrey Smirnov
2018-12-06 7:31 ` [PATCH 1/5] irqchip/irq-imx-gpcv2: Remove unused code Andrey Smirnov
2018-12-06 11:10 ` Lucas Stach
2018-12-06 7:31 ` [PATCH 2/5] irqchip/irq-imx-gpcv2: Share reg offset calculation code Andrey Smirnov
2018-12-06 11:11 ` Lucas Stach [this message]
2018-12-06 7:31 ` [PATCH 3/5] irqchip/irq-imx-gpcv2: Make use of BIT() macro Andrey Smirnov
2018-12-06 11:12 ` Lucas Stach
2018-12-06 7:31 ` [PATCH 4/5] irqchip/irq-imx-gpcv2: Make error messages more consistent Andrey Smirnov
2018-12-06 11:32 ` Lucas Stach
2018-12-06 7:31 ` [PATCH 5/5] irqchip/irq-imx-gpcv2: Add support for i.MX8MQ Andrey Smirnov
2018-12-06 11:36 ` Lucas Stach
2018-12-07 17:30 ` [PATCH 0/5] i.MX8MQ support for GPCv2 irqchip driver Marc Zyngier
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=1544094689.3709.59.camel@pengutronix.de \
--to=l.stach@pengutronix.de \
--cc=aisheng.dong@nxp.com \
--cc=andrew.smirnov@gmail.com \
--cc=cphealy@gmail.com \
--cc=hongxing.zhu@nxp.com \
--cc=jason@lakedaemon.net \
--cc=leonard.crestez@nxp.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-imx@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=marc.zyngier@arm.com \
--cc=tglx@linutronix.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox