Commit e7d6231e authored by Russell King's avatar Russell King

imx-drm: imx-drm-core: various cleanups

Various cleanups are possible after the previous round of changes; these
have no real functional bearing other than tidying up the code.
Acked-by: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
Acked-by: default avatarShawn Guo <shawn.guo@linaro.org>
Reviewed-by: default avatarFabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent b85f2b5d
...@@ -15,12 +15,12 @@ ...@@ -15,12 +15,12 @@
*/ */
#include <linux/component.h> #include <linux/component.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/fb.h>
#include <linux/module.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <drm/drmP.h> #include <drm/drmP.h>
#include <drm/drm_fb_helper.h> #include <drm/drm_fb_helper.h>
#include <drm/drm_crtc_helper.h> #include <drm/drm_crtc_helper.h>
#include <linux/fb.h>
#include <linux/module.h>
#include <drm/drm_gem_cma_helper.h> #include <drm/drm_gem_cma_helper.h>
#include <drm/drm_fb_cma_helper.h> #include <drm/drm_fb_cma_helper.h>
...@@ -28,12 +28,6 @@ ...@@ -28,12 +28,6 @@
#define MAX_CRTC 4 #define MAX_CRTC 4
struct crtc_cookie {
void *cookie;
int id;
struct list_head list;
};
struct imx_drm_crtc; struct imx_drm_crtc;
struct imx_drm_device { struct imx_drm_device {
...@@ -47,7 +41,8 @@ struct imx_drm_crtc { ...@@ -47,7 +41,8 @@ struct imx_drm_crtc {
struct drm_crtc *crtc; struct drm_crtc *crtc;
int pipe; int pipe;
struct imx_drm_crtc_helper_funcs imx_drm_helper_funcs; struct imx_drm_crtc_helper_funcs imx_drm_helper_funcs;
struct crtc_cookie cookie; void *cookie;
int id;
int mux_id; int mux_id;
}; };
...@@ -271,9 +266,9 @@ static int imx_drm_driver_load(struct drm_device *drm, unsigned long flags) ...@@ -271,9 +266,9 @@ static int imx_drm_driver_load(struct drm_device *drm, unsigned long flags)
goto err_kms; goto err_kms;
/* /*
* with vblank_disable_allowed = true, vblank interrupt will be disabled * with vblank_disable_allowed = true, vblank interrupt will be
* by drm timer once a current process gives up ownership of * disabled by drm timer once a current process gives up ownership
* vblank event.(after drm_vblank_put function is called) * of vblank event. (after drm_vblank_put function is called)
*/ */
drm->vblank_disable_allowed = true; drm->vblank_disable_allowed = true;
...@@ -350,26 +345,20 @@ int imx_drm_add_crtc(struct drm_device *drm, struct drm_crtc *crtc, ...@@ -350,26 +345,20 @@ int imx_drm_add_crtc(struct drm_device *drm, struct drm_crtc *crtc,
* The vblank arrays are dimensioned by MAX_CRTC - we can't * The vblank arrays are dimensioned by MAX_CRTC - we can't
* pass IDs greater than this to those functions. * pass IDs greater than this to those functions.
*/ */
if (imxdrm->pipes >= MAX_CRTC) { if (imxdrm->pipes >= MAX_CRTC)
ret = -EINVAL; return -EINVAL;
goto err_busy;
}
if (imxdrm->drm->open_count) { if (imxdrm->drm->open_count)
ret = -EBUSY; return -EBUSY;
goto err_busy;
}
imx_drm_crtc = kzalloc(sizeof(*imx_drm_crtc), GFP_KERNEL); imx_drm_crtc = kzalloc(sizeof(*imx_drm_crtc), GFP_KERNEL);
if (!imx_drm_crtc) { if (!imx_drm_crtc)
ret = -ENOMEM; return -ENOMEM;
goto err_alloc;
}
imx_drm_crtc->imx_drm_helper_funcs = *imx_drm_helper_funcs; imx_drm_crtc->imx_drm_helper_funcs = *imx_drm_helper_funcs;
imx_drm_crtc->pipe = imxdrm->pipes++; imx_drm_crtc->pipe = imxdrm->pipes++;
imx_drm_crtc->cookie.cookie = cookie; imx_drm_crtc->cookie = cookie;
imx_drm_crtc->cookie.id = id; imx_drm_crtc->id = id;
imx_drm_crtc->mux_id = imx_drm_crtc->pipe; imx_drm_crtc->mux_id = imx_drm_crtc->pipe;
imx_drm_crtc->crtc = crtc; imx_drm_crtc->crtc = crtc;
...@@ -392,8 +381,6 @@ int imx_drm_add_crtc(struct drm_device *drm, struct drm_crtc *crtc, ...@@ -392,8 +381,6 @@ int imx_drm_add_crtc(struct drm_device *drm, struct drm_crtc *crtc,
err_register: err_register:
imxdrm->crtc[imx_drm_crtc->pipe] = NULL; imxdrm->crtc[imx_drm_crtc->pipe] = NULL;
kfree(imx_drm_crtc); kfree(imx_drm_crtc);
err_alloc:
err_busy:
return ret; return ret;
} }
EXPORT_SYMBOL_GPL(imx_drm_add_crtc); EXPORT_SYMBOL_GPL(imx_drm_add_crtc);
...@@ -429,8 +416,8 @@ static uint32_t imx_drm_find_crtc_mask(struct imx_drm_device *imxdrm, ...@@ -429,8 +416,8 @@ static uint32_t imx_drm_find_crtc_mask(struct imx_drm_device *imxdrm,
for (i = 0; i < MAX_CRTC; i++) { for (i = 0; i < MAX_CRTC; i++) {
struct imx_drm_crtc *imx_drm_crtc = imxdrm->crtc[i]; struct imx_drm_crtc *imx_drm_crtc = imxdrm->crtc[i];
if (imx_drm_crtc && imx_drm_crtc->cookie.id == id && if (imx_drm_crtc && imx_drm_crtc->id == id &&
imx_drm_crtc->cookie.cookie == cookie) imx_drm_crtc->cookie == cookie)
return drm_crtc_mask(imx_drm_crtc->crtc); return drm_crtc_mask(imx_drm_crtc->crtc);
} }
......
...@@ -5,14 +5,15 @@ ...@@ -5,14 +5,15 @@
#define IPU_PIX_FMT_GBR24 v4l2_fourcc('G', 'B', 'R', '3') #define IPU_PIX_FMT_GBR24 v4l2_fourcc('G', 'B', 'R', '3')
struct device_node;
struct drm_crtc; struct drm_crtc;
struct drm_connector; struct drm_connector;
struct drm_device; struct drm_device;
struct drm_display_mode; struct drm_display_mode;
struct drm_encoder; struct drm_encoder;
struct imx_drm_crtc;
struct drm_fbdev_cma; struct drm_fbdev_cma;
struct drm_framebuffer; struct drm_framebuffer;
struct imx_drm_crtc;
struct platform_device; struct platform_device;
int imx_drm_crtc_id(struct imx_drm_crtc *crtc); int imx_drm_crtc_id(struct imx_drm_crtc *crtc);
...@@ -48,8 +49,6 @@ int imx_drm_panel_format_pins(struct drm_encoder *encoder, ...@@ -48,8 +49,6 @@ int imx_drm_panel_format_pins(struct drm_encoder *encoder,
int imx_drm_panel_format(struct drm_encoder *encoder, int imx_drm_panel_format(struct drm_encoder *encoder,
u32 interface_pix_fmt); u32 interface_pix_fmt);
struct device_node;
int imx_drm_encoder_get_mux_id(struct drm_encoder *encoder); int imx_drm_encoder_get_mux_id(struct drm_encoder *encoder);
int imx_drm_encoder_parse_of(struct drm_device *drm, int imx_drm_encoder_parse_of(struct drm_device *drm,
struct drm_encoder *encoder, struct device_node *np); struct drm_encoder *encoder, struct device_node *np);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment