Skip to contentSkip to conversation

omap:pm: Fix boot-time errors with debugfs disabled

PATCH In review Sanjeev Premi 4 participants 17 messages May 12, 2011 – May 24, 2011

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

PATCH 1/1 omap:pm: Fix boot-time errors with debugfs disabled

There is an implicit assumption in current implementation that debugfs is always enabled.

When debugfs is disabled, these errors are noticed during boot:
omap_voltage_late_init: Unable to create voltage debugfs main dir
vdd_debugfs_init: Unable to create debugfs directory for vdd_mpu
vdd_debugfs_init: Unable to create debugfs directory for vdd_core

This patch fixes these errors by enclosing code related to debugfs in #ifdef CONFIG_DEBUG_FS..#endif.

Boot tested on OMAP3EVM.

---
Patch was created and tested on the pm branch at commit:
d695569 : rebuild PM from branches

I am still finding my way around new code sructure. Haven't been able to verify if smartreflex and voltage layer are properly initialized. Though I do understand that smartreflex won't work without debugfs.

 arch/arm/mach-omap2/smartreflex.c |   15 +++++++++++++++
 arch/arm/mach-omap2/voltage.c     |    8 ++++++++
 2 files changed, 23 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/smartreflex.c +15 -0
index 2ce2fb7..b757632 100644
@@ -54,7 +54,9 @@ struct omap_sr {
 	struct list_head		node;
 	struct omap_sr_nvalue_table	*nvalue_table;
 	struct voltagedomain		*voltdm;
+#ifdef CONFIG_DEBUG_FS
 	struct dentry			*dbg_dir;
+#endif
 };
 
 /* sr_list contains all the instances of smartreflex module */
@@ -826,7 +828,9 @@ static int __init omap_sr_probe(struct platform_device *pdev)
 	struct omap_sr *sr_info = kzalloc(sizeof(struct omap_sr), GFP_KERNEL);
 	struct omap_sr_data *pdata = pdev->dev.platform_data;
 	struct resource *mem, *irq;
+#ifdef CONFIG_DEBUG_FS
 	struct dentry *vdd_dbg_dir, *nvalue_dir;
+#endif
 	struct omap_volt_data *volt_data;
 	int i, ret = 0;
 
@@ -903,6 +907,7 @@ static int __init omap_sr_probe(struct platform_device *pdev)
 	 * If the voltage domain debugfs directory is not created, do
 	 * not try to create rest of the debugfs entries.
 	 */
+#ifdef CONFIG_DEBUG_FS
 	vdd_dbg_dir = omap_voltage_get_dbgdir(sr_info->voltdm);
 	if (!vdd_dbg_dir) {
 		ret = -EINVAL;
@@ -952,14 +957,22 @@ static int __init omap_sr_probe(struct platform_device *pdev)
 		(void) debugfs_create_x32(name, S_IRUGO | S_IWUSR, nvalue_dir,
 				&(sr_info->nvalue_table[i].nvalue));
 	}
+#else
+	omap_voltage_get_volttable(sr_info->voltdm, &volt_data);
+	if (!volt_data) {
+		ret = -ENODATA;
+	}
+#endif /* CONFIG_DEBUG_FS */
 
 	return ret;
 
+#ifdef CONFIG_DEBUG_FS
 err_debugfs:
 	debugfs_remove_recursive(sr_info->dbg_dir);
 err_iounmap:
 	list_del(&sr_info->node);
 	iounmap(sr_info->base);
+#endif
 err_release_region:
 	release_mem_region(mem->start, resource_size(mem));
 err_free_devinfo:
@@ -988,8 +1001,10 @@ static int __devexit omap_sr_remove(struct platform_device *pdev)
 
 	if (sr_info->autocomp_active)
 		sr_stop_vddautocomp(sr_info);
+#ifdef CONFIG_DEBUG_FS
 	if (sr_info->dbg_dir)
 		debugfs_remove_recursive(sr_info->dbg_dir);
+#endif
 
 	list_del(&sr_info->node);
 	iounmap(sr_info->base);
arch/arm/mach-omap2/voltage.c +8 -0
index 9ef3789..6153211 100644
@@ -250,6 +250,7 @@ static void __init vp_init(struct omap_vdd_info *vdd)
 	vdd->write_reg(vp_val, prm_mod_offs, vdd->vp_data->vlimitto);
 }
 
+#ifdef CONFIG_DEBUG_FS
 static void __init vdd_debugfs_init(struct omap_vdd_info *vdd)
 {
 	char *name;
@@ -297,6 +298,7 @@ static void __init vdd_debugfs_init(struct omap_vdd_info *vdd)
 				vdd->debug_dir, (void *) vdd,
 				&nom_volt_debug_fops);
 }
