Skip to contentSkip to conversation

Staging: vc04_services: Remove typedef VCHI_CONNECTION_API_T

PATCH Superseded Meghana Madhyastha 2 participants 2 messages Sep 11, 2017

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: vc04_services: Remove typedef VCHI_CONNECTION_API_T

Removes the typedef in order to make the code more readable.

---
 .../staging/vc04_services/interface/vchi/connections/connection.h | 4 ++--
 drivers/staging/vc04_services/interface/vchi/vchi.h               | 8 ++++----
 drivers/staging/vc04_services/interface/vchi/vchi_common.h        | 3 ---
 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c    | 4 ++--
 4 files changed, 8 insertions(+), 11 deletions(-)
drivers/staging/vc04_services/interface/vchi/connections/connection.h +2 -2
index e793cdf..4ec16ec 100644
@@ -217,7 +217,7 @@ typedef void   (*VCHI_BUFFER_FREE)(VCHI_CONNECTION_SERVICE_HANDLE_T service_hand
  System driver struct
  *****************************************************************************/
 
-struct opaque_vchi_connection_api_t {
+struct opaque_vchi_connection_api {
    // Routine to init the connection
    VCHI_CONNECTION_INIT_T                      init;
 
@@ -314,7 +314,7 @@ struct opaque_vchi_connection_api_t {
 };
 
 struct vchi_connection_t {
-   const VCHI_CONNECTION_API_T *api;
+   const struct opaque_vchi_connection_api *api;
    VCHI_CONNECTION_STATE_T     *state;
 #ifdef VCHI_COARSE_LOCKING
    struct semaphore             sem;
drivers/staging/vc04_services/interface/vchi/vchi.h +4 -4
index addb7b0..7e14532 100644
@@ -159,7 +159,7 @@ typedef struct service_info_tag {
 extern "C" {
 #endif
 
-extern /*@observer@*/ VCHI_CONNECTION_T * vchi_create_connection( const VCHI_CONNECTION_API_T * function_table,
+extern /*@observer@*/ VCHI_CONNECTION_T * vchi_create_connection( const struct opaque_vchi_connection_api * function_table,
                                                    const VCHI_MESSAGE_DRIVER_T * low_level);
 
 
@@ -341,9 +341,9 @@ extern int32_t vchi_bulk_queue_transmit( VCHI_SERVICE_HANDLE_T handle,
  *****************************************************************************/
 
 // function prototypes for the different mid layers (the state info gives the different physical connections)
-extern const VCHI_CONNECTION_API_T *single_get_func_table( void );
-//extern const VCHI_CONNECTION_API_T *local_server_get_func_table( void );
-//extern const VCHI_CONNECTION_API_T *local_client_get_func_table( void );
+extern const struct opaque_vchi_connection_api *single_get_func_table( void );
+//extern const struct opaque_vchi_connection_api *local_server_get_func_table( void );
+//extern const struct opaque_vchi_connection_api *local_client_get_func_table( void );
 
 // declare all message drivers here
 const VCHI_MESSAGE_DRIVER_T *vchi_mphi_message_driver_func_table( void );
drivers/staging/vc04_services/interface/vchi/vchi_common.h +0 -3
index 45c2070..7a4cf69 100644
@@ -148,9 +148,6 @@ typedef struct vchi_msg_vector {
    int32_t vec_len;
 } VCHI_MSG_VECTOR_T;
 
-// Opaque type for a connection API
-typedef struct opaque_vchi_connection_api_t VCHI_CONNECTION_API_T;
-
 // Opaque type for a message driver
 typedef struct opaque_vchi_message_driver_t VCHI_MESSAGE_DRIVER_T;
 
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +2 -2
index 8af95fc..44c7eea 100644
@@ -62,14 +62,14 @@ vchi_mphi_message_driver_func_table(void)
 /* ----------------------------------------------------------------------
  * return a pointer to the 'single' connection driver fops
  * -------------------------------------------------------------------- */
-const VCHI_CONNECTION_API_T *
+const struct opaque_vchi_connection_api *
 single_get_func_table(void)
 {
 	return NULL;
 }
 
 VCHI_CONNECTION_T *vchi_create_connection(
-	const VCHI_CONNECTION_API_T *function_table,
+	const struct opaque_vchi_connection_api *function_table,
 	const VCHI_MESSAGE_DRIVER_T *low_level)
 {
 	(void)function_table;
Signature · 1 line
2.7.4
#1 lore raw
Quoted 37 lines · Meghana Madhyastha

Removes the typedef in order to make the code more readable.

---
 .../staging/vc04_services/interface/vchi/connections/connection.h | 4 ++--
 drivers/staging/vc04_services/interface/vchi/vchi.h               | 8 ++++----
 drivers/staging/vc04_services/interface/vchi/vchi_common.h        | 3 ---
 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c    | 4 ++--
 4 files changed, 8 insertions(+), 11 deletions(-)
drivers/staging/vc04_services/interface/vchi/connections/connection.h +2 -2
index e793cdf..4ec16ec 100644
@@ -217,7 +217,7 @@ typedef void   (*VCHI_BUFFER_FREE)(VCHI_CONNECTION_SERVICE_HANDLE_T service_hand
  System driver struct
  *****************************************************************************/
 
-struct opaque_vchi_connection_api_t {
+struct opaque_vchi_connection_api {
    // Routine to init the connection
    VCHI_CONNECTION_INIT_T                      init;
 
@@ -314,7 +314,7 @@ struct opaque_vchi_connection_api_t {
 };
 
 struct vchi_connection_t {
-   const VCHI_CONNECTION_API_T *api;
+   const struct opaque_vchi_connection_api *api;
    VCHI_CONNECTION_STATE_T     *state;
 #ifdef VCHI_COARSE_LOCKING
    struct semaphore             sem;
drivers/staging/vc04_services/interface/vchi/vchi.h +0 -0
index addb7b0..7e14532 100644

drivers/staging/vc04_services/interface/vchi/vchi.h typedef struct service_info_tag { · line 163

Quoted 6 lines
drivers/staging/vc04_services/interface/vchi/vchi.h +1 -1
@@ -159,7 +159,7 @@ typedef struct service_info_tag {
 extern "C" {
 #endif
 
-extern /*@observer@*/ VCHI_CONNECTION_T * vchi_create_connection( const VCHI_CONNECTION_API_T * function_table,
+extern /*@observer@*/ VCHI_CONNECTION_T * vchi_create_connection( const struct opaque_vchi_connection_api * function_table,
                                                    const VCHI_MESSAGE_DRIVER_T * low_level);

An 80-column problem has gotten worse by adding struct. Maybe put a newline plus tabe before the first parameter to move things over to the left.

drivers/staging/vc04_services/interface/vchi/vchi.h extern int32_t vchi_bulk_queue_transmit( VCHI_SERVICE_HANDLE_T handle, · line 346

Quoted 12 lines
drivers/staging/vc04_services/interface/vchi/vchi.h +3 -3
@@ -341,9 +341,9 @@ extern int32_t vchi_bulk_queue_transmit( VCHI_SERVICE_HANDLE_T handle,
  *****************************************************************************/
 
 // function prototypes for the different mid layers (the state info gives the different physical connections)
-extern const VCHI_CONNECTION_API_T *single_get_func_table( void );
-//extern const VCHI_CONNECTION_API_T *local_server_get_func_table( void );
-//extern const VCHI_CONNECTION_API_T *local_client_get_func_table( void );
+extern const struct opaque_vchi_connection_api *single_get_func_table( void );
+//extern const struct opaque_vchi_connection_api *local_server_get_func_table( void );
+//extern const struct opaque_vchi_connection_api *local_client_get_func_table( void );

Maybe the code under comments could just be dropped.

julia

Quoted 47 lines
drivers/staging/vc04_services/interface/vchi/vchi.h +0 -0
 // declare all message drivers here
 const VCHI_MESSAGE_DRIVER_T *vchi_mphi_message_driver_func_table( void );
drivers/staging/vc04_services/interface/vchi/vchi_common.h +0 -3
index 45c2070..7a4cf69 100644
@@ -148,9 +148,6 @@ typedef struct vchi_msg_vector {
    int32_t vec_len;
 } VCHI_MSG_VECTOR_T;
 
-// Opaque type for a connection API
-typedef struct opaque_vchi_connection_api_t VCHI_CONNECTION_API_T;
-
 // Opaque type for a message driver
 typedef struct opaque_vchi_message_driver_t VCHI_MESSAGE_DRIVER_T;
 
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +2 -3
index 8af95fc..44c7eea 100644
@@ -62,14 +62,14 @@ vchi_mphi_message_driver_func_table(void)
 /* ----------------------------------------------------------------------
  * return a pointer to the 'single' connection driver fops
  * -------------------------------------------------------------------- */
-const VCHI_CONNECTION_API_T *
+const struct opaque_vchi_connection_api *
 single_get_func_table(void)
 {
 	return NULL;
 }
 
 VCHI_CONNECTION_T *vchi_create_connection(
-	const VCHI_CONNECTION_API_T *function_table,
+	const struct opaque_vchi_connection_api *function_table,
 	const VCHI_MESSAGE_DRIVER_T *low_level)
 {
 	(void)function_table;
--

2.7.4

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20170911210239.GA3628%40meghana-HP-Pavilion-Notebook.
For more options, visit https://groups.google.com/d/optout.