summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2020-05-05 14:25:15 +0300
committerMark Brown <broonie@kernel.org>2020-05-05 14:25:15 +0300
commit4f18b82b020a398ee841fe9d925021e02a029be3 (patch)
tree986b9fbcefd5ffaaea229e3bbffb8ebf0fc33042
parentf13242d2c5f773428da95f9aa1231f3b2cc64ea4 (diff)
parent36c72a58d472b4032e09f165ea064a0251c9df07 (diff)
downloadlinux-4f18b82b020a398ee841fe9d925021e02a029be3.tar.xz
Merge series "Grab bag with AMD SPI fixes" from Lukas Wunner <lukas@wunner.de>:
Here's an assortment of drive-by fixes for the new AMD SPI driver. All of them are compile-tested only. Lukas Wunner (5): spi: amd: Fix duplicate iounmap in error path spi: amd: Pass probe errors back to driver core spi: amd: Drop duplicate driver data assignments spi: amd: Fix refcount underflow on remove spi: amd: Drop superfluous member from struct amd_spi drivers/spi/spi-amd.c | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) -- 2.26.2
-rw-r--r--drivers/spi/spi-amd.c27
1 files changed, 5 insertions, 22 deletions
diff --git a/drivers/spi/spi-amd.c b/drivers/spi/spi-amd.c
index c7cfc3dc20b1..d0aacd4de1b9 100644
--- a/drivers/spi/spi-amd.c
+++ b/drivers/spi/spi-amd.c
@@ -38,7 +38,6 @@ struct amd_spi {
void __iomem *io_remap_addr;
unsigned long io_base_addr;
u32 rom_addr;
- struct spi_master *master;
u8 chip_select;
};
@@ -164,9 +163,9 @@ static int amd_spi_master_setup(struct spi_device *spi)
}
static inline int amd_spi_fifo_xfer(struct amd_spi *amd_spi,
+ struct spi_master *master,
struct spi_message *message)
{
- struct spi_master *master = amd_spi->master;
struct spi_transfer *xfer = NULL;
u8 cmd_opcode;
u8 *buf = NULL;
@@ -241,7 +240,7 @@ static int amd_spi_master_transfer(struct spi_master *master,
* Extract spi_transfers from the spi message and
* program the controller.
*/
- amd_spi_fifo_xfer(amd_spi, msg);
+ amd_spi_fifo_xfer(amd_spi, master, msg);
return 0;
}
@@ -262,7 +261,6 @@ static int amd_spi_probe(struct platform_device *pdev)
}
amd_spi = spi_master_get_devdata(master);
- amd_spi->master = master;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
amd_spi->io_remap_addr = devm_ioremap_resource(&pdev->dev, res);
@@ -282,32 +280,18 @@ static int amd_spi_probe(struct platform_device *pdev)
master->transfer_one_message = amd_spi_master_transfer;
/* Register the controller with SPI framework */
- err = spi_register_master(master);
+ err = devm_spi_register_master(dev, master);
if (err) {
dev_err(dev, "error %d registering SPI controller\n", err);
- goto err_iounmap;
+ goto err_free_master;
}
- platform_set_drvdata(pdev, amd_spi);
return 0;
-err_iounmap:
- iounmap(amd_spi->io_remap_addr);
err_free_master:
spi_master_put(master);
- return 0;
-}
-
-static int amd_spi_remove(struct platform_device *pdev)
-{
- struct amd_spi *amd_spi = platform_get_drvdata(pdev);
-
- spi_unregister_master(amd_spi->master);
- spi_master_put(amd_spi->master);
- platform_set_drvdata(pdev, NULL);
-
- return 0;
+ return err;
}
static const struct acpi_device_id spi_acpi_match[] = {
@@ -322,7 +306,6 @@ static struct platform_driver amd_spi_driver = {
.acpi_match_table = ACPI_PTR(spi_acpi_match),
},
.probe = amd_spi_probe,
- .remove = amd_spi_remove,
};
module_platform_driver(amd_spi_driver);