aboutsummaryrefslogtreecommitdiffstats
path: root/net/nfc/hci/core.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2012-08-22 19:22:16 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2012-09-24 18:17:23 -0400
commit474fee3db16c63bc440bfb93b57f72ecfc4246f0 (patch)
treef5fed7f3b40408f21fa3b9edc67d5ac0b869149f /net/nfc/hci/core.c
parent5db327f96daa2401b9afec6cd80cebe6c6475bb1 (diff)
NFC: Use system_nrt_wq instead of custom ones
NFC is using a number of custom ordered workqueues w/ WQ_MEM_RECLAIM. WQ_MEM_RECLAIM is unnecessary unless NFC is gonna be used as transport for storage device, and all use cases match one work item to one ordered workqueue - IOW, there's no actual ordering going on at all and using system_nrt_wq gives the same behavior. There's nothing to be gained by using custom workqueues. Use system_nrt_wq instead and drop all the custom ones. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'net/nfc/hci/core.c')
-rw-r--r--net/nfc/hci/core.c42
1 files changed, 6 insertions, 36 deletions
diff --git a/net/nfc/hci/core.c b/net/nfc/hci/core.c
index 1ac7b3fac6c9..03646beb3a73 100644
--- a/net/nfc/hci/core.c
+++ b/net/nfc/hci/core.c
@@ -141,7 +141,7 @@ static void __nfc_hci_cmd_completion(struct nfc_hci_dev *hdev, int err,
141 kfree(hdev->cmd_pending_msg); 141 kfree(hdev->cmd_pending_msg);
142 hdev->cmd_pending_msg = NULL; 142 hdev->cmd_pending_msg = NULL;
143 143
144 queue_work(hdev->msg_tx_wq, &hdev->msg_tx_work); 144 queue_work(system_nrt_wq, &hdev->msg_tx_work);
145} 145}
146 146
147void nfc_hci_resp_received(struct nfc_hci_dev *hdev, u8 result, 147void nfc_hci_resp_received(struct nfc_hci_dev *hdev, u8 result,
@@ -326,7 +326,7 @@ static void nfc_hci_cmd_timeout(unsigned long data)
326{ 326{
327 struct nfc_hci_dev *hdev = (struct nfc_hci_dev *)data; 327 struct nfc_hci_dev *hdev = (struct nfc_hci_dev *)data;
328 328
329 queue_work(hdev->msg_tx_wq, &hdev->msg_tx_work); 329 queue_work(system_nrt_wq, &hdev->msg_tx_work);
330} 330}
331 331
332static int hci_dev_connect_gates(struct nfc_hci_dev *hdev, u8 gate_count, 332static int hci_dev_connect_gates(struct nfc_hci_dev *hdev, u8 gate_count,
@@ -659,23 +659,11 @@ EXPORT_SYMBOL(nfc_hci_free_device);
659 659
660int nfc_hci_register_device(struct nfc_hci_dev *hdev) 660int nfc_hci_register_device(struct nfc_hci_dev *hdev)
661{ 661{
662 struct device *dev = &hdev->ndev->dev;
663 const char *devname = dev_name(dev);
664 char name[32];
665 int r = 0;
666
667 mutex_init(&hdev->msg_tx_mutex); 662 mutex_init(&hdev->msg_tx_mutex);
668 663
669 INIT_LIST_HEAD(&hdev->msg_tx_queue); 664 INIT_LIST_HEAD(&hdev->msg_tx_queue);
670 665
671 INIT_WORK(&hdev->msg_tx_work, nfc_hci_msg_tx_work); 666 INIT_WORK(&hdev->msg_tx_work, nfc_hci_msg_tx_work);
672 snprintf(name, sizeof(name), "%s_hci_msg_tx_wq", devname);
673 hdev->msg_tx_wq = alloc_workqueue(name, WQ_NON_REENTRANT | WQ_UNBOUND |
674 WQ_MEM_RECLAIM, 1);
675 if (hdev->msg_tx_wq == NULL) {
676 r = -ENOMEM;
677 goto exit;
678 }
679 667
680 init_timer(&hdev->cmd_timer); 668 init_timer(&hdev->cmd_timer);
681 hdev->cmd_timer.data = (unsigned long)hdev; 669 hdev->cmd_timer.data = (unsigned long)hdev;
@@ -684,27 +672,10 @@ int nfc_hci_register_device(struct nfc_hci_dev *hdev)
684 skb_queue_head_init(&hdev->rx_hcp_frags); 672 skb_queue_head_init(&hdev->rx_hcp_frags);
685 673
686 INIT_WORK(&hdev->msg_rx_work, nfc_hci_msg_rx_work); 674 INIT_WORK(&hdev->msg_rx_work, nfc_hci_msg_rx_work);
687 snprintf(name, sizeof(name), "%s_hci_msg_rx_wq", devname);
688 hdev->msg_rx_wq = alloc_workqueue(name, WQ_NON_REENTRANT | WQ_UNBOUND |
689 WQ_MEM_RECLAIM, 1);
690 if (hdev->msg_rx_wq == NULL) {
691 r = -ENOMEM;
692 goto exit;
693 }
694 675
695 skb_queue_head_init(&hdev->msg_rx_queue); 676 skb_queue_head_init(&hdev->msg_rx_queue);
696 677
697 r = nfc_register_device(hdev->ndev); 678 return nfc_register_device(hdev->ndev);
698
699exit:
700 if (r < 0) {
701 if (hdev->msg_tx_wq)
702 destroy_workqueue(hdev->msg_tx_wq);
703 if (hdev->msg_rx_wq)
704 destroy_workqueue(hdev->msg_rx_wq);
705 }
706
707 return r;
708} 679}
709EXPORT_SYMBOL(nfc_hci_register_device); 680EXPORT_SYMBOL(nfc_hci_register_device);
710 681
@@ -725,9 +696,8 @@ void nfc_hci_unregister_device(struct nfc_hci_dev *hdev)
725 696
726 nfc_unregister_device(hdev->ndev); 697 nfc_unregister_device(hdev->ndev);
727 698
728 destroy_workqueue(hdev->msg_tx_wq); 699 cancel_work_sync(&hdev->msg_tx_work);
729 700 cancel_work_sync(&hdev->msg_rx_work);
730 destroy_workqueue(hdev->msg_rx_wq);
731} 701}
732EXPORT_SYMBOL(nfc_hci_unregister_device); 702EXPORT_SYMBOL(nfc_hci_unregister_device);
733 703
@@ -827,7 +797,7 @@ void nfc_hci_recv_frame(struct nfc_hci_dev *hdev, struct sk_buff *skb)
827 nfc_hci_hcp_message_rx(hdev, pipe, type, instruction, hcp_skb); 797 nfc_hci_hcp_message_rx(hdev, pipe, type, instruction, hcp_skb);
828 } else { 798 } else {
829 skb_queue_tail(&hdev->msg_rx_queue, hcp_skb); 799 skb_queue_tail(&hdev->msg_rx_queue, hcp_skb);
830 queue_work(hdev->msg_rx_wq, &hdev->msg_rx_work); 800 queue_work(system_nrt_wq, &hdev->msg_rx_work);
831 } 801 }
832} 802}
833EXPORT_SYMBOL(nfc_hci_recv_frame); 803EXPORT_SYMBOL(nfc_hci_recv_frame);