提交 00d09891 编写于 作者: J Jingoo Han 提交者: Brian Norris

mtd: omap2: Use devm_ioremap_resource()

Use devm_ioremap_resource() in order to make the code simpler,
and remove redundant return value check of platform_get_resource()
because the value is checked by devm_ioremap_resource(). Also,
'unsigned long mem_size' is removed from 'struct omap_nand_info',
because the 'mem_size' variable is not necessary anymore.
Signed-off-by: NJingoo Han <jg1.han@samsung.com>
Signed-off-by: NBrian Norris <computersforpeace@gmail.com>
上级 7995204e
无相关合并请求
...@@ -154,7 +154,6 @@ struct omap_nand_info { ...@@ -154,7 +154,6 @@ struct omap_nand_info {
int gpmc_cs; int gpmc_cs;
unsigned long phys_base; unsigned long phys_base;
unsigned long mem_size;
enum omap_ecc ecc_opt; enum omap_ecc ecc_opt;
struct completion comp; struct completion comp;
struct dma_chan *dma; struct dma_chan *dma;
...@@ -1607,27 +1606,11 @@ static int omap_nand_probe(struct platform_device *pdev) ...@@ -1607,27 +1606,11 @@ static int omap_nand_probe(struct platform_device *pdev)
nand_chip->options |= NAND_SKIP_BBTSCAN; nand_chip->options |= NAND_SKIP_BBTSCAN;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (res == NULL) { nand_chip->IO_ADDR_R = devm_ioremap_resource(&pdev->dev, res);
err = -EINVAL; if (IS_ERR(nand_chip->IO_ADDR_R))
dev_err(&pdev->dev, "error getting memory resource\n"); return PTR_ERR(nand_chip->IO_ADDR_R);
goto return_error;
}
info->phys_base = res->start; info->phys_base = res->start;
info->mem_size = resource_size(res);
if (!devm_request_mem_region(&pdev->dev, info->phys_base,
info->mem_size, pdev->dev.driver->name)) {
err = -EBUSY;
goto return_error;
}
nand_chip->IO_ADDR_R = devm_ioremap(&pdev->dev, info->phys_base,
info->mem_size);
if (!nand_chip->IO_ADDR_R) {
err = -ENOMEM;
goto return_error;
}
nand_chip->controller = &info->controller; nand_chip->controller = &info->controller;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册
反馈
建议
客服 返回
顶部