devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: jeffy <jeffy.chen-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
To: Marc Zyngier <marc.zyngier-5wv7dgnIgG8@public.gmane.org>,
	Jon Hunter <jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>,
	Thomas Gleixner <tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>,
	Jason Cooper <jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org>
Cc: Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Pawel Moll <pawel.moll-5wv7dgnIgG8@public.gmane.org>,
	Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>,
	Ian Campbell
	<ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org>,
	Kumar Gala <galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>,
	Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>,
	Thierry Reding
	<thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Kevin Hilman <khilman-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Geert Uytterhoeven
	<geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org>,
	Grygorii Strashko
	<grygorii.strashko-l0cyMroinI0@public.gmane.org>,
	Lars-Peter Clausen <lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org>,
	Linus Walleij
	<linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	briannorris-F7+t8E8rja9Wk0Htik3J/w@public.gmane.org
Subject: Re: [V6,3/9] irqdomain: Don't set type when mapping an IRQ
Date: Thu, 17 Aug 2017 22:42:13 +0800	[thread overview]
Message-ID: <5995AB45.6010706@rock-chips.com> (raw)
In-Reply-To: <feb4e020-b738-9165-c044-b0e246ee4bd5-5wv7dgnIgG8@public.gmane.org>

Hi Marc,

Thanks for your reply.

On 08/17/2017 09:34 PM, Marc Zyngier wrote:
> On 17/08/17 13:46, jeffy wrote:
>> Hi guys,
>>
>> I hit an problem when testing a level triggered irq with:
>>
>> irq = platform_get_irq_byname(pdev, "wake");
>> ...<-- irq trigger type is correct
>> irq_set_status_flags(irq, IRQ_NOAUTOEN);
>> ...<-- irq trigger type become zero
>> request_threaded_irq(irq, ...)
>>
>> the trigger type lost(irqd_get_trigger_type returns zero) after
>> irq_set_status_flags.
>>
>>
>> it looks like irq_set_status_flags would try to use
>> irq_settings_is_level to get level trigger type, which would get zero
>> since we removed set type here...could you help to check this, thanks :)
>
> Hmm. That's quite unexpected. Can you please try this?
>
> diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
> index a3cc37c0c85e..3675c6004f2a 100644
> --- a/kernel/irq/chip.c
> +++ b/kernel/irq/chip.c
> @@ -1000,7 +1000,7 @@ EXPORT_SYMBOL_GPL(irq_set_chip_and_handler_name);
>
>   void irq_modify_status(unsigned int irq, unsigned long clr, unsigned long set)
>   {
> -	unsigned long flags;
> +	unsigned long flags, trigger, tmp;
>   	struct irq_desc *desc = irq_get_desc_lock(irq, &flags, 0);
>
>   	if (!desc)
> @@ -1014,6 +1014,8 @@ void irq_modify_status(unsigned int irq, unsigned long clr, unsigned long set)
>
>   	irq_settings_clr_and_set(desc, clr, set);
>
> +	trigger = irqd_get_trigger_type(&desc->irq_data);
> +
>   	irqd_clear(&desc->irq_data, IRQD_NO_BALANCING | IRQD_PER_CPU |
>   		   IRQD_TRIGGER_MASK | IRQD_LEVEL | IRQD_MOVE_PCNTXT);
>   	if (irq_settings_has_no_balance_set(desc))
> @@ -1025,7 +1027,11 @@ void irq_modify_status(unsigned int irq, unsigned long clr, unsigned long set)
>   	if (irq_settings_is_level(desc))
>   		irqd_set(&desc->irq_data, IRQD_LEVEL);
>
> -	irqd_set(&desc->irq_data, irq_settings_get_trigger_mask(desc));
> +	tmp = irq_settings_get_trigger_mask(desc);
> +	if (tmp != IRQ_TYPE_NONE)
> +		trigger = tmp;
> +
> +	irqd_set(&desc->irq_data, trigger);
>
>   	irq_put_desc_unlock(desc, flags);
>   }
>
> Basically, save the trigger info before clearing it. If the interrupt
> has already been configured, use that. Otherwise restore the previous
> trigger settings. But I'm slightly confused as to which field is used
> for what...

Thanks:), this patch works well, so

Tested-by: Jeffy Chen <jeffy.chen-TNX95d0MmH7DzftRWevZcw@public.gmane.org>

