hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/spi/spi-armada-3700.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Marvell Armada-3700 SPI controller driver
34 *
....@@ -5,10 +6,6 @@
56 *
67 * Author: Wilson Ding <dingwei@marvell.com>
78 * Author: Romain Perier <romain.perier@free-electrons.com>
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 version 2 as
11
- * published by the Free Software Foundation.
129 */
1310
1411 #include <linux/clk.h>
....@@ -279,11 +276,11 @@
279276 return -ETIMEDOUT;
280277 }
281278
282
-static int a3700_spi_init(struct a3700_spi *a3700_spi)
279
+static void a3700_spi_init(struct a3700_spi *a3700_spi)
283280 {
284281 struct spi_master *master = a3700_spi->master;
285282 u32 val;
286
- int i, ret = 0;
283
+ int i;
287284
288285 /* Reset SPI unit */
289286 val = spireg_read(a3700_spi, A3700_SPI_IF_CFG_REG);
....@@ -314,8 +311,6 @@
314311 /* Mask the interrupts and clear cause bits */
315312 spireg_write(a3700_spi, A3700_SPI_INT_MASK_REG, 0);
316313 spireg_write(a3700_spi, A3700_SPI_INT_STAT_REG, ~0U);
317
-
318
- return ret;
319314 }
320315
321316 static irqreturn_t a3700_spi_interrupt(int irq, void *dev_id)
....@@ -820,7 +815,6 @@
820815 {
821816 struct device *dev = &pdev->dev;
822817 struct device_node *of_node = dev->of_node;
823
- struct resource *res;
824818 struct spi_master *master;
825819 struct a3700_spi *spi;
826820 u32 num_cs = 0;
....@@ -854,12 +848,10 @@
854848 platform_set_drvdata(pdev, master);
855849
856850 spi = spi_master_get_devdata(master);
857
- memset(spi, 0, sizeof(struct a3700_spi));
858851
859852 spi->master = master;
860853
861
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
862
- spi->base = devm_ioremap_resource(dev, res);
854
+ spi->base = devm_platform_ioremap_resource(pdev, 0);
863855 if (IS_ERR(spi->base)) {
864856 ret = PTR_ERR(spi->base);
865857 goto error;
....@@ -867,7 +859,6 @@
867859
868860 irq = platform_get_irq(pdev, 0);
869861 if (irq < 0) {
870
- dev_err(dev, "could not get irq: %d\n", irq);
871862 ret = -ENXIO;
872863 goto error;
873864 }
....@@ -892,9 +883,7 @@
892883 master->min_speed_hz = DIV_ROUND_UP(clk_get_rate(spi->clk),
893884 A3700_SPI_MAX_PRESCALE);
894885
895
- ret = a3700_spi_init(spi);
896
- if (ret)
897
- goto error_clk;
886
+ a3700_spi_init(spi);
898887
899888 ret = devm_request_irq(dev, spi->irq, a3700_spi_interrupt, 0,
900889 dev_name(dev), master);