]> git.pld-linux.org Git - packages/dahdi-linux.git/blob - math64.patch
- fix building kernel modules on x86
[packages/dahdi-linux.git] / math64.patch
1 diff -ur dahdi-linux-3.1.0/drivers/dahdi/xpp/xbus-core.c dahdi-linux-3.1.0-math64/drivers/dahdi/xpp/xbus-core.c
2 --- dahdi-linux-3.1.0/drivers/dahdi/xpp/xbus-core.c     2019-10-03 16:48:09.000000000 +0200
3 +++ dahdi-linux-3.1.0-math64/drivers/dahdi/xpp/xbus-core.c      2019-12-01 15:42:12.261848789 +0100
4 @@ -25,6 +25,7 @@
5  #include <linux/errno.h>
6  #include <linux/sched.h>
7  #include <linux/mutex.h>
8 +#include <linux/math64.h>
9  #include <linux/proc_fs.h>
10  #include <linux/seq_file.h>
11  #include <linux/slab.h>
12 @@ -1754,11 +1755,13 @@
13  
14  static void xbus_fill_proc_queue(struct seq_file *sfile, struct xframe_queue *q)
15  {
16 +       s32 rem;
17 +       s64 lag_sec = div_s64_rem(q->worst_lag_usec, 1000, &rem);
18         seq_printf(sfile,
19 -               "%-15s: counts %3d, %3d, %3d worst %3d, overflows %3d worst_lag %02lld.%lld ms\n",
20 +               "%-15s: counts %3d, %3d, %3d worst %3d, overflows %3d worst_lag %02lld.%ld ms\n",
21                 q->name, q->steady_state_count, q->count, q->max_count,
22 -               q->worst_count, q->overflows, q->worst_lag_usec / 1000,
23 -               q->worst_lag_usec % 1000);
24 +               q->worst_count, q->overflows, lag_sec,
25 +               rem);
26         xframe_queue_clearstats(q);
27  }
28  
29 diff -ur dahdi-linux-3.1.0/drivers/dahdi/xpp/xbus-pcm.c dahdi-linux-3.1.0-math64/drivers/dahdi/xpp/xbus-pcm.c
30 --- dahdi-linux-3.1.0/drivers/dahdi/xpp/xbus-pcm.c      2019-10-03 16:48:09.000000000 +0200
31 +++ dahdi-linux-3.1.0-math64/drivers/dahdi/xpp/xbus-pcm.c       2019-12-01 16:32:23.696492708 +0100
32 @@ -22,6 +22,7 @@
33  #include <linux/version.h>
34  #include <linux/kernel.h>
35  #include <linux/module.h>
36 +#include <linux/math64.h>
37  #include "xbus-pcm.h"
38  #include "xbus-core.h"
39  #include "xpp_dahdi.h"
40 @@ -129,7 +130,7 @@
41                 usec = ktime_us_delta(ticker->last_sample,
42                                         ticker->first_sample);
43                 ticker->first_sample = ticker->last_sample;
44 -               ticker->tick_period = usec / ticker->cycle;
45 +               ticker->tick_period = div_s64(usec, ticker->cycle);
46                 cycled = 1;
47         }
48         ticker->count++;
49 @@ -497,7 +498,7 @@
50         XBUS_DBG(SYNC, xbus,
51                  "%sDRIFT adjust %s (%d) (last update %lld seconds ago)\n",
52                  (disable_pll_sync) ? "Fake " : "", msg, drift,
53 -                msec_delta / MSEC_PER_SEC);
54 +                div_s64(msec_delta, MSEC_PER_SEC));
55         if (!disable_pll_sync)
56                 CALL_PROTO(GLOBAL, SYNC_SOURCE, xbus, NULL, SYNC_MODE_PLL,
57                            drift);
58 diff -ur dahdi-linux-3.1.0/drivers/dahdi/xpp/xbus-sysfs.c dahdi-linux-3.1.0-math64/drivers/dahdi/xpp/xbus-sysfs.c
59 --- dahdi-linux-3.1.0/drivers/dahdi/xpp/xbus-sysfs.c    2019-10-03 16:48:09.000000000 +0200
60 +++ dahdi-linux-3.1.0-math64/drivers/dahdi/xpp/xbus-sysfs.c     2019-12-01 16:29:26.289062748 +0100
61 @@ -23,6 +23,7 @@
62  #include <linux/kernel.h>
63  #include <linux/module.h>
64  #include <linux/errno.h>
65 +#include <linux/math64.h>
66  #include <linux/proc_fs.h>
67  #ifdef PROTOCOL_DEBUG
68  #include <linux/ctype.h>
69 @@ -249,11 +250,9 @@
70         /*
71          * Calculate lost ticks time
72          */
73 -       seconds = ktime_ms_delta(now, di->last_lost_tick) / 1000;
74 -       minutes = seconds / 60;
75 -       seconds = seconds % 60;
76 -       hours = minutes / 60;
77 -       minutes = minutes % 60;
78 +       seconds = div_s64(ktime_ms_delta(now, di->last_lost_tick), 1000);
79 +       minutes = div_s64_rem(seconds, 60, &seconds);
80 +       hours = div_s64_rem(minutes, 60, &minutes);
81         len += snprintf(buf + len, PAGE_SIZE - len,
82                 "%-15s: %8d (was %d:%02d:%02d ago)\n", "lost_ticks",
83                 di->lost_ticks, hours, minutes, seconds);
84 diff -ur dahdi-linux-3.1.0/drivers/dahdi/xpp/xframe_queue.c dahdi-linux-3.1.0-math64/drivers/dahdi/xpp/xframe_queue.c
85 --- dahdi-linux-3.1.0/drivers/dahdi/xpp/xframe_queue.c  2019-10-03 16:48:09.000000000 +0200
86 +++ dahdi-linux-3.1.0-math64/drivers/dahdi/xpp/xframe_queue.c   2019-12-01 15:46:21.663845498 +0100
87 @@ -1,3 +1,4 @@
88 +#include <linux/math64.h>
89  #include "xframe_queue.h"
90  #include "xbus-core.h"
91  #include "dahdi_debug.h"
92 @@ -40,10 +41,11 @@
93                THIS_MODULE->name, q->name);
94         list_for_each_entry_reverse(xframe, &q->head, frame_list) {
95                 xpacket_t *pack = (xpacket_t *)&xframe->packets[0];
96 -               s64 usec = ktime_us_delta(now, xframe->kt_queued);
97 +               s32 rem;
98 +               s64 sec = div_s64_rem(ktime_us_delta(now, xframe->kt_queued), 1000, &rem);
99  
100 -               snprintf(prefix, ARRAY_SIZE(prefix), "  %3d> %5lld.%03lld msec",
101 -                        i++, usec / 1000, usec % 1000);
102 +               snprintf(prefix, ARRAY_SIZE(prefix), "  %3d> %5lld.%03ld msec",
103 +                        i++, sec, rem);
104                 dump_packet(prefix, pack, 1);
105         }
106  }
107 @@ -60,11 +62,13 @@
108         if (q->count >= q->max_count) {
109                 q->overflows++;
110                 if ((overflow_cnt++ % 1000) < 5) {
111 -                       NOTICE("Overflow of %-15s: counts %3d, %3d, %3d worst %3d, overflows %3d worst_lag %02lld.%lld ms\n",
112 +                       s32 rem;
113 +                       s64 lag_sec = div_s64_rem(q->worst_lag_usec, 1000, &rem);
114 +                       NOTICE("Overflow of %-15s: counts %3d, %3d, %3d worst %3d, overflows %3d worst_lag %02lld.%ld ms\n",
115                              q->name, q->steady_state_count, q->count,
116                              q->max_count, q->worst_count, q->overflows,
117 -                            q->worst_lag_usec / 1000,
118 -                            q->worst_lag_usec % 1000);
119 +                            lag_sec,
120 +                            rem);
121                         __xframe_dump_queue(q);
122                 }
123                 ret = 0;
124 diff -ur dahdi-linux-3.1.0/drivers/dahdi/xpp/xpp_usb.c dahdi-linux-3.1.0-math64/drivers/dahdi/xpp/xpp_usb.c
125 --- dahdi-linux-3.1.0/drivers/dahdi/xpp/xpp_usb.c       2019-10-03 16:48:09.000000000 +0200
126 +++ dahdi-linux-3.1.0-math64/drivers/dahdi/xpp/xpp_usb.c        2019-12-01 16:34:50.324899402 +0100
127 @@ -27,6 +27,7 @@
128  #include <linux/interrupt.h>
129  #include <linux/delay.h>       /* for udelay */
130  #include <linux/seq_file.h>
131 +#include <linux/math64.h>
132  #include <asm/uaccess.h>
133  #include <asm/atomic.h>
134  #include <asm/timex.h>
135 @@ -882,7 +883,7 @@
136                 usec = 0; /* System clock jumped */
137         if (usec > xusb->max_tx_delay)
138                 xusb->max_tx_delay = usec;
139 -       i = usec / USEC_BUCKET;
140 +       i = div_s64(usec, USEC_BUCKET);
141         if (i >= NUM_BUCKETS)
142                 i = NUM_BUCKETS - 1;
143         xusb->usb_tx_delay[i]++;
This page took 0.032759 seconds and 3 git commands to generate.