[PATCH 13/33] staging: vc04_services: Remove VCHIQ_COMPLETION_DATA_T typedef

Dominic Braun inf.braun at fau.de
Tue Dec 11 18:31:10 UTC 2018


Typedefing structs is not encouraged in the kernel.

The removal of typedefs was requested in interface/vchi/TODO in commit
7626e002225a4c1b9455689b1f22909dfeff43ca.

Signed-off-by: Dominic Braun <inf.braun at fau.de>
Signed-off-by: Tobias Büttner <tobias.buettner at fau.de>
---
 .../interface/vchiq_arm/vchiq_arm.c           | 23 +++++++++++--------
 .../interface/vchiq_arm/vchiq_ioctl.h         |  6 ++---
 2 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
index 52495ef7b33d..37e92cbb9dac 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -133,7 +133,7 @@ struct bulk_waiter_node {
 
 struct vchiq_instance_struct {
 	VCHIQ_STATE_T *state;
-	VCHIQ_COMPLETION_DATA_T completions[MAX_COMPLETIONS];
+	struct vchiq_completion_data_struct completions[MAX_COMPLETIONS];
 	int completion_insert;
 	int completion_remove;
 	struct completion insert_event;
@@ -547,7 +547,7 @@ add_completion(VCHIQ_INSTANCE_T instance, VCHIQ_REASON_T reason,
 	VCHIQ_HEADER_T *header, struct user_service_struct *user_service,
 	void *bulk_userdata)
 {
-	VCHIQ_COMPLETION_DATA_T *completion;
+	struct vchiq_completion_data_struct *completion;
 	int insert;
 
 	DEBUG_INITIALISE(g_state.local)
@@ -1200,7 +1200,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 			int remove = instance->completion_remove;
 
 			for (ret = 0; ret < args.count; ret++) {
-				VCHIQ_COMPLETION_DATA_T *completion;
+				struct vchiq_completion_data_struct *completion;
 				VCHIQ_SERVICE_T *service;
 				struct user_service_struct *user_service;
 				VCHIQ_HEADER_T *header;
@@ -1281,10 +1281,13 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 					unlock_service(service);
 
 				if (copy_to_user((void __user *)(
-					(size_t)args.buf +
-					ret * sizeof(VCHIQ_COMPLETION_DATA_T)),
+					(size_t)args.buf + ret *
+					sizeof
+					(struct vchiq_completion_data_struct)),
 					completion,
-					sizeof(VCHIQ_COMPLETION_DATA_T)) != 0) {
+					sizeof
+					(struct vchiq_completion_data_struct))
+									!= 0) {
 						if (ret == 0)
 							ret = -EFAULT;
 					break;
@@ -1728,8 +1731,8 @@ vchiq_compat_ioctl_await_completion(struct file *file,
 				    unsigned long arg)
 {
 	struct vchiq_await_completion __user *args;
-	VCHIQ_COMPLETION_DATA_T __user *completion;
-	VCHIQ_COMPLETION_DATA_T completiontemp;
+	struct vchiq_completion_data_struct __user *completion;
+	struct vchiq_completion_data_struct completiontemp;
 	struct vchiq_await_completion32 args32;
 	struct vchiq_completion_data32 completion32;
 	unsigned int __user *msgbufcount32;
@@ -1745,7 +1748,7 @@ vchiq_compat_ioctl_await_completion(struct file *file,
 	if (!args)
 		return -EFAULT;
 
-	completion = (VCHIQ_COMPLETION_DATA_T __user *)(args + 1);
+	completion = (struct vchiq_completion_data_struct __user *)(args + 1);
 	msgbufptr = (void * __user *)(completion + 1);
 
 	if (copy_from_user(&args32,
@@ -2064,7 +2067,7 @@ static int vchiq_release(struct inode *inode, struct file *file)
 	/* Release any closed services */
 	while (instance->completion_remove !=
 		instance->completion_insert) {
-		VCHIQ_COMPLETION_DATA_T *completion;
+		struct vchiq_completion_data_struct *completion;
 		VCHIQ_SERVICE_T *service;
 
 		completion = &instance->completions[
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h
index 37bef2652411..8686d37bde0c 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h
@@ -61,16 +61,16 @@ typedef struct {
 	VCHIQ_BULK_MODE_T mode;
 } VCHIQ_QUEUE_BULK_TRANSFER_T;
 
-typedef struct {
+struct vchiq_completion_data_struct {
 	VCHIQ_REASON_T reason;
 	VCHIQ_HEADER_T *header;
 	void *service_userdata;
 	void *bulk_userdata;
-} VCHIQ_COMPLETION_DATA_T;
+};
 
 struct vchiq_await_completion {
 	unsigned int count;
-	VCHIQ_COMPLETION_DATA_T *buf;
+	struct vchiq_completion_data_struct *buf;
 	unsigned int msgbufsize;
 	unsigned int msgbufcount; /* IN/OUT */
 	void **msgbufs;
-- 
2.17.1



More information about the devel mailing list