[Accel-config] [PATCH v1 2/5] accel-config/test: remove dsa_test code checks scanned by checkpatch.pl

Tony Zhu <tony.zhu at intel.com> Tue, 30 Nov 2021 18:51:29 +0800
Newsgroups dev.linux.lists.accel-config
Message-ID <[email protected]>
Remove unnecessary lines and unalignments for better code style and code review.

Signed-off-by: Tony Zhu <tony.zhu(a)intel.com>
---
 test/dsa.c      | 87 ++++++++++++++++++++++-----------------------
 test/dsa.h      |  6 ++--
 test/dsa_test.c | 29 +++++++--------
 test/prep.c     | 94 ++++++++++++++++++++++++-------------------------
 4 files changed, 107 insertions(+), 109 deletions(-)

diff --git a/test/dsa.c b/test/dsa.c
index f5a0a5d..1191254 100644
--- a/test/dsa.c
+++ b/test/dsa.c
@@ -23,7 +23,7 @@ int debug_logging;
 static int umwait_support;
 
 static inline void cpuid(unsigned int *eax, unsigned int *ebx,
-		unsigned int *ecx, unsigned int *edx)
+			 unsigned int *ecx, unsigned int *edx)
 {
 	/* ecx is often an input as well as an output. */
 	asm volatile("cpuid"
@@ -46,7 +46,7 @@ struct dsa_context *dsa_init(void)
 	/* detect umwait support */
 	leaf = 7;
 	waitpkg = 0;
-	cpuid(&leaf, unused, &waitpkg, unused+1);
+	cpuid(&leaf, unused, &waitpkg, unused + 1);
 	if (waitpkg & 0x20) {
 		dbg("umwait supported\n");
 		umwait_support = 1;
@@ -85,7 +85,7 @@ static int dsa_setup_wq(struct dsa_context *ctx, struct accfg_wq *wq)
 	}
 
 	ctx->wq_reg = mmap(NULL, 0x1000, PROT_WRITE,
-			MAP_SHARED | MAP_POPULATE, ctx->fd, 0);
+			   MAP_SHARED | MAP_POPULATE, ctx->fd, 0);
 	if (ctx->wq_reg == MAP_FAILED) {
 		perror("mmap");
 		return -errno;
@@ -95,7 +95,7 @@ static int dsa_setup_wq(struct dsa_context *ctx, struct accfg_wq *wq)
 }
 
 static struct accfg_wq *dsa_get_wq(struct dsa_context *ctx,
-		int dev_id, int shared)
+				   int dev_id, int shared)
 {
 	struct accfg_device *device;
 	struct accfg_wq *wq;
@@ -111,7 +111,7 @@ static struct accfg_wq *dsa_get_wq(struct dsa_context *ctx,
 
 		/* Match the device to the id requested */
 		if (accfg_device_get_id(device) != dev_id &&
-				dev_id != -1)
+		    dev_id != -1)
 			continue;
 
 		accfg_wq_foreach(device, wq) {
@@ -131,8 +131,8 @@ static struct accfg_wq *dsa_get_wq(struct dsa_context *ctx,
 
 			/* Make sure the mode is correct */
 			mode = accfg_wq_get_mode(wq);
-			if ((mode == ACCFG_WQ_SHARED && !shared)
-				|| (mode == ACCFG_WQ_DEDICATED && shared))
+			if ((mode == ACCFG_WQ_SHARED && !shared) ||
+			    (mode == ACCFG_WQ_DEDICATED && shared))
 				continue;
 
 			rc = dsa_setup_wq(ctx, wq);
@@ -147,25 +147,23 @@ static struct accfg_wq *dsa_get_wq(struct dsa_context *ctx,
 }
 
 static struct accfg_wq *dsa_get_wq_byid(struct dsa_context *ctx,
-					 int dev_id, int wq_id)
+					int dev_id, int wq_id)
 {
 	struct accfg_device *device;
 	struct accfg_wq *wq;
 	int rc;
 
 	accfg_device_foreach(ctx->ctx, device) {
-
 		/* Make sure that the device is enabled */
 		if (accfg_device_get_state(device) != ACCFG_DEVICE_ENABLED)
 			continue;
 
 		/* Match the device to the id requested */
 		if (accfg_device_get_id(device) != dev_id &&
-				dev_id != DSA_DEVICE_ID_NO_INPUT)
+		    dev_id != DSA_DEVICE_ID_NO_INPUT)
 			continue;
 
 		accfg_wq_foreach(device, wq) {
-
 			/* Get a workqueue that's enabled */
 			if (accfg_wq_get_state(wq) != ACCFG_WQ_ENABLED)
 				continue;
@@ -228,8 +226,8 @@ int dsa_alloc(struct dsa_context *ctx, int shared, int dev_id, int wq_id)
 	ctx->max_xfer_bits = bsr(ctx->max_xfer_size);
 
 	info("alloc wq %d shared %d size %d addr %p batch sz %#x xfer sz %#x\n",
-			ctx->wq_idx, ctx->dedicated, ctx->wq_size, ctx->wq_reg,
-			ctx->max_batch_size, ctx->max_xfer_size);
+	     ctx->wq_idx, ctx->dedicated, ctx->wq_size, ctx->wq_reg,
+	     ctx->max_batch_size, ctx->max_xfer_size);
 
 	return 0;
 }
@@ -241,7 +239,7 @@ int alloc_task(struct dsa_context *ctx)
 		return -ENOMEM;
 
 	dbg("single task allocated, desc %#lx comp %#lx\n",
-			ctx->single_task->desc, ctx->single_task->comp);
+	    ctx->single_task->desc, ctx->single_task->comp);
 
 	return DSA_STATUS_OK;
 }
