aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/subscr.c
diff options
context:
space:
mode:
authorYing Xue <ying.xue@windriver.com>2015-01-09 02:27:00 -0500
committerDavid S. Miller <davem@davemloft.net>2015-01-12 16:24:31 -0500
commit2f55c43788df7358be8c6e78ae2a3d3268e7afb6 (patch)
treeae5cb5fd5124ab1323156bc19fae2bba3c6e9dc5 /net/tipc/subscr.c
parent6b8326ed14683f641e1c4149197f23a48c7cee36 (diff)
tipc: remove unnecessary wrapper functions of kernel timer APIs
Not only some wrapper function like k_term_timer() is empty, but also some others including k_start_timer() and k_cancel_timer() don't return back any value to its caller, what's more, there is no any component in the kernel world to do such thing. Therefore, these timer interfaces defined in tipc module should be purged. Signed-off-by: Ying Xue <ying.xue@windriver.com> Tested-by: Tero Aho <Tero.Aho@coriant.com> Reviewed-by: Jon Maloy <jon.maloy@ericsson.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/subscr.c')
-rw-r--r--net/tipc/subscr.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/net/tipc/subscr.c b/net/tipc/subscr.c
index 0344206b984f..e6cb959371dc 100644
--- a/net/tipc/subscr.c
+++ b/net/tipc/subscr.c
@@ -141,8 +141,9 @@ void tipc_subscr_report_overlap(struct tipc_subscription *sub, u32 found_lower,
141 subscr_send_event(sub, found_lower, found_upper, event, port_ref, node); 141 subscr_send_event(sub, found_lower, found_upper, event, port_ref, node);
142} 142}
143 143
144static void subscr_timeout(struct tipc_subscription *sub) 144static void subscr_timeout(unsigned long data)
145{ 145{
146 struct tipc_subscription *sub = (struct tipc_subscription *)data;
146 struct tipc_subscriber *subscriber = sub->subscriber; 147 struct tipc_subscriber *subscriber = sub->subscriber;
147 148
148 /* The spin lock per subscriber is used to protect its members */ 149 /* The spin lock per subscriber is used to protect its members */
@@ -167,7 +168,6 @@ static void subscr_timeout(struct tipc_subscription *sub)
167 TIPC_SUBSCR_TIMEOUT, 0, 0); 168 TIPC_SUBSCR_TIMEOUT, 0, 0);
168 169
169 /* Now destroy subscription */ 170 /* Now destroy subscription */
170 k_term_timer(&sub->timer);
171 kfree(sub); 171 kfree(sub);
172 atomic_dec(&subscription_count); 172 atomic_dec(&subscription_count);
173} 173}
@@ -207,8 +207,7 @@ static void subscr_release(struct tipc_subscriber *subscriber)
207 subscription_list) { 207 subscription_list) {
208 if (sub->timeout != TIPC_WAIT_FOREVER) { 208 if (sub->timeout != TIPC_WAIT_FOREVER) {
209 spin_unlock_bh(&subscriber->lock); 209 spin_unlock_bh(&subscriber->lock);
210 k_cancel_timer(&sub->timer); 210 del_timer_sync(&sub->timer);
211 k_term_timer(&sub->timer);
212 spin_lock_bh(&subscriber->lock); 211 spin_lock_bh(&subscriber->lock);
213 } 212 }
214 subscr_del(sub); 213 subscr_del(sub);
@@ -250,8 +249,7 @@ static void subscr_cancel(struct tipc_subscr *s,
250 if (sub->timeout != TIPC_WAIT_FOREVER) { 249 if (sub->timeout != TIPC_WAIT_FOREVER) {
251 sub->timeout = TIPC_WAIT_FOREVER; 250 sub->timeout = TIPC_WAIT_FOREVER;
252 spin_unlock_bh(&subscriber->lock); 251 spin_unlock_bh(&subscriber->lock);
253 k_cancel_timer(&sub->timer); 252 del_timer_sync(&sub->timer);
254 k_term_timer(&sub->timer);
255 spin_lock_bh(&subscriber->lock); 253 spin_lock_bh(&subscriber->lock);
256 } 254 }
257 subscr_del(sub); 255 subscr_del(sub);
@@ -296,7 +294,7 @@ static int subscr_subscribe(struct tipc_subscr *s,
296 sub->seq.type = htohl(s->seq.type, swap); 294 sub->seq.type = htohl(s->seq.type, swap);
297 sub->seq.lower = htohl(s->seq.lower, swap); 295 sub->seq.lower = htohl(s->seq.lower, swap);
298 sub->seq.upper = htohl(s->seq.upper, swap); 296 sub->seq.upper = htohl(s->seq.upper, swap);
299 sub->timeout = htohl(s->timeout, swap); 297 sub->timeout = msecs_to_jiffies(htohl(s->timeout, swap));
300 sub->filter = htohl(s->filter, swap); 298 sub->filter = htohl(s->filter, swap);
301 if ((!(sub->filter & TIPC_SUB_PORTS) == 299 if ((!(sub->filter & TIPC_SUB_PORTS) ==
302 !(sub->filter & TIPC_SUB_SERVICE)) || 300 !(sub->filter & TIPC_SUB_SERVICE)) ||
@@ -311,9 +309,8 @@ static int subscr_subscribe(struct tipc_subscr *s,
311 memcpy(&sub->evt.s, s, sizeof(struct tipc_subscr)); 309 memcpy(&sub->evt.s, s, sizeof(struct tipc_subscr));
312 atomic_inc(&subscription_count); 310 atomic_inc(&subscription_count);
313 if (sub->timeout != TIPC_WAIT_FOREVER) { 311 if (sub->timeout != TIPC_WAIT_FOREVER) {
314 k_init_timer(&sub->timer, 312 setup_timer(&sub->timer, subscr_timeout, (unsigned long)sub);
315 (Handler)subscr_timeout, (unsigned long)sub); 313 mod_timer(&sub->timer, jiffies + sub->timeout);
316 k_start_timer(&sub->timer, sub->timeout);
317 } 314 }
318 *sub_p = sub; 315 *sub_p = sub;
319 return 0; 316 return 0;