diff mbox

[4/7] drm/exynos: Clean up some G2D codes for readability

Message ID 1363165446-7482-1-git-send-email-inki.dae@samsung.com (mailing list archive)
State New, archived
Headers show

Commit Message

Inki Dae March 13, 2013, 9:04 a.m. UTC
From: YoungJun Cho <yj44.cho@samsung.com>

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 <yj44.cho@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
 drivers/gpu/drm/exynos/exynos_drm_g2d.c |   33 +++++++++++++-----------------
 1 files changed, 14 insertions(+), 19 deletions(-)

Comments

Joonyoung Shim March 13, 2013, 10:13 a.m. UTC | #1
On 03/13/2013 06:04 PM, Inki Dae wrote:
> From: YoungJun Cho <yj44.cho@samsung.com>
>
> 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.

Please make patch only about s/obj_type/buf_type.

>
> Signed-off-by: YoungJun Cho <yj44.cho@samsung.com>
> Signed-off-by: Inki Dae <inki.dae@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> ---
>   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;
>   };
> -

Need blank line.

>   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;

Please keep one variable to one line. The below modifications are ditto.

>   
>   	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;
diff mbox

Patch

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;