summaryrefslogtreecommitdiff
path: root/drivers/edp
diff options
context:
space:
mode:
authorSteve Rogers <srogers@nvidia.com>2014-03-24 09:18:48 -0500
committerTimo Alho <talho@nvidia.com>2014-03-28 07:50:37 -0700
commit8eda89462e2e691731f654285dab44540c2c8c45 (patch)
tree2f5a241d5b28bf8455f0eb07983e0bd79229ca08 /drivers/edp
parent119233cbfe4100a9a2a6405c42c1f821126c86a7 (diff)
EDP: sysedp: Add sysedp_set_state_by_name()
Bug 1486148 Change-Id: I8bf6af83530273ad5b04f1903f2d76048ff2b514 Signed-off-by: Steve Rogers <srogers@nvidia.com> Reviewed-on: http://git-master/r/386462 (cherry-picked from commmit 2583d5bbd2910bf4420329786bb3d7560bab1615) Reviewed-on: http://git-master/r/387831 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Timo Alho <talho@nvidia.com>
Diffstat (limited to 'drivers/edp')
-rw-r--r--drivers/edp/sysedp.c45
1 files changed, 38 insertions, 7 deletions
diff --git a/drivers/edp/sysedp.c b/drivers/edp/sysedp.c
index 97ff75938a86..06caf5b87151 100644
--- a/drivers/edp/sysedp.c
+++ b/drivers/edp/sysedp.c
@@ -65,18 +65,28 @@ void _sysedp_refresh(void)
sysedp_set_dynamic_cap((unsigned int)limit, (unsigned int)oc_relax);
}
-struct sysedp_consumer *sysedp_get_consumer(const char *name)
+static struct sysedp_consumer *_sysedp_get_consumer(const char *name)
{
struct sysedp_consumer *p;
struct sysedp_consumer *match = NULL;
- mutex_lock(&sysedp_lock);
list_for_each_entry(p, &registered_consumers, link) {
if (!strncmp(p->name, name, SYSEDP_NAME_LEN)) {
match = p;
break;
}
}
+
+ return match;
+}
+
+
+struct sysedp_consumer *sysedp_get_consumer(const char *name)
+{
+ struct sysedp_consumer *match = NULL;
+
+ mutex_lock(&sysedp_lock);
+ match = _sysedp_get_consumer(name);
mutex_unlock(&sysedp_lock);
return match;
@@ -174,12 +184,9 @@ struct sysedp_consumer *sysedp_create_consumer(const char *specname,
}
EXPORT_SYMBOL(sysedp_create_consumer);
-void sysedp_set_state(struct sysedp_consumer *consumer, unsigned int new_state)
+static void _sysedp_set_state(struct sysedp_consumer *consumer,
+ unsigned int new_state)
{
- if (!consumer)
- return;
-
- mutex_lock(&sysedp_lock);
if (consumer->state != new_state) {
trace_sysedp_change_state(consumer->name, consumer->state,
new_state);
@@ -187,10 +194,34 @@ void sysedp_set_state(struct sysedp_consumer *consumer, unsigned int new_state)
consumer->num_states-1);
_sysedp_refresh();
}
+}
+
+void sysedp_set_state(struct sysedp_consumer *consumer, unsigned int new_state)
+{
+ if (!consumer)
+ return;
+
+ mutex_lock(&sysedp_lock);
+ _sysedp_set_state(consumer, new_state);
mutex_unlock(&sysedp_lock);
}
EXPORT_SYMBOL(sysedp_set_state);
+void sysedp_set_state_by_name(const char *name, unsigned int new_state)
+{
+ struct sysedp_consumer *consumer = NULL;
+
+ if (!name)
+ return;
+
+ mutex_lock(&sysedp_lock);
+ consumer = _sysedp_get_consumer(name);
+ if (consumer)
+ _sysedp_set_state(consumer, new_state);
+ mutex_unlock(&sysedp_lock);
+}
+EXPORT_SYMBOL(sysedp_set_state_by_name);
+
unsigned int sysedp_get_state(struct sysedp_consumer *consumer)
{
unsigned int state;