hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/spi/spi-fsl-cpm.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Freescale SPI controller driver cpm functions.
34 *
....@@ -9,11 +10,6 @@
910 * CPM SPI and QE buffer descriptors mode support:
1011 * Copyright (c) 2009 MontaVista Software, Inc.
1112 * Author: Anton Vorontsov <avorontsov@ru.mvista.com>
12
- *
13
- * This program is free software; you can redistribute it and/or modify it
14
- * under the terms of the GNU General Public License as published by the
15
- * Free Software Foundation; either version 2 of the License, or (at your
16
- * option) any later version.
1713 */
1814 #include <asm/cpm.h>
1915 #include <soc/fsl/qe/qe.h>
....@@ -230,7 +226,7 @@
230226 case 1:
231227 kfree(fsl_dummy_rx);
232228 fsl_dummy_rx = NULL;
233
- /* fall through */
229
+ fallthrough;
234230 default:
235231 fsl_dummy_rx_refcnt--;
236232 break;
....@@ -298,7 +294,7 @@
298294 switch (mspi->subblock) {
299295 default:
300296 dev_warn(dev, "cell-index unspecified, assuming SPI1\n");
301
- /* fall through */
297
+ fallthrough;
302298 case 0:
303299 mspi->subblock = QE_CR_SUBBLOCK_SPI1;
304300 break;
....@@ -309,12 +305,10 @@
309305 }
310306
311307 if (mspi->flags & SPI_CPM1) {
312
- struct resource *res;
313308 void *pram;
314309
315
- res = platform_get_resource(to_platform_device(dev),
316
- IORESOURCE_MEM, 1);
317
- pram = devm_ioremap_resource(dev, res);
310
+ pram = devm_platform_ioremap_resource(to_platform_device(dev),
311
+ 1);
318312 if (IS_ERR(pram))
319313 mspi->pram = NULL;
320314 else
....@@ -398,7 +392,8 @@
398392 dma_unmap_single(dev, mspi->dma_dummy_rx, SPI_MRBLR, DMA_FROM_DEVICE);
399393 dma_unmap_single(dev, mspi->dma_dummy_tx, PAGE_SIZE, DMA_TO_DEVICE);
400394 cpm_muram_free(cpm_muram_offset(mspi->tx_bd));
401
- cpm_muram_free(cpm_muram_offset(mspi->pram));
395
+ if (!(mspi->flags & SPI_CPM1))
396
+ cpm_muram_free(cpm_muram_offset(mspi->pram));
402397 fsl_spi_free_dummy_rx();
403398 }
404399 EXPORT_SYMBOL_GPL(fsl_spi_cpm_free);