Skip to content

Commit

Permalink
ASoC: SOF: trace: fix linker error in i386 mode
Browse files Browse the repository at this point in the history
64-bit division or modulo needs to rely on do_div, cannot use / or %
in 32-bit mode

Fixes linker error

ERROR: "__moddi3" [sound/soc/sof/snd-sof.ko] undefined!
scripts/Makefile.modpost:92: recipe for target '__modpost' failed

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
  • Loading branch information
plbossart committed Jul 23, 2018
1 parent 28a3021 commit 53eb862
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion sound/soc/sof/trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ static ssize_t sof_dfsentry_trace_read(struct file *file, char __user *buffer,
unsigned long rem;
loff_t lpos = *ppos;
size_t avail, buffer_size = dfse->size;
u64 lpos_64;

/* make sure we know about any failures on the DSP side */
sdev->dtrace_error = false;
Expand All @@ -84,7 +85,9 @@ static ssize_t sof_dfsentry_trace_read(struct file *file, char __user *buffer,
return 0;

/* check for buffer wrap and count overflow */
lpos = lpos % buffer_size;
lpos_64 = lpos;
lpos = do_div(lpos_64, buffer_size);

if (count > buffer_size - lpos)
count = buffer_size - lpos;

Expand Down

0 comments on commit 53eb862

Please sign in to comment.