.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * timb_dma.c timberdale FPGA DMA driver |
---|
3 | 4 | * 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. |
---|
13 | 5 | */ |
---|
14 | 6 | |
---|
15 | 7 | /* Supports: |
---|
.. | .. |
---|
96 | 88 | struct dma_device dma; |
---|
97 | 89 | void __iomem *membase; |
---|
98 | 90 | struct tasklet_struct tasklet; |
---|
99 | | - struct timb_dma_chan channels[0]; |
---|
| 91 | + struct timb_dma_chan channels[]; |
---|
100 | 92 | }; |
---|
101 | 93 | |
---|
102 | 94 | static struct device *chan2dev(struct dma_chan *chan) |
---|
.. | .. |
---|
571 | 563 | return 0; |
---|
572 | 564 | } |
---|
573 | 565 | |
---|
574 | | -static void td_tasklet(unsigned long data) |
---|
| 566 | +static void td_tasklet(struct tasklet_struct *t) |
---|
575 | 567 | { |
---|
576 | | - struct timb_dma *td = (struct timb_dma *)data; |
---|
| 568 | + struct timb_dma *td = from_tasklet(td, t, tasklet); |
---|
577 | 569 | u32 isr; |
---|
578 | 570 | u32 ipr; |
---|
579 | 571 | u32 ier; |
---|
.. | .. |
---|
643 | 635 | DRIVER_NAME)) |
---|
644 | 636 | return -EBUSY; |
---|
645 | 637 | |
---|
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); |
---|
648 | 640 | if (!td) { |
---|
649 | 641 | err = -ENOMEM; |
---|
650 | 642 | goto err_release_region; |
---|
.. | .. |
---|
666 | 658 | iowrite32(0x0, td->membase + TIMBDMA_IER); |
---|
667 | 659 | iowrite32(0xFFFFFFFF, td->membase + TIMBDMA_ISR); |
---|
668 | 660 | |
---|
669 | | - tasklet_init(&td->tasklet, td_tasklet, (unsigned long)td); |
---|
| 661 | + tasklet_setup(&td->tasklet, td_tasklet); |
---|
670 | 662 | |
---|
671 | 663 | err = request_irq(irq, td_irq, IRQF_SHARED, DRIVER_NAME, td); |
---|
672 | 664 | if (err) { |
---|