* [PATCH] staging: vc04_services: Remove typedef struct
@ 2017-09-21 19:09 Harsha Sharma
2017-09-21 20:55 ` [Outreachy kernel] " Julia Lawall
0 siblings, 1 reply; 3+ messages in thread
From: Harsha Sharma @ 2017-09-21 19:09 UTC (permalink / raw)
To: gregkh; +Cc: devel, linux-kernel, outreachy-kernel, Harsha Sharma
Remove typedef from struct as linux-kernel coding style tends to
avoid using typedefs
Done using following coccinelle semantic patch
@r1@
type T;
@@
typedef struct { ... } T;
@script:python c1@
T2;
T << r1.T;
@@
if T[-2:] =="_t" or T[-2:] == "_T":
coccinelle.T2 = T[:-2];
else:
coccinelle.T2 = T;
print T, coccinelle.T2
@r2@
type r1.T;
identifier c1.T2;
@@
-typedef
struct
+ T2
{ ... }
-T
;
@r3@
type r1.T;
identifier c1.T2;
@@
-T
+struct T2
Signed-off-by: Harsha Sharma <harshasharmaiitr@gmail.com>
---
.../vc04_services/interface/vchiq_arm/vchiq_shim.c | 44 +++++++++++-----------
1 file changed, 22 insertions(+), 22 deletions(-)
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
index 8af95fc..adb602d 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
@@ -41,14 +41,14 @@
#define vchiq_status_to_vchi(status) ((int32_t)status)
-typedef struct {
+struct SHIM_SERVICE {
VCHIQ_SERVICE_HANDLE_T handle;
VCHIU_QUEUE_T queue;
VCHI_CALLBACK_T callback;
void *callback_param;
-} SHIM_SERVICE_T;
+};
/* ----------------------------------------------------------------------
* return pointer to the mphi message driver function table
@@ -99,7 +99,7 @@ int32_t vchi_msg_peek(VCHI_SERVICE_HANDLE_T handle,
uint32_t *msg_size,
VCHI_FLAGS_T flags)
{
- SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle;
+ struct SHIM_SERVICE *service = (struct SHIM_SERVICE *)handle;
VCHIQ_HEADER_T *header;
WARN_ON((flags != VCHI_FLAGS_NONE) &&
@@ -131,7 +131,7 @@ int32_t vchi_msg_peek(VCHI_SERVICE_HANDLE_T handle,
***********************************************************/
int32_t vchi_msg_remove(VCHI_SERVICE_HANDLE_T handle)
{
- SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle;
+ struct SHIM_SERVICE *service = (struct SHIM_SERVICE *)handle;
VCHIQ_HEADER_T *header;
header = vchiu_queue_pop(&service->queue);
@@ -163,7 +163,7 @@ int32_t vchi_msg_queue(VCHI_SERVICE_HANDLE_T handle,
void *context,
uint32_t data_size)
{
- SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle;
+ struct SHIM_SERVICE *service = (struct SHIM_SERVICE *)handle;
VCHIQ_STATUS_T status;
while (1) {
@@ -262,7 +262,7 @@ int32_t vchi_bulk_queue_receive(VCHI_SERVICE_HANDLE_T handle,
VCHI_FLAGS_T flags,
void *bulk_handle)
{
- SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle;
+ struct SHIM_SERVICE *service = (struct SHIM_SERVICE *)handle;
VCHIQ_BULK_MODE_T mode;
VCHIQ_STATUS_T status;
@@ -322,7 +322,7 @@ int32_t vchi_bulk_queue_transmit(VCHI_SERVICE_HANDLE_T handle,
VCHI_FLAGS_T flags,
void *bulk_handle)
{
- SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle;
+ struct SHIM_SERVICE *service = (struct SHIM_SERVICE *)handle;
VCHIQ_BULK_MODE_T mode;
VCHIQ_STATUS_T status;
@@ -384,7 +384,7 @@ int32_t vchi_msg_dequeue(VCHI_SERVICE_HANDLE_T handle,
uint32_t *actual_msg_size,
VCHI_FLAGS_T flags)
{
- SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle;
+ struct SHIM_SERVICE *service = (struct SHIM_SERVICE *)handle;
VCHIQ_HEADER_T *header;
WARN_ON((flags != VCHI_FLAGS_NONE) &&
@@ -458,7 +458,7 @@ int32_t vchi_msg_hold(VCHI_SERVICE_HANDLE_T handle,
VCHI_FLAGS_T flags,
VCHI_HELD_MSG_T *message_handle)
{
- SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle;
+ struct SHIM_SERVICE *service = (struct SHIM_SERVICE *)handle;
VCHIQ_HEADER_T *header;
WARN_ON((flags != VCHI_FLAGS_NONE) &&
@@ -579,8 +579,8 @@ int32_t vchi_disconnect(VCHI_INSTANCE_T instance_handle)
static VCHIQ_STATUS_T shim_callback(VCHIQ_REASON_T reason,
VCHIQ_HEADER_T *header, VCHIQ_SERVICE_HANDLE_T handle, void *bulk_user)
{
- SHIM_SERVICE_T *service =
- (SHIM_SERVICE_T *)VCHIQ_GET_SERVICE_USERDATA(handle);
+ struct SHIM_SERVICE *service =
+ (struct SHIM_SERVICE *)VCHIQ_GET_SERVICE_USERDATA(handle);
if (!service->callback)
goto release;
@@ -637,10 +637,10 @@ static VCHIQ_STATUS_T shim_callback(VCHIQ_REASON_T reason,
return VCHIQ_SUCCESS;
}
-static SHIM_SERVICE_T *service_alloc(VCHIQ_INSTANCE_T instance,
+static struct SHIM_SERVICE *service_alloc(VCHIQ_INSTANCE_T instance,
SERVICE_CREATION_T *setup)
{
- SHIM_SERVICE_T *service = kzalloc(sizeof(SHIM_SERVICE_T), GFP_KERNEL);
+ struct SHIM_SERVICE *service = kzalloc(sizeof(struct SHIM_SERVICE), GFP_KERNEL);
(void)instance;
@@ -657,7 +657,7 @@ static SHIM_SERVICE_T *service_alloc(VCHIQ_INSTANCE_T instance,
return service;
}
-static void service_free(SHIM_SERVICE_T *service)
+static void service_free(struct SHIM_SERVICE *service)
{
if (service) {
vchiu_queue_delete(&service->queue);
@@ -670,7 +670,7 @@ int32_t vchi_service_open(VCHI_INSTANCE_T instance_handle,
VCHI_SERVICE_HANDLE_T *handle)
{
VCHIQ_INSTANCE_T instance = (VCHIQ_INSTANCE_T)instance_handle;
- SHIM_SERVICE_T *service = service_alloc(instance, setup);
+ struct SHIM_SERVICE *service = service_alloc(instance, setup);
*handle = (VCHI_SERVICE_HANDLE_T)service;
@@ -703,7 +703,7 @@ int32_t vchi_service_create(VCHI_INSTANCE_T instance_handle,
VCHI_SERVICE_HANDLE_T *handle)
{
VCHIQ_INSTANCE_T instance = (VCHIQ_INSTANCE_T)instance_handle;
- SHIM_SERVICE_T *service = service_alloc(instance, setup);
+ struct SHIM_SERVICE *service = service_alloc(instance, setup);
*handle = (VCHI_SERVICE_HANDLE_T)service;
@@ -733,7 +733,7 @@ int32_t vchi_service_create(VCHI_INSTANCE_T instance_handle,
int32_t vchi_service_close(const VCHI_SERVICE_HANDLE_T handle)
{
int32_t ret = -1;
- SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle;
+ struct SHIM_SERVICE *service = (struct SHIM_SERVICE *)handle;
if (service) {
VCHIQ_STATUS_T status = vchiq_close_service(service->handle);
@@ -751,7 +751,7 @@ int32_t vchi_service_close(const VCHI_SERVICE_HANDLE_T handle)
int32_t vchi_service_destroy(const VCHI_SERVICE_HANDLE_T handle)
{
int32_t ret = -1;
- SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle;
+ struct SHIM_SERVICE *service = (struct SHIM_SERVICE *)handle;
if (service) {
VCHIQ_STATUS_T status = vchiq_remove_service(service->handle);
@@ -772,7 +772,7 @@ int32_t vchi_service_set_option(const VCHI_SERVICE_HANDLE_T handle,
int value)
{
int32_t ret = -1;
- SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle;
+ struct SHIM_SERVICE *service = (struct SHIM_SERVICE *)handle;
VCHIQ_SERVICE_OPTION_T vchiq_option;
switch (option) {
@@ -801,7 +801,7 @@ int32_t vchi_service_set_option(const VCHI_SERVICE_HANDLE_T handle,
int32_t vchi_get_peer_version(const VCHI_SERVICE_HANDLE_T handle, short *peer_version)
{
int32_t ret = -1;
- SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle;
+ struct SHIM_SERVICE *service = (struct SHIM_SERVICE *)handle;
if (service)
{
@@ -828,7 +828,7 @@ int32_t vchi_service_use(const VCHI_SERVICE_HANDLE_T handle)
{
int32_t ret = -1;
- SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle;
+ struct SHIM_SERVICE *service = (struct SHIM_SERVICE *)handle;
if (service)
ret = vchiq_status_to_vchi(vchiq_use_service(service->handle));
return ret;
@@ -849,7 +849,7 @@ int32_t vchi_service_release(const VCHI_SERVICE_HANDLE_T handle)
{
int32_t ret = -1;
- SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle;
+ struct SHIM_SERVICE *service = (struct SHIM_SERVICE *)handle;
if (service)
ret = vchiq_status_to_vchi(
vchiq_release_service(service->handle));
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Outreachy kernel] [PATCH] staging: vc04_services: Remove typedef struct
2017-09-21 19:09 [PATCH] staging: vc04_services: Remove typedef struct Harsha Sharma
@ 2017-09-21 20:55 ` Julia Lawall
0 siblings, 0 replies; 3+ messages in thread
From: Julia Lawall @ 2017-09-21 20:55 UTC (permalink / raw)
To: Harsha Sharma; +Cc: gregkh, devel, linux-kernel, outreachy-kernel
On Fri, 22 Sep 2017, Harsha Sharma wrote:
> Remove typedef from struct as linux-kernel coding style tends to
> avoid using typedefs
>
> Done using following coccinelle semantic patch
>
> @r1@
> type T;
> @@
>
> typedef struct { ... } T;
>
> @script:python c1@
> T2;
> T << r1.T;
> @@
> if T[-2:] =="_t" or T[-2:] == "_T":
> coccinelle.T2 = T[:-2];
> else:
> coccinelle.T2 = T;
>
> print T, coccinelle.T2
Could you also convert the structure name to lowercase?
julia
>
> @r2@
> type r1.T;
> identifier c1.T2;
> @@
> -typedef
> struct
> + T2
> { ... }
> -T
> ;
>
> @r3@
> type r1.T;
> identifier c1.T2;
> @@
> -T
> +struct T2
>
> Signed-off-by: Harsha Sharma <harshasharmaiitr@gmail.com>
> ---
> .../vc04_services/interface/vchiq_arm/vchiq_shim.c | 44 +++++++++++-----------
> 1 file changed, 22 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
> index 8af95fc..adb602d 100644
> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
> @@ -41,14 +41,14 @@
>
> #define vchiq_status_to_vchi(status) ((int32_t)status)
>
> -typedef struct {
> +struct SHIM_SERVICE {
> VCHIQ_SERVICE_HANDLE_T handle;
>
> VCHIU_QUEUE_T queue;
>
> VCHI_CALLBACK_T callback;
> void *callback_param;
> -} SHIM_SERVICE_T;
> +};
>
> /* ----------------------------------------------------------------------
> * return pointer to the mphi message driver function table
> @@ -99,7 +99,7 @@ int32_t vchi_msg_peek(VCHI_SERVICE_HANDLE_T handle,
> uint32_t *msg_size,
> VCHI_FLAGS_T flags)
> {
> - SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle;
> + struct SHIM_SERVICE *service = (struct SHIM_SERVICE *)handle;
> VCHIQ_HEADER_T *header;
>
> WARN_ON((flags != VCHI_FLAGS_NONE) &&
> @@ -131,7 +131,7 @@ int32_t vchi_msg_peek(VCHI_SERVICE_HANDLE_T handle,
> ***********************************************************/
> int32_t vchi_msg_remove(VCHI_SERVICE_HANDLE_T handle)
> {
> - SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle;
> + struct SHIM_SERVICE *service = (struct SHIM_SERVICE *)handle;
> VCHIQ_HEADER_T *header;
>
> header = vchiu_queue_pop(&service->queue);
> @@ -163,7 +163,7 @@ int32_t vchi_msg_queue(VCHI_SERVICE_HANDLE_T handle,
> void *context,
> uint32_t data_size)
> {
> - SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle;
> + struct SHIM_SERVICE *service = (struct SHIM_SERVICE *)handle;
> VCHIQ_STATUS_T status;
>
> while (1) {
> @@ -262,7 +262,7 @@ int32_t vchi_bulk_queue_receive(VCHI_SERVICE_HANDLE_T handle,
> VCHI_FLAGS_T flags,
> void *bulk_handle)
> {
> - SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle;
> + struct SHIM_SERVICE *service = (struct SHIM_SERVICE *)handle;
> VCHIQ_BULK_MODE_T mode;
> VCHIQ_STATUS_T status;
>
> @@ -322,7 +322,7 @@ int32_t vchi_bulk_queue_transmit(VCHI_SERVICE_HANDLE_T handle,
> VCHI_FLAGS_T flags,
> void *bulk_handle)
> {
> - SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle;
> + struct SHIM_SERVICE *service = (struct SHIM_SERVICE *)handle;
> VCHIQ_BULK_MODE_T mode;
> VCHIQ_STATUS_T status;
>
> @@ -384,7 +384,7 @@ int32_t vchi_msg_dequeue(VCHI_SERVICE_HANDLE_T handle,
> uint32_t *actual_msg_size,
> VCHI_FLAGS_T flags)
> {
> - SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle;
> + struct SHIM_SERVICE *service = (struct SHIM_SERVICE *)handle;
> VCHIQ_HEADER_T *header;
>
> WARN_ON((flags != VCHI_FLAGS_NONE) &&
> @@ -458,7 +458,7 @@ int32_t vchi_msg_hold(VCHI_SERVICE_HANDLE_T handle,
> VCHI_FLAGS_T flags,
> VCHI_HELD_MSG_T *message_handle)
> {
> - SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle;
> + struct SHIM_SERVICE *service = (struct SHIM_SERVICE *)handle;
> VCHIQ_HEADER_T *header;
>
> WARN_ON((flags != VCHI_FLAGS_NONE) &&
> @@ -579,8 +579,8 @@ int32_t vchi_disconnect(VCHI_INSTANCE_T instance_handle)
> static VCHIQ_STATUS_T shim_callback(VCHIQ_REASON_T reason,
> VCHIQ_HEADER_T *header, VCHIQ_SERVICE_HANDLE_T handle, void *bulk_user)
> {
> - SHIM_SERVICE_T *service =
> - (SHIM_SERVICE_T *)VCHIQ_GET_SERVICE_USERDATA(handle);
> + struct SHIM_SERVICE *service =
> + (struct SHIM_SERVICE *)VCHIQ_GET_SERVICE_USERDATA(handle);
>
> if (!service->callback)
> goto release;
> @@ -637,10 +637,10 @@ static VCHIQ_STATUS_T shim_callback(VCHIQ_REASON_T reason,
> return VCHIQ_SUCCESS;
> }
>
> -static SHIM_SERVICE_T *service_alloc(VCHIQ_INSTANCE_T instance,
> +static struct SHIM_SERVICE *service_alloc(VCHIQ_INSTANCE_T instance,
> SERVICE_CREATION_T *setup)
> {
> - SHIM_SERVICE_T *service = kzalloc(sizeof(SHIM_SERVICE_T), GFP_KERNEL);
> + struct SHIM_SERVICE *service = kzalloc(sizeof(struct SHIM_SERVICE), GFP_KERNEL);
>
> (void)instance;
>
> @@ -657,7 +657,7 @@ static SHIM_SERVICE_T *service_alloc(VCHIQ_INSTANCE_T instance,
> return service;
> }
>
> -static void service_free(SHIM_SERVICE_T *service)
> +static void service_free(struct SHIM_SERVICE *service)
> {
> if (service) {
> vchiu_queue_delete(&service->queue);
> @@ -670,7 +670,7 @@ int32_t vchi_service_open(VCHI_INSTANCE_T instance_handle,
> VCHI_SERVICE_HANDLE_T *handle)
> {
> VCHIQ_INSTANCE_T instance = (VCHIQ_INSTANCE_T)instance_handle;
> - SHIM_SERVICE_T *service = service_alloc(instance, setup);
> + struct SHIM_SERVICE *service = service_alloc(instance, setup);
>
> *handle = (VCHI_SERVICE_HANDLE_T)service;
>
> @@ -703,7 +703,7 @@ int32_t vchi_service_create(VCHI_INSTANCE_T instance_handle,
> VCHI_SERVICE_HANDLE_T *handle)
> {
> VCHIQ_INSTANCE_T instance = (VCHIQ_INSTANCE_T)instance_handle;
> - SHIM_SERVICE_T *service = service_alloc(instance, setup);
> + struct SHIM_SERVICE *service = service_alloc(instance, setup);
>
> *handle = (VCHI_SERVICE_HANDLE_T)service;
>
> @@ -733,7 +733,7 @@ int32_t vchi_service_create(VCHI_INSTANCE_T instance_handle,
> int32_t vchi_service_close(const VCHI_SERVICE_HANDLE_T handle)
> {
> int32_t ret = -1;
> - SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle;
> + struct SHIM_SERVICE *service = (struct SHIM_SERVICE *)handle;
>
> if (service) {
> VCHIQ_STATUS_T status = vchiq_close_service(service->handle);
> @@ -751,7 +751,7 @@ int32_t vchi_service_close(const VCHI_SERVICE_HANDLE_T handle)
> int32_t vchi_service_destroy(const VCHI_SERVICE_HANDLE_T handle)
> {
> int32_t ret = -1;
> - SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle;
> + struct SHIM_SERVICE *service = (struct SHIM_SERVICE *)handle;
>
> if (service) {
> VCHIQ_STATUS_T status = vchiq_remove_service(service->handle);
> @@ -772,7 +772,7 @@ int32_t vchi_service_set_option(const VCHI_SERVICE_HANDLE_T handle,
> int value)
> {
> int32_t ret = -1;
> - SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle;
> + struct SHIM_SERVICE *service = (struct SHIM_SERVICE *)handle;
> VCHIQ_SERVICE_OPTION_T vchiq_option;
>
> switch (option) {
> @@ -801,7 +801,7 @@ int32_t vchi_service_set_option(const VCHI_SERVICE_HANDLE_T handle,
> int32_t vchi_get_peer_version(const VCHI_SERVICE_HANDLE_T handle, short *peer_version)
> {
> int32_t ret = -1;
> - SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle;
> + struct SHIM_SERVICE *service = (struct SHIM_SERVICE *)handle;
>
> if (service)
> {
> @@ -828,7 +828,7 @@ int32_t vchi_service_use(const VCHI_SERVICE_HANDLE_T handle)
> {
> int32_t ret = -1;
>
> - SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle;
> + struct SHIM_SERVICE *service = (struct SHIM_SERVICE *)handle;
> if (service)
> ret = vchiq_status_to_vchi(vchiq_use_service(service->handle));
> return ret;
> @@ -849,7 +849,7 @@ int32_t vchi_service_release(const VCHI_SERVICE_HANDLE_T handle)
> {
> int32_t ret = -1;
>
> - SHIM_SERVICE_T *service = (SHIM_SERVICE_T *)handle;
> + struct SHIM_SERVICE *service = (struct SHIM_SERVICE *)handle;
> if (service)
> ret = vchiq_status_to_vchi(
> vchiq_release_service(service->handle));
> --
> 1.9.1
>
> --
> 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 outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1506020960-14190-1-git-send-email-harshasharmaiitr%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] staging: vc04_services: Remove typedef struct
@ 2017-09-28 11:02 Mihaela Muraru
0 siblings, 0 replies; 3+ messages in thread
From: Mihaela Muraru @ 2017-09-28 11:02 UTC (permalink / raw)
To: outreachy-kernel; +Cc: Eric Anholt, Stefan Wahren, Greg Kroah-Hartman
This patch removes typedef from struct and renames it from "typdedef struc vchiq_2835_state_struct" to "struct vchiq_2835_state" as per kernel coding standards.
Signed-off-by: Mihaela Muraru <mihaela.muraru21@gmail.com>
---
.../vc04_services/interface/vchiq_arm/vchiq_2835_arm.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
index 12b0e0d..ee00f51 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
@@ -59,10 +59,10 @@
#define BELL0 0x00
#define BELL2 0x08
-typedef struct vchiq_2835_state_struct {
+struct vchiq_2835_state {
int inited;
VCHIQ_ARM_STATE_T arm_state;
-} VCHIQ_2835_ARM_STATE_T;
+};
struct vchiq_pagelist_info {
PAGELIST_T *pagelist;
@@ -206,12 +206,12 @@ vchiq_platform_init_state(VCHIQ_STATE_T *state)
{
VCHIQ_STATUS_T status = VCHIQ_SUCCESS;
- state->platform_state = kzalloc(sizeof(VCHIQ_2835_ARM_STATE_T), GFP_KERNEL);
- ((VCHIQ_2835_ARM_STATE_T *)state->platform_state)->inited = 1;
- status = vchiq_arm_init_state(state, &((VCHIQ_2835_ARM_STATE_T *)state->platform_state)->arm_state);
+ state->platform_state = kzalloc(sizeof(struct vchiq_2835_state), GFP_KERNEL);
+ ((struct vchiq_2835_state *)state->platform_state)->inited = 1;
+ status = vchiq_arm_init_state(state, &((struct vchiq_2835_state *)state->platform_state)->arm_state);
if (status != VCHIQ_SUCCESS)
{
- ((VCHIQ_2835_ARM_STATE_T *)state->platform_state)->inited = 0;
+ ((struct vchiq_2835_state *)state->platform_state)->inited = 0;
}
return status;
}
@@ -219,11 +219,11 @@ vchiq_platform_init_state(VCHIQ_STATE_T *state)
VCHIQ_ARM_STATE_T*
vchiq_platform_get_arm_state(VCHIQ_STATE_T *state)
{
- if (!((VCHIQ_2835_ARM_STATE_T *)state->platform_state)->inited)
+ if (!((struct vchiq_2835_state *)state->platform_state)->inited)
{
BUG();
}
- return &((VCHIQ_2835_ARM_STATE_T *)state->platform_state)->arm_state;
+ return &((struct vchiq_2835_state *)state->platform_state)->arm_state;
}
void
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-09-28 11:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-21 19:09 [PATCH] staging: vc04_services: Remove typedef struct Harsha Sharma
2017-09-21 20:55 ` [Outreachy kernel] " Julia Lawall
2017-09-28 11:02 Mihaela Muraru
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.