Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1677795
| From | Linus Walleij <linus.walleij@linaro.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [RFC] gpio: about the need to manage irq mapping dynamically. |
| Date | 2017-06-29 16:20 +0200 |
| Message-ID | <tXIsy-bi-29@gated-at.bofh.it> (permalink) |
| References | (4 earlier) <tUv8u-37f-13@gated-at.bofh.it> <tUUTf-2Wi-3@gated-at.bofh.it> <tVbho-5Uv-7@gated-at.bofh.it> <tX2MG-3Ox-35@gated-at.bofh.it> <tX3pn-4kt-9@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Tue, Jun 27, 2017 at 8:25 PM, Jerome Brunet <jbrunet@baylibre.com> wrote: > At the time Linus strongly rejected the idea of calling irq_create_mapping (or > any sleeping functions) in gpio_to_irq: please see the reply from Oct 26, 2016 > (sorry for quoting such an old discussion but this is really the starting point) > > * Me: There is really a *lot* of gpio drivers which use irq_create_mapping in > the to_irq callback, are these all wrong ? > * Linus: Yes they are all wrong. They should all be using irq_find_mapping(). > > * Me: If this should not be used, what should we all do instead ? > * Linus: Call irq_create_mapping() in some other place. > > gpio_prepare_irq is a proposition for this 'other place'. There is a misunderstanding here. I wrote (at the time): > Yes, but you want to call irq_create_mapping() in slowpath (irq setup) > and irq_find_mapping() in fastpath (irq handler). Else the first IRQ > may result in unwelcomed surprises. This does not mean that irq_create_mapping() cannot be called in irq context because I think it can. What it means is that I think that is suboptimal from a performance point of view if called from gpio_to_irq(), because nominally, at this point, the mapping should already exist, since the GPIO and IRQ frameworks are orthogonal. But that may not apply to the case with many-to-few interrupt mappings... so I think I was in some 1-to-1-mapping context when I wrote this. Sorry :( So I changed my mind, it is fine for this type of driver to call irq_create_mapping() in gpio_to_irq(). Preferably with some comment around the call. It remains to see what happens if gpio_to_irq() would fail, as can happen in this case. Like if gpio_to_irq() would return 0 (NO_IRQ) or something negative. I think many drivers are not equipped for handling this. So I guess if you could change the semantics of all drivers calling gpio_to_irq() to also handle say 0 as an error and bail out, we can call irq_create_mapping() in gpio_to_irq(). Sorry if I'm confused... or confusing. Yours, Linus Walleij
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: [RFC] gpio: about the need to manage irq mapping dynamically. Linus Walleij <linus.walleij@linaro.org> - 2017-06-20 10:40 +0200
Re: [RFC] gpio: about the need to manage irq mapping dynamically. Jerome Brunet <jbrunet@baylibre.com> - 2017-06-20 12:30 +0200
Re: [RFC] gpio: about the need to manage irq mapping dynamically. Linus Walleij <linus.walleij@linaro.org> - 2017-06-20 18:40 +0200
Re: [RFC] gpio: about the need to manage irq mapping dynamically. Jerome Brunet <jbrunet@baylibre.com> - 2017-06-20 19:30 +0200
Re: [RFC] gpio: about the need to manage irq mapping dynamically. Linus Walleij <linus.walleij@linaro.org> - 2017-06-21 23:00 +0200
Re: [RFC] gpio: about the need to manage irq mapping dynamically. Jerome Brunet <jbrunet@baylibre.com> - 2017-06-22 16:30 +0200
Re: [RFC] gpio: about the need to manage irq mapping dynamically. Grygorii Strashko <grygorii.strashko@ti.com> - 2017-06-27 19:50 +0200
Re: [RFC] gpio: about the need to manage irq mapping dynamically. Jerome Brunet <jbrunet@baylibre.com> - 2017-06-27 20:30 +0200
Re: [RFC] gpio: about the need to manage irq mapping dynamically. Grygorii Strashko <grygorii.strashko@ti.com> - 2017-06-27 22:50 +0200
Re: [RFC] gpio: about the need to manage irq mapping dynamically. Linus Walleij <linus.walleij@linaro.org> - 2017-06-29 16:20 +0200
Re: [RFC] gpio: about the need to manage irq mapping dynamically. Grygorii Strashko <grygorii.strashko@ti.com> - 2017-06-30 22:00 +0200
Re: [RFC] gpio: about the need to manage irq mapping dynamically. Linus Walleij <linus.walleij@linaro.org> - 2017-07-02 17:10 +0200
Re: [RFC] gpio: about the need to manage irq mapping dynamically. Linus Walleij <linus.walleij@linaro.org> - 2017-06-29 16:20 +0200
Re: [RFC] gpio: about the need to manage irq mapping dynamically. Jerome Brunet <jbrunet@baylibre.com> - 2017-06-29 17:00 +0200
Re: [RFC] gpio: about the need to manage irq mapping dynamically. Marc Zyngier <marc.zyngier@arm.com> - 2017-06-29 19:00 +0200
Re: [RFC] gpio: about the need to manage irq mapping dynamically. Jerome Brunet <jbrunet@baylibre.com> - 2017-06-29 20:40 +0200
Re: [RFC] gpio: about the need to manage irq mapping dynamically. Linus Walleij <linus.walleij@linaro.org> - 2017-06-30 00:20 +0200
csiph-web