.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * DMA driver for STMicroelectronics STi FDMA controller |
---|
3 | 4 | * |
---|
.. | .. |
---|
5 | 6 | * |
---|
6 | 7 | * Author: Ludovic Barre <Ludovic.barre@st.com> |
---|
7 | 8 | * Peter Griffin <peter.griffin@linaro.org> |
---|
8 | | - * |
---|
9 | | - * This program is free software; you can redistribute it and/or modify |
---|
10 | | - * it under the terms of the GNU General Public License as published by |
---|
11 | | - * the Free Software Foundation; either version 2 of the License, or |
---|
12 | | - * (at your option) any later version. |
---|
13 | 9 | */ |
---|
14 | 10 | |
---|
15 | 11 | #include <linux/init.h> |
---|
.. | .. |
---|
19 | 15 | #include <linux/platform_device.h> |
---|
20 | 16 | #include <linux/interrupt.h> |
---|
21 | 17 | #include <linux/remoteproc.h> |
---|
| 18 | +#include <linux/slab.h> |
---|
22 | 19 | |
---|
23 | 20 | #include "st_fdma.h" |
---|
24 | 21 | |
---|
.. | .. |
---|
243 | 240 | struct st_fdma_desc *fdesc; |
---|
244 | 241 | int i; |
---|
245 | 242 | |
---|
246 | | - fdesc = kzalloc(sizeof(*fdesc) + |
---|
247 | | - sizeof(struct st_fdma_sw_node) * sg_len, GFP_NOWAIT); |
---|
| 243 | + fdesc = kzalloc(struct_size(fdesc, node, sg_len), GFP_NOWAIT); |
---|
248 | 244 | if (!fdesc) |
---|
249 | 245 | return NULL; |
---|
250 | 246 | |
---|
.. | .. |
---|
293 | 289 | struct st_fdma_chan *fchan = to_st_fdma_chan(chan); |
---|
294 | 290 | struct rproc *rproc = fchan->fdev->slim_rproc->rproc; |
---|
295 | 291 | unsigned long flags; |
---|
296 | | - |
---|
297 | | - LIST_HEAD(head); |
---|
298 | 292 | |
---|
299 | 293 | dev_dbg(fchan->fdev->dev, "%s: freeing chan:%d\n", |
---|
300 | 294 | __func__, fchan->vchan.chan.chan_id); |
---|
.. | .. |
---|
626 | 620 | static int st_fdma_pause(struct dma_chan *chan) |
---|
627 | 621 | { |
---|
628 | 622 | unsigned long flags; |
---|
629 | | - LIST_HEAD(head); |
---|
630 | 623 | struct st_fdma_chan *fchan = to_st_fdma_chan(chan); |
---|
631 | 624 | int ch_id = fchan->vchan.chan.chan_id; |
---|
632 | 625 | unsigned long cmd = FDMA_CMD_PAUSE(ch_id); |
---|
.. | .. |
---|
779 | 772 | platform_set_drvdata(pdev, fdev); |
---|
780 | 773 | |
---|
781 | 774 | fdev->irq = platform_get_irq(pdev, 0); |
---|
782 | | - if (fdev->irq < 0) { |
---|
783 | | - dev_err(&pdev->dev, "Failed to get irq resource\n"); |
---|
| 775 | + if (fdev->irq < 0) |
---|
784 | 776 | return -EINVAL; |
---|
785 | | - } |
---|
786 | 777 | |
---|
787 | 778 | ret = devm_request_irq(&pdev->dev, fdev->irq, st_fdma_irq_handler, 0, |
---|
788 | 779 | dev_name(&pdev->dev), fdev); |
---|
.. | .. |
---|
833 | 824 | fdev->dma_device.directions = BIT(DMA_DEV_TO_MEM) | BIT(DMA_MEM_TO_DEV); |
---|
834 | 825 | fdev->dma_device.residue_granularity = DMA_RESIDUE_GRANULARITY_BURST; |
---|
835 | 826 | |
---|
836 | | - ret = dma_async_device_register(&fdev->dma_device); |
---|
| 827 | + ret = dmaenginem_async_device_register(&fdev->dma_device); |
---|
837 | 828 | if (ret) { |
---|
838 | 829 | dev_err(&pdev->dev, |
---|
839 | 830 | "Failed to register DMA device (%d)\n", ret); |
---|
.. | .. |
---|
844 | 835 | if (ret) { |
---|
845 | 836 | dev_err(&pdev->dev, |
---|
846 | 837 | "Failed to register controller (%d)\n", ret); |
---|
847 | | - goto err_dma_dev; |
---|
| 838 | + goto err_rproc; |
---|
848 | 839 | } |
---|
849 | 840 | |
---|
850 | 841 | dev_info(&pdev->dev, "ST FDMA engine driver, irq:%d\n", fdev->irq); |
---|
851 | 842 | |
---|
852 | 843 | return 0; |
---|
853 | 844 | |
---|
854 | | -err_dma_dev: |
---|
855 | | - dma_async_device_unregister(&fdev->dma_device); |
---|
856 | 845 | err_rproc: |
---|
857 | 846 | st_fdma_free(fdev); |
---|
858 | 847 | st_slim_rproc_put(fdev->slim_rproc); |
---|
.. | .. |
---|
867 | 856 | devm_free_irq(&pdev->dev, fdev->irq, fdev); |
---|
868 | 857 | st_slim_rproc_put(fdev->slim_rproc); |
---|
869 | 858 | of_dma_controller_free(pdev->dev.of_node); |
---|
870 | | - dma_async_device_unregister(&fdev->dma_device); |
---|
871 | 859 | |
---|
872 | 860 | return 0; |
---|
873 | 861 | } |
---|