Skip to content

Commit e1ada0f

Browse files
himangi774gregkh
authored andcommitted
misc: mic: Introduce the managed version of ioremap
This patch moves data allocated using ioremap to managed data allocated using devm_ioremap and cleans now unnecessary iounmaps in probe and remove functions. Also the unnecessary label iounmap is done away with. Link: https://lkml.org/lkml/2014/6/1/191 Tested-by: Sudeep Dutt <sudeep.dutt@intel.com> Signed-off-by: Himangi Saraogi <himangi774@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 9f48c89 commit e1ada0f

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

‎drivers/misc/mic/card/mic_x100.c‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,8 @@ static int __init mic_probe(struct platform_device *pdev)
200200

201201
mdev->mmio.pa = MIC_X100_MMIO_BASE;
202202
mdev->mmio.len = MIC_X100_MMIO_LEN;
203-
mdev->mmio.va = ioremap(MIC_X100_MMIO_BASE, MIC_X100_MMIO_LEN);
203+
mdev->mmio.va = devm_ioremap(&pdev->dev, MIC_X100_MMIO_BASE,
204+
MIC_X100_MMIO_LEN);
204205
if (!mdev->mmio.va) {
205206
dev_err(&pdev->dev, "Cannot remap MMIO BAR\n");
206207
rc = -EIO;
@@ -214,7 +215,7 @@ static int __init mic_probe(struct platform_device *pdev)
214215
if (IS_ERR(mdrv->dma_mbdev)) {
215216
rc = PTR_ERR(mdrv->dma_mbdev);
216217
dev_err(&pdev->dev, "mbus_add_device failed rc %d\n", rc);
217-
goto iounmap;
218+
goto done;
218219
}
219220
rc = mic_driver_init(mdrv);
220221
if (rc) {
@@ -225,19 +226,15 @@ static int __init mic_probe(struct platform_device *pdev)
225226
return rc;
226227
remove_dma:
227228
mbus_unregister_device(mdrv->dma_mbdev);
228-
iounmap:
229-
iounmap(mdev->mmio.va);
230229
return rc;
231230
}
232231

233232
static int mic_remove(struct platform_device *pdev)
234233
{
235234
struct mic_driver *mdrv = &g_drv;
236-
struct mic_device *mdev = &mdrv->mdev;
237235

238236
mic_driver_uninit(mdrv);
239237
mbus_unregister_device(mdrv->dma_mbdev);
240-
iounmap(mdev->mmio.va);
241238
return 0;
242239
}
243240

0 commit comments

Comments
 (0)