diff options
author | Allen Pais <allen.pais@oracle.com> | 2017-10-11 06:33:44 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2017-11-05 19:12:10 -0500 |
commit | 4b519bb493e0866de7659b88dd22dc2cd89dd628 (patch) | |
tree | 602ab6e52ef2a670b8c6f7ce5c5c9f4a5547ca44 /net/nfc | |
parent | 81ade1cd6761e791904801ca9bfc960de4b94916 (diff) |
NFC: Convert timers to use timer_setup()
Switch to using the new timer_setup() and from_timer()
for net/nfc/*
Signed-off-by: Allen Pais <allen.pais@oracle.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'net/nfc')
-rw-r--r-- | net/nfc/core.c | 8 | ||||
-rw-r--r-- | net/nfc/hci/core.c | 7 | ||||
-rw-r--r-- | net/nfc/hci/llc_shdlc.c | 23 | ||||
-rw-r--r-- | net/nfc/llcp_core.c | 14 |
4 files changed, 21 insertions, 31 deletions
diff --git a/net/nfc/core.c b/net/nfc/core.c index 2c7c9b357e70..947a470f929d 100644 --- a/net/nfc/core.c +++ b/net/nfc/core.c | |||
@@ -1015,9 +1015,9 @@ exit: | |||
1015 | device_unlock(&dev->dev); | 1015 | device_unlock(&dev->dev); |
1016 | } | 1016 | } |
1017 | 1017 | ||
1018 | static void nfc_check_pres_timeout(unsigned long data) | 1018 | static void nfc_check_pres_timeout(struct timer_list *t) |
1019 | { | 1019 | { |
1020 | struct nfc_dev *dev = (struct nfc_dev *)data; | 1020 | struct nfc_dev *dev = from_timer(dev, t, check_pres_timer); |
1021 | 1021 | ||
1022 | schedule_work(&dev->check_pres_work); | 1022 | schedule_work(&dev->check_pres_work); |
1023 | } | 1023 | } |
@@ -1094,9 +1094,7 @@ struct nfc_dev *nfc_allocate_device(struct nfc_ops *ops, | |||
1094 | dev->targets_generation = 1; | 1094 | dev->targets_generation = 1; |
1095 | 1095 | ||
1096 | if (ops->check_presence) { | 1096 | if (ops->check_presence) { |
1097 | setup_timer(&dev->check_pres_timer, nfc_check_pres_timeout, | 1097 | timer_setup(&dev->check_pres_timer, nfc_check_pres_timeout, 0); |
1098 | (unsigned long)dev); | ||
1099 | |||
1100 | INIT_WORK(&dev->check_pres_work, nfc_check_pres_work); | 1098 | INIT_WORK(&dev->check_pres_work, nfc_check_pres_work); |
1101 | } | 1099 | } |
1102 | 1100 | ||
diff --git a/net/nfc/hci/core.c b/net/nfc/hci/core.c index a8a6e7814e09..ac8030c4bcf8 100644 --- a/net/nfc/hci/core.c +++ b/net/nfc/hci/core.c | |||
@@ -428,9 +428,9 @@ exit_noskb: | |||
428 | nfc_hci_driver_failure(hdev, r); | 428 | nfc_hci_driver_failure(hdev, r); |
429 | } | 429 | } |
430 | 430 | ||
431 | static void nfc_hci_cmd_timeout(unsigned long data) | 431 | static void nfc_hci_cmd_timeout(struct timer_list *t) |
432 | { | 432 | { |
433 | struct nfc_hci_dev *hdev = (struct nfc_hci_dev *)data; | 433 | struct nfc_hci_dev *hdev = from_timer(hdev, t, cmd_timer); |
434 | 434 | ||
435 | schedule_work(&hdev->msg_tx_work); | 435 | schedule_work(&hdev->msg_tx_work); |
436 | } | 436 | } |
@@ -1004,8 +1004,7 @@ int nfc_hci_register_device(struct nfc_hci_dev *hdev) | |||
1004 | 1004 | ||
1005 | INIT_WORK(&hdev->msg_tx_work, nfc_hci_msg_tx_work); | 1005 | INIT_WORK(&hdev->msg_tx_work, nfc_hci_msg_tx_work); |
1006 | 1006 | ||
1007 | setup_timer(&hdev->cmd_timer, nfc_hci_cmd_timeout, | 1007 | timer_setup(&hdev->cmd_timer, nfc_hci_cmd_timeout, 0); |
1008 | (unsigned long)hdev); | ||
1009 | 1008 | ||
1010 | skb_queue_head_init(&hdev->rx_hcp_frags); | 1009 | skb_queue_head_init(&hdev->rx_hcp_frags); |
1011 | 1010 | ||
diff --git a/net/nfc/hci/llc_shdlc.c b/net/nfc/hci/llc_shdlc.c index 58df37eae1e8..fe988936ad92 100644 --- a/net/nfc/hci/llc_shdlc.c +++ b/net/nfc/hci/llc_shdlc.c | |||
@@ -580,27 +580,27 @@ static void llc_shdlc_handle_send_queue(struct llc_shdlc *shdlc) | |||
580 | } | 580 | } |
581 | } | 581 | } |
582 | 582 | ||
583 | static void llc_shdlc_connect_timeout(unsigned long data) | 583 | static void llc_shdlc_connect_timeout(struct timer_list *t) |
584 | { | 584 | { |
585 | struct llc_shdlc *shdlc = (struct llc_shdlc *)data; | 585 | struct llc_shdlc *shdlc = from_timer(shdlc, t, connect_timer); |
586 | 586 | ||
587 | pr_debug("\n"); | 587 | pr_debug("\n"); |
588 | 588 | ||
589 | schedule_work(&shdlc->sm_work); | 589 | schedule_work(&shdlc->sm_work); |
590 | } | 590 | } |
591 | 591 | ||
592 | static void llc_shdlc_t1_timeout(unsigned long data) | 592 | static void llc_shdlc_t1_timeout(struct timer_list *t) |
593 | { | 593 | { |
594 | struct llc_shdlc *shdlc = (struct llc_shdlc *)data; | 594 | struct llc_shdlc *shdlc = from_timer(shdlc, t, t1_timer); |
595 | 595 | ||
596 | pr_debug("SoftIRQ: need to send ack\n"); | 596 | pr_debug("SoftIRQ: need to send ack\n"); |
597 | 597 | ||
598 | schedule_work(&shdlc->sm_work); | 598 | schedule_work(&shdlc->sm_work); |
599 | } | 599 | } |
600 | 600 | ||
601 | static void llc_shdlc_t2_timeout(unsigned long data) | 601 | static void llc_shdlc_t2_timeout(struct timer_list *t) |
602 | { | 602 | { |
603 | struct llc_shdlc *shdlc = (struct llc_shdlc *)data; | 603 | struct llc_shdlc *shdlc = from_timer(shdlc, t, t2_timer); |
604 | 604 | ||
605 | pr_debug("SoftIRQ: need to retransmit\n"); | 605 | pr_debug("SoftIRQ: need to retransmit\n"); |
606 | 606 | ||
@@ -763,14 +763,9 @@ static void *llc_shdlc_init(struct nfc_hci_dev *hdev, xmit_to_drv_t xmit_to_drv, | |||
763 | mutex_init(&shdlc->state_mutex); | 763 | mutex_init(&shdlc->state_mutex); |
764 | shdlc->state = SHDLC_DISCONNECTED; | 764 | shdlc->state = SHDLC_DISCONNECTED; |
765 | 765 | ||
766 | setup_timer(&shdlc->connect_timer, llc_shdlc_connect_timeout, | 766 | timer_setup(&shdlc->connect_timer, llc_shdlc_connect_timeout, 0); |
767 | (unsigned long)shdlc); | 767 | timer_setup(&shdlc->t1_timer, llc_shdlc_t1_timeout, 0); |
768 | 768 | timer_setup(&shdlc->t2_timer, llc_shdlc_t2_timeout, 0); | |
769 | setup_timer(&shdlc->t1_timer, llc_shdlc_t1_timeout, | ||
770 | (unsigned long)shdlc); | ||
771 | |||
772 | setup_timer(&shdlc->t2_timer, llc_shdlc_t2_timeout, | ||
773 | (unsigned long)shdlc); | ||
774 | 769 | ||
775 | shdlc->w = SHDLC_MAX_WINDOW; | 770 | shdlc->w = SHDLC_MAX_WINDOW; |
776 | shdlc->srej_support = SHDLC_SREJ_SUPPORT; | 771 | shdlc->srej_support = SHDLC_SREJ_SUPPORT; |
diff --git a/net/nfc/llcp_core.c b/net/nfc/llcp_core.c index 7988185072e5..ef4026a23e80 100644 --- a/net/nfc/llcp_core.c +++ b/net/nfc/llcp_core.c | |||
@@ -242,9 +242,9 @@ static void nfc_llcp_timeout_work(struct work_struct *work) | |||
242 | nfc_dep_link_down(local->dev); | 242 | nfc_dep_link_down(local->dev); |
243 | } | 243 | } |
244 | 244 | ||
245 | static void nfc_llcp_symm_timer(unsigned long data) | 245 | static void nfc_llcp_symm_timer(struct timer_list *t) |
246 | { | 246 | { |
247 | struct nfc_llcp_local *local = (struct nfc_llcp_local *) data; | 247 | struct nfc_llcp_local *local = from_timer(local, t, link_timer); |
248 | 248 | ||
249 | pr_err("SYMM timeout\n"); | 249 | pr_err("SYMM timeout\n"); |
250 | 250 | ||
@@ -285,9 +285,9 @@ static void nfc_llcp_sdreq_timeout_work(struct work_struct *work) | |||
285 | nfc_genl_llc_send_sdres(local->dev, &nl_sdres_list); | 285 | nfc_genl_llc_send_sdres(local->dev, &nl_sdres_list); |
286 | } | 286 | } |
287 | 287 | ||
288 | static void nfc_llcp_sdreq_timer(unsigned long data) | 288 | static void nfc_llcp_sdreq_timer(struct timer_list *t) |
289 | { | 289 | { |
290 | struct nfc_llcp_local *local = (struct nfc_llcp_local *) data; | 290 | struct nfc_llcp_local *local = from_timer(local, t, sdreq_timer); |
291 | 291 | ||
292 | schedule_work(&local->sdreq_timeout_work); | 292 | schedule_work(&local->sdreq_timeout_work); |
293 | } | 293 | } |
@@ -1573,8 +1573,7 @@ int nfc_llcp_register_device(struct nfc_dev *ndev) | |||
1573 | INIT_LIST_HEAD(&local->list); | 1573 | INIT_LIST_HEAD(&local->list); |
1574 | kref_init(&local->ref); | 1574 | kref_init(&local->ref); |
1575 | mutex_init(&local->sdp_lock); | 1575 | mutex_init(&local->sdp_lock); |
1576 | setup_timer(&local->link_timer, nfc_llcp_symm_timer, | 1576 | timer_setup(&local->link_timer, nfc_llcp_symm_timer, 0); |
1577 | (unsigned long)local); | ||
1578 | 1577 | ||
1579 | skb_queue_head_init(&local->tx_queue); | 1578 | skb_queue_head_init(&local->tx_queue); |
1580 | INIT_WORK(&local->tx_work, nfc_llcp_tx_work); | 1579 | INIT_WORK(&local->tx_work, nfc_llcp_tx_work); |
@@ -1600,8 +1599,7 @@ int nfc_llcp_register_device(struct nfc_dev *ndev) | |||
1600 | 1599 | ||
1601 | mutex_init(&local->sdreq_lock); | 1600 | mutex_init(&local->sdreq_lock); |
1602 | INIT_HLIST_HEAD(&local->pending_sdreqs); | 1601 | INIT_HLIST_HEAD(&local->pending_sdreqs); |
1603 | setup_timer(&local->sdreq_timer, nfc_llcp_sdreq_timer, | 1602 | timer_setup(&local->sdreq_timer, nfc_llcp_sdreq_timer, 0); |
1604 | (unsigned long)local); | ||
1605 | INIT_WORK(&local->sdreq_timeout_work, nfc_llcp_sdreq_timeout_work); | 1603 | INIT_WORK(&local->sdreq_timeout_work, nfc_llcp_sdreq_timeout_work); |
1606 | 1604 | ||
1607 | list_add(&local->list, &llcp_devices); | 1605 | list_add(&local->list, &llcp_devices); |