]> git.karo-electronics.de Git - linux-beck.git/commitdiff
gpio/mxc: add .to_irq for gpio chip
authorShawn Guo <shawn.guo@linaro.org>
Sat, 13 Aug 2011 16:14:02 +0000 (00:14 +0800)
committerSascha Hauer <s.hauer@pengutronix.de>
Tue, 16 Aug 2011 07:00:37 +0000 (09:00 +0200)
It adds .to_irq support for gpio chip, so that __gpio_to_irq in
gpiolib becomes usable.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
drivers/gpio/gpio-mxc.c

index 4340acae3bd3791d713b61022c13d8ed13ed4718..64aff20bc62078473acf38733dcb9cf74f4c2e22 100644 (file)
@@ -337,6 +337,15 @@ static void __devinit mxc_gpio_get_hw(struct platform_device *pdev)
        mxc_gpio_hwtype = hwtype;
 }
 
+static int mxc_gpio_to_irq(struct gpio_chip *gc, unsigned offset)
+{
+       struct bgpio_chip *bgc = to_bgpio_chip(gc);
+       struct mxc_gpio_port *port =
+               container_of(bgc, struct mxc_gpio_port, bgc);
+
+       return port->virtual_irq_start + offset;
+}
+
 static int __devinit mxc_gpio_probe(struct platform_device *pdev)
 {
        struct device_node *np = pdev->dev.of_node;
@@ -403,6 +412,7 @@ static int __devinit mxc_gpio_probe(struct platform_device *pdev)
        if (err)
                goto out_iounmap;
 
+       port->bgc.gc.to_irq = mxc_gpio_to_irq;
        port->bgc.gc.base = pdev->id * 32;
        port->bgc.dir = port->bgc.read_reg(port->bgc.reg_dir);
        port->bgc.data = port->bgc.read_reg(port->bgc.reg_set);