lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CACRpkdbdQHpv8gcgd+_5yp-3axeBiDFcoZS15DcJJTxey66g8w@mail.gmail.com>
Date:	Tue, 8 Apr 2014 15:20:05 +0200
From:	Linus Walleij <linus.walleij@...aro.org>
To:	Sebastian Andrzej Siewior <bigeasy@...utronix.de>
Cc:	delicious quinoa <delicious.quinoa@...il.com>,
	Alan Tull <atull@...era.com>,
	Alexandre Courbot <gnurou@...il.com>,
	"linux-gpio@...r.kernel.org" <linux-gpio@...r.kernel.org>,
	linux-kernel <linux-kernel@...r.kernel.org>,
	Dinh Nguyen <dinguyen@...era.com>
Subject: Re: [PATCH 2/3] gpio: dwapb: do not create the irq mapping upfront.

On Tue, Mar 25, 2014 at 10:17 PM, Sebastian Andrzej Siewior
<bigeasy@...utronix.de> wrote:
> * Linus Walleij | 2014-03-25 21:43:49 [+0100]:
>
>>> I looked at
>>> those two links and you quote gpio_to_irq() which is not required.
>>
>>In a *lot* of drivers it is implicitly required that gpio_to_irq()
>>is called first because they only call irq_create_mapping()
>>there. (And not in subsequent interrupt handlers etc.)
>
> so
>
> --- a/drivers/gpio/gpio-dwapb.c
> +++ b/drivers/gpio/gpio-dwapb.c
> @@ -68,7 +68,7 @@ static int dwapb_gpio_to_irq(struct gpio_chip *gc, unsigned offset)
>                                                     dwapb_gpio_port, bgc);
>         struct dwapb_gpio *gpio = port->gpio;
>
> -       return irq_find_mapping(gpio->domain, offset);
> +       return irq_create_mapping(gpio->domain, offset);
>  }
>
>  static void dwapb_toggle_trigger(struct dwapb_gpio *gpio, unsigned int offs)
>
> would fix the problem then.

No.

This only gets called if some GPIO consumer decides to call
gpio_to_irq() to find out the interrupt number before using the
interrupt.

There is no requirement that consumers do that!

It is perfectly legal for a GPIO irq comsumer to just use
some hard-coded IRQ number from a board file or similar,
or to just use an IRQ from a DT or ACPI entity without any
such translation.

So the mappings must be created in probe().

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