From: gregory.clement@free-electrons.com (Gregory CLEMENT)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 2/7] irqchip: armada-370-xp: Introduce a is_percpu_irq() helper for readability
Date: Tue, 03 Mar 2015 19:34:27 +0100 [thread overview]
Message-ID: <54F5FEB3.9040308@free-electrons.com> (raw)
In-Reply-To: <1425379400-4346-3-git-send-email-maxime.ripard@free-electrons.com>
Hi Maxime,
On 03/03/2015 11:43, Maxime Ripard wrote:
> From: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
>
> This commit introduces a helper function is_percpu_irq(), to be used
> when interrupts are mapped to decide which ones are set as per CPU.
>
> This change will allow to extend the list of per cpu interrupts in a less
> intrusive fashion; also, it makes the code slightly more readable by keeping
> a list of the per CPU interrupts.
Eventually the is_percpu_irq will be only
irq < ARMADA_370_XP_MAX_PER_CPU_IRQS
using just a couple of the PER_CPU_IRQ was bogus, but it is not something
new. At least this patch improves the readability so:
Acked-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Thanks,
Gregory
>
> Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> ---
> drivers/irqchip/irq-armada-370-xp.c | 18 ++++++++++++++----
> 1 file changed, 14 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c
> index b455c876974e..ea57fba263cf 100644
> --- a/drivers/irqchip/irq-armada-370-xp.c
> +++ b/drivers/irqchip/irq-armada-370-xp.c
> @@ -77,6 +77,16 @@ static DEFINE_MUTEX(msi_used_lock);
> static phys_addr_t msi_doorbell_addr;
> #endif
>
> +static inline bool is_percpu_irq(irq_hw_number_t irq)
> +{
> + switch (irq) {
> + case ARMADA_370_XP_TIMER0_PER_CPU_IRQ:
> + return true;
> + default:
> + return false;
> + }
> +}
> +
> /*
> * In SMP mode:
> * For shared global interrupts, mask/unmask global enable bit
> @@ -86,7 +96,7 @@ static void armada_370_xp_irq_mask(struct irq_data *d)
> {
> irq_hw_number_t hwirq = irqd_to_hwirq(d);
>
> - if (hwirq != ARMADA_370_XP_TIMER0_PER_CPU_IRQ)
> + if (!is_percpu_irq(hwirq))
> writel(hwirq, main_int_base +
> ARMADA_370_XP_INT_CLEAR_ENABLE_OFFS);
> else
> @@ -98,7 +108,7 @@ static void armada_370_xp_irq_unmask(struct irq_data *d)
> {
> irq_hw_number_t hwirq = irqd_to_hwirq(d);
>
> - if (hwirq != ARMADA_370_XP_TIMER0_PER_CPU_IRQ)
> + if (!is_percpu_irq(hwirq))
> writel(hwirq, main_int_base +
> ARMADA_370_XP_INT_SET_ENABLE_OFFS);
> else
> @@ -287,14 +297,14 @@ static int armada_370_xp_mpic_irq_map(struct irq_domain *h,
> unsigned int virq, irq_hw_number_t hw)
> {
> armada_370_xp_irq_mask(irq_get_irq_data(virq));
> - if (hw != ARMADA_370_XP_TIMER0_PER_CPU_IRQ)
> + if (!is_percpu_irq(hw))
> writel(hw, per_cpu_int_base +
> ARMADA_370_XP_INT_CLEAR_MASK_OFFS);
> else
> writel(hw, main_int_base + ARMADA_370_XP_INT_SET_ENABLE_OFFS);
> irq_set_status_flags(virq, IRQ_LEVEL);
>
> - if (hw == ARMADA_370_XP_TIMER0_PER_CPU_IRQ) {
> + if (is_percpu_irq(hw)) {
> irq_set_percpu_devid(virq);
> irq_set_chip_and_handler(virq, &armada_370_xp_irq_chip,
> handle_percpu_devid_irq);
>
--
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
next prev parent reply other threads:[~2015-03-03 18:34 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-03 10:43 [PATCH v2 0/7] ARM: mvebu: Enable perf support Maxime Ripard
2015-03-03 10:43 ` [PATCH v2 1/7] irqchip: armada-370-xp: Initialize per cpu registers when CONFIG_SMP=N Maxime Ripard
2015-03-03 18:29 ` Gregory CLEMENT
2015-03-03 10:43 ` [PATCH v2 2/7] irqchip: armada-370-xp: Introduce a is_percpu_irq() helper for readability Maxime Ripard
2015-03-03 18:34 ` Gregory CLEMENT [this message]
2015-03-03 10:43 ` [PATCH v2 3/7] irqchip: armada-370-xp: Enable the PMU interrupts Maxime Ripard
2015-03-03 18:38 ` Gregory CLEMENT
2015-03-03 10:43 ` [PATCH v2 4/7] ARM: mvebu: Enable Performance Monitor Unit on Armada XP/370 SoCs Maxime Ripard
2015-03-03 18:56 ` Gregory CLEMENT
2015-03-03 10:43 ` [PATCH v2 5/7] ARM: mvebu: Enable Performance Monitor Unit on Armada 375 SoC Maxime Ripard
2015-03-03 18:54 ` Gregory CLEMENT
2015-03-03 10:43 ` [PATCH v2 6/7] ARM: mvebu: Enable Performance Monitor Unit on Armada 380/385 SoC Maxime Ripard
2015-03-03 18:54 ` Gregory CLEMENT
2015-03-03 10:43 ` [PATCH v2 7/7] ARM: mvebu: Enable perf support in mvebu_v7_defconfig Maxime Ripard
2015-03-03 18:57 ` Gregory CLEMENT
2015-03-08 5:38 ` [PATCH v2 0/7] ARM: mvebu: Enable perf support Jason Cooper
2015-03-17 9:10 ` Gregory CLEMENT
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=54F5FEB3.9040308@free-electrons.com \
--to=gregory.clement@free-electrons.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.