Skip to contentSkip to conversation

ARM: Samsung: Remove unused code for the clocks debug-fs interface

PATCH New Sylwester Nawrocki 2 participants 3 messages Sep 2, 2012 – Sep 5, 2012

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: Samsung: Remove unused code for the clocks debug-fs interface

Commit f86c6660927614fcda257 "ARM: SAMSUNG: Add clkdev infrastructure" disabled population of the 'clocks' list - the clocks are now on the clkdev clock list. However, this effectively broke the existing clocks debug-fs interface on all Samsung platforms. Nobody complained about this missing feature for over one year, so remove the unused code.

This functionality will be restored when switching to the common clock framework.

---
 arch/arm/plat-samsung/clock.c              |   92 ----------------------------
 arch/arm/plat-samsung/include/plat/clock.h |    8 +--
 2 files changed, 1 insertions(+), 99 deletions(-)
arch/arm/plat-samsung/clock.c +0 -92
index 65c5eca..a8a69af 100644
@@ -39,25 +39,17 @@
 #include <linux/clk.h>
 #include <linux/spinlock.h>
 #include <linux/io.h>
-#if defined(CONFIG_DEBUG_FS)
-#include <linux/debugfs.h>
-#endif
 
 #include <mach/hardware.h>
 #include <asm/irq.h>
 
 #include <plat/cpu-freq.h>
-
 #include <plat/clock.h>
 #include <plat/cpu.h>
 
 #include <linux/serial_core.h>
 #include <plat/regs-serial.h> /* for s3c24xx_uart_devs */
 
-/* clock information */
-
-static LIST_HEAD(clocks);
-
 /* We originally used an mutex here, but some contexts (see resume)
  * are calling functions such as clk_set_parent() with IRQs disabled
  * causing an BUG to be triggered.
@@ -381,87 +373,3 @@ int __init s3c24xx_register_baseclocks(unsigned long xtal)
 
 	return 0;
 }
-
-#if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS)
-/* debugfs support to trace clock tree hierarchy and attributes */
-
-static struct dentry *clk_debugfs_root;
-
-static int clk_debugfs_register_one(struct clk *c)
-{
-	int err;
-	struct dentry *d;
-	struct clk *pa = c->parent;
-	char s[255];
-	char *p = s;
-
-	p += sprintf(p, "%s", c->devname);
-
-	d = debugfs_create_dir(s, pa ? pa->dent : clk_debugfs_root);
-	if (!d)
-		return -ENOMEM;
-
-	c->dent = d;
-
-	d = debugfs_create_u8("usecount", S_IRUGO, c->dent, (u8 *)&c->usage);
-	if (!d) {
-		err = -ENOMEM;
-		goto err_out;
-	}
-
-	d = debugfs_create_u32("rate", S_IRUGO, c->dent, (u32 *)&c->rate);
-	if (!d) {
-		err = -ENOMEM;
-		goto err_out;
-	}
-	return 0;
-
-err_out:
-	debugfs_remove_recursive(c->dent);
-	return err;
-}
-
-static int clk_debugfs_register(struct clk *c)
-{
-	int err;
-	struct clk *pa = c->parent;
-
-	if (pa && !pa->dent) {
-		err = clk_debugfs_register(pa);
-		if (err)
-			return err;
-	}
-
-	if (!c->dent) {
-		err = clk_debugfs_register_one(c);
-		if (err)
-			return err;
-	}
-	return 0;
-}
-
-static int __init clk_debugfs_init(void)
-{
-	struct clk *c;
-	struct dentry *d;
-	int err;
-
-	d = debugfs_create_dir("clock", NULL);
-	if (!d)
-		return -ENOMEM;
-	clk_debugfs_root = d;
-
-	list_for_each_entry(c, &clocks, list) {
-		err = clk_debugfs_register(c);
-		if (err)
-			goto err_out;
-	}
-	return 0;
-
-err_out:
-	debugfs_remove_recursive(clk_debugfs_root);
-	return err;
-}
-late_initcall(clk_debugfs_init);
-
-#endif /* defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS) */
arch/arm/plat-samsung/include/plat/clock.h +1 -7
index a62753d..16f3cd6 100644
@@ -1,5 +1,4 @@
-/* linux/arch/arm/plat-s3c/include/plat/clock.h
- *
+/*
  * Copyright (c) 2004-2005 Simtec Electronics
  *	http://www.simtec.co.uk/products/SWLINUX/
  *	Written by Ben Dooks, <[email protected]>
@@ -40,8 +39,6 @@ struct clk_ops {
 };
 
 struct clk {
-	struct list_head      list;
-	struct module        *owner;
 	struct clk           *parent;
 	const char           *name;
 	const char		*devname;
@@ -53,9 +50,6 @@ struct clk {
 	struct clk_ops		*ops;
 	int		    (*enable)(struct clk *, int enable);
 	struct clk_lookup	lookup;
-#if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS)
-	struct dentry		*dent;	/* For visible tree hierarchy */
-#endif
 };
 
 /* other clocks which may be registered by board support */