@@ -275,7 +273,7 @@ struct task *__alloc_task(void)
 
 /* this function is re-used by batch task */
 int init_task(struct task *tsk, int tflags, int opcode,
-		unsigned long xfer_size)
+	      unsigned long xfer_size)
 {
 	dbg("initilizing single task %#lx\n", tsk);
 
@@ -311,7 +309,7 @@ int init_task(struct task *tsk, int tflags, int opcode,
 	case DSA_OPCODE_MEMFILL: /* intentionally empty */
 	case DSA_OPCODE_DUALCAST:
 		/* DUALCAST: dst1/dst2 lower 12 bits must be same */
-		tsk->dst1 = aligned_alloc(1<<12, xfer_size);
+		tsk->dst1 = aligned_alloc(1 << 12, xfer_size);
 		if (!tsk->dst1)
 			return -ENOMEM;
 		if (tflags & TEST_FLAGS_PREF)
@@ -322,7 +320,7 @@ int init_task(struct task *tsk, int tflags, int opcode,
 	switch (opcode) {
 	case DSA_OPCODE_DUALCAST:
 		/* DUALCAST: dst1/dst2 lower 12 bits must be same */
-		tsk->dst2 = aligned_alloc(1<<12, xfer_size);
+		tsk->dst2 = aligned_alloc(1 << 12, xfer_size);
 		if (!tsk->dst2)
 			return -ENOMEM;
 		if (tflags & TEST_FLAGS_PREF)
@@ -330,7 +328,7 @@ int init_task(struct task *tsk, int tflags, int opcode,
 	}
 
 	dbg("Mem allocated: s1 %#lx s2 %#lx d1 %#lx d2 %#lx\n",
-			tsk->src1, tsk->src2, tsk->dst1, tsk->dst2);
+	    tsk->src1, tsk->src2, tsk->dst1, tsk->dst2);
 
 	return DSA_STATUS_OK;
 }
@@ -361,28 +359,28 @@ int alloc_batch_task(struct dsa_context *ctx, unsigned int task_num)
 	memset(btsk->sub_tasks, 0, task_num * sizeof(struct task));
 
 	btsk->sub_descs = aligned_alloc(64,
-			task_num * sizeof(struct dsa_hw_desc));
+					task_num * sizeof(struct dsa_hw_desc));
 	if (!btsk->sub_descs)
 		return -ENOMEM;
 	memset(btsk->sub_descs, 0, task_num * sizeof(struct dsa_hw_desc));
 
 	btsk->sub_comps = aligned_alloc(32,
-			task_num * sizeof(struct dsa_completion_record));
+					task_num * sizeof(struct dsa_completion_record));
 	if (!btsk->sub_comps)
 		return -ENOMEM;
 	memset(btsk->sub_comps, 0,
-			task_num * sizeof(struct dsa_completion_record));
+	       task_num * sizeof(struct dsa_completion_record));
 
 	dbg("batch task allocated %#lx, ctask %#lx, sub_tasks %#lx\n",
-			btsk, btsk->core_task, btsk->sub_tasks);
+	    btsk, btsk->core_task, btsk->sub_tasks);
 	dbg("sub_descs %#lx, sub_comps %#lx\n",
-			btsk->sub_descs, btsk->sub_comps);
+	    btsk->sub_descs, btsk->sub_comps);
 
 	return DSA_STATUS_OK;
 }
 
 int init_batch_task(struct batch_task *btsk, int task_num, int tflags,
-		int opcode, unsigned long xfer_size, unsigned long dflags)
+		    int opcode, unsigned long xfer_size, unsigned long dflags)
 {
 	int i, rc;
 
@@ -390,11 +388,10 @@ int init_batch_task(struct batch_task *btsk, int task_num, int tflags,
 	btsk->test_flags = tflags;
 
 	for (i = 0; i < task_num; i++) {
-		btsk->sub_tasks[i].desc = &(btsk->sub_descs[i]);
-		btsk->sub_tasks[i].comp = &(btsk->sub_comps[i]);
+		btsk->sub_tasks[i].desc = &btsk->sub_descs[i];
+		btsk->sub_tasks[i].comp = &btsk->sub_comps[i];
 		btsk->sub_tasks[i].dflags = dflags;
-		rc = init_task(&(btsk->sub_tasks[i]), tflags, opcode,
-				xfer_size);
+		rc = init_task(&btsk->sub_tasks[i], tflags, opcode, xfer_size);
 		if (rc != DSA_STATUS_OK) {
 			err("batch: init sub-task failed\n");
 			return rc;
@@ -447,7 +444,7 @@ static inline int umwait(unsigned long timeout, unsigned int state)
 }
 
 static int dsa_wait_on_desc_timeout(struct dsa_completion_record *comp,
-		unsigned int msec_timeout)
+				    unsigned int msec_timeout)
 {
 	unsigned int j = 0;
 
@@ -588,7 +585,7 @@ void free_batch_task(struct batch_task *btsk)
 		btsk->sub_tasks[i].comp = NULL;
 		/* sub_tasks is an array "btsk->sub_tasks", we don't free */
 		/* btsk->sub_tasks[i] itself here */
-		__clean_task(&(btsk->sub_tasks[i]));
+		__clean_task(&btsk->sub_tasks[i]);
 	}
 
 	free(btsk->sub_tasks);
@@ -659,7 +656,7 @@ again:
 
 	/* re-submit if PAGE_FAULT reported by HW && BOF is off */
 	if (stat_val(comp->status) == DSA_COMP_PAGE_FAULT_NOBOF &&
-			!(desc->flags & IDXD_OP_FLAG_BOF)) {
+	    !(desc->flags & IDXD_OP_FLAG_BOF)) {
 		dsa_reprep_memcpy(ctx);
 		goto again;
 	}
@@ -699,7 +696,7 @@ again:
 
 	/* re-submit if PAGE_FAULT reported by HW && BOF is off */
 	if (stat_val(comp->status) == DSA_COMP_PAGE_FAULT_NOBOF &&
-			!(desc->flags & IDXD_OP_FLAG_BOF)) {
+	    !(desc->flags & IDXD_OP_FLAG_BOF)) {
 		dsa_reprep_memfill(ctx);
 		goto again;
 	}
@@ -739,7 +736,7 @@ again:
 
 	/* re-submit if PAGE_FAULT reported by HW && BOF is off */
 	if (stat_val(comp->status) == DSA_COMP_PAGE_FAULT_NOBOF &&
-			!(desc->flags & IDXD_OP_FLAG_BOF)) {
+	    !(desc->flags & IDXD_OP_FLAG_BOF)) {
 		dsa_reprep_compare(ctx);
 		goto again;
 	}
@@ -779,7 +776,7 @@ again:
 
 	/* re-submit if PAGE_FAULT reported by HW && BOF is off */
 	if (stat_val(comp->status) == DSA_COMP_PAGE_FAULT_NOBOF &&
-			!(desc->flags & IDXD_OP_FLAG_BOF)) {
+	    !(desc->flags & IDXD_OP_FLAG_BOF)) {
 		dsa_reprep_compval(ctx);
 		goto again;
 	}
@@ -818,7 +815,7 @@ again:
 
 	/* re-submit if PAGE_FAULT reported by HW && BOF is off */
 	if (stat_val(comp->status) == DSA_COMP_PAGE_FAULT_NOBOF &&
-			!(desc->flags & IDXD_OP_FLAG_BOF)) {
+	    !(desc->flags & IDXD_OP_FLAG_BOF)) {
 		dsa_reprep_dualcast(ctx);
 		goto again;
 	}
@@ -909,7 +906,7 @@ int task_result_verify_compare(struct task *tsk, int mismatch_expected)
 	if (!mismatch_expected) {
 		if (tsk->comp->result) {
 			err("compval failed at %#x\n",
-					tsk->comp->bytes_completed);
+			    tsk->comp->bytes_completed);
 			return -ENXIO;
 		}
 		return DSA_STATUS_OK;
@@ -918,7 +915,7 @@ int task_result_verify_compare(struct task *tsk, int mismatch_expected)
 	/* mismatch_expected */
 	if (tsk->comp->result) {
 		info("expected mismatch at index %#x\n",
-				tsk->comp->bytes_completed);
+		     tsk->comp->bytes_completed);
 		return DSA_STATUS_OK;
 	}
 
@@ -931,7 +928,7 @@ int task_result_verify_compval(struct task *tsk, int mismatch_expected)
 	if (!mismatch_expected) {
 		if (tsk->comp->result) {
 			err("compval failed at %#x\n",
-					tsk->comp->bytes_completed);
+			    tsk->comp->bytes_completed);
 			return -ENXIO;
 		}
 		return DSA_STATUS_OK;
@@ -940,7 +937,7 @@ int task_result_verify_compval(struct task *tsk, int mismatch_expected)
 	/* mismatch_expected */
 	if (tsk->comp->result) {
 		info("expected mismatch at index %#x\n",
-				tsk->comp->bytes_completed);
+		     tsk->comp->bytes_completed);
 		return DSA_STATUS_OK;
 	}
 
