hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/crypto/qce/dma.c
....@@ -1,14 +1,6 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (c) 2012-2014, The Linux Foundation. All rights reserved.
3
- *
4
- * This program is free software; you can redistribute it and/or modify
5
- * it under the terms of the GNU General Public License version 2 and
6
- * only version 2 as published by the Free Software Foundation.
7
- *
8
- * This program is distributed in the hope that it will be useful,
9
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
10
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
- * GNU General Public License for more details.
124 */
135
146 #include <linux/dmaengine.h>
....@@ -20,11 +12,11 @@
2012 {
2113 int ret;
2214
23
- dma->txchan = dma_request_slave_channel_reason(dev, "tx");
15
+ dma->txchan = dma_request_chan(dev, "tx");
2416 if (IS_ERR(dma->txchan))
2517 return PTR_ERR(dma->txchan);
2618
27
- dma->rxchan = dma_request_slave_channel_reason(dev, "rx");
19
+ dma->rxchan = dma_request_chan(dev, "rx");
2820 if (IS_ERR(dma->rxchan)) {
2921 ret = PTR_ERR(dma->rxchan);
3022 goto error_rx;
....@@ -55,9 +47,11 @@
5547 }
5648
5749 struct scatterlist *
58
-qce_sgtable_add(struct sg_table *sgt, struct scatterlist *new_sgl)
50
+qce_sgtable_add(struct sg_table *sgt, struct scatterlist *new_sgl,
51
+ unsigned int max_len)
5952 {
6053 struct scatterlist *sg = sgt->sgl, *sg_last = NULL;
54
+ unsigned int new_len;
6155
6256 while (sg) {
6357 if (!sg_page(sg))
....@@ -68,12 +62,13 @@
6862 if (!sg)
6963 return ERR_PTR(-EINVAL);
7064
71
- while (new_sgl && sg) {
72
- sg_set_page(sg, sg_page(new_sgl), new_sgl->length,
73
- new_sgl->offset);
65
+ while (new_sgl && sg && max_len) {
66
+ new_len = new_sgl->length > max_len ? max_len : new_sgl->length;
67
+ sg_set_page(sg, sg_page(new_sgl), new_len, new_sgl->offset);
7468 sg_last = sg;
7569 sg = sg_next(sg);
7670 new_sgl = sg_next(new_sgl);
71
+ max_len -= new_len;
7772 }
7873
7974 return sg_last;