+#endif
 
 /* Voltage scale and accessory APIs */
 static int _pre_volt_scale(struct omap_vdd_info *vdd,
@@ -980,6 +982,7 @@ int omap_voltage_register_pmic(struct voltagedomain *voltdm,
  * add any debug entry for a particular voltage domain. Returns NULL
  * in case of error.
  */
+#ifdef CONFIG_DEBUG_FS
 struct dentry *omap_voltage_get_dbgdir(struct voltagedomain *voltdm)
 {
 	struct omap_vdd_info *vdd;
@@ -993,6 +996,7 @@ struct dentry *omap_voltage_get_dbgdir(struct voltagedomain *voltdm)
 
 	return vdd->debug_dir;
 }
+#endif
 
 /**
  * omap_change_voltscale_method() - API to change the voltage scaling method.
@@ -1078,16 +1082,20 @@ int __init omap_voltage_late_init(void)
 		return -EINVAL;
 	}
 
+#ifdef CONFIG_DEBUG_FS
 	voltage_dir = debugfs_create_dir("voltage", NULL);
 	if (IS_ERR(voltage_dir))
 		pr_err("%s: Unable to create voltage debugfs main dir\n",
 			__func__);
+#endif
 	for (i = 0; i < nr_scalable_vdd; i++) {
 		if (omap_vdd_data_configure(vdd_info[i]))
 			continue;
 		omap_vc_init(vdd_info[i]);
 		vp_init(vdd_info[i]);
+#ifdef CONFIG_DEBUG_FS
 		vdd_debugfs_init(vdd_info[i]);
+#endif
 	}
 
 	return 0;
Signature · 1 line
1.7.2.2
#1 lore raw
Quoted 2 lines · Sanjeev Premi

There is an implicit assumption in current implementation that debugfs is always enabled.

thanks for doing this.

Quoted 8 lines

When debugfs is disabled, these errors are noticed during boot:
 omap_voltage_late_init: Unable to create voltage debugfs main dir
 vdd_debugfs_init: Unable to create debugfs directory for vdd_mpu
 vdd_debugfs_init: Unable to create debugfs directory for vdd_core

This patch fixes these errors by enclosing code related to debugfs in #ifdef CONFIG_DEBUG_FS..#endif.

generic - couple of comments - I think the #defs should be isolated off to headers - maybe the right approach may be to move the debugfs entries off to a separate file? or pm-debug.c??

Quoted 7 lines

Boot tested on OMAP3EVM.

---
 Patch was created and tested on the pm branch at commit:
  d695569 : rebuild PM from branches

Could I suggest Kevin's volt cleanup series - based off _c branch if there are cleanups to be done?

Quoted 6 lines

 I am still finding my way around new code sructure. Haven't been able to verify if smartreflex and voltage layer are properly initialized. Though I do understand that smartreflex won't work without debugfs.

Last I tried, with Vishwa's dvfs branch on panda without voltage registrations, things could crash :( if I get some time I will try to port Vishwa's series onto kevin's branch as well and test and provide any patches necessary.

Quoted 130 lines

 arch/arm/mach-omap2/smartreflex.c |   15 +++++++++++++++ arch/arm/mach-omap2/voltage.c     |    8 ++++++++

 2 files changed, 23 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/smartreflex.c +12 -0
index 2ce2fb7..b757632 100644
@@ -54,7 +54,9 @@ struct omap_sr {
        struct list_head                node;
        struct omap_sr_nvalue_table     *nvalue_table;
        struct voltagedomain            *voltdm;
+#ifdef CONFIG_DEBUG_FS
        struct dentry                   *dbg_dir;
+#endif
  };
 
  /* sr_list contains all the instances of smartreflex module */
@@ -826,7 +828,9 @@ static int __init omap_sr_probe(struct platform_device *pdev)
        struct omap_sr *sr_info = kzalloc(sizeof(struct omap_sr), GFP_KERNEL);
        struct omap_sr_data *pdata = pdev->dev.platform_data;
        struct resource *mem, *irq;
+#ifdef CONFIG_DEBUG_FS
        struct dentry *vdd_dbg_dir, *nvalue_dir;
+#endif
        struct omap_volt_data *volt_data;
        int i, ret = 0;
 
@@ -903,6 +907,7 @@ static int __init omap_sr_probe(struct platform_device *pdev)
         * If the voltage domain debugfs directory is not created, do
         * not try to create rest of the debugfs entries.
         */
+#ifdef CONFIG_DEBUG_FS
        vdd_dbg_dir = omap_voltage_get_dbgdir(sr_info->voltdm);
        if (!vdd_dbg_dir) {
                ret = -EINVAL;
@@ -952,14 +957,22 @@ static int __init omap_sr_probe(struct platform_device *pdev)
                (void) debugfs_create_x32(name, S_IRUGO | S_IWUSR, nvalue_dir,
                                &(sr_info->nvalue_table[i].nvalue));
        }
+#else
+       omap_voltage_get_volttable(sr_info->voltdm, &volt_data);
+       if (!volt_data) {
+               ret = -ENODATA;
+       }
+#endif /* CONFIG_DEBUG_FS */
 
        return ret;
 
+#ifdef CONFIG_DEBUG_FS

 err_debugfs:
       debugfs_remove_recursive(sr_info->dbg_dir); err_iounmap:
       list_del(&sr_info->node); iounmap(sr_info->base);
+#endif
 err_release_region:
       release_mem_region(mem->start, resource_size(mem)); err_free_devinfo:

arch/arm/mach-omap2/smartreflex.c +2 -0
@@ -988,8 +1001,10 @@ static int __devexit omap_sr_remove(struct platform_device *pdev)
 
        if (sr_info->autocomp_active)
                sr_stop_vddautocomp(sr_info);
+#ifdef CONFIG_DEBUG_FS
        if (sr_info->dbg_dir)
                debugfs_remove_recursive(sr_info->dbg_dir);
+#endif
 
        list_del(&sr_info->node);
        iounmap(sr_info->base);
arch/arm/mach-omap2/voltage.c +8 -1
index 9ef3789..6153211 100644
@@ -250,6 +250,7 @@ static void __init vp_init(struct omap_vdd_info *vdd)
        vdd->write_reg(vp_val, prm_mod_offs, vdd->vp_data->vlimitto);
  }
 
+#ifdef CONFIG_DEBUG_FS
  static void __init vdd_debugfs_init(struct omap_vdd_info *vdd)
  {
        char *name;
@@ -297,6 +298,7 @@ static void __init vdd_debugfs_init(struct omap_vdd_info *vdd)
                                vdd->debug_dir, (void *) vdd,
                                &nom_volt_debug_fops);
  }
