mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 17:25:35 +03:00
devfreq: track governor usage count
Prevent governor from unexpectedly getting unloaded when it is in used. Bug 5394611 Change-Id: I84b2ee3ce7666d4107096d958971d28700e744b4 Signed-off-by: Johnny Liu <johnliu@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3408797 GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com> Reviewed-by: svcacv <svcacv@nvidia.com> Reviewed-by: Bibek Basu <bbasu@nvidia.com>
This commit is contained in:
@@ -326,6 +326,9 @@ static int nvhost_pod_event_handler(struct devfreq *df,
|
||||
|
||||
switch (event) {
|
||||
case DEVFREQ_GOV_START:
|
||||
if (!try_module_get(THIS_MODULE))
|
||||
return -ENODEV;
|
||||
|
||||
mutex_lock(&df->lock);
|
||||
ret = nvhost_pod_init(df);
|
||||
mutex_unlock(&df->lock);
|
||||
@@ -336,6 +339,7 @@ static int nvhost_pod_event_handler(struct devfreq *df,
|
||||
mutex_lock(&df->lock);
|
||||
nvhost_pod_exit(df);
|
||||
mutex_unlock(&df->lock);
|
||||
module_put(THIS_MODULE);
|
||||
break;
|
||||
case DEVFREQ_GOV_UPDATE_INTERVAL:
|
||||
devfreq_update_interval(df, (unsigned int *)data);
|
||||
|
||||
@@ -531,6 +531,9 @@ static int devfreq_tegra_wmark_event_handler(struct devfreq *df,
|
||||
|
||||
switch (event) {
|
||||
case DEVFREQ_GOV_START:
|
||||
if (!try_module_get(THIS_MODULE))
|
||||
return -ENODEV;
|
||||
|
||||
err = tegra_wmark_init(df);
|
||||
if (err)
|
||||
return err;
|
||||
@@ -542,6 +545,7 @@ static int devfreq_tegra_wmark_event_handler(struct devfreq *df,
|
||||
wmark_config.lower_wmark_enabled = 0;
|
||||
drvdata->update_wmark_threshold(df, &wmark_config);
|
||||
tegra_wmark_exit(df);
|
||||
module_put(THIS_MODULE);
|
||||
break;
|
||||
case DEVFREQ_GOV_SUSPEND:
|
||||
wmark_config.upper_wmark_enabled = 0;
|
||||
|
||||
Reference in New Issue
Block a user