[PATCH v2 05/33] staging: vc04_services: Remove USER_SERVICE_T typedef

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Typedefing structs is not encouraged in the kernel.

Signed-off-by: Dominic Braun <inf.braun@xxxxxx>
Signed-off-by: Tobias Büttner <tobias.buettner@xxxxxx>
---
 .../interface/vchiq_arm/vchiq_arm.c           | 44 ++++++++++---------
 1 file changed, 23 insertions(+), 21 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 fa15033daf5f..50b874271cea 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -110,7 +110,7 @@ static const char *const resume_state_names[] = {
 
 static void suspend_timer_callback(struct timer_list *t);
 
-typedef struct user_service_struct {
+struct user_service {
 	VCHIQ_SERVICE_T *service;
 	void *userdata;
 	VCHIQ_INSTANCE_T instance;
@@ -124,7 +124,7 @@ typedef struct user_service_struct {
 	struct completion remove_event;
 	struct completion close_event;
 	VCHIQ_HEADER_T * msg_queue[MSG_QUEUE_SIZE];
-} USER_SERVICE_T;
+};
 
 struct bulk_waiter_node {
 	struct bulk_waiter bulk_waiter;
@@ -546,7 +546,7 @@ vchiq_blocking_bulk_transfer(VCHIQ_SERVICE_HANDLE_T handle, void *data,
 
 static VCHIQ_STATUS_T
 add_completion(VCHIQ_INSTANCE_T instance, VCHIQ_REASON_T reason,
-	VCHIQ_HEADER_T *header, USER_SERVICE_T *user_service,
+	VCHIQ_HEADER_T *header, struct user_service *user_service,
 	void *bulk_userdata)
 {
 	VCHIQ_COMPLETION_DATA_T *completion;
@@ -616,11 +616,11 @@ service_callback(VCHIQ_REASON_T reason, VCHIQ_HEADER_T *header,
 	VCHIQ_SERVICE_HANDLE_T handle, void *bulk_userdata)
 {
 	/* How do we ensure the callback goes to the right client?
-	** The service_user data points to a USER_SERVICE_T record containing
-	** the original callback and the user state structure, which contains a
-	** circular buffer for completion records.
+	** The service_user data points to a user_service record
+	** containing the original callback and the user state structure, which
+	** contains a circular buffer for completion records.
 	*/
-	USER_SERVICE_T *user_service;
+	struct user_service *user_service;
 	VCHIQ_SERVICE_T *service;
 	VCHIQ_INSTANCE_T instance;
 	bool skip_completion = false;
@@ -631,7 +631,7 @@ service_callback(VCHIQ_REASON_T reason, VCHIQ_HEADER_T *header,
 
 	service = handle_to_service(handle);
 	BUG_ON(!service);
-	user_service = (USER_SERVICE_T *)service->base.userdata;
+	user_service = (struct user_service *)service->base.userdata;
 	instance = user_service->instance;
 
 	if (!instance || instance->closing)
@@ -735,7 +735,7 @@ user_service_free(void *userdata)
 *   close_delivered
 *
 ***************************************************************************/
-static void close_delivered(USER_SERVICE_T *user_service)
+static void close_delivered(struct user_service *user_service)
 {
 	vchiq_log_info(vchiq_arm_log_level,
 		"%s(handle=%x)",
@@ -899,7 +899,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 
 	case VCHIQ_IOC_CREATE_SERVICE: {
 		VCHIQ_CREATE_SERVICE_T args;
-		USER_SERVICE_T *user_service = NULL;
+		struct user_service *user_service = NULL;
 		void *userdata;
 		int srvstate;
 
@@ -910,7 +910,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 			break;
 		}
 
-		user_service = kmalloc(sizeof(USER_SERVICE_T), GFP_KERNEL);
+		user_service = kmalloc(sizeof(*user_service), GFP_KERNEL);
 		if (!user_service) {
 			ret = -ENOMEM;
 			break;
@@ -984,7 +984,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 	case VCHIQ_IOC_CLOSE_SERVICE:
 	case VCHIQ_IOC_REMOVE_SERVICE: {
 		VCHIQ_SERVICE_HANDLE_T handle = (VCHIQ_SERVICE_HANDLE_T)arg;
-		USER_SERVICE_T *user_service;
+		struct user_service *user_service;
 
 		service = find_service_for_instance(instance, handle);
 		if (!service) {
@@ -1204,7 +1204,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 			for (ret = 0; ret < args.count; ret++) {
 				VCHIQ_COMPLETION_DATA_T *completion;
 				VCHIQ_SERVICE_T *service;
-				USER_SERVICE_T *user_service;
+				struct user_service *user_service;
 				VCHIQ_HEADER_T *header;
 
 				if (remove == instance->completion_insert)
@@ -1320,7 +1320,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 
 	case VCHIQ_IOC_DEQUEUE_MESSAGE: {
 		VCHIQ_DEQUEUE_MESSAGE_T args;
-		USER_SERVICE_T *user_service;
+		struct user_service *user_service;
 		VCHIQ_HEADER_T *header;
 
 		DEBUG_TRACE(DEQUEUE_MESSAGE_LINE);
@@ -1335,7 +1335,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 			ret = -EINVAL;
 			break;
 		}
-		user_service = (USER_SERVICE_T *)service->base.userdata;
+		user_service = (struct user_service *)service->base.userdata;
 		if (user_service->is_vchi == 0) {
 			ret = -EINVAL;
 			break;
@@ -1462,8 +1462,8 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 
 		service = find_closed_service_for_instance(instance, handle);
 		if (service != NULL) {
-			USER_SERVICE_T *user_service =
-				(USER_SERVICE_T *)service->base.userdata;
+			struct user_service *user_service =
+				(struct user_service *)service->base.userdata;
 			close_delivered(user_service);
 		} else
 			ret = -EINVAL;
@@ -2021,7 +2021,7 @@ static int vchiq_release(struct inode *inode, struct file *file)
 	/* Mark all services for termination... */
 	i = 0;
 	while ((service = next_service_by_instance(state, instance, &i))) {
-		USER_SERVICE_T *user_service = service->base.userdata;
+		struct user_service *user_service = service->base.userdata;
 
 		/* Wake the slot handler if the msg queue is full. */
 		complete(&user_service->remove_event);
@@ -2033,7 +2033,7 @@ static int vchiq_release(struct inode *inode, struct file *file)
 	/* ...and wait for them to die */
 	i = 0;
 	while ((service = next_service_by_instance(state, instance, &i))) {
-		USER_SERVICE_T *user_service = service->base.userdata;
+		struct user_service *user_service = service->base.userdata;
 
 		wait_for_completion(&service->remove_event);
 
@@ -2069,7 +2069,8 @@ static int vchiq_release(struct inode *inode, struct file *file)
 			instance->completion_remove & (MAX_COMPLETIONS - 1)];
 		service = completion->service_userdata;
 		if (completion->reason == VCHIQ_SERVICE_CLOSED) {
-			USER_SERVICE_T *user_service = service->base.userdata;
+			struct user_service *user_service =
+							service->base.userdata;
 
 			/* Wake any blocked user-thread */
 			if (instance->use_close_delivered)
@@ -2210,7 +2211,8 @@ vchiq_dump_platform_instances(void *dump_context)
 void
 vchiq_dump_platform_service_state(void *dump_context, VCHIQ_SERVICE_T *service)
 {
-	USER_SERVICE_T *user_service = (USER_SERVICE_T *)service->base.userdata;
+	struct user_service *user_service =
+			(struct user_service *)service->base.userdata;
 	char buf[80];
 	int len;
 
-- 
2.17.1

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux