]>
Commit | Line | Data |
---|---|---|
4338db61 JR |
1 | From 529b104aacaa6164d39e955003718bf15edcf08e Mon Sep 17 00:00:00 2001 |
2 | From: Tzafrir Cohen <tzafrir.cohen@xorcom.com> | |
3 | Date: Mon, 1 Jan 2018 16:06:25 +0200 | |
4 | Subject: [PATCH 1/2] xpp: move command_timer functions to xbus-core | |
5 | ||
6 | Would allow to later fully initializing the command_timer in xbus-core.c | |
7 | rather than xbus-pcm.c . | |
8 | --- | |
9 | drivers/dahdi/xpp/xbus-core.c | 30 ++++++++++++++++++++++++++++++ | |
10 | drivers/dahdi/xpp/xbus-pcm.c | 30 ------------------------------ | |
11 | 2 files changed, 30 insertions(+), 30 deletions(-) | |
12 | ||
13 | diff --git a/drivers/dahdi/xpp/xbus-core.c b/drivers/dahdi/xpp/xbus-core.c | |
14 | index 4281f1c..ca129cd 100644 | |
15 | --- a/drivers/dahdi/xpp/xbus-core.c | |
16 | +++ b/drivers/dahdi/xpp/xbus-core.c | |
17 | @@ -1350,6 +1350,36 @@ err: | |
18 | return 0; | |
19 | } | |
20 | ||
21 | +static void xbus_command_timer(unsigned long param) | |
22 | +{ | |
23 | + xbus_t *xbus = (xbus_t *)param; | |
24 | + struct timeval now; | |
25 | + | |
26 | + BUG_ON(!xbus); | |
27 | + do_gettimeofday(&now); | |
28 | + xbus_command_queue_tick(xbus); | |
29 | + if (!xbus->self_ticking) /* Must be 1KHz rate */ | |
30 | + mod_timer(&xbus->command_timer, jiffies + 1); | |
31 | +} | |
32 | + | |
33 | +void xbus_set_command_timer(xbus_t *xbus, bool on) | |
34 | +{ | |
35 | + XBUS_DBG(SYNC, xbus, "%s\n", (on) ? "ON" : "OFF"); | |
36 | + if (on) { | |
37 | + if (!timer_pending(&xbus->command_timer)) { | |
38 | + XBUS_DBG(SYNC, xbus, "add_timer\n"); | |
39 | + xbus->command_timer.function = xbus_command_timer; | |
40 | + xbus->command_timer.data = (unsigned long)xbus; | |
41 | + xbus->command_timer.expires = jiffies + 1; | |
42 | + add_timer(&xbus->command_timer); | |
43 | + } | |
44 | + } else if (timer_pending(&xbus->command_timer)) { | |
45 | + XBUS_DBG(SYNC, xbus, "del_timer\n"); | |
46 | + del_timer(&xbus->command_timer); | |
47 | + } | |
48 | + xbus->self_ticking = !on; | |
49 | +} | |
50 | + | |
51 | bool xbus_setflags(xbus_t *xbus, int flagbit, bool on) | |
52 | { | |
53 | unsigned long flags; | |
54 | diff --git a/drivers/dahdi/xpp/xbus-pcm.c b/drivers/dahdi/xpp/xbus-pcm.c | |
55 | index 32f04fa..3f46780 100644 | |
56 | --- a/drivers/dahdi/xpp/xbus-pcm.c | |
57 | +++ b/drivers/dahdi/xpp/xbus-pcm.c | |
58 | @@ -353,36 +353,6 @@ static void xpp_set_syncer(xbus_t *xbus, bool on) | |
59 | (syncer) ? syncer->busname : "NO-SYNC"); | |
60 | } | |
61 | ||
62 | -static void xbus_command_timer(unsigned long param) | |
63 | -{ | |
64 | - xbus_t *xbus = (xbus_t *)param; | |
65 | - struct timeval now; | |
66 | - | |
67 | - BUG_ON(!xbus); | |
68 | - do_gettimeofday(&now); | |
69 | - xbus_command_queue_tick(xbus); | |
70 | - if (!xbus->self_ticking) /* Must be 1KHz rate */ | |
71 | - mod_timer(&xbus->command_timer, jiffies + 1); | |
72 | -} | |
73 | - | |
74 | -void xbus_set_command_timer(xbus_t *xbus, bool on) | |
75 | -{ | |
76 | - XBUS_DBG(SYNC, xbus, "%s\n", (on) ? "ON" : "OFF"); | |
77 | - if (on) { | |
78 | - if (!timer_pending(&xbus->command_timer)) { | |
79 | - XBUS_DBG(SYNC, xbus, "add_timer\n"); | |
80 | - xbus->command_timer.function = xbus_command_timer; | |
81 | - xbus->command_timer.data = (unsigned long)xbus; | |
82 | - xbus->command_timer.expires = jiffies + 1; | |
83 | - add_timer(&xbus->command_timer); | |
84 | - } | |
85 | - } else if (timer_pending(&xbus->command_timer)) { | |
86 | - XBUS_DBG(SYNC, xbus, "del_timer\n"); | |
87 | - del_timer(&xbus->command_timer); | |
88 | - } | |
89 | - xbus->self_ticking = !on; | |
90 | -} | |
91 | - | |
92 | /* | |
93 | * Called when the Astribank replies to a sync change request | |
94 | */ | |
95 | -- | |
96 | 2.11.0 | |
97 |