@@ -977,22 +974,22 @@ int batch_result_verify(struct batch_task *btsk, int bof)
 	struct task *tsk;
 
 	core_stat = stat_val(btsk->core_task->comp->status);
-	if (core_stat == DSA_COMP_SUCCESS)
+	if (core_stat == DSA_COMP_SUCCESS) {
 		info("core task success, chekcing sub-tasks\n");
-	else if (!bof && core_stat == DSA_COMP_BATCH_FAIL)
+	} else if (!bof && core_stat == DSA_COMP_BATCH_FAIL) {
 		info("partial complete with NBOF, checking sub-tasks\n");
-	else {
+	} else {
 		err("batch core task failed with status %d\n", core_stat);
 		return DSA_STATUS_FAIL;
 	}
 
 	for (i = 0; i < btsk->task_num; i++) {
-		tsk = &(btsk->sub_tasks[i]);
+		tsk = &btsk->sub_tasks[i];
 		sub_stat = stat_val(tsk->comp->status);
 
-		if (!bof && sub_stat == DSA_COMP_PAGE_FAULT_NOBOF)
+		if (!bof && sub_stat == DSA_COMP_PAGE_FAULT_NOBOF) {
 			dbg("PF in sub-task[%d], consider as passed\n", i);
-		else if (sub_stat == DSA_COMP_SUCCESS) {
+		} else if (sub_stat == DSA_COMP_SUCCESS) {
 			rc = task_result_verify(tsk, 0);
 			if (rc != DSA_STATUS_OK) {
 				err("Sub-task[%d] failed with rc=%d", i, rc);
diff --git a/test/dsa.h b/test/dsa.h
index 3341d3d..df2fc09 100644
--- a/test/dsa.h
+++ b/test/dsa.h
@@ -217,7 +217,7 @@ int dsa_alloc(struct dsa_context *ctx, int shared, int dev_id, int wq_id);
 int alloc_task(struct dsa_context *ctx);
 struct task *__alloc_task(void);
 int init_task(struct task *tsk, int tflags, int opcode,
-		unsigned long xfer_size);
+	      unsigned long xfer_size);
 
 int dsa_noop(struct dsa_context *ctx);
 int dsa_wait_noop(struct dsa_context *ctx);
@@ -259,7 +259,7 @@ int batch_result_verify(struct batch_task *btsk, int bof);
 
 int alloc_batch_task(struct dsa_context *ctx, unsigned int task_num);
 int init_batch_task(struct batch_task *btsk, int task_num, int tflags,
-		int opcode, unsigned long xfer_size, unsigned long dflags);
+		    int opcode, unsigned long xfer_size, unsigned long dflags);
 
 void dsa_prep_batch(struct batch_task *btsk, unsigned long desc_flags);
 void dsa_prep_batch_noop(struct batch_task *btsk);
@@ -277,6 +277,6 @@ void __clean_task(struct task *tsk);
 void free_batch_task(struct batch_task *btsk);
 
 void dsa_prep_desc_common(struct dsa_hw_desc *hw, char opcode,
-		uint64_t dest, uint64_t src, size_t len, unsigned long dflags);
+			  uint64_t dest, uint64_t src, size_t len, unsigned long dflags);
 void dsa_desc_submit(struct dsa_context *ctx, struct dsa_hw_desc *hw);
 #endif
diff --git a/test/dsa_test.c b/test/dsa_test.c
index 879569a..1009785 100644
--- a/test/dsa_test.c
+++ b/test/dsa_test.c
@@ -30,13 +30,13 @@ static void usage(void)
 }
 
 static int test_batch(struct dsa_context *ctx, size_t buf_size,
-		int tflags, uint32_t bopcode, unsigned int bsize)
+		      int tflags, uint32_t bopcode, unsigned int bsize)
 {
 	unsigned long dflags;
 	int rc = 0;
 
 	info("batch: len %#lx tflags %#x bopcode %#x batch_no %d\n",
-			buf_size, tflags, bopcode, bsize);
+	     buf_size, tflags, bopcode, bsize);
 
 	if (bopcode == DSA_OPCODE_BATCH) {
 		err("Can't have batch op inside batch op\n");
@@ -54,7 +54,7 @@ static int test_batch(struct dsa_context *ctx, size_t buf_size,
 		dflags |= IDXD_OP_FLAG_BOF;
 
 	rc = init_batch_task(ctx->batch_task, bsize, tflags, bopcode,
-			buf_size, dflags);
+			     buf_size, dflags);
 	if (rc != DSA_STATUS_OK)
 		return rc;
 
@@ -138,8 +138,9 @@ int main(int argc, char *argv[])
 			break;
 		case 'd':
 			if (sscanf(optarg, "%[a-z]%u/%*[a-z]%u.%u", dev_type,
-						&dev_id, &dev_wq_id, &wq_id) != 4) {
-				err("invalid input device:dev_wq_id:%d ,wq_id:%d\n", dev_wq_id, wq_id);
+				   &dev_id, &dev_wq_id, &wq_id) != 4) {
+				err("invalid input device:dev_wq_id:%d ,wq_id:%d\n",
+				    dev_wq_id, wq_id);
 				return -EINVAL;
 			}
 			break;