+#endif
 
  /* Voltage scale and accessory APIs */
  static int _pre_volt_scale(struct omap_vdd_info *vdd,
@@ -980,6 +982,7 @@ int omap_voltage_register_pmic(struct voltagedomain *voltdm,
  * add any debug entry for a particular voltage domain. Returns NULL
  * in case of error.
  */
+#ifdef CONFIG_DEBUG_FS
  struct dentry *omap_voltage_get_dbgdir(struct voltagedomain *voltdm)
  {
        struct omap_vdd_info *vdd;
@@ -993,6 +996,7 @@ struct dentry *omap_voltage_get_dbgdir(struct voltagedomain *voltdm)
 
        return vdd->debug_dir;
  }
+#endif
 
  /**
  * omap_change_voltscale_method() - API to change the voltage scaling method.
@@ -1078,16 +1082,20 @@ int __init omap_voltage_late_init(void)
                return -EINVAL;
        }
 
+#ifdef CONFIG_DEBUG_FS
        voltage_dir = debugfs_create_dir("voltage", NULL);
        if (IS_ERR(voltage_dir))
                pr_err("%s: Unable to create voltage debugfs main dir\n",
                        __func__);
+#endif
        for (i = 0; i < nr_scalable_vdd; i++) {
                if (omap_vdd_data_configure(vdd_info[i]))
                        continue;
                omap_vc_init(vdd_info[i]);
                vp_init(vdd_info[i]);
+#ifdef CONFIG_DEBUG_FS
                vdd_debugfs_init(vdd_info[i]);
+#endif
        }
 
        return 0;
--

1.7.2.2

Quoted 5 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Regards,
Nishanth Menon
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
Quoted 20 lines

-----Original Message-----
From: Menon, Nishanth
Sent: Thursday, May 12, 2011 11:32 PM
To: Premi, Sanjeev
Cc: [email protected]
Subject: Re: [PATCH] omap:pm: Fix boot-time errors with debugfs disabled

Quoted 2 lines · Sanjeev Premi

There is an implicit assumption in current implementation that debugfs is always enabled.

thanks for doing this.

Quoted 6 lines

When debugfs is disabled, these errors are noticed during boot:
 omap_voltage_late_init: Unable to create voltage debugfs main dir
 vdd_debugfs_init: Unable to create debugfs directory for vdd_mpu
 vdd_debugfs_init: Unable to create debugfs directory for vdd_core

Quoted 5 lines
Quoted 2 lines

This patch fixes these errors by enclosing code related to debugfs in #ifdef CONFIG_DEBUG_FS..#endif.

generic - couple of comments - I think the #defs should be isolated off to headers - maybe the right approach may be to move the debugfs

[sp] None of the code encapsulated here is "header" material.
I guess you have seen the patch below.

Quoted 1 line

entries off to a separate file? or pm-debug.c??

[sp] I wish it was all debug code. It is "operational" code.
Check the Kconfig in plat-omap. Smartreflex is not even expected to work without debugfs. Though I believe much of the data put in debugfs can be in local lists/structures.

That was supposed to be my next set of patches - as I understand the implementation better.

Quoted 11 lines
Quoted 8 lines

Boot tested on OMAP3EVM.

---
 Patch was created and tested on the pm branch at commit:
  d695569 : rebuild PM from branches

Could I suggest Kevin's volt cleanup series - based off _c branch if there are cleanups to be done?

[sp] I didn't see it updated for 5 weeks. hence used this.
but patch should apply cleanly...

Quoted 8 lines
Quoted 7 lines

 I am still finding my way around new code sructure. Haven't been able to verify if smartreflex and voltage layer are properly initialized. Though I do understand that smartreflex won't work without debugfs.

Quoted 4 lines

Last I tried, with Vishwa's dvfs branch on panda without voltage registrations, things could crash :( if I get some time I will try to port Vishwa's series onto kevin's branch as well and test and provide any patches necessary.

[sp] I can try this on Panda. Will be able to get one tomorrow.

~sanjeev

[snip]...[snip]
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
Quoted 2 lines · Sanjeev
Quoted 2 lines

-----Original Message-----
From: Menon, Nishanth

...

Quoted 6 lines
Quoted 4 lines

Last I tried, with Vishwa's dvfs branch on panda without voltage registrations, things could crash :( if I get some time I will try to port Vishwa's series onto kevin's branch as well and test and provide any patches necessary.

[sp] I can try this on Panda. Will be able to get one tomorrow.

In case it helps, below is what I use for Panda.

---
ARM: OMAP2 voltage: Don't die if board does not register voltage params

This allows the DVFS patches to boot on boards not yet modified to register voltage params.

---
 arch/arm/mach-omap2/voltage.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/voltage.c +6 -0
index dbc1cfe..8f23d95 100644
@@ -617,6 +617,12 @@ static void __init omap4_vc_init(struct omap_vdd_info *vdd)
 	struct clk *sys_ck;
 	u32 sys_clk_speed;
 
+	if (!vdd->board_data) {
+		pr_warning("%s: No voltage board params registered for vdd_%s\n",
+			   __func__, vdd->voltdm.name);
+		return;
+	}
+
 	sys_ck = clk_get(NULL, "sys_clkin_ck");
 	if (IS_ERR(sys_ck)) {
 		pr_warning("%s: Could not get the sys clk to calculate"
Signature · 1 line
1.7.3.1
#4 lore raw
Quoted 31 lines · Todd Poynor
Quoted 2 lines · Sanjeev
Quoted 2 lines

-----Original Message-----
From: Menon, Nishanth

...

Quoted 6 lines
Quoted 4 lines

Last I tried, with Vishwa's dvfs branch on panda without voltage registrations, things could crash :( if I get some time I will try to port Vishwa's series onto kevin's branch as well and test and provide any patches necessary.

[sp] I can try this on Panda. Will be able to get one tomorrow.

In case it helps, below is what I use for Panda.

---
ARM: OMAP2 voltage: Don't die if board does not register voltage params

This allows the DVFS patches to boot on boards not yet modified to register voltage params.

---
 arch/arm/mach-omap2/voltage.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/voltage.c +0 -0
index dbc1cfe..8f23d95 100644
@@ -617,6 +617,12 @@ static void __init omap4_vc_init(struct omap_vdd_info *vdd)
 	struct clk *sys_ck;
 	u32 sys_clk_speed;

arch/arm/mach-omap2/voltage.c static void __init omap4_vc_init(struct omap_vdd_info *vdd) · line 628

Quoted 10 lines
arch/arm/mach-omap2/voltage.c +6 -0
 
+	if (!vdd->board_data) {
+		pr_warning("%s: No voltage board params registered for vdd_%s\n",
+			   __func__, vdd->voltdm.name);
+		return;
+	}
+
 	sys_ck = clk_get(NULL, "sys_clkin_ck");
 	if (IS_ERR(sys_ck)) {
 		pr_warning("%s: Could not get the sys clk to calculate"

looks around the right place.. but, which branch is this based on? cant see board_data on linus master..

Signature · 2 lines
Regards,
Nishanth Menon
#5 lore raw
In reply to Premi, Sanjeev
Quoted 9 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Premi, Sanjeev
Sent: Friday, May 13, 2011 12:46 AM
To: Menon, Nishanth
Cc: [email protected]
Subject: RE: [PATCH] omap:pm: Fix boot-time errors with debugfs disabled

[sp]

Quoted 9 lines
Quoted 3 lines

Last I tried, with Vishwa's dvfs branch on panda without voltage registrations, things could crash :( if I get some time I

will try to

Quoted 1 line

port Vishwa's series onto kevin's branch as well and test

and provide

Quoted 1 line

any patches necessary.

[sp] I can try this on Panda. Will be able to get one tomorrow.

Tested same uImage on Panda as well. Just pasting the top header here...

[    0.000000] Linux version 2.6.39-rc4-13782-gd695569-dirty (premi@mylinux) (gcc version 4.5.1 (Sourcery G++ Lite 2010.09-50) ) #6 SMP Thu May 12 21:40:58 IST 2011
[    0.000000] CPU: ARMv7 Processor [411fc092] revision 2 (ARMv7), cr=10c53c7f
[    0.000000] CPU: VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] Machine: OMAP4 Panda board
[    0.000000] Memory policy: ECC disabled, Data cache writealloc
[    0.000000] Truncating RAM at 80000000-bfffffff to -afffffff (vmalloc region overlap).
[    0.000000] OMAP4430 ES2.1
Quoted 10 lines

~sanjeev

[snip]...[snip]
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#6 lore raw
Quoted 8 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Premi, Sanjeev
Sent: Friday, May 13, 2011 6:18 PM
To: [email protected]
Cc: Menon, Nishanth
Subject: RE: [PATCH] omap:pm: Fix boot-time errors with debugfs disabled

[snip]...[snip]

Quoted 7 lines
Quoted 2 lines

[sp] I can try this on Panda. Will be able to get one tomorrow.

Tested same uImage on Panda as well. Just pasting the top header here...

Quoted 13 lines
[    0.000000] Linux version 2.6.39-rc4-13782-gd695569-dirty 
(premi@mylinux) (gcc version 4.5.1 (Sourcery G++ Lite 
2010.09-50) ) #6 SMP Thu May 12 21:40:58 IST 2011
[    0.000000] CPU: ARMv7 Processor [411fc092] revision 2 
(ARMv7), cr=10c53c7f
[    0.000000] CPU: VIPT nonaliasing data cache, VIPT 
aliasing instruction cache
[    0.000000] Machine: OMAP4 Panda board
[    0.000000] Memory policy: ECC disabled, Data cache writealloc
[    0.000000] Truncating RAM at 80000000-bfffffff to 
-afffffff (vmalloc region overlap).
[    0.000000] OMAP4430 ES2.1

Kevin,

Wanted to check if you have look at this patch?

~sanjeev

[snip]...[snip]

#7 lore raw
In reply to Premi, Sanjeev

On Thu, May 12, 2011 at 14:16, Premi, Sanjeev <[email protected]> wrote:
[...]

Quoted 18 lines
Quoted 5 lines
Quoted 2 lines

This patch fixes these errors by enclosing code related to debugfs in #ifdef CONFIG_DEBUG_FS..#endif.

generic - couple of comments - I think the #defs should be isolated off to headers - maybe the right approach may be to move the debugfs

[sp] None of the code encapsulated here is "header" material. I guess you have seen the patch below.

Quoted 1 line

entries off to a separate file? or pm-debug.c??

[sp] I wish it was all debug code. It is "operational" code. Check the Kconfig in plat-omap. Smartreflex is not even expected to work without debugfs. Though I believe much of the data put in debugfs can be in local lists/structures.

    That was supposed to be my next set of patches - as I understand the implementation better.

[...]

Quoted 5 lines
Quoted 2 lines

Could I suggest Kevin's volt cleanup series - based off _c branch if there are cleanups to be done?

[sp] I didn't see it updated for 5 weeks. hence used this. but patch should apply cleanly...

While cleaning up voltdm_c set earlier this week, I think your changes apply better there.
btw, I could incorporate a bit of your code into my patch, esp the one Tony commented on http://marc.info/?l=linux-omap&m=130570559515977&w=2
but, overall, on the topic of SR, either:
a) move SR autocomp into sysfs (and dump the rest of the debugfs - it is useful for validation, but does'nt really provide additional info)
- given that it used to reside in /sys/power/sr_vddx_autocomp and then moved to debugfs, I am not sure if this is the right path
b) move SR autocomp into a board defined configuration.. more intrusive, but folks would really want to enable SR as an option at times from userspace - many distros and devices do this (e.g. N900)..

Regards,
Nishanth Menon
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#8 lore raw
Quoted 40 lines

-----Original Message-----
From: Menon, Nishanth
Sent: Wednesday, May 18, 2011 1:55 PM
To: Premi, Sanjeev
Cc: [email protected]
Subject: Re: [PATCH] omap:pm: Fix boot-time errors with debugfs disabled

On Thu, May 12, 2011 at 14:16, Premi, Sanjeev <[email protected]> wrote:
[...]

Quoted 1 line
Quoted 1 line
Quoted 1 line

This patch fixes these errors by enclosing code related

to debugfs

Quoted 4 lines
Quoted 4 lines
Quoted 1 line

in #ifdef CONFIG_DEBUG_FS..#endif.

generic - couple of comments - I think the #defs should be isolated off to headers - maybe the right approach may be to move

the debugfs

Quoted 9 lines

[sp] None of the code encapsulated here is "header" material. I guess you have seen the patch below.

Quoted 1 line

entries off to a separate file? or pm-debug.c??

[sp] I wish it was all debug code. It is "operational" code. Check the Kconfig in plat-omap. Smartreflex is not even expected to work without debugfs. Though I believe much of the

data put in

Quoted 4 lines

    debugfs can be in local lists/structures.

    That was supposed to be my next set of patches - as I understand the implementation better.

[...]

Quoted 1 line
Quoted 1 line

Could I suggest Kevin's volt cleanup series - based off _c

branch if

Quoted 4 lines
Quoted 1 line

there are cleanups to be done?

[sp] I didn't see it updated for 5 weeks. hence used this. but patch should apply cleanly...

Quoted 12 lines

While cleaning up voltdm_c set earlier this week, I think your changes apply better there.
btw, I could incorporate a bit of your code into my patch, esp the one Tony commented on http://marc.info/?l=linux-omap&m=130570559515977&w=2
but, overall, on the topic of SR, either:
a) move SR autocomp into sysfs (and dump the rest of the debugfs - it is useful for validation, but does'nt really provide additional info)
- given that it used to reside in /sys/power/sr_vddx_autocomp and then moved to debugfs, I am not sure if this is the right path
b) move SR autocomp into a board defined configuration.. more intrusive, but folks would really want to enable SR as an option at times from userspace - many distros and devices do this (e.g. N900)..

[sp] I am not sure what you are suggesting. Can't we take in the patch and
then do the movements? ... the ones that doesn't seem to be implemented so far (based on your comments).

~sanjeev

Quoted 4 lines

Regards,
Nishanth Menon
--

To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#9 lore raw
Quoted 4 lines · Sanjeev
Quoted 4 lines

While cleaning up voltdm_c set earlier this week, I think your changes apply better there.
btw, I could incorporate a bit of your code into my patch, esp the one Tony commented on http://marc.info/?l=linux-omap&m=130570559515977&w=2

ok this part got rejected pending regulator framework for scalable voltage domains..

Quoted 9 lines
Quoted 8 lines

but, overall, on the topic of SR, either:
a)  move SR autocomp into sysfs (and dump the rest of the debugfs - it is useful for validation, but does'nt really provide additional info)
- given that it used to reside in /sys/power/sr_vddx_autocomp and then moved to debugfs, I am not sure if this is the right path
b) move SR autocomp into a board defined configuration.. more intrusive, but folks would really want to enable SR as an option at times from userspace - many distros and devices do this (e.g. N900)..

Quoted 3 lines

[sp] I am not sure what you are suggesting. Can't we take in the patch and then do the movements? ... the ones that doesn't seem to be implemented so far (based on your comments).

depends on what Kevin thinks is the future of voltdm(in terms of which .4x target) - might be good to focus our attention into a single branch and cleanit up for upstream.. I am personally not sure what should autocomp's future should be - I think option of having boards be able to define it - maybe as part of regulator framework + debugfs cleanup similar(as voltdm_c has removed I believe all of voltage debugfs - so your patch can be much smaller and effective there)..

Regards,
Nishanth Menon
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#10 lore raw
Quoted 36 lines

-----Original Message-----
From: Menon, Nishanth
Sent: Wednesday, May 18, 2011 2:36 PM
To: Premi, Sanjeev
Cc: [email protected]
Subject: Re: [PATCH] omap:pm: Fix boot-time errors with debugfs disabled

Quoted 1 line · Sanjeev
Quoted 1 line

While cleaning up voltdm_c set earlier this week, I think

your changes

Quoted 2 lines
Quoted 2 lines

apply better there.
btw, I could incorporate a bit of your code into my patch,

esp the one

Quoted 1 line
Quoted 1 line

Tony commented on

http://marc.info/?l=linux-omap&m=130570559515977&w=2
ok this part got rejected pending regulator framework for scalable voltage domains..

Quoted 2 lines
Quoted 2 lines

but, overall, on the topic of SR, either:
a)  move SR autocomp into sysfs (and dump the rest of the

debugfs - it

Quoted 1 line
Quoted 1 line

is useful for validation, but does'nt really provide

additional info)

Quoted 1 line
Quoted 1 line

- given that it used to reside in

/sys/power/sr_vddx_autocomp and then

Quoted 4 lines
Quoted 4 lines

moved to debugfs, I am not sure if this is the right path
b) move SR autocomp into a board defined configuration.. more intrusive, but folks would really want to enable SR as an option at times from userspace - many distros and devices do this

(e.g. N900)..

Quoted 2 lines

[sp] I am not sure what you are suggesting. Can't we take

in the patch and

Quoted 1 line

    then do the movements? ... the ones that doesn't seem

to be implemented

Quoted 8 lines
Quoted 1 line

    so far (based on your comments).

depends on what Kevin thinks is the future of voltdm(in terms of which .4x target) - might be good to focus our attention into a single branch and cleanit up for upstream.. I am personally not sure what should autocomp's future should be - I think option of having boards be able to define it - maybe as part of regulator framework + debugfs cleanup similar(as voltdm_c has removed I believe all of voltage debugfs - so your patch can be much smaller and effective there)..

[sp] Reworking the patch for different branch is fine.
But what about the pm branch today.

Quoted 4 lines

Regards,
Nishanth Menon
--

To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#11 lore raw
In reply to Sanjeev Premi

Hi Sanjeev,

Quoted 8 lines · Sanjeev Premi

There is an implicit assumption in current implementation that debugfs is always enabled.

When debugfs is disabled, these errors are noticed during boot:
omap_voltage_late_init: Unable to create voltage debugfs main dir
vdd_debugfs_init: Unable to create debugfs directory for vdd_mpu
vdd_debugfs_init: Unable to create debugfs directory for vdd_core

Quoted 6 lines

This patch fixes these errors by enclosing code related to debugfs in #ifdef CONFIG_DEBUG_FS..#endif.

Boot tested on OMAP3EVM.

Sorry for the delay here, I've been on the road and finally catching up on the list.

Basically, I'm in the process of a pretty major cleanup of the VC/VP and SR layers. For example, in my pm-wip/voltdm_* branches, the debugfs interface to the voltage layer has been completely removed. I'm also thinking of removing the SR debugfs interface also, as I don't really think we need a userspace interface for this. A board-level interface is probably enough (/me waits for flame from Nishanth :)

That being said, your approach below isn't quite right in its usage of #ifdefs. Use of #ifdefs like this is frowned upon for many reasons. For starters, take a look the '#ifdefs are ugly' section of Documentation/SubmittingPatches.

Kevin

Quoted 136 lines

---
Patch was created and tested on the pm branch at commit:
d695569 : rebuild PM from branches

I am still finding my way around new code sructure. Haven't been able to verify if smartreflex and voltage layer are properly initialized. Though I do understand that smartreflex won't work without debugfs.

 arch/arm/mach-omap2/smartreflex.c |   15 +++++++++++++++
 arch/arm/mach-omap2/voltage.c     |    8 ++++++++
 2 files changed, 23 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/smartreflex.c +15 -0
index 2ce2fb7..b757632 100644
@@ -54,7 +54,9 @@ struct omap_sr {
 	struct list_head		node;
 	struct omap_sr_nvalue_table	*nvalue_table;
 	struct voltagedomain		*voltdm;
+#ifdef CONFIG_DEBUG_FS
 	struct dentry			*dbg_dir;
+#endif
 };
 
 /* sr_list contains all the instances of smartreflex module */
@@ -826,7 +828,9 @@ static int __init omap_sr_probe(struct platform_device *pdev)
 	struct omap_sr *sr_info = kzalloc(sizeof(struct omap_sr), GFP_KERNEL);
 	struct omap_sr_data *pdata = pdev->dev.platform_data;
 	struct resource *mem, *irq;
+#ifdef CONFIG_DEBUG_FS
 	struct dentry *vdd_dbg_dir, *nvalue_dir;
+#endif
 	struct omap_volt_data *volt_data;
 	int i, ret = 0;
 
@@ -903,6 +907,7 @@ static int __init omap_sr_probe(struct platform_device *pdev)
 	 * If the voltage domain debugfs directory is not created, do
 	 * not try to create rest of the debugfs entries.
 	 */
+#ifdef CONFIG_DEBUG_FS
 	vdd_dbg_dir = omap_voltage_get_dbgdir(sr_info->voltdm);
 	if (!vdd_dbg_dir) {
 		ret = -EINVAL;
@@ -952,14 +957,22 @@ static int __init omap_sr_probe(struct platform_device *pdev)
 		(void) debugfs_create_x32(name, S_IRUGO | S_IWUSR, nvalue_dir,
 				&(sr_info->nvalue_table[i].nvalue));
 	}
+#else
+	omap_voltage_get_volttable(sr_info->voltdm, &volt_data);
+	if (!volt_data) {
+		ret = -ENODATA;
+	}
+#endif /* CONFIG_DEBUG_FS */
 
 	return ret;
 
+#ifdef CONFIG_DEBUG_FS
 err_debugfs:
 	debugfs_remove_recursive(sr_info->dbg_dir);
 err_iounmap:
 	list_del(&sr_info->node);
 	iounmap(sr_info->base);
+#endif
 err_release_region:
 	release_mem_region(mem->start, resource_size(mem));
 err_free_devinfo:
@@ -988,8 +1001,10 @@ static int __devexit omap_sr_remove(struct platform_device *pdev)
 
 	if (sr_info->autocomp_active)
 		sr_stop_vddautocomp(sr_info);
+#ifdef CONFIG_DEBUG_FS
 	if (sr_info->dbg_dir)
 		debugfs_remove_recursive(sr_info->dbg_dir);
+#endif
 
 	list_del(&sr_info->node);
 	iounmap(sr_info->base);
arch/arm/mach-omap2/voltage.c +8 -0
index 9ef3789..6153211 100644
@@ -250,6 +250,7 @@ static void __init vp_init(struct omap_vdd_info *vdd)
 	vdd->write_reg(vp_val, prm_mod_offs, vdd->vp_data->vlimitto);
 }
 
+#ifdef CONFIG_DEBUG_FS
 static void __init vdd_debugfs_init(struct omap_vdd_info *vdd)
 {
 	char *name;
@@ -297,6 +298,7 @@ static void __init vdd_debugfs_init(struct omap_vdd_info *vdd)
 				vdd->debug_dir, (void *) vdd,
 				&nom_volt_debug_fops);
 }
