summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRick Chen <rickctchen@google.com>2022-08-23 15:10:25 +0800
committerBryan Lavrich <lavrich@google.com>2022-08-30 21:26:06 +0000
commitaa4039a8a342526d4b12ff7b014b8a3e73ca5ace (patch)
tree35b88457a0937d182762c793516f8b6023bc4e5b
parent994a20dc87c9986dfb3697558efc9331ffca8244 (diff)
downloadaoc-aa4039a8a342526d4b12ff7b014b8a3e73ca5ace.tar.gz
Separate usf_queue wakelock name
Bug: 242810115 Test: Check two wakelock name usf_queue_wake_up & usf_queue_non_wake_up. Signed-off-by: Rick Chen <rickctchen@google.com> Change-Id: I4fb5061ab06a2db52ee92dea63ede1ced1c7d2ab
-rw-r--r--aoc_channel_dev.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/aoc_channel_dev.c b/aoc_channel_dev.c
index 47b1f5e..b79f080 100644
--- a/aoc_channel_dev.c
+++ b/aoc_channel_dev.c
@@ -65,6 +65,12 @@ static atomic_t channel_index_counter = ATOMIC_INIT(1);
static int aocc_probe(struct aoc_service_dev *dev);
static int aocc_remove(struct aoc_service_dev *dev);
+static const char * const wakelock_names[] = {
+ "usf_queue",
+ "usf_queue_non_wake_up",
+ NULL,
+};
+
static const char * const channel_service_names[] = {
"com.google.usf",
"com.google.usf.non_wake_up",
@@ -763,7 +769,8 @@ static void aocc_sh_mem_doorbell_probe(struct aoc_service_dev *dev)
static int aocc_probe(struct aoc_service_dev *dev)
{
struct chan_prvdata *prvdata;
- int ret = 0;
+ int ret = 0, i = 0;
+ bool service_found = false;
struct sched_param param = {
.sched_priority = 10,
};
@@ -779,7 +786,16 @@ static int aocc_probe(struct aoc_service_dev *dev)
if (ret)
return ret;
prvdata->user_wakelock = wakeup_source_register(&dev->dev, dev_name(&dev->dev));
- prvdata->queue_wakelock = wakeup_source_register(&dev->dev, "usf_queue");
+ for (i = 0; i < ARRAY_SIZE(wakelock_names); i++) {
+ if (strcmp(dev_name(&dev->dev), channel_service_names[i]) == 0) {
+ prvdata->queue_wakelock = wakeup_source_register(&dev->dev,
+ wakelock_names[i]);
+ service_found = true;
+ break;
+ }
+ }
+ if (!service_found)
+ return -EINVAL;
dev->prvdata = prvdata;
prvdata->demux_task = kthread_run(&aocc_demux_kthread, dev, dev_name(&dev->dev));
sched_setscheduler(prvdata->demux_task, SCHED_FIFO, &param);