drm/exynos/ipp: replace work_struct casting with better constructs
authorAndrzej Hajda <a.hajda@samsung.com>
Thu, 28 Aug 2014 09:07:33 +0000 (11:07 +0200)
committerInki Dae <daeinki@gmail.com>
Fri, 19 Sep 2014 15:56:12 +0000 (00:56 +0900)
Type casting should be avoided if possible. In case of
work_struct it can be simply replaced by reference to member field.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Reviewed-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
drivers/gpu/drm/exynos/exynos_drm_fimc.c
drivers/gpu/drm/exynos/exynos_drm_gsc.c
drivers/gpu/drm/exynos/exynos_drm_ipp.c
drivers/gpu/drm/exynos/exynos_drm_rotator.c

index ec7cc9ea50df692db90293319a3f8fe2465d5107..7a5338ed2433a532157a9c047c955f61664e9779 100644 (file)
@@ -1298,7 +1298,7 @@ static irqreturn_t fimc_irq_handler(int irq, void *dev_id)
 
        event_work->ippdrv = ippdrv;
        event_work->buf_id[EXYNOS_DRM_OPS_DST] = buf_id;
-       queue_work(ippdrv->event_workq, (struct work_struct *)event_work);
+       queue_work(ippdrv->event_workq, &event_work->work);
 
        return IRQ_HANDLED;
 }
index 9e3ff1672965d3e17044d0e59fa524193404ff02..c6a013fc321cf13d9ce8b8f1a7403beb758e86e4 100644 (file)
@@ -1326,8 +1326,7 @@ static irqreturn_t gsc_irq_handler(int irq, void *dev_id)
                        buf_id[EXYNOS_DRM_OPS_SRC];
                event_work->buf_id[EXYNOS_DRM_OPS_DST] =
                        buf_id[EXYNOS_DRM_OPS_DST];
-               queue_work(ippdrv->event_workq,
-                       (struct work_struct *)event_work);
+               queue_work(ippdrv->event_workq, &event_work->work);
        }
 
        return IRQ_HANDLED;
index 857817cc9b4aad7346373e8694cf99e82528006a..fff3509f7b97a41de1cb2812c03a1c22b08d4ab5 100644 (file)
@@ -790,7 +790,7 @@ static void ipp_handle_cmd_work(struct device *dev,
 
        cmd_work->ippdrv = ippdrv;
        cmd_work->c_node = c_node;
-       queue_work(ctx->cmd_workq, (struct work_struct *)cmd_work);
+       queue_work(ctx->cmd_workq, &cmd_work->work);
 }
 
 static int ipp_queue_buf_with_run(struct device *dev,
@@ -1318,7 +1318,7 @@ err_clear:
 void ipp_sched_cmd(struct work_struct *work)
 {
        struct drm_exynos_ipp_cmd_work *cmd_work =
-               (struct drm_exynos_ipp_cmd_work *)work;
+               container_of(work, struct drm_exynos_ipp_cmd_work, work);
        struct exynos_drm_ippdrv *ippdrv;
        struct drm_exynos_ipp_cmd_node *c_node;
        struct drm_exynos_ipp_property *property;
@@ -1531,7 +1531,7 @@ err_event_unlock:
 void ipp_sched_event(struct work_struct *work)
 {
        struct drm_exynos_ipp_event_work *event_work =
-               (struct drm_exynos_ipp_event_work *)work;
+               container_of(work, struct drm_exynos_ipp_event_work, work);
        struct exynos_drm_ippdrv *ippdrv;
        struct drm_exynos_ipp_cmd_node *c_node;
        int ret;
index 55af6b41c1dfa3f0da4be362245212838371ff1a..b6a37d4f5b1326f9eb8f2226feea954087f6879e 100644 (file)
@@ -156,8 +156,7 @@ static irqreturn_t rotator_irq_handler(int irq, void *arg)
                event_work->ippdrv = ippdrv;
                event_work->buf_id[EXYNOS_DRM_OPS_DST] =
                        rot->cur_buf_id[EXYNOS_DRM_OPS_DST];
-               queue_work(ippdrv->event_workq,
-                       (struct work_struct *)event_work);
+               queue_work(ippdrv->event_workq, &event_work->work);
        } else {
                DRM_ERROR("the SFR is set illegally\n");
        }