Skip to content

Commit

Permalink
drm/exynos/fimd: stop using manager->ctx pointer
Browse files Browse the repository at this point in the history
The patch replaces accesses to manager->ctx pointer by container_of
construct. As fimd was the last user of ctx the patch removes
this field as well.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
  • Loading branch information
Andrzej Hajda authored and Inki Dae committed Nov 24, 2014
1 parent e152dbd commit 400c8ac
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 19 deletions.
1 change: 0 additions & 1 deletion drivers/gpu/drm/exynos/exynos_drm_drv.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@ struct exynos_drm_manager {
struct drm_crtc *crtc;
int pipe;
struct exynos_drm_manager_ops *ops;
void *ctx;
};

struct exynos_drm_g2d_private {
Expand Down
40 changes: 22 additions & 18 deletions drivers/gpu/drm/exynos/exynos_drm_fimd.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,11 @@ struct fimd_context {
struct exynos_drm_display *display;
};

static inline struct fimd_context *mgr_to_fimd(struct exynos_drm_manager *mgr)
{
return container_of(mgr, struct fimd_context, manager);
}

static const struct of_device_id fimd_driver_dt_match[] = {
{ .compatible = "samsung,s3c6400-fimd",
.data = &s3c64xx_fimd_driver_data },
Expand All @@ -211,7 +216,7 @@ static inline struct fimd_driver_data *drm_fimd_get_driver_data(

static void fimd_wait_for_vblank(struct exynos_drm_manager *mgr)
{
struct fimd_context *ctx = mgr->ctx;
struct fimd_context *ctx = mgr_to_fimd(mgr);

if (ctx->suspended)
return;
Expand Down Expand Up @@ -256,7 +261,7 @@ static void fimd_enable_shadow_channel_path(struct fimd_context *ctx, int win,

static void fimd_clear_channel(struct exynos_drm_manager *mgr)
{
struct fimd_context *ctx = mgr->ctx;
struct fimd_context *ctx = mgr_to_fimd(mgr);
int win, ch_enabled = 0;

DRM_DEBUG_KMS("%s\n", __FILE__);
Expand Down Expand Up @@ -289,7 +294,7 @@ static void fimd_clear_channel(struct exynos_drm_manager *mgr)
static int fimd_mgr_initialize(struct exynos_drm_manager *mgr,
struct drm_device *drm_dev)
{
struct fimd_context *ctx = mgr->ctx;
struct fimd_context *ctx = mgr_to_fimd(mgr);
struct exynos_drm_private *priv;
priv = drm_dev->dev_private;

Expand All @@ -311,7 +316,7 @@ static int fimd_mgr_initialize(struct exynos_drm_manager *mgr,

static void fimd_mgr_remove(struct exynos_drm_manager *mgr)
{
struct fimd_context *ctx = mgr->ctx;
struct fimd_context *ctx = mgr_to_fimd(mgr);

/* detach this sub driver from iommu mapping if supported. */
if (is_drm_iommu_supported(ctx->drm_dev))
Expand Down Expand Up @@ -351,14 +356,14 @@ static bool fimd_mode_fixup(struct exynos_drm_manager *mgr,
static void fimd_mode_set(struct exynos_drm_manager *mgr,
const struct drm_display_mode *in_mode)
{
struct fimd_context *ctx = mgr->ctx;
struct fimd_context *ctx = mgr_to_fimd(mgr);

drm_mode_copy(&ctx->mode, in_mode);
}

static void fimd_commit(struct exynos_drm_manager *mgr)
{
struct fimd_context *ctx = mgr->ctx;
struct fimd_context *ctx = mgr_to_fimd(mgr);
struct drm_display_mode *mode = &ctx->mode;
struct fimd_driver_data *driver_data = ctx->driver_data;
void *timing_base = ctx->regs + driver_data->timing_base;
Expand Down Expand Up @@ -458,7 +463,7 @@ static void fimd_commit(struct exynos_drm_manager *mgr)

static int fimd_enable_vblank(struct exynos_drm_manager *mgr)
{
struct fimd_context *ctx = mgr->ctx;
struct fimd_context *ctx = mgr_to_fimd(mgr);
u32 val;

if (ctx->suspended)
Expand Down Expand Up @@ -490,7 +495,7 @@ static int fimd_enable_vblank(struct exynos_drm_manager *mgr)

static void fimd_disable_vblank(struct exynos_drm_manager *mgr)
{
struct fimd_context *ctx = mgr->ctx;
struct fimd_context *ctx = mgr_to_fimd(mgr);
u32 val;

if (ctx->suspended)
Expand All @@ -515,7 +520,7 @@ static void fimd_disable_vblank(struct exynos_drm_manager *mgr)
static void fimd_win_mode_set(struct exynos_drm_manager *mgr,
struct exynos_drm_overlay *overlay)
{
struct fimd_context *ctx = mgr->ctx;
struct fimd_context *ctx = mgr_to_fimd(mgr);
struct fimd_win_data *win_data;
int win;
unsigned long offset;
Expand Down Expand Up @@ -673,7 +678,7 @@ static void fimd_shadow_protect_win(struct fimd_context *ctx,

static void fimd_win_commit(struct exynos_drm_manager *mgr, int zpos)
{
struct fimd_context *ctx = mgr->ctx;
struct fimd_context *ctx = mgr_to_fimd(mgr);
struct fimd_win_data *win_data;
int win = zpos;
unsigned long val, alpha, size;
Expand Down Expand Up @@ -796,7 +801,7 @@ static void fimd_win_commit(struct exynos_drm_manager *mgr, int zpos)

static void fimd_win_disable(struct exynos_drm_manager *mgr, int zpos)
{
struct fimd_context *ctx = mgr->ctx;
struct fimd_context *ctx = mgr_to_fimd(mgr);
struct fimd_win_data *win_data;
int win = zpos;

Expand Down Expand Up @@ -830,7 +835,7 @@ static void fimd_win_disable(struct exynos_drm_manager *mgr, int zpos)

static void fimd_window_suspend(struct exynos_drm_manager *mgr)
{
struct fimd_context *ctx = mgr->ctx;
struct fimd_context *ctx = mgr_to_fimd(mgr);
struct fimd_win_data *win_data;
int i;

Expand All @@ -844,7 +849,7 @@ static void fimd_window_suspend(struct exynos_drm_manager *mgr)

static void fimd_window_resume(struct exynos_drm_manager *mgr)
{
struct fimd_context *ctx = mgr->ctx;
struct fimd_context *ctx = mgr_to_fimd(mgr);
struct fimd_win_data *win_data;
int i;

Expand All @@ -857,7 +862,7 @@ static void fimd_window_resume(struct exynos_drm_manager *mgr)

static void fimd_apply(struct exynos_drm_manager *mgr)
{
struct fimd_context *ctx = mgr->ctx;
struct fimd_context *ctx = mgr_to_fimd(mgr);
struct fimd_win_data *win_data;
int i;

Expand All @@ -874,7 +879,7 @@ static void fimd_apply(struct exynos_drm_manager *mgr)

static int fimd_poweron(struct exynos_drm_manager *mgr)
{
struct fimd_context *ctx = mgr->ctx;
struct fimd_context *ctx = mgr_to_fimd(mgr);
int ret;

if (!ctx->suspended)
Expand Down Expand Up @@ -922,7 +927,7 @@ static int fimd_poweron(struct exynos_drm_manager *mgr)

static int fimd_poweroff(struct exynos_drm_manager *mgr)
{
struct fimd_context *ctx = mgr->ctx;
struct fimd_context *ctx = mgr_to_fimd(mgr);

if (ctx->suspended)
return 0;
Expand Down Expand Up @@ -993,7 +998,7 @@ static void fimd_trigger(struct device *dev)

static void fimd_te_handler(struct exynos_drm_manager *mgr)
{
struct fimd_context *ctx = mgr->ctx;
struct fimd_context *ctx = mgr_to_fimd(mgr);

/* Checks the crtc is detached already from encoder */
if (ctx->pipe < 0 || !ctx->drm_dev)
Expand Down Expand Up @@ -1206,7 +1211,6 @@ static int fimd_probe(struct platform_device *pdev)

init_waitqueue_head(&ctx->wait_vsync_queue);
atomic_set(&ctx->wait_vsync_event, 0);
ctx->manager.ctx = ctx;

platform_set_drvdata(pdev, ctx);

Expand Down

0 comments on commit 400c8ac

Please sign in to comment.