diff options
author | Maxime Ripard <maxime.ripard@free-electrons.com> | 2017-02-09 19:39:18 +0300 |
---|---|---|
committer | Maxime Ripard <maxime.ripard@free-electrons.com> | 2017-03-08 00:24:02 +0300 |
commit | 596afb6f051382aa0cb067e4d6b3080e51531ddc (patch) | |
tree | 6819312277c76411e44627e0c2707a3e67f0d725 /drivers/gpu/drm/sun4i/sun4i_drv.c | |
parent | 3c64fb37475d7eb99aa01b46af1edb3863261640 (diff) | |
download | linux-596afb6f051382aa0cb067e4d6b3080e51531ddc.tar.xz |
drm/sun4i: Grab reserved memory region
Allow to provide an optional memory region to allocate from for our DRM
driver.
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Diffstat (limited to 'drivers/gpu/drm/sun4i/sun4i_drv.c')
-rw-r--r-- | drivers/gpu/drm/sun4i/sun4i_drv.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c index 1de15cd1b102..767bbadcc85d 100644 --- a/drivers/gpu/drm/sun4i/sun4i_drv.c +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c @@ -12,6 +12,7 @@ #include <linux/component.h> #include <linux/of_graph.h> +#include <linux/of_reserved_mem.h> #include <drm/drmP.h> #include <drm/drm_crtc_helper.h> @@ -101,10 +102,16 @@ static int sun4i_drv_bind(struct device *dev) } drm->dev_private = drv; + ret = of_reserved_mem_device_init(dev); + if (ret && ret != -ENODEV) { + dev_err(drm->dev, "Couldn't claim our memory region\n"); + goto free_drm; + } + /* drm_vblank_init calls kcalloc, which can fail */ ret = drm_vblank_init(drm, 1); if (ret) - goto free_drm; + goto free_mem_region; drm_mode_config_init(drm); @@ -142,6 +149,8 @@ finish_poll: cleanup_mode_config: drm_mode_config_cleanup(drm); drm_vblank_cleanup(drm); +free_mem_region: + of_reserved_mem_device_release(dev); free_drm: drm_dev_unref(drm); return ret; @@ -156,6 +165,7 @@ static void sun4i_drv_unbind(struct device *dev) sun4i_framebuffer_free(drm); drm_mode_config_cleanup(drm); drm_vblank_cleanup(drm); + of_reserved_mem_device_release(dev); drm_dev_unref(drm); } |