forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-09 95099d4622f8cb224d94e314c7a8e0df60b13f87
kernel/drivers/crypto/img-hash.c
....@@ -1,15 +1,13 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (c) 2014 Imagination Technologies
34 * Authors: Will Thomas, James Hartley
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License version 2 as published
7
- * by the Free Software Foundation.
85 *
96 * Interface structure taken from omap-sham driver
107 */
118
129 #include <linux/clk.h>
10
+#include <linux/dma-mapping.h>
1311 #include <linux/dmaengine.h>
1412 #include <linux/interrupt.h>
1513 #include <linux/io.h>
....@@ -106,7 +104,7 @@
106104 struct ahash_request fallback_req;
107105
108106 /* Zero length buffer must remain last member of struct */
109
- u8 buffer[0] __aligned(sizeof(u32));
107
+ u8 buffer[] __aligned(sizeof(u32));
110108 };
111109
112110 struct img_hash_ctx {
....@@ -333,12 +331,12 @@
333331 static int img_hash_dma_init(struct img_hash_dev *hdev)
334332 {
335333 struct dma_slave_config dma_conf;
336
- int err = -EINVAL;
334
+ int err;
337335
338
- hdev->dma_lch = dma_request_slave_channel(hdev->dev, "tx");
339
- if (!hdev->dma_lch) {
336
+ hdev->dma_lch = dma_request_chan(hdev->dev, "tx");
337
+ if (IS_ERR(hdev->dma_lch)) {
340338 dev_err(hdev->dev, "Couldn't acquire a slave DMA channel.\n");
341
- return -EBUSY;
339
+ return PTR_ERR(hdev->dma_lch);
342340 }
343341 dma_conf.direction = DMA_MEM_TO_DEV;
344342 dma_conf.dst_addr = hdev->bus_addr;
....@@ -961,9 +959,7 @@
961959 crypto_init_queue(&hdev->queue, IMG_HASH_QUEUE_LENGTH);
962960
963961 /* Register bank */
964
- hash_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
965
-
966
- hdev->io_base = devm_ioremap_resource(dev, hash_res);
962
+ hdev->io_base = devm_platform_ioremap_resource(pdev, 0);
967963 if (IS_ERR(hdev->io_base)) {
968964 err = PTR_ERR(hdev->io_base);
969965 dev_err(dev, "can't ioremap, returned %d\n", err);
....@@ -983,7 +979,6 @@
983979
984980 irq = platform_get_irq(pdev, 0);
985981 if (irq < 0) {
986
- dev_err(dev, "no IRQ resource info\n");
987982 err = irq;
988983 goto res_err;
989984 }