[RFC 09/50] staging: vchiq: move vchiq_release_message() into vchiq

From: Nicolas Saenz Julienne
Date: Wed May 27 2020 - 07:54:43 EST


For messages with a reason different from VCHIQ_MESSAGE_AVAILABLE the
responsibility for releasing them is kept in vchi, in other words,
services don't need to worry about it. As we're trying to unify vchi and
vchiq, move the release code into vchiq.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@xxxxxxx>
---
.../staging/vc04_services/interface/vchiq_arm/vchiq_core.c | 4 ++++
.../staging/vc04_services/interface/vchiq_arm/vchiq_shim.c | 4 +---
2 files changed, 5 insertions(+), 3 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 67b2090c91db..ef31e541c902 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
@@ -372,6 +372,10 @@ make_service_callback(struct vchiq_service *service, enum vchiq_reason reason,
service->state->id, service->handle);
status = VCHIQ_SUCCESS;
}
+
+ if (reason != VCHIQ_MESSAGE_AVAILABLE)
+ vchiq_release_message(service->handle, header);
+
return status;
}

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 0fc5fa05c6c2..55f9e34ea50e 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
@@ -444,7 +444,7 @@ static enum vchiq_status shim_callback(enum vchiq_reason reason,
service->callback(service->callback_param,
VCHI_CALLBACK_MSG_AVAILABLE, NULL);

- goto done;
+ break;

case VCHIQ_BULK_TRANSMIT_DONE:
service->callback(service->callback_param,
@@ -483,8 +483,6 @@ static enum vchiq_status shim_callback(enum vchiq_reason reason,
}

release:
- vchiq_release_message(service->handle, header);
-done:
return VCHIQ_SUCCESS;
}

--
2.26.2