hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/dma/timb_dma.c
....@@ -1,15 +1,7 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * timb_dma.c timberdale FPGA DMA driver
34 * Copyright (c) 2010 Intel Corporation
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
7
- * published by the Free Software Foundation.
8
- *
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU General Public License for more details.
135 */
146
157 /* Supports:
....@@ -96,7 +88,7 @@
9688 struct dma_device dma;
9789 void __iomem *membase;
9890 struct tasklet_struct tasklet;
99
- struct timb_dma_chan channels[0];
91
+ struct timb_dma_chan channels[];
10092 };
10193
10294 static struct device *chan2dev(struct dma_chan *chan)
....@@ -571,9 +563,9 @@
571563 return 0;
572564 }
573565
574
-static void td_tasklet(unsigned long data)
566
+static void td_tasklet(struct tasklet_struct *t)
575567 {
576
- struct timb_dma *td = (struct timb_dma *)data;
568
+ struct timb_dma *td = from_tasklet(td, t, tasklet);
577569 u32 isr;
578570 u32 ipr;
579571 u32 ier;
....@@ -643,8 +635,8 @@
643635 DRIVER_NAME))
644636 return -EBUSY;
645637
646
- td = kzalloc(sizeof(struct timb_dma) +
647
- sizeof(struct timb_dma_chan) * pdata->nr_channels, GFP_KERNEL);
638
+ td = kzalloc(struct_size(td, channels, pdata->nr_channels),
639
+ GFP_KERNEL);
648640 if (!td) {
649641 err = -ENOMEM;
650642 goto err_release_region;
....@@ -666,7 +658,7 @@
666658 iowrite32(0x0, td->membase + TIMBDMA_IER);
667659 iowrite32(0xFFFFFFFF, td->membase + TIMBDMA_ISR);
668660
669
- tasklet_init(&td->tasklet, td_tasklet, (unsigned long)td);
661
+ tasklet_setup(&td->tasklet, td_tasklet);
670662
671663 err = request_irq(irq, td_irq, IRQF_SHARED, DRIVER_NAME, td);
672664 if (err) {