Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1596635 > unrolled thread

[PATCH] irqdomain: handle the per-CPU irq trigger type settings

Started bygengdongjiu <gengdongjiu@huawei.com>
First post2017-03-10 06:00 +0100
Last post2017-03-10 11:40 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] irqdomain: handle the per-CPU irq trigger type settings gengdongjiu <gengdongjiu@huawei.com> - 2017-03-10 06:00 +0100
    Re: [PATCH] irqdomain: handle the per-CPU irq trigger type  settings Thomas Gleixner <tglx@linutronix.de> - 2017-03-10 11:40 +0100

#1596635 — [PATCH] irqdomain: handle the per-CPU irq trigger type settings

Fromgengdongjiu <gengdongjiu@huawei.com>
Date2017-03-10 06:00 +0100
Subject[PATCH] irqdomain: handle the per-CPU irq trigger type settings
Message-ID<tjkOK-708-25@gated-at.bofh.it>
    when devices parse and map an per-cpu interrupt into linux virq space
    using irq_of_parse_and_map API, it will always be failed if needs to set
    the specified irq trigger type, because irq_set_irq_type is only for 1-N
    mode interrupt source, not for per-cpu interrupt source. so handle per-cpu
    IRQs for this failure.

    Signed-off-by: Dongjiu Geng <gengdongjiu@huawei.com>
                   Zhanghai bin <zhanghaibin7@huawei.com>

diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
index 9fd618d..8116cf2 100755
--- a/kernel/irq/irqdomain.c
+++ b/kernel/irq/irqdomain.c
@@ -542,8 +542,16 @@ unsigned int irq_create_of_mapping(struct of_phandle_args *irq_data)

        /* Set type if specified and different than the current one */
        if (type != IRQ_TYPE_NONE &&
-           type != irq_get_trigger_type(virq))
-               irq_set_irq_type(virq, type);
+           type != irq_get_trigger_type(virq)) {
+               int ret = 0;
+               struct irq_data *irq_data = irq_get_irq_data(virq);
+
+               ret = irq_set_irq_type(virq, type);
+
+                /* Handle per-cpu IRQ: just save type in irq_data */
+               if (-EINVAL == ret && irq_data)
+                       irqd_set_trigger_type(irq_data, type);
+       }
        return virq;
 }
 EXPORT_SYMBOL_GPL(irq_create_of_mapping);

[toc] | [next] | [standalone]


#1597037 — Re: [PATCH] irqdomain: handle the per-CPU irq trigger type settings

FromThomas Gleixner <tglx@linutronix.de>
Date2017-03-10 11:40 +0100
SubjectRe: [PATCH] irqdomain: handle the per-CPU irq trigger type settings
Message-ID<tjq7M-2G5-29@gated-at.bofh.it>
In reply to#1596635
On Fri, 10 Mar 2017, gengdongjiu wrote:

>     when devices parse and map an per-cpu interrupt into linux virq space
>     using irq_of_parse_and_map API, it will always be failed if needs to set
>     the specified irq trigger type, because irq_set_irq_type is only for 1-N
>     mode interrupt source, not for per-cpu interrupt source. so handle per-cpu
>     IRQs for this failure.

Please format your changelogs proper into sections:

1) Context

2) Problem

3) Solution

Writing one big lump of a sentence is just unreadable.

Aside of that:

1) No indentation of the changelog
2) Sentences start with upper case letters
3) Function references want () after the function name

Aside

> 
>     Signed-off-by: Dongjiu Geng <gengdongjiu@huawei.com>
>                    Zhanghai bin <zhanghaibin7@huawei.com>

That SOB is bogus.

> diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
> index 9fd618d..8116cf2 100755
> --- a/kernel/irq/irqdomain.c
> +++ b/kernel/irq/irqdomain.c
> @@ -542,8 +542,16 @@ unsigned int irq_create_of_mapping(struct of_phandle_args *irq_data)
> 
>         /* Set type if specified and different than the current one */
>         if (type != IRQ_TYPE_NONE &&
> -           type != irq_get_trigger_type(virq))
> -               irq_set_irq_type(virq, type);
> +           type != irq_get_trigger_type(virq)) {
> +               int ret = 0;
> +               struct irq_data *irq_data = irq_get_irq_data(virq);
> +
> +               ret = irq_set_irq_type(virq, type);
> +
> +                /* Handle per-cpu IRQ: just save type in irq_data */
> +               if (-EINVAL == ret && irq_data)
> +                       irqd_set_trigger_type(irq_data, type);

This is completely broken. That stores a trigger type for any interrupt if
the set type function fails.

You fail to explain

    - WHY irq_set_irq_type() fails for these per cpu interrupts
    
    - WHY storing the type in irqdata solves anything

    - WHAT sets the type in the actual interrupt hardware

That information should be in the changelog ....

Thanks,

	tglx

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web