forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-10 748e4f3d702def1a4bff191e0cf93b6a05340f01
kernel/arch/arm/common/dmabounce.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * arch/arm/common/dmabounce.c
34 *
....@@ -16,10 +17,6 @@
1617 *
1718 * Copyright (C) 2002 Hewlett Packard Company.
1819 * Copyright (C) 2004 MontaVista Software, Inc.
19
- *
20
- * This program is free software; you can redistribute it and/or
21
- * modify it under the terms of the GNU General Public License
22
- * version 2 as published by the Free Software Foundation.
2320 */
2421
2522 #include <linux/module.h>
....@@ -27,7 +24,8 @@
2724 #include <linux/slab.h>
2825 #include <linux/page-flags.h>
2926 #include <linux/device.h>
30
-#include <linux/dma-mapping.h>
27
+#include <linux/dma-direct.h>
28
+#include <linux/dma-map-ops.h>
3129 #include <linux/dmapool.h>
3230 #include <linux/list.h>
3331 #include <linux/scatterlist.h>
....@@ -257,7 +255,7 @@
257255 if (buf == NULL) {
258256 dev_err(dev, "%s: unable to map unsafe buffer %p!\n",
259257 __func__, ptr);
260
- return ARM_MAPPING_ERROR;
258
+ return DMA_MAPPING_ERROR;
261259 }
262260
263261 dev_dbg(dev, "%s: unsafe buffer %p (dma=%#x) mapped to %p (dma=%#x)\n",
....@@ -327,7 +325,7 @@
327325
328326 ret = needs_bounce(dev, dma_addr, size);
329327 if (ret < 0)
330
- return ARM_MAPPING_ERROR;
328
+ return DMA_MAPPING_ERROR;
331329
332330 if (ret == 0) {
333331 arm_dma_ops.sync_single_for_device(dev, dma_addr, size, dir);
....@@ -336,7 +334,7 @@
336334
337335 if (PageHighMem(page)) {
338336 dev_err(dev, "DMA buffer bouncing of HIGHMEM pages is not supported\n");
339
- return ARM_MAPPING_ERROR;
337
+ return DMA_MAPPING_ERROR;
340338 }
341339
342340 return map_single(dev, page_address(page) + offset, size, dir, attrs);
....@@ -453,11 +451,6 @@
453451 return arm_dma_ops.dma_supported(dev, dma_mask);
454452 }
455453
456
-static int dmabounce_mapping_error(struct device *dev, dma_addr_t dma_addr)
457
-{
458
- return arm_dma_ops.mapping_error(dev, dma_addr);
459
-}
460
-
461454 static const struct dma_map_ops dmabounce_ops = {
462455 .alloc = arm_dma_alloc,
463456 .free = arm_dma_free,
....@@ -472,7 +465,6 @@
472465 .sync_sg_for_cpu = arm_dma_sync_sg_for_cpu,
473466 .sync_sg_for_device = arm_dma_sync_sg_for_device,
474467 .dma_supported = dmabounce_dma_supported,
475
- .mapping_error = dmabounce_mapping_error,
476468 };
477469
478470 static int dmabounce_init_pool(struct dmabounce_pool *pool, struct device *dev,