aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firewire
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2010-08-18 09:05:02 -0400
committerStefan Richter <stefanr@s5r6.in-berlin.de>2010-08-19 14:28:25 -0400
commit2222bcb76790f4f61f39ec1514946a7593b07e02 (patch)
treef479ec53c083071d70935b51eb7adab844233779 /drivers/firewire
parent1bf145fed572583d4cb7c1784689a0b42c997ba6 (diff)
firewire: core: do not use del_timer_sync() in interrupt context
Because we might be in interrupt context, replace del_timer_sync() with del_timer(). If the timer is already running, we know that it will clean up the transaction, so we do not need to do any further processing in the normal transaction handler. Many thanks to Yong Zhang for diagnosing this. Reported-by: Stefan Richter <stefanr@s5r6.in-berlin.de> Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/firewire')
-rw-r--r--drivers/firewire/core-transaction.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/firewire/core-transaction.c b/drivers/firewire/core-transaction.c
index ca7ca56661e0..b42a0bde8494 100644
--- a/drivers/firewire/core-transaction.c
+++ b/drivers/firewire/core-transaction.c
@@ -81,6 +81,10 @@ static int close_transaction(struct fw_transaction *transaction,
81 spin_lock_irqsave(&card->lock, flags); 81 spin_lock_irqsave(&card->lock, flags);
82 list_for_each_entry(t, &card->transaction_list, link) { 82 list_for_each_entry(t, &card->transaction_list, link) {
83 if (t == transaction) { 83 if (t == transaction) {
84 if (!del_timer(&t->split_timeout_timer)) {
85 spin_unlock_irqrestore(&card->lock, flags);
86 goto timed_out;
87 }
84 list_del_init(&t->link); 88 list_del_init(&t->link);
85 card->tlabel_mask &= ~(1ULL << t->tlabel); 89 card->tlabel_mask &= ~(1ULL << t->tlabel);
86 break; 90 break;
@@ -89,11 +93,11 @@ static int close_transaction(struct fw_transaction *transaction,
89 spin_unlock_irqrestore(&card->lock, flags); 93 spin_unlock_irqrestore(&card->lock, flags);
90 94
91 if (&t->link != &card->transaction_list) { 95 if (&t->link != &card->transaction_list) {
92 del_timer_sync(&t->split_timeout_timer);
93 t->callback(card, rcode, NULL, 0, t->callback_data); 96 t->callback(card, rcode, NULL, 0, t->callback_data);
94 return 0; 97 return 0;
95 } 98 }
96 99
100 timed_out:
97 return -ENOENT; 101 return -ENOENT;
98} 102}
99 103
@@ -921,6 +925,10 @@ void fw_core_handle_response(struct fw_card *card, struct fw_packet *p)
921 spin_lock_irqsave(&card->lock, flags); 925 spin_lock_irqsave(&card->lock, flags);
922 list_for_each_entry(t, &card->transaction_list, link) { 926 list_for_each_entry(t, &card->transaction_list, link) {
923 if (t->node_id == source && t->tlabel == tlabel) { 927 if (t->node_id == source && t->tlabel == tlabel) {
928 if (!del_timer(&t->split_timeout_timer)) {
929 spin_unlock_irqrestore(&card->lock, flags);
930 goto timed_out;
931 }
924 list_del_init(&t->link); 932 list_del_init(&t->link);
925 card->tlabel_mask &= ~(1ULL << t->tlabel); 933 card->tlabel_mask &= ~(1ULL << t->tlabel);
926 break; 934 break;
@@ -929,6 +937,7 @@ void fw_core_handle_response(struct fw_card *card, struct fw_packet *p)
929 spin_unlock_irqrestore(&card->lock, flags); 937 spin_unlock_irqrestore(&card->lock, flags);
930 938
931 if (&t->link == &card->transaction_list) { 939 if (&t->link == &card->transaction_list) {
940 timed_out:
932 fw_notify("Unsolicited response (source %x, tlabel %x)\n", 941 fw_notify("Unsolicited response (source %x, tlabel %x)\n",
933 source, tlabel); 942 source, tlabel);
934 return; 943 return;
@@ -963,8 +972,6 @@ void fw_core_handle_response(struct fw_card *card, struct fw_packet *p)
963 break; 972 break;
964 } 973 }
965 974
966 del_timer_sync(&t->split_timeout_timer);
967
968 /* 975 /*
969 * The response handler may be executed while the request handler 976 * The response handler may be executed while the request handler
970 * is still pending. Cancel the request handler. 977 * is still pending. Cancel the request handler.