summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMeghana Barkalle <mbarkalle@google.com>2023-05-17 17:24:18 +0000
committerTreehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com>2023-12-13 16:36:31 +0000
commitff40771b0aee25b5f0da575919e457ca12259e04 (patch)
treed9040c0cf43a591cc504746bf4884df7cd562d2b
parent3c3738fafc1c80d84ead3b586f72a05b7e26b32e (diff)
downloadlwis-ff40771b0aee25b5f0da575919e457ca12259e04.tar.gz
LWIS: Pass irq state to correctly restore transaction lock
Pass the flags to restore and save irq state of transaction lock correctly in defer_transaction_locked Bug: 299130975 Test: GCA Smoke Test, several iterations Change-Id: Iebc2594a61d326765cfd824adfe3c959e2d7a213 (cherry picked from commit 1357a6553825f70080ceb5a019918a035989c0f4) Signed-off-by: Meghana Barkalle <mbarkalle@google.com>
-rw-r--r--lwis_transaction.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/lwis_transaction.c b/lwis_transaction.c
index 8372370..8bc39b0 100644
--- a/lwis_transaction.c
+++ b/lwis_transaction.c
@@ -928,13 +928,14 @@ new_repeating_transaction_iteration(struct lwis_client *client,
static void defer_transaction_locked(struct lwis_client *client,
struct lwis_transaction *transaction,
struct list_head *pending_events,
- struct list_head *pending_fences, bool del_event_list_node)
+ struct list_head *pending_fences, bool del_event_list_node,
+ unsigned long* flags)
{
- unsigned long flags = 0;
if (del_event_list_node) {
list_del(&transaction->event_list_node);
}
+
/* I2C read/write cannot be executed in IRQ context */
if (in_irq() && client->lwis_dev->type == DEVICE_TYPE_I2C) {
list_add_tail(&transaction->process_queue_node, &client->transaction_process_queue);
@@ -942,10 +943,10 @@ static void defer_transaction_locked(struct lwis_client *client,
}
if (transaction->info.run_in_event_context) {
- spin_unlock_irqrestore(&client->transaction_lock, flags);
+ spin_unlock_irqrestore(&client->transaction_lock, *flags);
process_transaction(client, &transaction, pending_events, pending_fences,
/*skip_err=*/false, /*check_transaction_limit=*/false);
- spin_lock_irqsave(&client->transaction_lock, flags);
+ spin_lock_irqsave(&client->transaction_lock, *flags);
} else {
list_add_tail(&transaction->process_queue_node, &client->transaction_process_queue);
}
@@ -1002,7 +1003,8 @@ int lwis_transaction_event_trigger(struct lwis_client *client, int64_t event_id,
hash_del(&transaction->pending_map_node);
defer_transaction_locked(client, transaction, pending_events,
&pending_fences,
- /* del_event_list_node */ false);
+ /* del_event_list_node */ false,
+ &flags);
}
continue;
}
@@ -1020,7 +1022,8 @@ int lwis_transaction_event_trigger(struct lwis_client *client, int64_t event_id,
if (trigger_counter == LWIS_EVENT_COUNTER_ON_NEXT_OCCURRENCE ||
trigger_counter == event_counter) {
defer_transaction_locked(client, transaction, pending_events,
- &pending_fences, /* del_event_list_node */ true);
+ &pending_fences, /* del_event_list_node */ true,
+ &flags);
} else if (trigger_counter == LWIS_EVENT_COUNTER_EVERY_TIME) {
new_instance = new_repeating_transaction_iteration(client, transaction);
if (!new_instance) {
@@ -1031,7 +1034,8 @@ int lwis_transaction_event_trigger(struct lwis_client *client, int64_t event_id,
continue;
}
defer_transaction_locked(client, new_instance, pending_events,
- &pending_fences, /* del_event_list_node */ false);
+ &pending_fences, /* del_event_list_node */ false,
+ &flags);
}
}