+#endif
 
 /* Voltage scale and accessory APIs */
 static int _pre_volt_scale(struct omap_vdd_info *vdd,
@@ -980,6 +982,7 @@ int omap_voltage_register_pmic(struct voltagedomain *voltdm,
  * add any debug entry for a particular voltage domain. Returns NULL
  * in case of error.
  */
+#ifdef CONFIG_DEBUG_FS
 struct dentry *omap_voltage_get_dbgdir(struct voltagedomain *voltdm)
 {
 	struct omap_vdd_info *vdd;
@@ -993,6 +996,7 @@ struct dentry *omap_voltage_get_dbgdir(struct voltagedomain *voltdm)
 
 	return vdd->debug_dir;
 }
+#endif
 
 /**
  * omap_change_voltscale_method() - API to change the voltage scaling method.
@@ -1078,16 +1082,20 @@ int __init omap_voltage_late_init(void)
 		return -EINVAL;
 	}
 
+#ifdef CONFIG_DEBUG_FS
 	voltage_dir = debugfs_create_dir("voltage", NULL);
 	if (IS_ERR(voltage_dir))
 		pr_err("%s: Unable to create voltage debugfs main dir\n",
 			__func__);
+#endif
 	for (i = 0; i < nr_scalable_vdd; i++) {
 		if (omap_vdd_data_configure(vdd_info[i]))
 			continue;
 		omap_vc_init(vdd_info[i]);
 		vp_init(vdd_info[i]);
+#ifdef CONFIG_DEBUG_FS
 		vdd_debugfs_init(vdd_info[i]);
+#endif
 	}
 
 	return 0;
#12 lore raw
Quoted 6 lines · Kevin Hilman

Basically, I'm in the process of a pretty major cleanup of the VC/VP and SR layers.  For example, in my pm-wip/voltdm_* branches, the debugfs interface to the voltage layer has been completely removed.  I'm also thinking of removing the SR debugfs interface also, as I don't really think we need a userspace interface for this.  A board-level interface is probably enough (/me waits for flame from Nishanth :)

/me obliges with my 2cents ;) :

on board level interface - yes - we should have it.

on plugging out userspace: This is too risky an approach - having a mechanism to control SR from userspace is critical - yes folks can do a regwrite over /dev/mem to plug it out, but with multiple SR classes, it hardly ever going to be right. further, SR is a touchy beast to bad clk and system configurations - if we view debugfs as what it was meant to be: debug interface, SR deserves it. I agree that asking for userspace to have a sysfs is not worth it if board level interface has it. (and adding custom patches for every board developer out there... well.. it is not really worth the pain).

Regards,
Nishanth Menon
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#13 lore raw
In reply to Kevin Hilman
Quoted 39 lines

-----Original Message-----
From: Hilman, Kevin
Sent: Wednesday, May 18, 2011 10:04 PM
To: Premi, Sanjeev
Cc: [email protected]
Subject: Re: [PATCH] omap:pm: Fix boot-time errors with debugfs disabled

Hi Sanjeev,

Quoted 8 lines · Sanjeev Premi

There is an implicit assumption in current implementation that debugfs is always enabled.

When debugfs is disabled, these errors are noticed during boot:
omap_voltage_late_init: Unable to create voltage debugfs main dir
vdd_debugfs_init: Unable to create debugfs directory for vdd_mpu
vdd_debugfs_init: Unable to create debugfs directory for vdd_core

Quoted 6 lines

This patch fixes these errors by enclosing code related to debugfs in #ifdef CONFIG_DEBUG_FS..#endif.

Boot tested on OMAP3EVM.

Sorry for the delay here, I've been on the road and finally catching up
on the list.

Basically, I'm in the process of a pretty major cleanup of the VC/VP and
SR layers. For example, in my pm-wip/voltdm_* branches, the debugfs interface to the voltage layer has been completely removed. I'm also thinking of removing the SR debugfs interface also, as I don't really think we need a userspace interface for this. A board-level interface is probably enough (/me waits for flame from Nishanth :)

Quoted 4 lines

That being said, your approach below isn't quite right in its usage of #ifdefs. Use of #ifdefs like this is frowned upon for many reasons. For starters, take a look the '#ifdefs are ugly' section of Documentation/SubmittingPatches.

[sp] I don't like #ifdefs either but each time we cannot create
a new file changes like this.

The current code is a mess with debugfs used too frequently. And - all of it is not for debug. The location of ifdefs in in the patch illustrates it quite well.

BTW, this isn't the only use of ifdefs in a C file in Linux.

~sanjeev

Quoted 156 lines

Kevin

Quoted 9 lines

---
Patch was created and tested on the pm branch at commit:
d695569 : rebuild PM from branches

I am still finding my way around new code sructure. Haven't been able to verify if smartreflex and voltage layer are properly initialized. Though I do understand that smartreflex won't work without debugfs.

Review

Quoted 5 lines
 arch/arm/mach-omap2/smartreflex.c |   15 +++++++++++++++
 arch/arm/mach-omap2/voltage.c     |    8 ++++++++
 2 files changed, 23 insertions(+), 0 deletions(-)
(quoted diff) +0 -0

b/arch/arm/mach-omap2/smartreflex.c

arch/arm/mach-omap2/smartreflex.c static int __init omap_sr_probe(struct

Quoted 14 lines

index 2ce2fb7..b757632 100644

arch/arm/mach-omap2/smartreflex.c +2 -0
@@ -54,7 +54,9 @@ struct omap_sr {
 	struct list_head		node;
 	struct omap_sr_nvalue_table	*nvalue_table;
 	struct voltagedomain		*voltdm;
+#ifdef CONFIG_DEBUG_FS
 	struct dentry			*dbg_dir;
+#endif
 };
 
 /* sr_list contains all the instances of smartreflex module */
@@ -826,7 +828,9 @@ static int __init omap_sr_probe(struct 

platform_device *pdev)

arch/arm/mach-omap2/smartreflex.c static int __init omap_sr_probe(struct · line 828

Quoted 1 line
arch/arm/mach-omap2/smartreflex.c +0 -0
 	struct omap_sr *sr_info = kzalloc(sizeof(struct 

omap_sr), GFP_KERNEL);

arch/arm/mach-omap2/smartreflex.c static int __init omap_sr_probe(struct

Quoted 9 lines
arch/arm/mach-omap2/smartreflex.c +2 -0
 	struct omap_sr_data *pdata = pdev->dev.platform_data;
 	struct resource *mem, *irq;
+#ifdef CONFIG_DEBUG_FS
 	struct dentry *vdd_dbg_dir, *nvalue_dir;
+#endif
 	struct omap_volt_data *volt_data;
 	int i, ret = 0;
 
@@ -903,6 +907,7 @@ static int __init omap_sr_probe(struct 

platform_device *pdev)

arch/arm/mach-omap2/smartreflex.c static int __init

Quoted 8 lines
arch/arm/mach-omap2/smartreflex.c +1 -0
 	 * If the voltage domain debugfs directory is not created, do
 	 * not try to create rest of the debugfs entries.
 	 */
+#ifdef CONFIG_DEBUG_FS
 	vdd_dbg_dir = omap_voltage_get_dbgdir(sr_info->voltdm);
 	if (!vdd_dbg_dir) {
 		ret = -EINVAL;
@@ -952,14 +957,22 @@ static int __init 

omap_sr_probe(struct platform_device *pdev)

arch/arm/mach-omap2/smartreflex.c static int __init · line 957

Quoted 1 line
arch/arm/mach-omap2/smartreflex.c +0 -0
 		(void) debugfs_create_x32(name, S_IRUGO | 

S_IWUSR, nvalue_dir,

arch/arm/mach-omap2/smartreflex.c static int __devexit

Quoted 22 lines
arch/arm/mach-omap2/smartreflex.c +8 -0
 				&(sr_info->nvalue_table[i].nvalue));
 	}
+#else
+	omap_voltage_get_volttable(sr_info->voltdm, &volt_data);
+	if (!volt_data) {
+		ret = -ENODATA;
+	}
+#endif /* CONFIG_DEBUG_FS */
 
 	return ret;
 
+#ifdef CONFIG_DEBUG_FS
 err_debugfs:
 	debugfs_remove_recursive(sr_info->dbg_dir);
 err_iounmap:
 	list_del(&sr_info->node);
 	iounmap(sr_info->base);
+#endif
 err_release_region:
 	release_mem_region(mem->start, resource_size(mem));
 err_free_devinfo:
@@ -988,8 +1001,10 @@ static int __devexit 

omap_sr_remove(struct platform_device *pdev)

Review

Quoted 11 lines
arch/arm/mach-omap2/smartreflex.c +2 -0
 	if (sr_info->autocomp_active)
 		sr_stop_vddautocomp(sr_info);
+#ifdef CONFIG_DEBUG_FS
 	if (sr_info->dbg_dir)
 		debugfs_remove_recursive(sr_info->dbg_dir);
+#endif
 
 	list_del(&sr_info->node);
 	iounmap(sr_info->base);
(quoted diff) +0 -0

b/arch/arm/mach-omap2/voltage.c

arch/arm/mach-omap2/voltage.c static void __init vp_init(struct

Quoted 4 lines

index 9ef3789..6153211 100644

arch/arm/mach-omap2/voltage.c +0 -0
@@ -250,6 +250,7 @@ static void __init vp_init(struct 

omap_vdd_info *vdd)

arch/arm/mach-omap2/voltage.c static void __init

Quoted 8 lines
arch/arm/mach-omap2/voltage.c +1 -0
 	vdd->write_reg(vp_val, prm_mod_offs, vdd->vp_data->vlimitto);
 }
 
+#ifdef CONFIG_DEBUG_FS
 static void __init vdd_debugfs_init(struct omap_vdd_info *vdd)
 {
 	char *name;
@@ -297,6 +298,7 @@ static void __init 

vdd_debugfs_init(struct omap_vdd_info *vdd)

arch/arm/mach-omap2/voltage.c int omap_voltage_register_pmic(struct

Quoted 8 lines
arch/arm/mach-omap2/voltage.c +1 -0
 				vdd->debug_dir, (void *) vdd,
 				&nom_volt_debug_fops);
 }
+#endif
 
 /* Voltage scale and accessory APIs */
 static int _pre_volt_scale(struct omap_vdd_info *vdd,
@@ -980,6 +982,7 @@ int omap_voltage_register_pmic(struct 

voltagedomain *voltdm,

arch/arm/mach-omap2/voltage.c int omap_voltage_register_pmic(struct · line 982

Quoted 1 line
arch/arm/mach-omap2/voltage.c +0 -0
  * add any debug entry for a particular voltage domain. 

Returns NULL

arch/arm/mach-omap2/voltage.c int omap_voltage_register_pmic(struct voltagedomain *voltdm,

Quoted 4 lines
arch/arm/mach-omap2/voltage.c +1 -0
  * in case of error.
  */
+#ifdef CONFIG_DEBUG_FS
 struct dentry *omap_voltage_get_dbgdir(struct 

voltagedomain *voltdm)

arch/arm/mach-omap2/voltage.c struct dentry

Quoted 3 lines
arch/arm/mach-omap2/voltage.c +0 -0
 {
 	struct omap_vdd_info *vdd;
@@ -993,6 +996,7 @@ struct dentry 

*omap_voltage_get_dbgdir(struct voltagedomain *voltdm)

arch/arm/mach-omap2/voltage.c struct dentry *omap_voltage_get_dbgdir(struct voltagedomain *voltdm)

Quoted 7 lines
arch/arm/mach-omap2/voltage.c +1 -0
 	return vdd->debug_dir;
 }
+#endif
 
 /**
  * omap_change_voltscale_method() - API to change the 

voltage scaling method.

arch/arm/mach-omap2/voltage.c int __init omap_voltage_late_init(void) · line 1088

Quoted 8 lines
arch/arm/mach-omap2/voltage.c +1 -0
@@ -1078,16 +1082,20 @@ int __init omap_voltage_late_init(void)
 		return -EINVAL;
 	}
 
+#ifdef CONFIG_DEBUG_FS
 	voltage_dir = debugfs_create_dir("voltage", NULL);
 	if (IS_ERR(voltage_dir))
 		pr_err("%s: Unable to create voltage debugfs 

main dir\n",

Quoted 13 lines
arch/arm/mach-omap2/voltage.c +3 -0
 			__func__);
+#endif
 	for (i = 0; i < nr_scalable_vdd; i++) {
 		if (omap_vdd_data_configure(vdd_info[i]))
 			continue;
 		omap_vc_init(vdd_info[i]);
 		vp_init(vdd_info[i]);
+#ifdef CONFIG_DEBUG_FS
 		vdd_debugfs_init(vdd_info[i]);
+#endif
 	}
 
 	return 0;
#14 lore raw
Quoted 44 lines · Sanjeev
Quoted 39 lines

-----Original Message-----
From: Hilman, Kevin
Sent: Wednesday, May 18, 2011 10:04 PM
To: Premi, Sanjeev
Cc: [email protected]
Subject: Re: [PATCH] omap:pm: Fix boot-time errors with debugfs disabled

Hi Sanjeev,

Quoted 8 lines · Sanjeev Premi

There is an implicit assumption in current implementation that debugfs is always enabled.

When debugfs is disabled, these errors are noticed during boot:
  omap_voltage_late_init: Unable to create voltage debugfs main dir
  vdd_debugfs_init: Unable to create debugfs directory for vdd_mpu
  vdd_debugfs_init: Unable to create debugfs directory for vdd_core

Quoted 6 lines

This patch fixes these errors by enclosing code related to debugfs in #ifdef CONFIG_DEBUG_FS..#endif.

Boot tested on OMAP3EVM.

Sorry for the delay here, I've been on the road and finally catching up
on the list.

Basically, I'm in the process of a pretty major cleanup of the VC/VP and
SR layers.  For example, in my pm-wip/voltdm_* branches, the debugfs interface to the voltage layer has been completely removed.  I'm also thinking of removing the SR debugfs interface also, as I don't really think we need a userspace interface for this.  A board-level interface is probably enough (/me waits for flame from Nishanth :)

Quoted 4 lines

That being said, your approach below isn't quite right in its usage of #ifdefs.  Use of #ifdefs like this is frowned upon for many reasons. For starters, take a look the '#ifdefs are ugly' section of Documentation/SubmittingPatches.

Quoted 8 lines

[sp] I don't like #ifdefs either but each time we cannot create a new file changes like this.

    The current code is a mess with debugfs used too frequently. And - all of it is not for debug. The location of ifdefs in in the patch illustrates it quite well.

    BTW, this isn't the only use of ifdefs in a C file in Linux.

in reality the only reason you've had to do this patch was because we had a wicked handling of debugfs entries in voltage layer - with voltdm_c these are all gone. further any entries remaining (e.g. SR) are:
dentry for debugfs file -> just a minor overhead not deserving a #ifdef all other functions of debugfs (as per include/linux/debugfs.h) when debugfs is disabled in .config will be static inlined and we will not need any #ifdefs at all

The real pending question is about functional SR debugfs entries that need to loose it's critical functionality.
Regards,
Nishanth Menon
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#15 lore raw
Quoted 81 lines

-----Original Message-----
From: Menon, Nishanth
Sent: Thursday, May 19, 2011 7:28 PM
To: Premi, Sanjeev
Cc: Hilman, Kevin; [email protected]
Subject: Re: [PATCH] omap:pm: Fix boot-time errors with debugfs disabled

Quoted 10 lines · Sanjeev
Quoted 10 lines

-----Original Message-----
From: Hilman, Kevin
Sent: Wednesday, May 18, 2011 10:04 PM
To: Premi, Sanjeev
Cc: [email protected]
Subject: Re: [PATCH] omap:pm: Fix boot-time errors with debugfs disabled

Hi Sanjeev,

Quoted 7 lines
Quoted 7 lines
Quoted 5 lines · Sanjeev Premi

There is an implicit assumption in current implementation that debugfs is always enabled.

When debugfs is disabled, these errors are noticed during boot:
  omap_voltage_late_init: Unable to create voltage

debugfs main dir

Quoted 1 line
Quoted 1 line
Quoted 1 line

  vdd_debugfs_init: Unable to create debugfs directory

for vdd_mpu

Quoted 1 line
Quoted 1 line
Quoted 1 line

  vdd_debugfs_init: Unable to create debugfs directory

for vdd_core

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

This patch fixes these errors by enclosing code related

to debugfs

Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

in #ifdef CONFIG_DEBUG_FS..#endif.

Boot tested on OMAP3EVM.

Quoted 7 lines
Quoted 7 lines

Sorry for the delay here, I've been on the road and finally catching up
on the list.

Basically, I'm in the process of a pretty major cleanup of the VC/VP and
SR layers.  For example, in my pm-wip/voltdm_* branches,

the debugfs

Quoted 1 line
Quoted 1 line

interface to the voltage layer has been completely

removed.  I'm also

Quoted 1 line
Quoted 1 line

thinking of removing the SR debugfs interface also, as I

don't really

Quoted 1 line
Quoted 1 line

think we need a userspace interface for this.  A

board-level interface

Quoted 3 lines
Quoted 3 lines

is probably enough (/me waits for flame from Nishanth :)

That being said, your approach below isn't quite right in

its usage of

Quoted 1 line
Quoted 1 line

#ifdefs.  Use of #ifdefs like this is frowned upon for

many reasons.

Quoted 11 lines
Quoted 2 lines

For starters, take a look the '#ifdefs are ugly' section of Documentation/SubmittingPatches.

[sp] I don't like #ifdefs either but each time we cannot create a new file changes like this.

    The current code is a mess with debugfs used too frequently. And - all of it is not for debug. The location of ifdefs in in the patch illustrates it quite well.

    BTW, this isn't the only use of ifdefs in a C file in Linux.

in reality the only reason you've had to do this patch was because we had a wicked handling of debugfs entries in voltage layer - with voltdm_c these are all gone. further any entries remaining (e.g. SR) are:
dentry for debugfs file -> just a minor overhead not deserving a #ifdef
all other functions of debugfs (as per include/linux/debugfs.h) when debugfs is disabled in .config will be static inlined and we will not need any #ifdefs at all

Quoted 2 lines

The real pending question is about functional SR debugfs entries that need to loose it's critical functionality.

[sp] good argument for future not the present and past. Fact is that
"wicked handling of debugfs entries" made their way.

I am not worried about the patch in or out - few folks who were stuck on the issue would have used it anyway. But, whether each fix for today can be postponed for future restructuring.

#ifdefs were just easy target for the postponement.

~sanjeev

Quoted 3 lines

Regards,
Nishanth Menon
--

To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#16 lore raw

"Premi, Sanjeev" <[email protected]> writes:

[...]

Quoted 18 lines
Quoted 18 lines
Quoted 8 lines

[sp] I don't like #ifdefs either but each time we cannot create a new file changes like this.

    The current code is a mess with debugfs used too frequently. And - all of it is not for debug. The location of ifdefs in in the patch illustrates it quite well.

    BTW, this isn't the only use of ifdefs in a C file in Linux.

in reality the only reason you've had to do this patch was because we had a wicked handling of debugfs entries in voltage layer - with voltdm_c these are all gone. further any entries remaining (e.g. SR) are:
dentry for debugfs file -> just a minor overhead not deserving a #ifdef
all other functions of debugfs (as per include/linux/debugfs.h) when debugfs is disabled in .config will be static inlined and we will not need any #ifdefs at all

Quoted 5 lines
Quoted 2 lines

The real pending question is about functional SR debugfs entries that need to loose it's critical functionality.

[sp] good argument for future not the present and past. Fact is that
"wicked handling of debugfs entries" made their way.

Correct. As maintainers, we do not always catch every problem. Also, we have not been as strict about some things in the past as we are now.

However, the fact that bad coding style exists in the kernel already is not a good argument for accepting more.

Quoted 5 lines

I am not worried about the patch in or out - few folks who were stuck on the issue would have used it anyway. But, whether each fix for today can be postponed for future restructuring.

#ifdefs were just easy target for the postponement.

Nothing has to be postponed for future restructuring.

The reason $SUBJECT patch was not merged, was because the approach was not correct.

If you submit an acceptable fix to this problem, I'll merge it today even if I'm in the process of removing those features in parallel restructuring work, because I don't know when my removal work will be ready.

Kevin
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html