forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-11 072de836f53be56a70cecf70b43ae43b7ce17376
kernel/drivers/dma/qcom/bam_dma.c
....@@ -1,15 +1,6 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (c) 2013-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.
12
- *
134 */
145 /*
156 * QCOM BAM DMA engine driver
....@@ -83,7 +74,7 @@
8374 struct list_head desc_node;
8475 enum dma_transfer_direction dir;
8576 size_t length;
86
- struct bam_desc_hw desc[0];
77
+ struct bam_desc_hw desc[];
8778 };
8879
8980 enum bam_reg {
....@@ -390,7 +381,6 @@
390381 void __iomem *regs;
391382 struct device *dev;
392383 struct dma_device common;
393
- struct device_dma_parameters dma_parms;
394384 struct bam_chan *channels;
395385 u32 num_channels;
396386 u32 num_ees;
....@@ -636,8 +626,8 @@
636626 num_alloc += DIV_ROUND_UP(sg_dma_len(sg), BAM_FIFO_SIZE);
637627
638628 /* allocate enough room to accomodate the number of entries */
639
- async_desc = kzalloc(sizeof(*async_desc) +
640
- (num_alloc * sizeof(struct bam_desc_hw)), GFP_NOWAIT);
629
+ async_desc = kzalloc(struct_size(async_desc, desc, num_alloc),
630
+ GFP_NOWAIT);
641631
642632 if (!async_desc)
643633 goto err_out;
....@@ -1080,13 +1070,13 @@
10801070
10811071 /**
10821072 * dma_tasklet - DMA IRQ tasklet
1083
- * @data: tasklet argument (bam controller structure)
1073
+ * @t: tasklet argument (bam controller structure)
10841074 *
10851075 * Sets up next DMA operation and then processes all completed transactions
10861076 */
1087
-static void dma_tasklet(unsigned long data)
1077
+static void dma_tasklet(struct tasklet_struct *t)
10881078 {
1089
- struct bam_device *bdev = (struct bam_device *)data;
1079
+ struct bam_device *bdev = from_tasklet(bdev, t, task);
10901080 struct bam_chan *bchan;
10911081 unsigned long flags;
10921082 unsigned int i;
....@@ -1302,7 +1292,7 @@
13021292 if (ret)
13031293 goto err_disable_clk;
13041294
1305
- tasklet_init(&bdev->task, dma_tasklet, (unsigned long)bdev);
1295
+ tasklet_setup(&bdev->task, dma_tasklet);
13061296
13071297 bdev->channels = devm_kcalloc(bdev->dev, bdev->num_channels,
13081298 sizeof(*bdev->channels), GFP_KERNEL);
....@@ -1325,7 +1315,6 @@
13251315
13261316 /* set max dma segment size */
13271317 bdev->common.dev = bdev->dev;
1328
- bdev->common.dev->dma_parms = &bdev->dma_parms;
13291318 ret = dma_set_max_seg_size(bdev->common.dev, BAM_FIFO_SIZE);
13301319 if (ret) {
13311320 dev_err(bdev->dev, "cannot set maximum segment size\n");