@@ -159,7 +160,7 @@ int main(int argc, char *argv[])
 
 	dsa = dsa_init();
 
-	if (dsa == NULL)
+	if (!dsa)
 		return -ENOMEM;
 
 	rc = dsa_alloc(dsa, wq_type, dev_id, wq_id);
@@ -278,7 +279,7 @@ int main(int argc, char *argv[])
 		struct task *tsk;
 
 		info("compare: matching buffers len %#lx tflags %#x\n",
-				buf_size, tflags);
+		     buf_size, tflags);
 
 		rc = alloc_task(dsa);
 		if (rc != DSA_STATUS_OK) {
@@ -305,9 +306,9 @@ int main(int argc, char *argv[])
 			goto error;
 
 		info("Testing mismatch buffers\n");
-		info("creating a diff at index %#lx\n", tsk->xfer_size/2);
-		((uint8_t *)(tsk->src1))[tsk->xfer_size/2] = 0;
-		((uint8_t *)(tsk->src2))[tsk->xfer_size/2] = 1;
+		info("creating a diff at index %#lx\n", tsk->xfer_size / 2);
+		((uint8_t *)(tsk->src1))[tsk->xfer_size / 2] = 0;
+		((uint8_t *)(tsk->src2))[tsk->xfer_size / 2] = 1;
 
 		memset(tsk->comp, 0, sizeof(struct dsa_completion_record));
 
@@ -329,7 +330,7 @@ int main(int argc, char *argv[])
 		struct task *tsk;
 
 		info("compval: matching buffer len %#lx tflags %#x\n",
-				buf_size, tflags);
+		     buf_size, tflags);
 
 		rc = alloc_task(dsa);
 		if (rc != DSA_STATUS_OK) {
@@ -356,9 +357,9 @@ int main(int argc, char *argv[])
 			goto error;
 
 		info("Testing mismatching buffers\n");
-		info("creating a diff at index %#lx\n", tsk->xfer_size/2);
-		((uint8_t *)(tsk->src1))[tsk->xfer_size/2] =
-				~(((uint8_t *)(tsk->src1))[tsk->xfer_size/2]);
+		info("creating a diff at index %#lx\n", tsk->xfer_size / 2);
+		((uint8_t *)(tsk->src1))[tsk->xfer_size / 2] =
+				~(((uint8_t *)(tsk->src1))[tsk->xfer_size / 2]);
 
 		memset(tsk->comp, 0, sizeof(struct dsa_completion_record));
 
diff --git a/test/prep.c b/test/prep.c
index 808317b..ab18e53 100644
--- a/test/prep.c
+++ b/test/prep.c
@@ -9,7 +9,7 @@
 #include "dsa.h"
 
 void dsa_prep_desc_common(struct dsa_hw_desc *hw, char opcode,
-		uint64_t dest, uint64_t src, size_t len, unsigned long dflags)
+			  uint64_t dest, uint64_t src, size_t len, unsigned long dflags)
 {
 	hw->flags = dflags;
 	hw->opcode = opcode;
@@ -36,7 +36,7 @@ void dsa_prep_noop(struct task *tsk)
 
 	tsk->dflags = IDXD_OP_FLAG_CRAV | IDXD_OP_FLAG_RCR;
 	dsa_prep_desc_common(tsk->desc, tsk->opcode, (uint64_t)(tsk->dst1),
-			(uint64_t)(tsk->src1), 0, tsk->dflags);
+			     (uint64_t)(tsk->src1), 0, tsk->dflags);
 	tsk->desc->completion_addr = (uint64_t)(tsk->comp);
 	tsk->comp->status = 0;
 }
