* [PATCH] gpio-tegra: Do not create the debugfs entry by default
@ 2015-11-16 16:07 Suzuki K. Poulose
2015-11-16 16:49 ` Thierry Reding
2015-11-17 14:20 ` Linus Walleij
0 siblings, 2 replies; 3+ messages in thread
From: Suzuki K. Poulose @ 2015-11-16 16:07 UTC (permalink / raw)
To: linux-gpio
Cc: linux-tegra, linux-kernel, linus.walleij, thierry.reding, swarren,
gnurou, Suzuki K. Poulose
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>
---
drivers/gpio/gpio-tegra.c | 105 ++++++++++++++++++++++++---------------------
1 file changed, 56 insertions(+), 49 deletions(-)
diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c
index 027e5f4..896bf29 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)
}
#endif
+#ifdef CONFIG_DEBUG_FS
+
+#include <linux/debugfs.h>
+#include <linux/seq_file.h>
+
+static int dbg_gpio_show(struct seq_file *s, void *unused)
+{
+ int i;
+ int j;
+
+ for (i = 0; i < tegra_gpio_bank_count; i++) {
+ for (j = 0; j < 4; j++) {
+ int gpio = tegra_gpio_compose(i, j, 0);
+ seq_printf(s,
+ "%d:%d %02x %02x %02x %02x %02x %02x %06x\n",
+ i, j,
+ tegra_gpio_readl(GPIO_CNF(gpio)),
+ tegra_gpio_readl(GPIO_OE(gpio)),
+ tegra_gpio_readl(GPIO_OUT(gpio)),
+ tegra_gpio_readl(GPIO_IN(gpio)),
+ tegra_gpio_readl(GPIO_INT_STA(gpio)),
+ tegra_gpio_readl(GPIO_INT_ENB(gpio)),
+ tegra_gpio_readl(GPIO_INT_LVL(gpio)));
+ }
+ }
+ return 0;
+}
+
+static int dbg_gpio_open(struct inode *inode, struct file *file)
+{
+ return single_open(file, dbg_gpio_show, &inode->i_private);
+}
+
+static const struct file_operations debug_fops = {
+ .open = dbg_gpio_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = single_release,
+};
+
+static void tegra_gpio_debuginit(void)
+{
+ (void) debugfs_create_file("tegra_gpio", S_IRUGO,
+ NULL, NULL, &debug_fops);
+}
+
+#else
+
+static inline void tegra_gpio_debuginit(void)
+{
+}
+
+#endif
+
static struct irq_chip tegra_gpio_irq_chip = {
.name = "GPIO",
.irq_ack = tegra_gpio_irq_ack,
@@ -519,6 +573,8 @@ static int tegra_gpio_probe(struct platform_device *pdev)
spin_lock_init(&bank->lvl_lock[j]);
}
+ tegra_gpio_debuginit();
+
return 0;
}
@@ -536,52 +592,3 @@ static int __init tegra_gpio_init(void)
return platform_driver_register(&tegra_gpio_driver);
}
postcore_initcall(tegra_gpio_init);
-
-#ifdef CONFIG_DEBUG_FS
-
-#include <linux/debugfs.h>
-#include <linux/seq_file.h>
-
-static int dbg_gpio_show(struct seq_file *s, void *unused)
-{
- int i;
- int j;
-
- for (i = 0; i < tegra_gpio_bank_count; i++) {
- for (j = 0; j < 4; j++) {
- int gpio = tegra_gpio_compose(i, j, 0);
- seq_printf(s,
- "%d:%d %02x %02x %02x %02x %02x %02x %06x\n",
- i, j,
- tegra_gpio_readl(GPIO_CNF(gpio)),
- tegra_gpio_readl(GPIO_OE(gpio)),
- tegra_gpio_readl(GPIO_OUT(gpio)),
- tegra_gpio_readl(GPIO_IN(gpio)),
- tegra_gpio_readl(GPIO_INT_STA(gpio)),
- tegra_gpio_readl(GPIO_INT_ENB(gpio)),
- tegra_gpio_readl(GPIO_INT_LVL(gpio)));
- }
- }
- return 0;
-}
-
-static int dbg_gpio_open(struct inode *inode, struct file *file)
-{
- return single_open(file, dbg_gpio_show, &inode->i_private);
-}
-
-static const struct file_operations debug_fops = {
- .open = dbg_gpio_open,
- .read = seq_read,
- .llseek = seq_lseek,
- .release = single_release,
-};
-
-static int __init tegra_gpio_debuginit(void)
-{
- (void) debugfs_create_file("tegra_gpio", S_IRUGO,
- NULL, NULL, &debug_fops);
- return 0;
-}
-late_initcall(tegra_gpio_debuginit);
-#endif
--
1.7.9.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] gpio-tegra: Do not create the debugfs entry by default
2015-11-16 16:07 [PATCH] gpio-tegra: Do not create the debugfs entry by default Suzuki K. Poulose
@ 2015-11-16 16:49 ` Thierry Reding
2015-11-17 14:20 ` Linus Walleij
1 sibling, 0 replies; 3+ messages in thread
From: Thierry Reding @ 2015-11-16 16:49 UTC (permalink / raw)
To: Suzuki K. Poulose
Cc: linux-gpio, linux-tegra, linux-kernel, linus.walleij, swarren,
gnurou
[-- Attachment #1: Type: text/plain, Size: 647 bytes --]
On Mon, Nov 16, 2015 at 04:07:10PM +0000, Suzuki K. Poulose wrote:
> 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>
> ---
> drivers/gpio/gpio-tegra.c | 105 ++++++++++++++++++++++++---------------------
> 1 file changed, 56 insertions(+), 49 deletions(-)
Yikes, good catch!
Acked-by: Thierry Reding <treding@nvidia.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] gpio-tegra: Do not create the debugfs entry by default
2015-11-16 16:07 [PATCH] gpio-tegra: Do not create the debugfs entry by default Suzuki K. Poulose
2015-11-16 16:49 ` Thierry Reding
@ 2015-11-17 14:20 ` Linus Walleij
1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2015-11-17 14:20 UTC (permalink / raw)
To: Suzuki K. Poulose
Cc: linux-gpio@vger.kernel.org, linux-tegra@vger.kernel.org,
linux-kernel@vger.kernel.org, Thierry Reding, Stephen Warren,
Alexandre Courbot
On Mon, Nov 16, 2015 at 5:07 PM, Suzuki K. Poulose
<suzuki.poulose@arm.com> wrote:
> 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>
Patch applied for fixes with Thierry's ACK.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-11-17 14:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-16 16:07 [PATCH] gpio-tegra: Do not create the debugfs entry by default Suzuki K. Poulose
2015-11-16 16:49 ` Thierry Reding
2015-11-17 14:20 ` Linus Walleij
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).