Skip to content

Commit 58c5a0e

Browse files
bbrezillonmiquelraynal
authored andcommitted
mtd: rawnand: fsl_upm: Use platform_get_resource() + devm_ioremap_resource()
Replace the of_address_to_resource() + devm_ioremap() calls by platform_get_resource() + devm_ioremap_resource() ones which allows us to get rid of one error message since devm_ioremap_resource() already takes care of that. Signed-off-by: Boris Brezillon <[email protected]> Signed-off-by: Miquel Raynal <[email protected]> Link: https://lore.kernel.org/linux-mtd/[email protected]
1 parent 0016648 commit 58c5a0e

File tree

1 file changed

+7
-16
lines changed

1 file changed

+7
-16
lines changed

drivers/mtd/nand/raw/fsl_upm.c

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#include <linux/mtd/nand_ecc.h>
1515
#include <linux/mtd/partitions.h>
1616
#include <linux/mtd/mtd.h>
17-
#include <linux/of_address.h>
1817
#include <linux/of_platform.h>
1918
#include <linux/of_gpio.h>
2019
#include <linux/io.h>
@@ -197,7 +196,7 @@ static int fun_chip_init(struct fsl_upm_nand *fun,
197196
static int fun_probe(struct platform_device *ofdev)
198197
{
199198
struct fsl_upm_nand *fun;
200-
struct resource io_res;
199+
struct resource *io_res;
201200
const __be32 *prop;
202201
int rnb_gpio;
203202
int ret;
@@ -208,13 +207,12 @@ static int fun_probe(struct platform_device *ofdev)
208207
if (!fun)
209208
return -ENOMEM;
210209

211-
ret = of_address_to_resource(ofdev->dev.of_node, 0, &io_res);
212-
if (ret) {
213-
dev_err(&ofdev->dev, "can't get IO base\n");
214-
return ret;
215-
}
210+
io_res = platform_get_resource(ofdev, IORESOURCE_MEM, 0);
211+
fun->io_base = devm_ioremap_resource(&ofdev->dev, io_res);
212+
if (IS_ERR(fun->io_base))
213+
return PTR_ERR(fun->io_base);
216214

217-
ret = fsl_upm_find(io_res.start, &fun->upm);
215+
ret = fsl_upm_find(io_res->start, &fun->upm);
218216
if (ret) {
219217
dev_err(&ofdev->dev, "can't find UPM\n");
220218
return ret;
@@ -280,17 +278,10 @@ static int fun_probe(struct platform_device *ofdev)
280278
fun->wait_flags = FSL_UPM_WAIT_RUN_PATTERN |
281279
FSL_UPM_WAIT_WRITE_BYTE;
282280

283-
fun->io_base = devm_ioremap(&ofdev->dev, io_res.start,
284-
resource_size(&io_res));
285-
if (!fun->io_base) {
286-
ret = -ENOMEM;
287-
goto err2;
288-
}
289-
290281
fun->dev = &ofdev->dev;
291282
fun->last_ctrl = NAND_CLE;
292283

293-
ret = fun_chip_init(fun, ofdev->dev.of_node, &io_res);
284+
ret = fun_chip_init(fun, ofdev->dev.of_node, io_res);
294285
if (ret)
295286
goto err2;
296287

0 commit comments

Comments
 (0)