@@ -46,7 +46,7 @@ void dsa_prep_memcpy(struct task *tsk)
 	info("preparing descriptor for memcpy\n");
 
 	dsa_prep_desc_common(tsk->desc, tsk->opcode, (uint64_t)(tsk->dst1),
-			(uint64_t)(tsk->src1), tsk->xfer_size, tsk->dflags);
+			     (uint64_t)(tsk->src1), tsk->xfer_size, tsk->dflags);
 	tsk->desc->completion_addr = (uint64_t)(tsk->comp);
 	tsk->comp->status = 0;
 }
@@ -57,8 +57,8 @@ void dsa_reprep_memcpy(struct dsa_context *ctx)
 	struct dsa_hw_desc *hw = ctx->single_task->desc;
 
 	info("PF addr %#lx dir %d bc %#x\n",
-			compl->fault_addr, compl->result,
-			compl->bytes_completed);
+	     compl->fault_addr, compl->result,
+	     compl->bytes_completed);
 
 	hw->xfer_size -= compl->bytes_completed;
 
@@ -81,11 +81,11 @@ void dsa_prep_batch_noop(struct batch_task *btsk)
 	uint32_t dflags = IDXD_OP_FLAG_CRAV | IDXD_OP_FLAG_RCR;
 
 	for (i = 0; i < btsk->task_num; i++) {
-		sub_task = &(btsk->sub_tasks[i]);
+		sub_task = &btsk->sub_tasks[i];
 		dsa_prep_desc_common(sub_task->desc, sub_task->opcode,
-				(uint64_t)(sub_task->dst1),
-				(uint64_t)(sub_task->src1),
-				0, dflags);
+				     (uint64_t)(sub_task->dst1),
+				     (uint64_t)(sub_task->src1),
+				     0, dflags);
 		sub_task->desc->completion_addr = (uint64_t)(sub_task->comp);
 		sub_task->comp->status = 0;
 	}
