summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJiri Slaby (SUSE) <jirislaby@kernel.org>2024-04-05 08:08:17 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-04-09 15:28:03 +0200
commitfea0dde081621e25bcf7efd40cce6c8272e3aa13 (patch)
tree07a7fc03929fb1a33c0e36b859e635e087e3c5d2 /lib
parentkfifo: rename l to len_to_end in setup_sgl() (diff)
downloadlinux-fea0dde081621e25bcf7efd40cce6c8272e3aa13.tar.xz
linux-fea0dde081621e25bcf7efd40cce6c8272e3aa13.zip
kfifo: pass offset to setup_sgl_buf() instead of a pointer
As a preparatory for dma addresses filling, we need the data offset instead of virtual pointer in setup_sgl_buf(). So pass the former instead the latter. And pointer to fifo is needed in setup_sgl_buf() now too. Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org> Cc: Stefani Seibold <stefani@seibold.net> Cc: Andrew Morton <akpm@linux-foundation.org> Link: https://lore.kernel.org/r/20240405060826.2521-7-jirislaby@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/kfifo.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/kfifo.c b/lib/kfifo.c
index 61e35550aea5..3a249ce4f281 100644
--- a/lib/kfifo.c
+++ b/lib/kfifo.c
@@ -305,9 +305,12 @@ int __kfifo_to_user(struct __kfifo *fifo, void __user *to,
}
EXPORT_SYMBOL(__kfifo_to_user);
-static unsigned int setup_sgl_buf(struct scatterlist *sgl, void *buf,
- int nents, unsigned int len)
+static unsigned int setup_sgl_buf(struct __kfifo *fifo, struct scatterlist *sgl,
+ unsigned int data_offset, int nents,
+ unsigned int len)
{
+ const void *buf = fifo->data + data_offset;
+
if (!nents || !len)
return 0;
@@ -332,8 +335,8 @@ static unsigned int setup_sgl(struct __kfifo *fifo, struct scatterlist *sgl,
}
len_to_end = min(len, size - off);
- n = setup_sgl_buf(sgl, fifo->data + off, nents, len_to_end);
- n += setup_sgl_buf(sgl + n, fifo->data, nents - n, len - len_to_end);
+ n = setup_sgl_buf(fifo, sgl, off, nents, len_to_end);
+ n += setup_sgl_buf(fifo, sgl + n, 0, nents - n, len - len_to_end);
return n;
}