spi: lantiq-ssc: Use devm_platform_ioremap_resource() in lantiq_ssc_probe()
Simplify this function implementation by using a known wrapper function. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Link: https://lore.kernel.org/r/230495a7-b754-bc6a-05e0-059a6b6c643d@web.de Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
539ff2488a
commit
22262695f4
@ -797,7 +797,6 @@ static int lantiq_ssc_probe(struct platform_device *pdev)
|
|||||||
{
|
{
|
||||||
struct device *dev = &pdev->dev;
|
struct device *dev = &pdev->dev;
|
||||||
struct spi_master *master;
|
struct spi_master *master;
|
||||||
struct resource *res;
|
|
||||||
struct lantiq_ssc_spi *spi;
|
struct lantiq_ssc_spi *spi;
|
||||||
const struct lantiq_ssc_hwcfg *hwcfg;
|
const struct lantiq_ssc_hwcfg *hwcfg;
|
||||||
const struct of_device_id *match;
|
const struct of_device_id *match;
|
||||||
@ -812,12 +811,6 @@ static int lantiq_ssc_probe(struct platform_device *pdev)
|
|||||||
}
|
}
|
||||||
hwcfg = match->data;
|
hwcfg = match->data;
|
||||||
|
|
||||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
|
||||||
if (!res) {
|
|
||||||
dev_err(dev, "failed to get resources\n");
|
|
||||||
return -ENXIO;
|
|
||||||
}
|
|
||||||
|
|
||||||
rx_irq = platform_get_irq_byname(pdev, LTQ_SPI_RX_IRQ_NAME);
|
rx_irq = platform_get_irq_byname(pdev, LTQ_SPI_RX_IRQ_NAME);
|
||||||
if (rx_irq < 0)
|
if (rx_irq < 0)
|
||||||
return -ENXIO;
|
return -ENXIO;
|
||||||
@ -839,8 +832,7 @@ static int lantiq_ssc_probe(struct platform_device *pdev)
|
|||||||
spi->dev = dev;
|
spi->dev = dev;
|
||||||
spi->hwcfg = hwcfg;
|
spi->hwcfg = hwcfg;
|
||||||
platform_set_drvdata(pdev, spi);
|
platform_set_drvdata(pdev, spi);
|
||||||
|
spi->regbase = devm_platform_ioremap_resource(pdev, 0);
|
||||||
spi->regbase = devm_ioremap_resource(dev, res);
|
|
||||||
if (IS_ERR(spi->regbase)) {
|
if (IS_ERR(spi->regbase)) {
|
||||||
err = PTR_ERR(spi->regbase);
|
err = PTR_ERR(spi->regbase);
|
||||||
goto err_master_put;
|
goto err_master_put;
|
||||||
|
Loading…
Reference in New Issue
Block a user