summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/imx/dcss/dcss-ctxld.c
diff options
context:
space:
mode:
authorPhilipp Stanner <pstanner@redhat.com>2024-01-24 12:19:05 +0100
committerLaurentiu Palcu <laurentiu.palcu@oss.nxp.com>2024-02-02 15:36:21 +0200
commit2bb98fc1d4a7715da3cb429d77731b0d1d2d3903 (patch)
treee98d498a19f3cec162f6add63c1507c9ae9606f3 /drivers/gpu/drm/imx/dcss/dcss-ctxld.c
parent90393c9b5408cafededdee2f34082c4c3c671901 (diff)
drm/imx/dcss: have all init functions use devres
dcss currently allocates and ioremaps quite a few resources in its probe function's call graph. Devres now provides convenient functions which perform the same task but do the cleanup automatically. Port all memory allocations and ioremap() calls to the devres counterparts. Signed-off-by: Philipp Stanner <pstanner@redhat.com> Reviewed-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com> Signed-off-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240124111904.18261-4-pstanner@redhat.com
Diffstat (limited to 'drivers/gpu/drm/imx/dcss/dcss-ctxld.c')
-rw-r--r--drivers/gpu/drm/imx/dcss/dcss-ctxld.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/drivers/gpu/drm/imx/dcss/dcss-ctxld.c b/drivers/gpu/drm/imx/dcss/dcss-ctxld.c
index 3a84cb3209c4..e41d5c2a3ea4 100644
--- a/drivers/gpu/drm/imx/dcss/dcss-ctxld.c
+++ b/drivers/gpu/drm/imx/dcss/dcss-ctxld.c
@@ -202,7 +202,7 @@ int dcss_ctxld_init(struct dcss_dev *dcss, unsigned long ctxld_base)
struct dcss_ctxld *ctxld;
int ret;
- ctxld = kzalloc(sizeof(*ctxld), GFP_KERNEL);
+ ctxld = devm_kzalloc(dcss->dev, sizeof(*ctxld), GFP_KERNEL);
if (!ctxld)
return -ENOMEM;
@@ -217,7 +217,7 @@ int dcss_ctxld_init(struct dcss_dev *dcss, unsigned long ctxld_base)
goto err;
}
- ctxld->ctxld_reg = ioremap(ctxld_base, SZ_4K);
+ ctxld->ctxld_reg = devm_ioremap(dcss->dev, ctxld_base, SZ_4K);
if (!ctxld->ctxld_reg) {
dev_err(dcss->dev, "ctxld: unable to remap ctxld base\n");
ret = -ENOMEM;
@@ -226,18 +226,14 @@ int dcss_ctxld_init(struct dcss_dev *dcss, unsigned long ctxld_base)
ret = dcss_ctxld_irq_config(ctxld, to_platform_device(dcss->dev));
if (ret)
- goto err_irq;
+ goto err;
dcss_ctxld_hw_cfg(ctxld);
return 0;
-err_irq:
- iounmap(ctxld->ctxld_reg);
-
err:
dcss_ctxld_free_ctx(ctxld);
- kfree(ctxld);
return ret;
}
@@ -246,11 +242,7 @@ void dcss_ctxld_exit(struct dcss_ctxld *ctxld)
{
free_irq(ctxld->irq, ctxld);
- if (ctxld->ctxld_reg)
- iounmap(ctxld->ctxld_reg);
-
dcss_ctxld_free_ctx(ctxld);
- kfree(ctxld);
}
static int dcss_ctxld_enable_locked(struct dcss_ctxld *ctxld)