Commit fa79f200 authored by YueHaibing's avatar YueHaibing Committed by Mark Brown

spi: sifive: use devm_platform_ioremap_resource() to simplify code

Use devm_platform_ioremap_resource() to simplify the code a bit.
This is detected by coccinelle.
Reported-by: default avatarHulk Robot <hulkci@huawei.com>
Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
Link: https://lore.kernel.org/r/20190904135918.25352-27-yuehaibing@huawei.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent b38f1f9b
...@@ -292,7 +292,6 @@ sifive_spi_transfer_one(struct spi_master *master, struct spi_device *device, ...@@ -292,7 +292,6 @@ sifive_spi_transfer_one(struct spi_master *master, struct spi_device *device,
static int sifive_spi_probe(struct platform_device *pdev) static int sifive_spi_probe(struct platform_device *pdev)
{ {
struct sifive_spi *spi; struct sifive_spi *spi;
struct resource *res;
int ret, irq, num_cs; int ret, irq, num_cs;
u32 cs_bits, max_bits_per_word; u32 cs_bits, max_bits_per_word;
struct spi_master *master; struct spi_master *master;
...@@ -307,8 +306,7 @@ static int sifive_spi_probe(struct platform_device *pdev) ...@@ -307,8 +306,7 @@ static int sifive_spi_probe(struct platform_device *pdev)
init_completion(&spi->done); init_completion(&spi->done);
platform_set_drvdata(pdev, master); platform_set_drvdata(pdev, master);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); spi->regs = devm_platform_ioremap_resource(pdev, 0);
spi->regs = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(spi->regs)) { if (IS_ERR(spi->regs)) {
ret = PTR_ERR(spi->regs); ret = PTR_ERR(spi->regs);
goto put_master; goto put_master;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment