diff options
author | Craig Dooley <dooleyc@google.com> | 2021-09-30 21:17:07 +0000 |
---|---|---|
committer | Yixuan Jiang <yixuanjiang@google.com> | 2021-10-05 04:23:39 +0000 |
commit | c31337544e5aadd1ef7d08be8203afce82a1f118 (patch) | |
tree | 4595484cbff237daf067e8063c64543d34cbc7f9 | |
parent | 376178ce9982c86d0541f2a5abdd62239c1ced50 (diff) | |
download | aoc-c31337544e5aadd1ef7d08be8203afce82a1f118.tar.gz |
Always unlock the AoC memory on restart
If AoC crashed before coming online, GSA_UNLOCK was not being called, causing the next
firmware load to fail and AoC would permanently be offline
Bug: 198069635
Signed-off-by: Craig Dooley <dooleyc@google.com>
Change-Id: I281e9d994b5bdcace030189cbe6bb110bc01bbf1
(cherry picked from commit d49e8adc127839a8e2448b366f6aff61f42f97ea)
-rw-r--r-- | aoc.c | 32 |
1 files changed, 16 insertions, 16 deletions
@@ -2121,26 +2121,26 @@ static void aoc_take_offline(struct aoc_prvdata *prvdata) int rc; /* check if devices/services are ready */ - if (aoc_state == AOC_STATE_OFFLINE || !prvdata->services) - return; - - pr_notice("taking aoc offline\n"); - aoc_state = AOC_STATE_OFFLINE; + if (aoc_state == AOC_STATE_ONLINE) { + pr_notice("taking aoc offline\n"); + aoc_state = AOC_STATE_OFFLINE; - bus_for_each_dev(&aoc_bus_type, NULL, NULL, aoc_remove_device); + bus_for_each_dev(&aoc_bus_type, NULL, NULL, aoc_remove_device); - if (aoc_control) - aoc_control->magic = 0; + if (aoc_control) + aoc_control->magic = 0; - devm_kfree(prvdata->dev, prvdata->services); - prvdata->services = NULL; - prvdata->total_services = 0; + if (prvdata->services) { + devm_kfree(prvdata->dev, prvdata->services); + prvdata->services = NULL; + prvdata->total_services = 0; + } - /* wakeup AOC before calling GSA */ - aoc_req_assert(prvdata, true); - rc = aoc_req_wait(prvdata, true); - if (rc) { - dev_err(prvdata->dev, "timed out waiting for aoc_ack\n"); + /* wakeup AOC before calling GSA */ + aoc_req_assert(prvdata, true); + rc = aoc_req_wait(prvdata, true); + if (rc) + dev_err(prvdata->dev, "timed out waiting for aoc_ack\n"); } /* TODO: GSA_AOC_SHUTDOWN needs to be 4, but the current header defines |