--
1.7.4.1

#1 lore raw

PATCH 1/1 ARM: Samsung: Remove unused code for the clocks debug-fs interface

Quoted 7 lines · Sylwester Nawrocki

Commit f86c6660927614fcda257 "ARM: SAMSUNG: Add clkdev infrastructure" disabled population of the 'clocks' list - the clocks are now on the clkdev clock list. However, this effectively broke the existing clocks debug-fs interface on all Samsung platforms. Nobody complained about this missing feature for over one year, so remove the unused code.

Yeah, could be. BTW, following will fix it on Samsung platforms?

From: Arve Hj<C3><B8>nnev<C3><A5>g <[email protected]>
Subject: [PATCH] ARM: SAMSUNG: Fix clock debugfs code

Restore list add deleted by commit f86c66609276('ARM: SAMSUNG:
Add clkdev infrastructure') and fix clk_debugfs_register_one to not crash when devname is NULL.

---
 arch/arm/plat-samsung/clock.c |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)
arch/arm/plat-samsung/clock.c +14 -1
index 65c5eca..b7338ce 100644
@@ -281,6 +281,15 @@ int s3c24xx_register_clock(struct clk *clk)
 	if (clk->enable == NULL)
 		clk->enable = clk_null_enable;
 
+	/* add to the list of available clocks */
+
+	/* Quick check to see if this clock has already been registered. */
+	BUG_ON(clk->list.prev != clk->list.next);
+
+	spin_lock(&clocks_lock);
+	list_add(&clk->list, &clocks);
+	spin_unlock(&clocks_lock);
+
 	/* fill up the clk_lookup structure and register it*/
 	clk->lookup.dev_id = clk->devname;
 	clk->lookup.con_id = clk->name;
@@ -395,7 +404,11 @@ static int clk_debugfs_register_one(struct clk *c)
 	char s[255];
 	char *p = s;
 
-	p += sprintf(p, "%s", c->devname);
+	if (c->name)
+		p += sprintf(p, "%s", c->name);
+
+	if (c->devname)
+		p += sprintf(p, ":%s", c->devname);
 
 	d = debugfs_create_dir(s, pa ? pa->dent : clk_debugfs_root);
 	if (!d)
Signature · 9 lines
1.7.1

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.
Quoted 6 lines

This functionality will be restored when switching to the common clock framework.

---
 arch/arm/plat-samsung/clock.c              |   92

---------------------------

Quoted 3 lines

-

 arch/arm/plat-samsung/include/plat/clock.h |    8 +--
 2 files changed, 1 insertions(+), 99 deletions(-)
#2 lore raw

PATCH 1/1 ARM: Samsung: Remove unused code for the clocks debug-fs interface

Quoted 1 line · Kukjin Kim

Yeah, could be. BTW, following will fix it on Samsung platforms?

Yes, that might be better. I tried something similar but thought it might not be worth to invest in a dead horse.. Anyway, since converting all Samsung platforms is expected to take some time (also all this out of tree code) probably better to apply this fix now, before we have an alternative solution.

I noticed the most of clocks hove now reported wrong "rate" value in this debugs-fs tree, due to not calling get_rate when needed. It's not really important though (looks like it's by design).

--

Regards,
Sylwester