Skip to content

Commit 648016d

Browse files
ffontainepush143smart
authored andcommitted
xpp: Fix build with 32-bits kernel
Use div_s64 or div_s64_rem to fix the following build failure on 32-bits kernels: ERROR: modpost: "__divdi3" [/home/fabrice/buildroot/output/build/dahdi-linux-5c840cf43838e0690873e73409491c392333b3b8/drivers/dahdi/xpp/xpp_usb.ko] undefined! ERROR: modpost: "__udivdi3" [/home/fabrice/buildroot/output/build/dahdi-linux-5c840cf43838e0690873e73409491c392333b3b8/drivers/dahdi/xpp/xpp_usb.ko] undefined! ERROR: modpost: "__moddi3" [/home/fabrice/buildroot/output/build/dahdi-linux-5c840cf43838e0690873e73409491c392333b3b8/drivers/dahdi/xpp/xpp.ko] undefined! ERROR: modpost: "__divdi3" [/home/fabrice/buildroot/output/build/dahdi-linux-5c840cf43838e0690873e73409491c392333b3b8/drivers/dahdi/xpp/xpp.ko] undefined! [Retrieved from: https://git.buildroot.net/buildroot/tree/package/dahdi-linux/0002-fix-build-with-32-bits-kernel.patch] Signed-off-by: Fabrice Fontaine <[email protected]>
1 parent 9633b8e commit 648016d

File tree

5 files changed

+20
-12
lines changed

5 files changed

+20
-12
lines changed

Diff for: drivers/dahdi/xpp/xbus-core.c

+6-3
Original file line numberDiff line numberDiff line change
@@ -1771,11 +1771,14 @@ int waitfor_xpds(xbus_t *xbus, char *buf)
17711771

17721772
static void xbus_fill_proc_queue(struct seq_file *sfile, struct xframe_queue *q)
17731773
{
1774+
s64 msec = 0;
1775+
s32 rem = 0;
1776+
1777+
msec = div_s64_rem(q->worst_lag_usec, 1000, &rem);
17741778
seq_printf(sfile,
1775-
"%-15s: counts %3d, %3d, %3d worst %3d, overflows %3d worst_lag %02lld.%lld ms\n",
1779+
"%-15s: counts %3d, %3d, %3d worst %3d, overflows %3d worst_lag %02lld.%d ms\n",
17761780
q->name, q->steady_state_count, q->count, q->max_count,
1777-
q->worst_count, q->overflows, q->worst_lag_usec / 1000,
1778-
q->worst_lag_usec % 1000);
1781+
q->worst_count, q->overflows, msec, rem);
17791782
xframe_queue_clearstats(q);
17801783
}
17811784

Diff for: drivers/dahdi/xpp/xbus-pcm.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ static int xpp_ticker_step(struct xpp_ticker *ticker, const ktime_t t)
129129
usec = ktime_us_delta(ticker->last_sample,
130130
ticker->first_sample);
131131
ticker->first_sample = ticker->last_sample;
132-
ticker->tick_period = usec / ticker->cycle;
132+
ticker->tick_period = div_s64(usec, ticker->cycle);
133133
cycled = 1;
134134
}
135135
ticker->count++;
@@ -497,7 +497,7 @@ static void send_drift(xbus_t *xbus, int drift)
497497
XBUS_DBG(SYNC, xbus,
498498
"%sDRIFT adjust %s (%d) (last update %lld seconds ago)\n",
499499
(disable_pll_sync) ? "Fake " : "", msg, drift,
500-
msec_delta / MSEC_PER_SEC);
500+
div_s64(msec_delta, MSEC_PER_SEC));
501501
if (!disable_pll_sync)
502502
CALL_PROTO(GLOBAL, SYNC_SOURCE, xbus, NULL, SYNC_MODE_PLL,
503503
drift);

Diff for: drivers/dahdi/xpp/xbus-sysfs.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ static DEVICE_ATTR_READER(driftinfo_show, dev, buf)
249249
/*
250250
* Calculate lost ticks time
251251
*/
252-
seconds = ktime_ms_delta(now, di->last_lost_tick) / 1000;
252+
seconds = div_s64(ktime_ms_delta(now, di->last_lost_tick), 1000);
253253
minutes = seconds / 60;
254254
seconds = seconds % 60;
255255
hours = minutes / 60;

Diff for: drivers/dahdi/xpp/xframe_queue.c

+10-5
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,18 @@ static void __xframe_dump_queue(struct xframe_queue *q)
3535
int i = 0;
3636
char prefix[30];
3737
ktime_t now = ktime_get();
38+
s64 msec = 0;
39+
s32 rem = 0;
3840

3941
printk(KERN_DEBUG "%s: dump queue '%s' (first packet in each frame)\n",
4042
THIS_MODULE->name, q->name);
4143
list_for_each_entry_reverse(xframe, &q->head, frame_list) {
4244
xpacket_t *pack = (xpacket_t *)&xframe->packets[0];
4345
s64 usec = ktime_us_delta(now, xframe->kt_queued);
46+
msec = div_s64_rem(usec, 1000, &rem);
4447

45-
snprintf(prefix, ARRAY_SIZE(prefix), " %3d> %5lld.%03lld msec",
46-
i++, usec / 1000, usec % 1000);
48+
snprintf(prefix, ARRAY_SIZE(prefix), " %3d> %5lld.%03d msec",
49+
i++, msec, rem);
4750
dump_packet(prefix, pack, 1);
4851
}
4952
}
@@ -52,6 +55,8 @@ static bool __xframe_enqueue(struct xframe_queue *q, xframe_t *xframe)
5255
{
5356
int ret = 1;
5457
static int overflow_cnt;
58+
s64 msec = 0;
59+
s32 rem = 0;
5560

5661
if (unlikely(q->disabled)) {
5762
ret = 0;
@@ -60,11 +65,11 @@ static bool __xframe_enqueue(struct xframe_queue *q, xframe_t *xframe)
6065
if (q->count >= q->max_count) {
6166
q->overflows++;
6267
if ((overflow_cnt++ % 1000) < 5) {
63-
NOTICE("Overflow of %-15s: counts %3d, %3d, %3d worst %3d, overflows %3d worst_lag %02lld.%lld ms\n",
68+
msec = div_s64_rem(q->worst_lag_usec, 1000, &rem);
69+
NOTICE("Overflow of %-15s: counts %3d, %3d, %3d worst %3d, overflows %3d worst_lag %02lld.%d ms\n",
6470
q->name, q->steady_state_count, q->count,
6571
q->max_count, q->worst_count, q->overflows,
66-
q->worst_lag_usec / 1000,
67-
q->worst_lag_usec % 1000);
72+
msec, rem);
6873
__xframe_dump_queue(q);
6974
}
7075
ret = 0;

Diff for: drivers/dahdi/xpp/xpp_usb.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,7 @@ static void xpp_send_callback(struct urb *urb)
887887
usec = 0; /* System clock jumped */
888888
if (usec > xusb->max_tx_delay)
889889
xusb->max_tx_delay = usec;
890-
i = usec / USEC_BUCKET;
890+
i = div_s64(usec, USEC_BUCKET);
891891
if (i >= NUM_BUCKETS)
892892
i = NUM_BUCKETS - 1;
893893
xusb->usb_tx_delay[i]++;

0 commit comments

Comments
 (0)