]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
video: tegra: host: remove sysfs interface when we deinit a module
authorBryan Wu <pengw@nvidia.com>
Tue, 23 Apr 2013 23:18:19 +0000 (16:18 -0700)
committerDan Willemsen <dwillemsen@nvidia.com>
Sat, 14 Sep 2013 20:15:24 +0000 (13:15 -0700)
We need to remove those power related sysfs interface when deinit a
module otherwise reinit the module will fail due to existing sysfs
interface.

Bug 1249358

Change-Id: Ic218244534db0f969ddebe92dff2e069a70468cd
Signed-off-by: Bryan Wu <pengw@nvidia.com>
Reviewed-on: http://git-master/r/226474
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Allen Martin <amartin@nvidia.com>
drivers/video/tegra/host/nvhost_acm.c

index c7f3383666845259fc664f8f111d386ef59f7316..6807c80cb8324a361abd8d1bc2160efeeb45cfca 100644 (file)
@@ -537,11 +537,22 @@ int nvhost_module_suspend(struct platform_device *dev)
 void nvhost_module_deinit(struct platform_device *dev)
 {
        int i;
+       struct kobj_attribute *attr = NULL;
        struct nvhost_device_data *pdata = platform_get_drvdata(dev);
 
        nvhost_module_suspend(dev);
        for (i = 0; i < pdata->num_clks; i++)
                clk_put(pdata->clk[i]);
+
+       if (pdata->power_kobj) {
+               for (i = 0; i < NVHOST_POWER_SYSFS_ATTRIB_MAX; i++) {
+                       attr = &pdata->power_attrib->power_attr[i];
+                       sysfs_remove_file(pdata->power_kobj, &attr->attr);
+               }
+
+               kobject_put(pdata->power_kobj);
+       }
+
 }
 
 /* common runtime pm and power domain APIs */