@@ -98,11 +98,11 @@ void dsa_prep_batch_memcpy(struct batch_task *btsk)
 	struct task *sub_task;
 
 	for (i = 0; i < btsk->task_num; i++) {
-		sub_task = &(btsk->sub_tasks[i]);
+		sub_task = &btsk->sub_tasks[i];
 		dsa_prep_desc_common(sub_task->desc, sub_task->opcode,
-				(uint64_t)(sub_task->dst1),
-				(uint64_t)(sub_task->src1),
-				sub_task->xfer_size, sub_task->dflags);
+				     (uint64_t)(sub_task->dst1),
+				     (uint64_t)(sub_task->src1),
+				     sub_task->xfer_size, sub_task->dflags);
 		sub_task->desc->completion_addr = (uint64_t)(sub_task->comp);
 		sub_task->comp->status = 0;
 	}
@@ -114,7 +114,7 @@ void dsa_prep_memfill(struct task *tsk)
 
 	/* src_addr is the location of pattern for memfill descriptor */
 	dsa_prep_desc_common(tsk->desc, tsk->opcode, (uint64_t)(tsk->dst1),
-			tsk->pattern, tsk->xfer_size, tsk->dflags);
+			     tsk->pattern, tsk->xfer_size, tsk->dflags);
 	tsk->desc->completion_addr = (uint64_t)(tsk->comp);
 	tsk->comp->status = 0;
 }
