diff options
author | Suzuki K. Poulose <suzuki.poulose@arm.com> | 2015-11-16 11:07:10 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2015-11-17 09:18:51 -0500 |
commit | b59d5fb7e9c7b145eae1119af04b7c450efaa11b (patch) | |
tree | 3c9bfa9940b10e9f85db3a139303310c7c8ae4f3 /drivers/gpio/gpio-tegra.c | |
parent | 5664de25fa8ad2f06d6d7dd44df61023e1aaaa14 (diff) |
gpio-tegra: Do not create the debugfs entry by default
The tegra gpio driver creates the debugfs entry irrespective of
whether the device exists or not. This is enabled on an arm64_defconfig
and leaves an entry in debugfs on all platforms where it is not
useful. This patch fixes the issue by creating the entry only when
a device exists.
Signed-off-by: Suzuki K. Poulose <suzuki.poulose@arm.com>
Acked-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio/gpio-tegra.c')
-rw-r--r-- | drivers/gpio/gpio-tegra.c | 105 |
1 files changed, 56 insertions, 49 deletions
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 | ||