>
> 	M.
>

  parent reply	other threads:[~2017-08-17 14:42 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-07 15:12 [PATCH V6 0/9] Add support for Tegra210 AGIC Jon Hunter
2016-06-07 15:12 ` [PATCH V6 1/9] irqdomain: Fix handling of type settings for existing mappings Jon Hunter
2016-06-07 15:12 ` [PATCH V6 2/9] genirq: Look-up trigger type if not specified by caller Jon Hunter
     [not found]   ` <1465312354-27778-3-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-06-13 10:42     ` Marc Zyngier
     [not found]       ` <575E8E29.3090808-5wv7dgnIgG8@public.gmane.org>
2016-06-13 11:09         ` Jon Hunter
     [not found]           ` <575E9457.8010100-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-06-13 11:59             ` Marc Zyngier
2016-06-13 12:24               ` Jon Hunter
     [not found]                 ` <575EA603.7090002-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-06-13 12:33                   ` Marc Zyngier
2016-06-07 15:12 ` [PATCH V6 3/9] irqdomain: Don't set type when mapping an IRQ Jon Hunter
     [not found]   ` <1465312354-27778-4-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-07-29  3:53     ` Masahiro Yamada
     [not found]       ` <CAK7LNASBpym341Yz57LPa5z81aLX0xmhEVvoY+q5zfiQkFSxwg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-07-29  8:10         ` Marc Zyngier
     [not found]           ` <579B0F6C.9070806-5wv7dgnIgG8@public.gmane.org>
2016-08-01  1:28             ` Masahiro Yamada
2016-08-01  7:46               ` Marc Zyngier
     [not found]                 ` <579EFE6D.3050807-5wv7dgnIgG8@public.gmane.org>
2016-08-01  8:30                   ` Masahiro Yamada
2016-07-29  8:31         ` Jon Hunter
     [not found]           ` <bdd8ed36-c2dc-6f73-d362-2cf47d128e6f-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-08-01  3:09             ` Masahiro Yamada
2017-08-17 12:46     ` [V6,3/9] " jeffy
2017-08-17 13:34       ` Marc Zyngier
     [not found]         ` <feb4e020-b738-9165-c044-b0e246ee4bd5-5wv7dgnIgG8@public.gmane.org>
2017-08-17 14:42           ` jeffy [this message]
     [not found] ` <1465312354-27778-1-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-06-07 15:12   ` [PATCH V6 4/9] genirq: Add runtime power management support for IRQ chips Jon Hunter
     [not found]     ` <1465312354-27778-5-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-06-10 22:08       ` Kevin Hilman
2016-06-07 15:12 ` [PATCH V6 5/9] irqchip/gic: Isolate early GIC initialisation code Jon Hunter
2016-06-07 15:12 ` [PATCH V6 6/9] irqchip/gic: Add helper function for chip initialisation Jon Hunter
2016-06-07 15:12 ` [PATCH V6 7/9] irqchip/gic: Prepare for adding platform driver Jon Hunter
2016-06-07 15:12 ` [PATCH V6 8/9] dt-bindings: arm-gic: Add documentation for Tegra210 AGIC Jon Hunter
2016-06-07 15:12 ` [PATCH V6 9/9] irqchip/gic: Add platform driver for non-root GICs that require RPM Jon Hunter
     [not found]   ` <1465312354-27778-10-git-send-email-jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-06-13  9:10     ` Marc Zyngier
     [not found]       ` <575E789F.3050509-5wv7dgnIgG8@public.gmane.org>
2016-06-13  9:58         ` Jon Hunter
     [not found]           ` <575E83B8.2050602-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-06-13 10:13             ` Marc Zyngier
     [not found]               ` <575E8741.8060902-5wv7dgnIgG8@public.gmane.org>
2016-06-13 10:27                 ` Jon Hunter

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=5995AB45.6010706@rock-chips.com \
    --to=jeffy.chen-tnx95d0mmh7dzftrwevzcw@public.gmane.org \
    --cc=briannorris-F7+t8E8rja9Wk0Htik3J/w@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
    --cc=geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org \
    --cc=grygorii.strashko-l0cyMroinI0@public.gmane.org \
    --cc=ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org \
    --cc=jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org \
    --cc=jonathanh-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    --cc=khilman-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org \
    --cc=linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=marc.zyngier-5wv7dgnIgG8@public.gmane.org \
    --cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
    --cc=pawel.moll-5wv7dgnIgG8@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org \
    --cc=tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org \
    --cc=thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).