OMAP2+: smartreflex: remove SR debug directory in omap_sr_remove()
authorAnand S Sawant <sawant@ti.com>
Thu, 17 Feb 2011 15:57:30 +0000 (21:27 +0530)
committerKevin Hilman <khilman@ti.com>
Thu, 10 Mar 2011 00:38:37 +0000 (16:38 -0800)
omap_sr_probe() creates the smartreflex debug directory and its
underlying nvalue debug directory. These directories are removed in
omap_sr_remove().

Basic smartreflex functionality tested on OMAP3630 Zoom3 & OMAP4430 SDP

Signed-off-by: Anand S Sawant <sawant@ti.com>
Signed-off-by: Kevin Hilman <khilman@ti.com>
arch/arm/mach-omap2/smartreflex.c

index b57ae502e0c76fd694f1bc09f189ea4acf9e3ea1..0ab4dd5081eeadd07786d79efd5dae62f77d0440 100644 (file)
@@ -54,6 +54,7 @@ struct omap_sr {
        struct list_head                node;
        struct omap_sr_nvalue_table     *nvalue_table;
        struct voltagedomain            *voltdm;
+       struct dentry                   *dbg_dir;
 };
 
 /* sr_list contains all the instances of smartreflex module */
@@ -823,7 +824,7 @@ 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, *dbg_dir, *nvalue_dir;
+       struct dentry *vdd_dbg_dir, *nvalue_dir;
        struct omap_volt_data *volt_data;
        int i, ret = 0;
 
@@ -898,24 +899,24 @@ static int __init omap_sr_probe(struct platform_device *pdev)
                goto err_release_region;
        }
 
-       dbg_dir = debugfs_create_dir("smartreflex", vdd_dbg_dir);
-       if (IS_ERR(dbg_dir)) {
+       sr_info->dbg_dir = debugfs_create_dir("smartreflex", vdd_dbg_dir);
+       if (IS_ERR(sr_info->dbg_dir)) {
                dev_err(&pdev->dev, "%s: Unable to create debugfs directory\n",
                        __func__);
-               ret = PTR_ERR(dbg_dir);
+               ret = PTR_ERR(sr_info->dbg_dir);
                goto err_release_region;
        }
 
-       (void) debugfs_create_file("autocomp", S_IRUGO | S_IWUSR, dbg_dir,
-                               (void *)sr_info, &pm_sr_fops);
-       (void) debugfs_create_x32("errweight", S_IRUGO, dbg_dir,
+       (void) debugfs_create_file("autocomp", S_IRUGO | S_IWUSR,
+                       sr_info->dbg_dir, (void *)sr_info, &pm_sr_fops);
+       (void) debugfs_create_x32("errweight", S_IRUGO, sr_info->dbg_dir,
                        &sr_info->err_weight);
-       (void) debugfs_create_x32("errmaxlimit", S_IRUGO, dbg_dir,
+       (void) debugfs_create_x32("errmaxlimit", S_IRUGO, sr_info->dbg_dir,
                        &sr_info->err_maxlimit);
-       (void) debugfs_create_x32("errminlimit", S_IRUGO, dbg_dir,
+       (void) debugfs_create_x32("errminlimit", S_IRUGO, sr_info->dbg_dir,
                        &sr_info->err_minlimit);
 
-       nvalue_dir = debugfs_create_dir("nvalue", dbg_dir);
+       nvalue_dir = debugfs_create_dir("nvalue", sr_info->dbg_dir);
        if (IS_ERR(nvalue_dir)) {
                dev_err(&pdev->dev, "%s: Unable to create debugfs directory"
                        "for n-values\n", __func__);
@@ -972,6 +973,8 @@ static int __devexit omap_sr_remove(struct platform_device *pdev)
 
        if (sr_info->autocomp_active)
                sr_stop_vddautocomp(sr_info);
+       if (sr_info->dbg_dir)
+               debugfs_remove_recursive(sr_info->dbg_dir);
 
        list_del(&sr_info->node);
        iounmap(sr_info->base);
This page took 0.025965 seconds and 5 git commands to generate.