Merge branch 'next/pm' of git://git.linaro.org/people/arnd/arm-soc
[pandora-kernel.git] / arch / arm / mach-omap2 / smartreflex.c
index f49804f..0347b93 100644 (file)
@@ -62,6 +62,7 @@ static LIST_HEAD(sr_list);
 
 static struct omap_sr_class_data *sr_class;
 static struct omap_sr_pmic_data *sr_pmic_data;
+static struct dentry           *sr_dbg_dir;
 
 static inline void sr_write_reg(struct omap_sr *sr, unsigned offset, u32 value)
 {
@@ -826,9 +827,10 @@ 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;
-       struct dentry *vdd_dbg_dir, *nvalue_dir;
+       struct dentry *nvalue_dir;
        struct omap_volt_data *volt_data;
        int i, ret = 0;
+       char *name;
 
        if (!sr_info) {
                dev_err(&pdev->dev, "%s: unable to allocate sr_info\n",
@@ -899,18 +901,25 @@ static int __init omap_sr_probe(struct platform_device *pdev)
        }
 
        dev_info(&pdev->dev, "%s: SmartReflex driver initialized\n", __func__);
+       if (!sr_dbg_dir) {
+               sr_dbg_dir = debugfs_create_dir("smartreflex", NULL);
+               if (!sr_dbg_dir) {
+                       ret = PTR_ERR(sr_dbg_dir);
+                       pr_err("%s:sr debugfs dir creation failed(%d)\n",
+                               __func__, ret);
+                       goto err_iounmap;
+               }
+       }
 
-       /*
-        * If the voltage domain debugfs directory is not created, do
-        * not try to create rest of the debugfs entries.
-        */
-       vdd_dbg_dir = omap_voltage_get_dbgdir(sr_info->voltdm);
-       if (!vdd_dbg_dir) {
-               ret = -EINVAL;
+       name = kasprintf(GFP_KERNEL, "sr_%s", sr_info->voltdm->name);
+       if (!name) {
+               dev_err(&pdev->dev, "%s: Unable to alloc debugfs name\n",
+                       __func__);
+               ret = -ENOMEM;
                goto err_iounmap;
        }
-
-       sr_info->dbg_dir = debugfs_create_dir("smartreflex", vdd_dbg_dir);
+       sr_info->dbg_dir = debugfs_create_dir(name, sr_dbg_dir);
+       kfree(name);
        if (IS_ERR(sr_info->dbg_dir)) {
                dev_err(&pdev->dev, "%s: Unable to create debugfs directory\n",
                        __func__);