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