diff options
| -rw-r--r-- | drivers/gpio/gpio-74xx-mmio.c | 7 | ||||
| -rw-r--r-- | drivers/gpio/gpio-omap.c | 2 | ||||
| -rw-r--r-- | drivers/gpio/gpio-palmas.c | 2 | ||||
| -rw-r--r-- | drivers/gpio/gpio-syscon.c | 6 | ||||
| -rw-r--r-- | drivers/gpio/gpio-tegra.c | 105 | ||||
| -rw-r--r-- | drivers/gpio/gpiolib.c | 2 |
6 files changed, 69 insertions, 55 deletions
diff --git a/drivers/gpio/gpio-74xx-mmio.c b/drivers/gpio/gpio-74xx-mmio.c index 6ed7c0fb3378..6b186829087c 100644 --- a/drivers/gpio/gpio-74xx-mmio.c +++ b/drivers/gpio/gpio-74xx-mmio.c | |||
| @@ -113,13 +113,16 @@ static int mmio_74xx_dir_out(struct gpio_chip *gc, unsigned int gpio, int val) | |||
| 113 | 113 | ||
| 114 | static int mmio_74xx_gpio_probe(struct platform_device *pdev) | 114 | static int mmio_74xx_gpio_probe(struct platform_device *pdev) |
| 115 | { | 115 | { |
| 116 | const struct of_device_id *of_id = | 116 | const struct of_device_id *of_id; |
| 117 | of_match_device(mmio_74xx_gpio_ids, &pdev->dev); | ||
| 118 | struct mmio_74xx_gpio_priv *priv; | 117 | struct mmio_74xx_gpio_priv *priv; |
| 119 | struct resource *res; | 118 | struct resource *res; |
| 120 | void __iomem *dat; | 119 | void __iomem *dat; |
| 121 | int err; | 120 | int err; |
| 122 | 121 | ||
| 122 | of_id = of_match_device(mmio_74xx_gpio_ids, &pdev->dev); | ||
| 123 | if (!of_id) | ||
| 124 | return -ENODEV; | ||
| 125 | |||
| 123 | priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); | 126 | priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); |
| 124 | if (!priv) | 127 | if (!priv) |
| 125 | return -ENOMEM; | 128 | return -ENOMEM; |
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index 56d2d026e62e..f7fbb46d5d79 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c | |||
| @@ -1122,8 +1122,6 @@ static int omap_gpio_chip_init(struct gpio_bank *bank, struct irq_chip *irqc) | |||
| 1122 | /* MPUIO is a bit different, reading IRQ status clears it */ | 1122 | /* MPUIO is a bit different, reading IRQ status clears it */ |
| 1123 | if (bank->is_mpuio) { | 1123 | if (bank->is_mpuio) { |
| 1124 | irqc->irq_ack = dummy_irq_chip.irq_ack; | 1124 | irqc->irq_ack = dummy_irq_chip.irq_ack; |
| 1125 | irqc->irq_mask = irq_gc_mask_set_bit; | ||
| 1126 | irqc->irq_unmask = irq_gc_mask_clr_bit; | ||
| 1127 | if (!bank->regs->wkup_en) | 1125 | if (!bank->regs->wkup_en) |
| 1128 | irqc->irq_set_wake = NULL; | 1126 | irqc->irq_set_wake = NULL; |
| 1129 | } | 1127 | } |
diff --git a/drivers/gpio/gpio-palmas.c b/drivers/gpio/gpio-palmas.c index 171a6389f9ce..52b447c071cb 100644 --- a/drivers/gpio/gpio-palmas.c +++ b/drivers/gpio/gpio-palmas.c | |||
| @@ -167,6 +167,8 @@ static int palmas_gpio_probe(struct platform_device *pdev) | |||
| 167 | const struct palmas_device_data *dev_data; | 167 | const struct palmas_device_data *dev_data; |
| 168 | 168 | ||
| 169 | match = of_match_device(of_palmas_gpio_match, &pdev->dev); | 169 | match = of_match_device(of_palmas_gpio_match, &pdev->dev); |
| 170 | if (!match) | ||
| 171 | return -ENODEV; | ||
| 170 | dev_data = match->data; | 172 | dev_data = match->data; |
| 171 | if (!dev_data) | 173 | if (!dev_data) |
| 172 | dev_data = &palmas_dev_data; | 174 | dev_data = &palmas_dev_data; |
diff --git a/drivers/gpio/gpio-syscon.c b/drivers/gpio/gpio-syscon.c index 045a952576c7..7b25fdf64802 100644 --- a/drivers/gpio/gpio-syscon.c +++ b/drivers/gpio/gpio-syscon.c | |||
| @@ -187,11 +187,15 @@ MODULE_DEVICE_TABLE(of, syscon_gpio_ids); | |||
| 187 | static int syscon_gpio_probe(struct platform_device *pdev) | 187 | static int syscon_gpio_probe(struct platform_device *pdev) |
| 188 | { | 188 | { |
| 189 | struct device *dev = &pdev->dev; | 189 | struct device *dev = &pdev->dev; |
| 190 | const struct of_device_id *of_id = of_match_device(syscon_gpio_ids, dev); | 190 | const struct of_device_id *of_id; |
| 191 | struct syscon_gpio_priv *priv; | 191 | struct syscon_gpio_priv *priv; |
| 192 | struct device_node *np = dev->of_node; | 192 | struct device_node *np = dev->of_node; |
| 193 | int ret; | 193 | int ret; |
| 194 | 194 | ||
| 195 | of_id = of_match_device(syscon_gpio_ids, dev); | ||
| 196 | if (!of_id) | ||
| 197 | return -ENODEV; | ||
| 198 | |||
| 195 | priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); | 199 | priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); |
| 196 | if (!priv) | 200 | if (!priv) |
| 197 | return -ENOMEM; | 201 | return -ENOMEM; |
diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c index 027e5f47dd28..896bf29776b0 100644 --- a/drivers/gpio/gpio-tegra.c +++ b/drivers/gpio/gpio-tegra.c | |||
| @@ -375,6 +375,60 @@ static int tegra_gpio_irq_set_wake(struct irq_data *d, unsigned int enable) | |||
| 375 | } | 375 | } |
| 376 | #endif | 376 | #endif |
| 377 | 377 | ||
| 378 | #ifdef CONFIG_DEBUG_FS | ||
| 379 | |||
| 380 | #include <linux/debugfs.h> | ||
| 381 | #include <linux/seq_file.h> | ||
| 382 | |||
| 383 | static int dbg_gpio_show(struct seq_file *s, void *unused) | ||
| 384 | { | ||
| 385 | int i; | ||
| 386 | int j; | ||
| 387 | |||
| 388 | for (i = 0; i < tegra_gpio_bank_count; i++) { | ||
| 389 | for (j = 0; j < 4; j++) { | ||
| 390 | int gpio = tegra_gpio_compose(i, j, 0); | ||
| 391 | seq_printf(s, | ||
| 392 | "%d:%d %02x %02x %02x %02x %02x %02x %06x\n", | ||
| 393 | i, j, | ||
| 394 | tegra_gpio_readl(GPIO_CNF(gpio)), | ||
| 395 | tegra_gpio_readl(GPIO_OE(gpio)), | ||
| 396 | tegra_gpio_readl(GPIO_OUT(gpio)), | ||
| 397 | tegra_gpio_readl(GPIO_IN(gpio)), | ||
| 398 | tegra_gpio_readl(GPIO_INT_STA(gpio)), | ||
| 399 | tegra_gpio_readl(GPIO_INT_ENB(gpio)), | ||
| 400 | tegra_gpio_readl(GPIO_INT_LVL(gpio))); | ||
| 401 | } | ||
| 402 | } | ||
| 403 | return 0; | ||
| 404 | } | ||
| 405 | |||
| 406 | static int dbg_gpio_open(struct inode *inode, struct file *file) | ||
| 407 | { | ||
| 408 | return single_open(file, dbg_gpio_show, &inode->i_private); | ||
| 409 | } | ||
| 410 | |||
| 411 | static const struct file_operations debug_fops = { | ||
| 412 | .open = dbg_gpio_open, | ||
| 413 | .read = seq_read, | ||
| 414 | .llseek = seq_lseek, | ||
| 415 | .release = single_release, | ||
| 416 | }; | ||
| 417 | |||
| 418 | static void tegra_gpio_debuginit(void) | ||
| 419 | { | ||
| 420 | (void) debugfs_create_file("tegra_gpio", S_IRUGO, | ||
| 421 | NULL, NULL, &debug_fops); | ||
| 422 | } | ||
| 423 | |||
| 424 | #else | ||
| 425 | |||
| 426 | static inline void tegra_gpio_debuginit(void) | ||
| 427 | { | ||
| 428 | } | ||
| 429 | |||
| 430 | #endif | ||
| 431 | |||
| 378 | static struct irq_chip tegra_gpio_irq_chip = { | 432 | static struct irq_chip tegra_gpio_irq_chip = { |
| 379 | .name = "GPIO", | 433 | .name = "GPIO", |
| 380 | .irq_ack = tegra_gpio_irq_ack, | 434 | .irq_ack = tegra_gpio_irq_ack, |
| @@ -519,6 +573,8 @@ static int tegra_gpio_probe(struct platform_device *pdev) | |||
| 519 | spin_lock_init(&bank->lvl_lock[j]); | 573 | spin_lock_init(&bank->lvl_lock[j]); |
| 520 | } | 574 | } |
| 521 | 575 | ||
| 576 | tegra_gpio_debuginit(); | ||
| 577 | |||
| 522 | return 0; | 578 | return 0; |
| 523 | } | 579 | } |
| 524 | 580 | ||
| @@ -536,52 +592,3 @@ static int __init tegra_gpio_init(void) | |||
| 536 | return platform_driver_register(&tegra_gpio_driver); | 592 | return platform_driver_register(&tegra_gpio_driver); |
| 537 | } | 593 | } |
| 538 | postcore_initcall(tegra_gpio_init); | 594 | postcore_initcall(tegra_gpio_init); |
| 539 | |||
| 540 | #ifdef CONFIG_DEBUG_FS | ||
| 541 | |||
| 542 | #include <linux/debugfs.h> | ||
| 543 | #include <linux/seq_file.h> | ||
| 544 | |||
| 545 | static int dbg_gpio_show(struct seq_file *s, void *unused) | ||
| 546 | { | ||
| 547 | int i; | ||
| 548 | int j; | ||
| 549 | |||
| 550 | for (i = 0; i < tegra_gpio_bank_count; i++) { | ||
| 551 | for (j = 0; j < 4; j++) { | ||
| 552 | int gpio = tegra_gpio_compose(i, j, 0); | ||
| 553 | seq_printf(s, | ||
| 554 | "%d:%d %02x %02x %02x %02x %02x %02x %06x\n", | ||
| 555 | i, j, | ||
| 556 | tegra_gpio_readl(GPIO_CNF(gpio)), | ||
| 557 | tegra_gpio_readl(GPIO_OE(gpio)), | ||
| 558 | tegra_gpio_readl(GPIO_OUT(gpio)), | ||
| 559 | tegra_gpio_readl(GPIO_IN(gpio)), | ||
| 560 | tegra_gpio_readl(GPIO_INT_STA(gpio)), | ||
| 561 | tegra_gpio_readl(GPIO_INT_ENB(gpio)), | ||
| 562 | tegra_gpio_readl(GPIO_INT_LVL(gpio))); | ||
| 563 | } | ||
| 564 | } | ||
| 565 | return 0; | ||
| 566 | } | ||
| 567 | |||
| 568 | static int dbg_gpio_open(struct inode *inode, struct file *file) | ||
| 569 | { | ||
| 570 | return single_open(file, dbg_gpio_show, &inode->i_private); | ||
| 571 | } | ||
| 572 | |||
| 573 | static const struct file_operations debug_fops = { | ||
| 574 | .open = dbg_gpio_open, | ||
| 575 | .read = seq_read, | ||
| 576 | .llseek = seq_lseek, | ||
| 577 | .release = single_release, | ||
| 578 | }; | ||
| 579 | |||
| 580 | static int __init tegra_gpio_debuginit(void) | ||
| 581 | { | ||
| 582 | (void) debugfs_create_file("tegra_gpio", S_IRUGO, | ||
| 583 | NULL, NULL, &debug_fops); | ||
| 584 | return 0; | ||
| 585 | } | ||
| 586 | late_initcall(tegra_gpio_debuginit); | ||
| 587 | #endif | ||
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index a18f00fc1bb8..2a91f3287e3b 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c | |||
| @@ -233,7 +233,7 @@ static struct gpio_desc *gpio_name_to_desc(const char * const name) | |||
| 233 | for (i = 0; i != chip->ngpio; ++i) { | 233 | for (i = 0; i != chip->ngpio; ++i) { |
| 234 | struct gpio_desc *gpio = &chip->desc[i]; | 234 | struct gpio_desc *gpio = &chip->desc[i]; |
| 235 | 235 | ||
| 236 | if (!gpio->name) | 236 | if (!gpio->name || !name) |
| 237 | continue; | 237 | continue; |
| 238 | 238 | ||
| 239 | if (!strcmp(gpio->name, name)) { | 239 | if (!strcmp(gpio->name, name)) { |
