Commit 4e12ef2b authored by Yang Yingliang's avatar Yang Yingliang Committed by Mark Brown

spi: cadence-quadspi: Use devm_platform_{get_and_}ioremap_resource()

Use the devm_platform_{get_and}_ioremap_resource() helper instead of
calling platform_get_resource() and devm_ioremap_resource() separately.
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20220928145852.1882221-2-yangyingliang@huawei.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent a008ae9f
...@@ -1580,7 +1580,6 @@ static int cqspi_probe(struct platform_device *pdev) ...@@ -1580,7 +1580,6 @@ static int cqspi_probe(struct platform_device *pdev)
struct spi_master *master; struct spi_master *master;
struct resource *res_ahb; struct resource *res_ahb;
struct cqspi_st *cqspi; struct cqspi_st *cqspi;
struct resource *res;
int ret; int ret;
int irq; int irq;
...@@ -1616,8 +1615,7 @@ static int cqspi_probe(struct platform_device *pdev) ...@@ -1616,8 +1615,7 @@ static int cqspi_probe(struct platform_device *pdev)
} }
/* Obtain and remap controller address. */ /* Obtain and remap controller address. */
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); cqspi->iobase = devm_platform_ioremap_resource(pdev, 0);
cqspi->iobase = devm_ioremap_resource(dev, res);
if (IS_ERR(cqspi->iobase)) { if (IS_ERR(cqspi->iobase)) {
dev_err(dev, "Cannot remap controller address.\n"); dev_err(dev, "Cannot remap controller address.\n");
ret = PTR_ERR(cqspi->iobase); ret = PTR_ERR(cqspi->iobase);
...@@ -1625,8 +1623,7 @@ static int cqspi_probe(struct platform_device *pdev) ...@@ -1625,8 +1623,7 @@ static int cqspi_probe(struct platform_device *pdev)
} }
/* Obtain and remap AHB address. */ /* Obtain and remap AHB address. */
res_ahb = platform_get_resource(pdev, IORESOURCE_MEM, 1); cqspi->ahb_base = devm_platform_get_and_ioremap_resource(pdev, 1, &res_ahb);
cqspi->ahb_base = devm_ioremap_resource(dev, res_ahb);
if (IS_ERR(cqspi->ahb_base)) { if (IS_ERR(cqspi->ahb_base)) {
dev_err(dev, "Cannot remap AHB address.\n"); dev_err(dev, "Cannot remap AHB address.\n");
ret = PTR_ERR(cqspi->ahb_base); ret = PTR_ERR(cqspi->ahb_base);
......
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