2 ****************************************************************************************
8 ****************************************************************************************
13 ****************************************************************************************
16 #include "ecrnx_p2p.h"
17 #include "ecrnx_msg_tx.h"
21 * FUNCTION DEFINITIONS
22 ****************************************************************************************
25 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
26 static void ecrnx_p2p_discovery_timer_fn(struct timer_list *t)
28 static void ecrnx_p2p_discovery_timer_fn(ulong x)
31 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
32 struct ecrnx_hw *ecrnx_hw = from_timer(ecrnx_hw, t, p2p_listen.listen_timer);
34 struct ecrnx_hw *ecrnx_hw = (void *)x;
36 ECRNX_PRINT("ecrnx_p2p_discovery_timer_fn\n");
38 schedule_work(&ecrnx_hw->p2p_listen.listen_expired_work);
42 void ecrnx_p2p_listen_init(struct ecrnx_p2p_listen *p2p_listen)
44 struct ecrnx_hw *ecrnx_hw = container_of(p2p_listen, struct ecrnx_hw, p2p_listen);
45 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
46 timer_setup(&p2p_listen->listen_timer, ecrnx_p2p_discovery_timer_fn, 0);
48 setup_timer(&p2p_listen->listen_timer, ecrnx_p2p_discovery_timer_fn, (ulong)ecrnx_hw);
50 INIT_WORK(&p2p_listen->listen_expired_work, ecrnx_p2p_listen_expired);
52 init_waitqueue_head(&p2p_listen->rxdataq);
55 void ecrnx_p2p_listen_expired(struct work_struct *work)
57 struct ecrnx_p2p_listen *p2p_listen = container_of(work, struct ecrnx_p2p_listen, listen_expired_work);
58 struct ecrnx_hw *ecrnx_hw = container_of(p2p_listen, struct ecrnx_hw, p2p_listen);
60 ECRNX_PRINT("p2p_listen_expired\n");
62 if (p2p_listen->listen_started)
64 del_timer_sync(&p2p_listen->listen_timer);
65 ecrnx_send_p2p_cancel_listen_req(ecrnx_hw, p2p_listen->ecrnx_vif);