From patchwork Wed Mar 13 09:04:06 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Inki Dae X-Patchwork-Id: 2262451 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id 688EF3FD8C for ; Wed, 13 Mar 2013 09:08:11 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3755BE6825 for ; Wed, 13 Mar 2013 02:08:11 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by gabe.freedesktop.org (Postfix) with ESMTP id 4F25BE6832 for ; Wed, 13 Mar 2013 02:04:08 -0700 (PDT) Received: from epcpsbgr3.samsung.com (u143.gpu120.samsung.co.kr [203.254.230.143]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MJL003E5D6OA950@mailout3.samsung.com> for dri-devel@lists.freedesktop.org; Wed, 13 Mar 2013 18:04:07 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [203.254.230.45]) by epcpsbgr3.samsung.com (EPCPMTA) with SMTP id 53.9B.05174.70140415; Wed, 13 Mar 2013 18:04:07 +0900 (KST) X-AuditID: cbfee68f-b7f4a6d000001436-5f-5140410742f7 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 3B.74.17838.70140415; Wed, 13 Mar 2013 18:04:07 +0900 (KST) Received: from daeinki-desktop.10.32.193.11 ([10.90.8.53]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MJL00EN3D6VBQ10@mmp1.samsung.com> for dri-devel@lists.freedesktop.org; Wed, 13 Mar 2013 18:04:07 +0900 (KST) From: Inki Dae To: airlied@linux.ie, dri-devel@lists.freedesktop.org Subject: [PATCH 4/7] drm/exynos: Clean up some G2D codes for readability Date: Wed, 13 Mar 2013 18:04:06 +0900 Message-id: <1363165446-7482-1-git-send-email-inki.dae@samsung.com> X-Mailer: git-send-email 1.7.4.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrLLMWRmVeSWpSXmKPExsVy+t8zXV12R4dAg++flSyufH3P5sDocb/7 OFMAYxSXTUpqTmZZapG+XQJXxqt54QULlCvaJ3xna2Dskuli5OSQEDCR2H7tJguELSZx4d56 ti5GLg4hgWWMEi+erGHsYuQAK3r32RoivohRomvDKkYIZx2TxOmd05hAutkEVCUmrrjPBmKL CJhKdExaygJSxCzQzSjx/MFfVpCEsICHxMmDX8AaWIAapv5azg5i8wo4S/xo/cgKcYaCxIJ7 b8HOkBA4wCax4sUDNogGAYlvkw+xQJwkK7HpADNEvaTEwRU3WCYwCi5gZFjFKJpakFxQnJRe ZKxXnJhbXJqXrpecn7uJERJU/TsY7x6wPsSYDDRuIrOUaHI+MCjzSuINjc2MLExNTI2NzC3N SBNWEudVa7EOFBJITyxJzU5NLUgtii8qzUktPsTIxMEp1cDoZC/b06WdW5z4+j1fxsxUuaMZ y14YPN4qlPxteVT9wyn+G6bqBC952fi8hZnZ/LXEfFnu0CtcM6wubVF9UpBfeUWkist+X7ec z6SUigye2SEsGw7ON1eKkVIJ+hF+X1phQVHvoqUuBxgunLKpE949s3fy+t6jwnJZN2eYP4n8 Zx92KLNe850SS3FGoqEWc1FxIgCy8eOOQAIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupikeLIzCtJLcpLzFFi42I5/e+xgC67o0Ogwe6NYhZXvr5nc2D0uN99 nCmAMaqB0SYjNTEltUghNS85PyUzL91WyTs43jne1MzAUNfQ0sJcSSEvMTfVVsnFJ0DXLTMH aKySQlliTilQKCCxuFhJ3w7ThNAQN10LmMYIXd+QILgeIwM0kLCOMePVvPCCBcoV7RO+szUw dsl0MXJwSAiYSLz7bN3FyAlkiklcuLeerYuRi0NIYBGjRNeGVYwQzjomidM7pzGBVLEJqEpM XHGfDcQWETCV6Ji0lAWkiFmgm1Hi+YO/rCAJYQEPiZMHv4A1sAA1TP21nB3E5hVwlvjR+pEV Yp2CxIJ7b9kmMHIvYGRYxSiaWpBcUJyUnmuoV5yYW1yal66XnJ+7iREcss+kdjCubLA4xCjA wajEwyvw1T5QiDWxrLgy9xCjBAezkgjvNxuHQCHelMTKqtSi/Pii0pzU4kOMyUDbJzJLiSbn A+MpryTe0NjEzMjSyMzYxNzYmDRhJXHeA63WgUIC6YklqdmpqQWpRTBbmDg4pRoYl6z5nr96 2oeuQ8mqGfZ/va3iq5lePTyVpPLg1nrDDjWHF9t2zf29t2OlYLninKjVN+d/aQmN7ltstTg7 Wi465bPcpynbGx7aztv5faequvoVb5mVJ/fZlGxmqzrK+L9ou9bK67xPN21vKt7zOPBJzIpr 63Y4Fb629JldLv/ayePlz4hpu2c+qVZiKc5INNRiLipOBADmO6FKnQIAAA== DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Cc: kyungmin.park@samsung.com, sw0312.kim@samsung.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org From: YoungJun Cho This patch just cleans up G2D codes for readability. For this, it changes the member of g2d_cmdlist_node, obj_type into buf_type and gathers relevant variables together. Signed-off-by: YoungJun Cho Signed-off-by: Inki Dae Signed-off-by: Kyungmin Park --- drivers/gpu/drm/exynos/exynos_drm_g2d.c | 33 +++++++++++++----------------- 1 files changed, 14 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_g2d.c b/drivers/gpu/drm/exynos/exynos_drm_g2d.c index 91bc4cc..ce8e670 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_g2d.c +++ b/drivers/gpu/drm/exynos/exynos_drm_g2d.c @@ -131,13 +131,12 @@ struct g2d_cmdlist_userptr { bool in_pool; bool out_of_list; }; - struct g2d_cmdlist_node { struct list_head list; struct g2d_cmdlist *cmdlist; unsigned int map_nr; unsigned long handles[MAX_BUF_ADDR_NR]; - unsigned int obj_type[MAX_BUF_ADDR_NR]; + unsigned int buf_type[MAX_BUF_ADDR_NR]; dma_addr_t dma_addr; struct drm_exynos_pending_g2d_event *event; @@ -186,8 +185,7 @@ static int g2d_init_cmdlist(struct g2d_data *g2d) struct device *dev = g2d->dev; struct g2d_cmdlist_node *node = g2d->cmdlist_node; struct exynos_drm_subdrv *subdrv = &g2d->subdrv; - int nr; - int ret; + int nr, ret; init_dma_attrs(&g2d->cmdlist_dma_attrs); dma_set_attr(DMA_ATTR_WRITE_COMBINE, &g2d->cmdlist_dma_attrs); @@ -514,17 +512,17 @@ static int g2d_map_cmdlist_gem(struct g2d_data *g2d, struct drm_file *file) { struct g2d_cmdlist *cmdlist = node->cmdlist; - int offset; int i; for (i = 0; i < node->map_nr; i++) { + int offset; unsigned long handle; dma_addr_t *addr; offset = cmdlist->last - (i * 2 + 1); handle = cmdlist->data[offset]; - if (node->obj_type[i] == BUF_TYPE_GEM) { + if (node->buf_type[i] == BUF_TYPE_GEM) { addr = exynos_drm_gem_get_dma_addr(drm_dev, handle, file); if (IS_ERR(addr)) { @@ -568,7 +566,7 @@ static void g2d_unmap_cmdlist_gem(struct g2d_data *g2d, for (i = 0; i < node->map_nr; i++) { unsigned long handle = node->handles[i]; - if (node->obj_type[i] == BUF_TYPE_GEM) + if (node->buf_type[i] == BUF_TYPE_GEM) exynos_drm_gem_put_dma_addr(subdrv->drm_dev, handle, filp); else @@ -576,7 +574,7 @@ static void g2d_unmap_cmdlist_gem(struct g2d_data *g2d, false); node->handles[i] = 0; - node->obj_type[i] = 0; + node->buf_type[i] = 0; } node->map_nr = 0; @@ -646,7 +644,6 @@ static void g2d_runqueue_worker(struct work_struct *work) struct g2d_data *g2d = container_of(work, struct g2d_data, runqueue_work); - mutex_lock(&g2d->runqueue_mutex); clk_disable(g2d->gate_clk); pm_runtime_put_sync(g2d->dev); @@ -722,11 +719,11 @@ static int g2d_check_reg_offset(struct device *dev, int nr, bool for_addr) { struct g2d_cmdlist *cmdlist = node->cmdlist; - int reg_offset; - int index; - int i; + int index, i; for (i = 0; i < nr; i++) { + int reg_offset; + index = cmdlist->last - 2 * (i + 1); if (for_addr) { @@ -734,7 +731,7 @@ static int g2d_check_reg_offset(struct device *dev, reg_offset = (cmdlist->data[index] & ~0x7fffffff) >> 31; if (reg_offset) { - node->obj_type[i] = BUF_TYPE_USERPTR; + node->buf_type[i] = BUF_TYPE_USERPTR; cmdlist->data[index] &= ~G2D_BUF_USERPTR; } } @@ -756,8 +753,8 @@ static int g2d_check_reg_offset(struct device *dev, if (!for_addr) goto err; - if (node->obj_type[i] != BUF_TYPE_USERPTR) - node->obj_type[i] = BUF_TYPE_GEM; + if (node->buf_type[i] != BUF_TYPE_USERPTR) + node->buf_type[i] = BUF_TYPE_GEM; break; default: if (for_addr) @@ -799,8 +796,7 @@ int exynos_g2d_set_cmdlist_ioctl(struct drm_device *drm_dev, void *data, struct g2d_cmdlist_node *node; struct g2d_cmdlist *cmdlist; unsigned long flags; - int size; - int ret; + int size, ret; if (!dev) return -ENODEV; @@ -953,8 +949,7 @@ int exynos_g2d_exec_ioctl(struct drm_device *drm_dev, void *data, struct g2d_data *g2d; struct drm_exynos_g2d_exec *req = data; struct g2d_runqueue_node *runqueue_node; - struct list_head *run_cmdlist; - struct list_head *event_list; + struct list_head *run_cmdlist, *event_list; if (!dev) return -ENODEV;