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: <CACRpkdYqLamX6P=0he2Swy=_io2u6SKjGHPNziMdDj2j+UR+Uw@mail.gmail.com>
Date:	Tue, 7 Jan 2014 19:50:47 +0100
From:	Linus Walleij <linus.walleij@...aro.org>
To:	Lars Poeschel <larsi@....tu-dresden.de>
Cc:	Lars Poeschel <poeschel@...onage.de>,
	Rob Herring <rob.herring@...xeda.com>,
	Pawel Moll <pawel.moll@....com>,
	Mark Rutland <mark.rutland@....com>,
	"ijc+devicetree@...lion.org.uk" <ijc+devicetree@...lion.org.uk>,
	Kumar Gala <galak@...eaurora.org>,
	Rob Landley <rob@...dley.net>,
	Alexandre Courbot <gnurou@...il.com>,
	"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
	"linux-doc@...r.kernel.org" <linux-doc@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"linux-gpio@...r.kernel.org" <linux-gpio@...r.kernel.org>
Subject: Re: [PATCH] gpio: mcp23s08: Add irq functionality for i2c chips

On Tue, Jan 7, 2014 at 3:05 PM, Lars Poeschel <larsi@....tu-dresden.de> wrote:

> From: Lars Poeschel <poeschel@...onage.de>
>
> This adds interrupt functionality for i2c chips to the driver.
> They can act as a interrupt-controller and generate interrupts, if
> the inputs change.
> This is tested on a mcp23017 chip.
>
> Signed-off-by: Lars Poeschel <poeschel@...onage.de>
(...)
>         u8                      addr;
>
>         u16                     cache[11];
> +       u16                     irq_rise;
> +       u16                     irq_fall;
> +       int                     irq;
>         /* lock protects the cached values */
>         struct mutex            lock;
> +       struct mutex            irq_lock;
> +       struct irq_domain       *irq_domain;

(...)
> +static int mcp23s08_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
> +{
> +       struct mcp23s08 *mcp = container_of(chip, struct mcp23s08, chip);
> +
> +       return irq_create_mapping(mcp->irq_domain, offset);

We have recently established that the mapping shall not be created in
gpio_to_irq().
Instead call irq_create_mapping() for all valid IRQ lines in probe() and
use irq_find_mapping() here.

> +static struct irq_chip mcp23s08_irq_chip = {
> +       .name = "gpio-mcp23xxx",
> +       .irq_mask = mcp23s08_irq_mask,
> +       .irq_unmask = mcp23s08_irq_unmask,
> +       .irq_set_type = mcp23s08_irq_set_type,
> +       .irq_bus_lock = mcp23s08_irq_bus_lock,
> +       .irq_bus_sync_unlock = mcp23s08_irq_bus_unlock,
> +};

Add irq_startup() and irq_shutdown() hooks in accordance with something
like this patch:
http://marc.info/?l=linux-gpio&m=138571851304612&w=2

The important thing is that you call
gpio_lock_as_irq()/gpio_unlock_as_irq()

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