File 0001-xpp-move-command_timer-functions-to-xbus-core.patch of Package dahdi-linux
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 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