MT#55283 kernel-module: Use do_div() instead of 64-bit division operator

On some 32-bit architectures, such as armhf, the CPU does not have a
64-bit division instruction, and the compiler injects an intrinsic
function reference (such as __aeabi_ldivmod) that is provided for
example by libgcc.

When compiling Linux kernel code, we are not using libgcc, so such
references end up being undefined, failing the link. Instead we need to
use support provided by the kernel itself. In this case the do_div()
macro.

Change-Id: I5ed60aee487e66d6fcfc2293644d773b6820c178
(cherry picked from commit b688988363)
(cherry picked from commit 3e57259b73)
mr13.5.1
Guillem Jover 1 week ago
parent 7634448563
commit b69883693d

@ -26,6 +26,7 @@
#include <linux/spinlock.h>
#include <linux/bsearch.h>
#include <asm/atomic.h>
#include <asm/div64.h>
#include <linux/netfilter_ipv4/ip_tables.h>
#include <linux/netfilter_ipv4.h>
#include <linux/netfilter_ipv6.h>
@ -1691,6 +1692,7 @@ static int proc_list_show(struct seq_file *f, void *v) {
struct rtpengine_target *g = v;
unsigned int i, j;
unsigned long flags;
uint64_t last_packet;
seq_printf(f, "local ");
seq_addr_print(f, &g->target.local);
@ -1720,8 +1722,9 @@ static int proc_list_show(struct seq_file *f, void *v) {
(unsigned long long) atomic64_read(&g->target.pt_stats[i]->packets));
}
seq_printf(f, " last packet: %lli\n",
(long long) atomic64_read(&g->target.stats->last_packet_us) / 1000000L);
last_packet = atomic64_read(&g->target.stats->last_packet_us);
do_div(last_packet, 1000000L);
seq_printf(f, " last packet: %lli\n", (long long) last_packet);
seq_printf(f, " SSRC in:");
for (i = 0; i < ARRAY_SIZE(g->target.ssrc); i++) {

Loading…
Cancel
Save