diff options
author | Rick Chen <rickctchen@google.com> | 2022-08-23 15:10:25 +0800 |
---|---|---|
committer | TreeHugger Robot <treehugger-gerrit@google.com> | 2022-09-01 00:19:42 +0000 |
commit | b671a009819386044208eb2e7a6be8103ff97448 (patch) | |
tree | f8e5a063723525081e5d6a81c2e4149c871c9e35 | |
parent | 19dcd66ef388d93a774a0d3ddc0bf3cdec68c1eb (diff) | |
download | aoc-b671a009819386044208eb2e7a6be8103ff97448.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.c | 20 |
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, ¶m); |