Merge branch 'misc.namei' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
[linux-2.6-microblaze.git] / drivers / gpio / gpio-tegra186.c
index 05974b7..c99858f 100644 (file)
@@ -456,7 +456,7 @@ static void tegra186_gpio_irq(struct irq_desc *desc)
 
        for (i = 0; i < gpio->soc->num_ports; i++) {
                const struct tegra_gpio_port *port = &gpio->soc->ports[i];
-               unsigned int pin, irq;
+               unsigned int pin;
                unsigned long value;
                void __iomem *base;
 
@@ -469,11 +469,8 @@ static void tegra186_gpio_irq(struct irq_desc *desc)
                value = readl(base + TEGRA186_GPIO_INTERRUPT_STATUS(1));
 
                for_each_set_bit(pin, &value, port->pins) {
-                       irq = irq_find_mapping(domain, offset + pin);
-                       if (WARN_ON(irq == 0))
-                               continue;
-
-                       generic_handle_irq(irq);
+                       int ret = generic_handle_domain_irq(domain, offset + pin);
+                       WARN_RATELIMIT(ret, "hwirq = %d", offset + pin);
                }
 
 skip:
@@ -610,15 +607,21 @@ static int tegra186_gpio_probe(struct platform_device *pdev)
        if (!gpio)
                return -ENOMEM;
 
-       gpio->soc = of_device_get_match_data(&pdev->dev);
+       gpio->soc = device_get_match_data(&pdev->dev);
 
        gpio->secure = devm_platform_ioremap_resource_byname(pdev, "security");
-       if (IS_ERR(gpio->secure))
-               return PTR_ERR(gpio->secure);
+       if (IS_ERR(gpio->secure)) {
+               gpio->secure = devm_platform_ioremap_resource(pdev, 0);
+               if (IS_ERR(gpio->secure))
+                       return PTR_ERR(gpio->secure);
+       }
 
        gpio->base = devm_platform_ioremap_resource_byname(pdev, "gpio");
-       if (IS_ERR(gpio->base))
-               return PTR_ERR(gpio->base);
+       if (IS_ERR(gpio->base)) {
+               gpio->base = devm_platform_ioremap_resource(pdev, 1);
+               if (IS_ERR(gpio->base))
+                       return PTR_ERR(gpio->base);
+       }
 
        err = platform_irq_count(pdev);
        if (err < 0)
@@ -680,11 +683,13 @@ static int tegra186_gpio_probe(struct platform_device *pdev)
 
        gpio->gpio.names = (const char * const *)names;
 
+#if defined(CONFIG_OF_GPIO)
        gpio->gpio.of_node = pdev->dev.of_node;
        gpio->gpio.of_gpio_n_cells = 2;
        gpio->gpio.of_xlate = tegra186_gpio_of_xlate;
+#endif /* CONFIG_OF_GPIO */
 
-       gpio->intc.name = pdev->dev.of_node->name;
+       gpio->intc.name = dev_name(&pdev->dev);
        gpio->intc.irq_ack = tegra186_irq_ack;
        gpio->intc.irq_mask = tegra186_irq_mask;
        gpio->intc.irq_unmask = tegra186_irq_unmask;
@@ -730,18 +735,7 @@ static int tegra186_gpio_probe(struct platform_device *pdev)
                offset += port->pins;
        }
 
-       platform_set_drvdata(pdev, gpio);
-
-       err = devm_gpiochip_add_data(&pdev->dev, &gpio->gpio, gpio);
-       if (err < 0)
-               return err;
-
-       return 0;
-}
-
-static int tegra186_gpio_remove(struct platform_device *pdev)
-{
-       return 0;
+       return devm_gpiochip_add_data(&pdev->dev, &gpio->gpio, gpio);
 }
 
 #define TEGRA186_MAIN_GPIO_PORT(_name, _bank, _port, _pins)    \
@@ -907,13 +901,22 @@ static const struct of_device_id tegra186_gpio_of_match[] = {
 };
 MODULE_DEVICE_TABLE(of, tegra186_gpio_of_match);
 
+static const struct acpi_device_id  tegra186_gpio_acpi_match[] = {
+       { .id = "NVDA0108", .driver_data = (kernel_ulong_t)&tegra186_main_soc },
+       { .id = "NVDA0208", .driver_data = (kernel_ulong_t)&tegra186_aon_soc },
+       { .id = "NVDA0308", .driver_data = (kernel_ulong_t)&tegra194_main_soc },
+       { .id = "NVDA0408", .driver_data = (kernel_ulong_t)&tegra194_aon_soc },
+       {}
+};
+MODULE_DEVICE_TABLE(acpi, tegra186_gpio_acpi_match);
+
 static struct platform_driver tegra186_gpio_driver = {
        .driver = {
                .name = "tegra186-gpio",
                .of_match_table = tegra186_gpio_of_match,
+               .acpi_match_table = tegra186_gpio_acpi_match,
        },
        .probe = tegra186_gpio_probe,
-       .remove = tegra186_gpio_remove,
 };
 module_platform_driver(tegra186_gpio_driver);