[PATCH 25/33] staging: vc04_services: Remove VCHIQ_SERVICE_QUOTA_T typedef

Dominic Braun inf.braun at fau.de
Tue Dec 11 18:31:22 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_core.c          | 19 ++++++++++---------
 .../interface/vchiq_arm/vchiq_core.h          |  6 +++---
 2 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
index b22f1ec44f62..db2ce2ea17db 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
@@ -358,7 +358,7 @@ static void
 mark_service_closing_internal(VCHIQ_SERVICE_T *service, int sh_thread)
 {
 	VCHIQ_STATE_T *state = service->state;
-	VCHIQ_SERVICE_QUOTA_T *service_quota;
+	struct vchiq_service_quota_struct *service_quota;
 
 	service->closing = 1;
 
@@ -665,8 +665,9 @@ process_free_queue(VCHIQ_STATE_T *state, BITSET_T *service_found, size_t length)
 
 			if (VCHIQ_MSG_TYPE(msgid) == VCHIQ_MSG_DATA) {
 				int port = VCHIQ_MSG_SRCPORT(msgid);
-				VCHIQ_SERVICE_QUOTA_T *service_quota =
-					&state->service_quotas[port];
+				struct vchiq_service_quota_struct
+					*service_quota =
+						&state->service_quotas[port];
 				int count;
 
 				spin_lock(&quota_spinlock);
@@ -813,7 +814,7 @@ queue_message(VCHIQ_STATE_T *state, VCHIQ_SERVICE_T *service,
 	int flags)
 {
 	VCHIQ_SHARED_STATE_T *local;
-	VCHIQ_SERVICE_QUOTA_T *service_quota = NULL;
+	struct vchiq_service_quota_struct *service_quota = NULL;
 	struct vchiq_header_struct *header;
 	int type = VCHIQ_MSG_TYPE(msgid);
 
@@ -2216,7 +2217,7 @@ vchiq_init_state(VCHIQ_STATE_T *state, VCHIQ_SLOT_ZERO_T *slot_zero)
 	state->slot_queue_available = 0;
 
 	for (i = 0; i < VCHIQ_MAX_SERVICES; i++) {
-		VCHIQ_SERVICE_QUOTA_T *service_quota =
+		struct vchiq_service_quota_struct *service_quota =
 			&state->service_quotas[i];
 		init_completion(&service_quota->quota_event);
 	}
@@ -2326,7 +2327,7 @@ vchiq_add_service_internal(VCHIQ_STATE_T *state,
 {
 	VCHIQ_SERVICE_T *service;
 	VCHIQ_SERVICE_T **pservice = NULL;
-	VCHIQ_SERVICE_QUOTA_T *service_quota;
+	struct vchiq_service_quota_struct *service_quota;
 	int i;
 
 	service = kmalloc(sizeof(VCHIQ_SERVICE_T), GFP_KERNEL);
@@ -3320,7 +3321,7 @@ vchiq_set_service_option(VCHIQ_SERVICE_HANDLE_T handle,
 			break;
 
 		case VCHIQ_SERVICE_OPTION_SLOT_QUOTA: {
-			VCHIQ_SERVICE_QUOTA_T *service_quota =
+			struct vchiq_service_quota_struct *service_quota =
 				&service->state->service_quotas[
 					service->localport];
 			if (value == 0)
@@ -3340,7 +3341,7 @@ vchiq_set_service_option(VCHIQ_SERVICE_HANDLE_T handle,
 		} break;
 
 		case VCHIQ_SERVICE_OPTION_MESSAGE_QUOTA: {
-			VCHIQ_SERVICE_QUOTA_T *service_quota =
+			struct vchiq_service_quota_struct *service_quota =
 				&service->state->service_quotas[
 					service->localport];
 			if (value == 0)
@@ -3502,7 +3503,7 @@ vchiq_dump_service_state(void *dump_context, VCHIQ_SERVICE_T *service)
 
 	if (service->srvstate != VCHIQ_SRVSTATE_FREE) {
 		char remoteport[30];
-		VCHIQ_SERVICE_QUOTA_T *service_quota =
+		struct vchiq_service_quota_struct *service_quota =
 			&service->state->service_quotas[service->localport];
 		int fourcc = service->base.fourcc;
 		int tx_pending, rx_pending;
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
index 8ee881faf179..bd38b3dd9f3e 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
@@ -332,14 +332,14 @@ typedef struct vchiq_service_struct {
 	statically allocated, since for accounting reasons a service's slot
 	usage is carried over between users of the same port number.
  */
-typedef struct vchiq_service_quota_struct {
+struct vchiq_service_quota_struct {
 	unsigned short slot_quota;
 	unsigned short slot_use_count;
 	unsigned short message_quota;
 	unsigned short message_use_count;
 	struct completion quota_event;
 	int previous_tx_index;
-} VCHIQ_SERVICE_QUOTA_T;
+};
 
 typedef struct vchiq_shared_state_struct {
 
@@ -497,7 +497,7 @@ struct vchiq_state_struct {
 	} stats;
 
 	VCHIQ_SERVICE_T * services[VCHIQ_MAX_SERVICES];
-	VCHIQ_SERVICE_QUOTA_T service_quotas[VCHIQ_MAX_SERVICES];
+	struct vchiq_service_quota_struct service_quotas[VCHIQ_MAX_SERVICES];
 	VCHIQ_SLOT_INFO_T slot_info[VCHIQ_MAX_SLOTS];
 
 	VCHIQ_PLATFORM_STATE_T platform_state;
-- 
2.17.1



More information about the devel mailing list