mtd: rawnand: atmel: Make use of the helper function devm_platform_ioremap_resource()
Use the devm_platform_ioremap_resource() helper instead of calling platform_get_resource() and devm_ioremap_resource() separately Signed-off-by: Cai Huoqing <caihuoqing@baidu.com> Reviewed-by: Nicolas Ferre <nicolas.ferre@microchip.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20210901074031.8883-1-caihuoqing@baidu.com
This commit is contained in:
parent
a2aec2c86e
commit
c606d4f77c
|
@ -834,7 +834,6 @@ static struct atmel_pmecc *atmel_pmecc_create(struct platform_device *pdev,
|
||||||
{
|
{
|
||||||
struct device *dev = &pdev->dev;
|
struct device *dev = &pdev->dev;
|
||||||
struct atmel_pmecc *pmecc;
|
struct atmel_pmecc *pmecc;
|
||||||
struct resource *res;
|
|
||||||
|
|
||||||
pmecc = devm_kzalloc(dev, sizeof(*pmecc), GFP_KERNEL);
|
pmecc = devm_kzalloc(dev, sizeof(*pmecc), GFP_KERNEL);
|
||||||
if (!pmecc)
|
if (!pmecc)
|
||||||
|
@ -844,13 +843,11 @@ static struct atmel_pmecc *atmel_pmecc_create(struct platform_device *pdev,
|
||||||
pmecc->dev = dev;
|
pmecc->dev = dev;
|
||||||
mutex_init(&pmecc->lock);
|
mutex_init(&pmecc->lock);
|
||||||
|
|
||||||
res = platform_get_resource(pdev, IORESOURCE_MEM, pmecc_res_idx);
|
pmecc->regs.base = devm_platform_ioremap_resource(pdev, pmecc_res_idx);
|
||||||
pmecc->regs.base = devm_ioremap_resource(dev, res);
|
|
||||||
if (IS_ERR(pmecc->regs.base))
|
if (IS_ERR(pmecc->regs.base))
|
||||||
return ERR_CAST(pmecc->regs.base);
|
return ERR_CAST(pmecc->regs.base);
|
||||||
|
|
||||||
res = platform_get_resource(pdev, IORESOURCE_MEM, errloc_res_idx);
|
pmecc->regs.errloc = devm_platform_ioremap_resource(pdev, errloc_res_idx);
|
||||||
pmecc->regs.errloc = devm_ioremap_resource(dev, res);
|
|
||||||
if (IS_ERR(pmecc->regs.errloc))
|
if (IS_ERR(pmecc->regs.errloc))
|
||||||
return ERR_CAST(pmecc->regs.errloc);
|
return ERR_CAST(pmecc->regs.errloc);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue