From: Horatiu Vultur <horatiu.vultur@microchip.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: "open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
Linus Walleij <linus.walleij@linaro.org>,
Microchip Linux Driver Support <UNGLinuxDriver@microchip.com>
Subject: Re: [PATCH] pinctrl: ocelot: Fix interrupt controller
Date: Sat, 3 Sep 2022 20:42:33 +0200 [thread overview]
Message-ID: <20220903184233.whjduwtdyuvyf6lv@soft-dev3-1.localhost> (raw)
In-Reply-To: <CAHp75Ve7EkE3q3_nOvT_KLmpmnXzMw179nbOxYEYzUeLY0QRnw@mail.gmail.com>
The 09/02/2022 17:51, Andy Shevchenko wrote:
Hi Andy,
>
> > + /*
> > + * It is enough to read only one action because the trigger level is the
> > + * same for all of them.
> > + */
>
> Hmm... this is interesting. How is the hardware supposed to work if
> the user asks for two contradictory levels for two different IRQs?
The HW can detect the changes in line for each pin on which the IRQ is.
And each pin will have a different irq_desc with different actions.
Or maybe I missunderstood the question?
Also maybe a better way to get trigger level is to use
irqd_get_trigger_type.
...
> > + struct ocelot_irq_work *work = kmalloc(sizeof(*work), GFP_ATOMIC);
>
> It's more visible what's going on if you split this to definition and
> assignment and move assignment closer to its first user.
>
> > + if (!work)
> > + return;
So you would like something like this:
---
struct ocelot_irq_work *work;
work = kmalloc(sizeof(*work), GFP_ATOMIC);
if (!work)
return;
...
---
>
> ...
>
> > type &= IRQ_TYPE_SENSE_MASK;
>
> This seems redundant, see below.
>
>
> > - if (!(type & (IRQ_TYPE_EDGE_BOTH | IRQ_TYPE_LEVEL_HIGH)))
> > + if (type == IRQ_TYPE_NONE)
> > return -EINVAL;
>
> Is it ever possible? IIRC the IRQ chip code, the set->type won't be
> called at all in such a case. Also type is already limited to the
> sense mask, no?
It is not possible. From what I have seen on the callstack, the type is
already anded with IRQ_TYPE_SENSE_MASK, and it would not call
ocelot_irq_set_type for IRQ_TYPE_NONE.
Therefor I will remove these.
>
> --
> With Best Regards,
> Andy Shevchenko
--
/Horatiu
prev parent reply other threads:[~2022-09-03 18:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-02 12:43 [PATCH] pinctrl: ocelot: Fix interrupt controller Horatiu Vultur
2022-09-02 14:51 ` Andy Shevchenko
2022-09-03 18:42 ` Horatiu Vultur [this message]
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=20220903184233.whjduwtdyuvyf6lv@soft-dev3-1.localhost \
--to=horatiu.vultur@microchip.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=andy.shevchenko@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.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