@@ -125,8 +125,8 @@ void dsa_reprep_memfill(struct dsa_context *ctx)
 	struct dsa_hw_desc *hw = ctx->single_task->desc;
 
 	info("PF addr %#lx dir %d bc %#x\n",
-			compl->fault_addr, compl->result,
-			compl->bytes_completed);
+	     compl->fault_addr, compl->result,
+	     compl->bytes_completed);
 
 	hw->xfer_size -= compl->bytes_completed;
 
@@ -145,12 +145,12 @@ void dsa_prep_batch_memfill(struct batch_task *btsk)
 	struct task *sub_task;
 
 	for (i = 0; i < btsk->task_num; i++) {
-		sub_task = &(btsk->sub_tasks[i]);
+		sub_task = &btsk->sub_tasks[i];
 		dsa_prep_desc_common(sub_task->desc, sub_task->opcode,
-				(uint64_t)(sub_task->dst1),
-				sub_task->pattern,
-				sub_task->xfer_size,
-				sub_task->dflags);
+				     (uint64_t)(sub_task->dst1),
+				     sub_task->pattern,
+				     sub_task->xfer_size,
+				     sub_task->dflags);
 		sub_task->desc->completion_addr = (uint64_t)(sub_task->comp);
 		sub_task->comp->status = 0;
 	}
@@ -161,7 +161,7 @@ void dsa_prep_compare(struct task *tsk)
 	info("preparing descriptor for compare\n");
 
 	dsa_prep_desc_common(tsk->desc, tsk->opcode, (uint64_t)(tsk->src1),
-			(uint64_t)(tsk->src2), tsk->xfer_size, tsk->dflags);
+			     (uint64_t)(tsk->src2), tsk->xfer_size, tsk->dflags);
 	tsk->desc->completion_addr = (uint64_t)(tsk->comp);
 	tsk->comp->status = 0;
 }
@@ -172,8 +172,8 @@ void dsa_reprep_compare(struct dsa_context *ctx)
 	struct dsa_hw_desc *hw = ctx->single_task->desc;
 
 	info("PF addr %#lx dir %d bc %#x\n",
-			compl->fault_addr, compl->result,
-			compl->bytes_completed);
+	     compl->fault_addr, compl->result,
+	     compl->bytes_completed);
 
 	hw->xfer_size -= compl->bytes_completed;
 
@@ -193,12 +193,12 @@ void dsa_prep_batch_compare(struct batch_task *btsk)
 	struct task *sub_task;
 
 	for (i = 0; i < btsk->task_num; i++) {
-		sub_task = &(btsk->sub_tasks[i]);
+		sub_task = &btsk->sub_tasks[i];
 		dsa_prep_desc_common(sub_task->desc, sub_task->opcode,
-				(uint64_t)(sub_task->src1),
-				(uint64_t)(sub_task->src2),
-				sub_task->xfer_size,
-				sub_task->dflags);
+				     (uint64_t)(sub_task->src1),
+				     (uint64_t)(sub_task->src2),
+				     sub_task->xfer_size,
+				     sub_task->dflags);
 		sub_task->desc->completion_addr = (uint64_t)(sub_task->comp);
 		sub_task->comp->status = 0;
 	}
