aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>2013-02-10 06:25:25 -0500
committerJohannes Berg <johannes.berg@intel.com>2013-02-12 10:52:26 -0500
commit36eed56a8f7e1bd7fb5014ea0e702708e1702f30 (patch)
tree07552fdc0f23a827615fef8e3dc314a3cb3e0a06
parent7a4539736eaeecb6bec25a718492fed6377a23af (diff)
iwlwifi: mvm: beautify code in rx_handlers
Make the code more readable, and while at it also add a missing "break" to avoid checking handlers that cannot be used. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/ops.c41
1 files changed, 22 insertions, 19 deletions
diff --git a/drivers/net/wireless/iwlwifi/mvm/ops.c b/drivers/net/wireless/iwlwifi/mvm/ops.c
index 983dca3f888a..aa59adf87db3 100644
--- a/drivers/net/wireless/iwlwifi/mvm/ops.c
+++ b/drivers/net/wireless/iwlwifi/mvm/ops.c
@@ -536,25 +536,28 @@ static int iwl_mvm_rx_dispatch(struct iwl_op_mode *op_mode,
536 536
537 for (i = 0; i < ARRAY_SIZE(iwl_mvm_rx_handlers); i++) { 537 for (i = 0; i < ARRAY_SIZE(iwl_mvm_rx_handlers); i++) {
538 const struct iwl_rx_handlers *rx_h = &iwl_mvm_rx_handlers[i]; 538 const struct iwl_rx_handlers *rx_h = &iwl_mvm_rx_handlers[i];
539 if (rx_h->cmd_id == pkt->hdr.cmd) { 539 struct iwl_async_handler_entry *entry;
540 struct iwl_async_handler_entry *entry; 540
541 if (!rx_h->async) 541 if (rx_h->cmd_id != pkt->hdr.cmd)
542 return rx_h->fn(mvm, rxb, cmd); 542 continue;
543 543
544 entry = kzalloc(sizeof(*entry), GFP_ATOMIC); 544 if (!rx_h->async)
545 /* we can't do much... */ 545 return rx_h->fn(mvm, rxb, cmd);
546 if (!entry) 546
547 return 0; 547 entry = kzalloc(sizeof(*entry), GFP_ATOMIC);
548 548 /* we can't do much... */
549 entry->rxb._page = rxb_steal_page(rxb); 549 if (!entry)
550 entry->rxb._offset = rxb->_offset; 550 return 0;
551 entry->rxb._rx_page_order = rxb->_rx_page_order; 551
552 entry->fn = rx_h->fn; 552 entry->rxb._page = rxb_steal_page(rxb);
553 spin_lock(&mvm->async_handlers_lock); 553 entry->rxb._offset = rxb->_offset;
554 list_add_tail(&entry->list, &mvm->async_handlers_list); 554 entry->rxb._rx_page_order = rxb->_rx_page_order;
555 spin_unlock(&mvm->async_handlers_lock); 555 entry->fn = rx_h->fn;
556 schedule_work(&mvm->async_handlers_wk); 556 spin_lock(&mvm->async_handlers_lock);
557 } 557 list_add_tail(&entry->list, &mvm->async_handlers_list);
558 spin_unlock(&mvm->async_handlers_lock);
559 schedule_work(&mvm->async_handlers_wk);
560 break;
558 } 561 }
559 562
560 return 0; 563 return 0;