Commit b798f772 authored by Yangtao Li's avatar Yangtao Li Committed by Miquel Raynal
Browse files

mtd: nand: omap: Use devm_platform_get_and_ioremap_resource()



Convert platform_get_resource(), devm_ioremap_resource() to a single
call to devm_platform_get_and_ioremap_resource(), as this is exactly
what this function does.

Signed-off-by: default avatarYangtao Li <frank.li@vivo.com>
Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20230713104422.29222-1-frank.li@vivo.com
parent 717a5383
Loading
Loading
Loading
Loading
+2 −8
Original line number Diff line number Diff line
@@ -467,12 +467,6 @@ static int omap2_onenand_probe(struct platform_device *pdev)
	struct device *dev = &pdev->dev;
	struct device_node *np = dev->of_node;

	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
	if (!res) {
		dev_err(dev, "error getting memory resource\n");
		return -EINVAL;
	}

	r = of_property_read_u32(np, "reg", &val);
	if (r) {
		dev_err(dev, "reg not found in DT\n");
@@ -486,11 +480,11 @@ static int omap2_onenand_probe(struct platform_device *pdev)
	init_completion(&c->irq_done);
	init_completion(&c->dma_done);
	c->gpmc_cs = val;
	c->phys_base = res->start;

	c->onenand.base = devm_ioremap_resource(dev, res);
	c->onenand.base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
	if (IS_ERR(c->onenand.base))
		return PTR_ERR(c->onenand.base);
	c->phys_base = res->start;

	c->int_gpiod = devm_gpiod_get_optional(dev, "int", GPIOD_IN);
	if (IS_ERR(c->int_gpiod)) {