@@ -209,7 +209,7 @@ void dsa_prep_compval(struct task *tsk)
 	info("preparing descriptor for compval\n");
 
 	dsa_prep_desc_common(tsk->desc, tsk->opcode, tsk->pattern,
-			(uint64_t)(tsk->src1), tsk->xfer_size, tsk->dflags);
+			     (uint64_t)(tsk->src1), tsk->xfer_size, tsk->dflags);
 	tsk->desc->completion_addr = (uint64_t)(tsk->comp);
 	tsk->comp->status = 0;
 }
@@ -220,8 +220,8 @@ void dsa_reprep_compval(struct dsa_context *ctx)
 	struct dsa_hw_desc *hw = ctx->single_task->desc;
 
 	info("PF addr %#lx dir %d bc %#x\n",
-			compl->fault_addr, compl->result,
-			compl->bytes_completed);
+	     compl->fault_addr, compl->result,
+	     compl->bytes_completed);
 
 	hw->xfer_size -= compl->bytes_completed;
 
@@ -240,12 +240,12 @@ void dsa_prep_batch_compval(struct batch_task *btsk)
 	struct task *sub_task;
 
 	for (i = 0; i < btsk->task_num; i++) {
-		sub_task = &(btsk->sub_tasks[i]);
+		sub_task = &btsk->sub_tasks[i];
 		dsa_prep_desc_common(sub_task->desc, sub_task->opcode,
-				sub_task->pattern,
-				(uint64_t)(sub_task->src1),
-				sub_task->xfer_size,
-				sub_task->dflags);
+				     sub_task->pattern,
+				     (uint64_t)(sub_task->src1),
+				     sub_task->xfer_size,
+				     sub_task->dflags);
 		sub_task->desc->completion_addr = (uint64_t)(sub_task->comp);
 		sub_task->comp->status = 0;
 	}
@@ -256,7 +256,7 @@ void dsa_prep_dualcast(struct task *tsk)
 	info("preparing descriptor for dualcast\n");
 
 	dsa_prep_desc_common(tsk->desc, tsk->opcode, (uint64_t)(tsk->dst1),
-			(uint64_t)(tsk->src1), tsk->xfer_size, tsk->dflags);
+			     (uint64_t)(tsk->src1), tsk->xfer_size, tsk->dflags);
 	tsk->desc->dest2 = (uint64_t)(tsk->dst2);
 	tsk->desc->completion_addr = (uint64_t)(tsk->comp);
 	tsk->comp->status = 0;
@@ -268,8 +268,8 @@ void dsa_reprep_dualcast(struct dsa_context *ctx)
 	struct dsa_hw_desc *hw = ctx->single_task->desc;
 
 	info("PF addr %#lx dir %d bc %#x\n",
-			compl->fault_addr, compl->result,
-			compl->bytes_completed);
+	     compl->fault_addr, compl->result,
+	     compl->bytes_completed);
 
 	hw->xfer_size -= compl->bytes_completed;
 
@@ -290,12 +290,12 @@ void dsa_prep_batch_dualcast(struct batch_task *btsk)
 	struct task *sub_task;
 
 	for (i = 0; i < btsk->task_num; i++) {
-		sub_task = &(btsk->sub_tasks[i]);
+		sub_task = &btsk->sub_tasks[i];
 		dsa_prep_desc_common(sub_task->desc, sub_task->opcode,
-				(uint64_t)(sub_task->dst1),
-				(uint64_t)(sub_task->src1),
-				sub_task->xfer_size,
-				sub_task->dflags);
+				     (uint64_t)(sub_task->dst1),
+				     (uint64_t)(sub_task->src1),
+				     sub_task->xfer_size,
+				     sub_task->dflags);
 		sub_task->desc->dest2 = (uint64_t)(sub_task->dst2);
 		sub_task->desc->completion_addr = (uint64_t)(sub_task->comp);
 		sub_task->comp->status = 0;
@@ -312,8 +312,8 @@ void dsa_prep_batch(struct batch_task *btsk, unsigned long desc_flags)
 	desc_flags &= ~IDXD_OP_FLAG_BOF;
 
 	dsa_prep_desc_common(ctsk->desc, DSA_OPCODE_BATCH,
-			0, (uint64_t)(btsk->sub_descs),
-			btsk->task_num, desc_flags);
+			     0, (uint64_t)(btsk->sub_descs),
+			     btsk->task_num, desc_flags);
 	ctsk->desc->completion_addr = (uint64_t)(ctsk->comp);
 	ctsk->desc->desc_count = (uint32_t)(btsk->task_num);
 
-- 
2.27.0