Remove all instances of enum vchiq_status from vc04_services and replace
them with regular linux error values.
VCHIQ_SUCCESS replaced with 0, VCHIQ_ERROR replaced with -EINVAL, and
VCHIQ_RETRY replaced (for the most part) with -EINTR as VCHIQ_RETRY
often is returned from an interruptable function call.
The exceptions to this are vchiq_send_remote_use() and
vchiq_send_remote_use_active() as they return a VCHIQ_RETRY but have
been changed to return -EINVAL instead of -EINTR. This is because when
the conn_state is VCHIQ_CONNSTATE_DISCONNECTED, the state is not valid
to continue on in the function
Signed-off-by: Joel Slebodnick <[email protected]>
---
.../bcm2835-audio/bcm2835-vchiq.c | 10 +-
.../include/linux/raspberrypi/vchiq.h | 67 +++---
drivers/staging/vc04_services/interface/TODO | 5 -
.../interface/vchiq_arm/vchiq_arm.c | 122 +++++-----
.../interface/vchiq_arm/vchiq_arm.h | 12 +-
.../interface/vchiq_arm/vchiq_core.c | 220 +++++++++---------
.../interface/vchiq_arm/vchiq_core.h | 18 +-
.../interface/vchiq_arm/vchiq_dev.c | 38 ++-
.../interface/vchiq_arm/vchiq_ioctl.h | 8 +-
9 files changed, 238 insertions(+), 262 deletions(-)
diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
index e429b33b4d39..e3c1362b4add 100644
--- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
+++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
@@ -89,15 +89,15 @@ static int bcm2835_audio_send_simple(struct bcm2835_audio_instance *instance,
return bcm2835_audio_send_msg(instance, &m, wait);
}
-static enum vchiq_status audio_vchi_callback(enum vchiq_reason reason,
- struct vchiq_header *header,
- unsigned int handle, void *userdata)
+static int audio_vchi_callback(enum vchiq_reason reason,
+ struct vchiq_header *header,
+ unsigned int handle, void *userdata)
{
struct bcm2835_audio_instance *instance = vchiq_get_service_userdata(handle);
struct vc_audio_msg *m;
if (reason != VCHIQ_MESSAGE_AVAILABLE)
- return VCHIQ_SUCCESS;
+ return 0;
m = (void *)header->data;
if (m->type == VC_AUDIO_MSG_TYPE_RESULT) {
@@ -115,7 +115,7 @@ static enum vchiq_status audio_vchi_callback(enum vchiq_reason reason,
}
vchiq_release_message(handle, header);
- return VCHIQ_SUCCESS;
+ return 0;
}
static int
diff --git a/drivers/staging/vc04_services/include/linux/raspberrypi/vchiq.h b/drivers/staging/vc04_services/include/linux/raspberrypi/vchiq.h
index c93f2f3e87bb..81aa87654d3a 100644
--- a/drivers/staging/vc04_services/include/linux/raspberrypi/vchiq.h
+++ b/drivers/staging/vc04_services/include/linux/raspberrypi/vchiq.h
@@ -17,12 +17,6 @@ enum vchiq_reason {
VCHIQ_BULK_RECEIVE_ABORTED /* service, -, bulk_userdata */
};
-enum vchiq_status {
- VCHIQ_ERROR = -1,
- VCHIQ_SUCCESS = 0,
- VCHIQ_RETRY = 1
-};
-
enum vchiq_bulk_mode {
VCHIQ_BULK_MODE_CALLBACK,
VCHIQ_BULK_MODE_BLOCKING,
@@ -55,10 +49,10 @@ struct vchiq_element {
struct vchiq_service_base {
int fourcc;
- enum vchiq_status (*callback)(enum vchiq_reason reason,
- struct vchiq_header *header,
- unsigned int handle,
- void *bulk_userdata);
+ int (*callback)(enum vchiq_reason reason,
+ struct vchiq_header *header,
+ unsigned int handle,
+ void *bulk_userdata);
void *userdata;
};
@@ -71,10 +65,10 @@ struct vchiq_completion_data_kernel {
struct vchiq_service_params_kernel {
int fourcc;
- enum vchiq_status (*callback)(enum vchiq_reason reason,
- struct vchiq_header *header,
- unsigned int handle,
- void *bulk_userdata);
+ int (*callback)(enum vchiq_reason reason,
+ struct vchiq_header *header,
+ unsigned int handle,
+ void *bulk_userdata);
void *userdata;
short version; /* Increment for non-trivial changes */
short version_min; /* Update for incompatible changes */
@@ -82,29 +76,26 @@ struct vchiq_service_params_kernel {
struct vchiq_instance;
-extern enum vchiq_status vchiq_initialise(struct vchiq_instance **pinstance);
-extern enum vchiq_status vchiq_shutdown(struct vchiq_instance *instance);
-extern enum vchiq_status vchiq_connect(struct vchiq_instance *instance);
-extern enum vchiq_status vchiq_open_service(struct vchiq_instance *instance,
- const struct vchiq_service_params_kernel *params,
- unsigned int *pservice);
-extern enum vchiq_status vchiq_close_service(unsigned int service);
-extern enum vchiq_status vchiq_use_service(unsigned int service);
-extern enum vchiq_status vchiq_release_service(unsigned int service);
-extern void vchiq_msg_queue_push(unsigned int handle, struct vchiq_header *header);
-extern void vchiq_release_message(unsigned int service,
- struct vchiq_header *header);
-extern int vchiq_queue_kernel_message(unsigned int handle, void *data,
- unsigned int size);
-extern enum vchiq_status vchiq_bulk_transmit(unsigned int service,
- const void *data, unsigned int size, void *userdata,
- enum vchiq_bulk_mode mode);
-extern enum vchiq_status vchiq_bulk_receive(unsigned int service,
- void *data, unsigned int size, void *userdata,
- enum vchiq_bulk_mode mode);
-extern void *vchiq_get_service_userdata(unsigned int service);
-extern enum vchiq_status vchiq_get_peer_version(unsigned int handle,
- short *peer_version);
-extern struct vchiq_header *vchiq_msg_hold(unsigned int handle);
+int vchiq_initialise(struct vchiq_instance **pinstance);
+int vchiq_shutdown(struct vchiq_instance *instance);
+int vchiq_connect(struct vchiq_instance *instance);
+int vchiq_open_service(struct vchiq_instance *instance,
+ const struct vchiq_service_params_kernel *params,
+ unsigned int *pservice);
+int vchiq_close_service(unsigned int service);
+int vchiq_use_service(unsigned int service);
+int vchiq_release_service(unsigned int service);
+void vchiq_msg_queue_push(unsigned int handle, struct vchiq_header *header);
+void vchiq_release_message(unsigned int service, struct vchiq_header *header);
+int vchiq_queue_kernel_message(unsigned int handle, void *data,
+ unsigned int size);
+int vchiq_bulk_transmit(unsigned int service, const void *data,
+ unsigned int size, void *userdata,
+ enum vchiq_bulk_mode mode);
+int vchiq_bulk_receive(unsigned int service, void *data, unsigned int size,
+ void *userdata, enum vchiq_bulk_mode mode);
+void *vchiq_get_service_userdata(unsigned int service);
+int vchiq_get_peer_version(unsigned int handle, short *peer_version);
+struct vchiq_header *vchiq_msg_hold(unsigned int handle);
#endif /* VCHIQ_H */
diff --git a/drivers/staging/vc04_services/interface/TODO b/drivers/staging/vc04_services/interface/TODO
index 97085a0b3223..6d9d4a800aa7 100644
--- a/drivers/staging/vc04_services/interface/TODO
+++ b/drivers/staging/vc04_services/interface/TODO
@@ -40,11 +40,6 @@ beneficial to go over all of them and, if correct, comment on their merits.
Extra points to whomever confidently reviews the remote_event_*() family of
functions.
-* Get rid of custom function return values
-
-Most functions use a custom set of return values, we should force proper Linux
-error numbers. Special care is needed for VCHIQ_RETRY.
-
* Reformat core code with more sane indentations
The code follows the 80 characters limitation yet tends to go 3 or 4 levels of
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 0596ac61e286..c87b2ef5a59c 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -152,7 +152,7 @@ static struct device *g_dev;
static DEFINE_SEMAPHORE(g_free_fragments_mutex);
-static enum vchiq_status
+static int
vchiq_blocking_bulk_transfer(unsigned int handle, void *data,
unsigned int size, enum vchiq_bulk_dir dir);
@@ -720,13 +720,13 @@ void free_bulk_waiter(struct vchiq_instance *instance)
}
}
-enum vchiq_status vchiq_shutdown(struct vchiq_instance *instance)
+int vchiq_shutdown(struct vchiq_instance *instance)
{
- enum vchiq_status status = VCHIQ_SUCCESS;
+ int status = 0;
struct vchiq_state *state = instance->state;
if (mutex_lock_killable(&state->mutex))
- return VCHIQ_RETRY;
+ return -EINTR;
/* Remove all services */
vchiq_shutdown_internal(state, instance);
@@ -747,19 +747,19 @@ static int vchiq_is_connected(struct vchiq_instance *instance)
return instance->connected;
}
-enum vchiq_status vchiq_connect(struct vchiq_instance *instance)
+int vchiq_connect(struct vchiq_instance *instance)
{
- enum vchiq_status status;
+ int status;
struct vchiq_state *state = instance->state;
if (mutex_lock_killable(&state->mutex)) {
vchiq_log_trace(vchiq_core_log_level, "%s: call to mutex_lock failed", __func__);
- status = VCHIQ_RETRY;
+ status = -EINTR;
goto failed;
}
status = vchiq_connect_internal(state, instance);
- if (status == VCHIQ_SUCCESS)
+ if (!status)
instance->connected = 1;
mutex_unlock(&state->mutex);
@@ -771,12 +771,12 @@ enum vchiq_status vchiq_connect(struct vchiq_instance *instance)
}
EXPORT_SYMBOL(vchiq_connect);
-static enum vchiq_status
+static int
vchiq_add_service(struct vchiq_instance *instance,
const struct vchiq_service_params_kernel *params,
unsigned int *phandle)
{
- enum vchiq_status status;
+ int status;
struct vchiq_state *state = instance->state;
struct vchiq_service *service = NULL;
int srvstate;
@@ -791,9 +791,9 @@ vchiq_add_service(struct vchiq_instance *instance,
if (service) {
*phandle = service->handle;
- status = VCHIQ_SUCCESS;
+ status = 0;
} else {
- status = VCHIQ_ERROR;
+ status = -EINVAL;
}
vchiq_log_trace(vchiq_core_log_level, "%s(%p): returning %d", __func__, instance, status);
@@ -801,12 +801,12 @@ vchiq_add_service(struct vchiq_instance *instance,
return status;
}
-enum vchiq_status
+int
vchiq_open_service(struct vchiq_instance *instance,
const struct vchiq_service_params_kernel *params,
unsigned int *phandle)
{
- enum vchiq_status status = VCHIQ_ERROR;
+ int status = -EINVAL;
struct vchiq_state *state = instance->state;
struct vchiq_service *service = NULL;
@@ -820,7 +820,7 @@ vchiq_open_service(struct vchiq_instance *instance,
if (service) {
*phandle = service->handle;
status = vchiq_open_service_internal(service, current->pid);
- if (status != VCHIQ_SUCCESS) {
+ if (status) {
vchiq_remove_service(service->handle);
*phandle = VCHIQ_SERVICE_HANDLE_INVALID;
}
@@ -833,11 +833,11 @@ vchiq_open_service(struct vchiq_instance *instance,
}
EXPORT_SYMBOL(vchiq_open_service);
-enum vchiq_status
+int
vchiq_bulk_transmit(unsigned int handle, const void *data, unsigned int size,
void *userdata, enum vchiq_bulk_mode mode)
{
- enum vchiq_status status;
+ int status;
while (1) {
switch (mode) {
@@ -853,15 +853,15 @@ vchiq_bulk_transmit(unsigned int handle, const void *data, unsigned int size,
VCHIQ_BULK_TRANSMIT);
break;
default:
- return VCHIQ_ERROR;
+ return -EINVAL;
}
/*
- * vchiq_*_bulk_transfer() may return VCHIQ_RETRY, so we need
+ * vchiq_*_bulk_transfer() may be interrupted, so we need
* to implement a retry mechanism since this function is
* supposed to block until queued
*/
- if (status != VCHIQ_RETRY)
+ if (status != -EINTR)
break;
msleep(1);
@@ -871,11 +871,11 @@ vchiq_bulk_transmit(unsigned int handle, const void *data, unsigned int size,
}
EXPORT_SYMBOL(vchiq_bulk_transmit);
-enum vchiq_status vchiq_bulk_receive(unsigned int handle, void *data,
- unsigned int size, void *userdata,
- enum vchiq_bulk_mode mode)
+int vchiq_bulk_receive(unsigned int handle, void *data,
+ unsigned int size, void *userdata,
+ enum vchiq_bulk_mode mode)
{
- enum vchiq_status status;
+ int status;
while (1) {
switch (mode) {
@@ -890,15 +890,15 @@ enum vchiq_status vchiq_bulk_receive(unsigned int handle, void *data,
VCHIQ_BULK_RECEIVE);
break;
default:
- return VCHIQ_ERROR;
+ return -EINVAL;
}
/*
- * vchiq_*_bulk_transfer() may return VCHIQ_RETRY, so we need
+ * vchiq_*_bulk_transfer() may be interrupted, so we need
* to implement a retry mechanism since this function is
* supposed to block until queued
*/
- if (status != VCHIQ_RETRY)
+ if (status != -EINTR)
break;
msleep(1);
@@ -908,18 +908,18 @@ enum vchiq_status vchiq_bulk_receive(unsigned int handle, void *data,
}
EXPORT_SYMBOL(vchiq_bulk_receive);
-static enum vchiq_status
+static int
vchiq_blocking_bulk_transfer(unsigned int handle, void *data, unsigned int size,
enum vchiq_bulk_dir dir)
{
struct vchiq_instance *instance;
struct vchiq_service *service;
- enum vchiq_status status;
+ int status;
struct bulk_waiter_node *waiter = NULL, *iter;
service = find_service_by_handle(handle);
if (!service)
- return VCHIQ_ERROR;
+ return -EINVAL;
instance = service->instance;
@@ -955,14 +955,14 @@ vchiq_blocking_bulk_transfer(unsigned int handle, void *data, unsigned int size,
waiter = kzalloc(sizeof(*waiter), GFP_KERNEL);
if (!waiter) {
vchiq_log_error(vchiq_core_log_level, "%s - out of memory", __func__);
- return VCHIQ_ERROR;
+ return -EINVAL;
}
}
status = vchiq_bulk_transfer(handle, data, NULL, size,
&waiter->bulk_waiter,
VCHIQ_BULK_MODE_BLOCKING, dir);
- if ((status != VCHIQ_RETRY) || fatal_signal_pending(current) || !waiter->bulk_waiter.bulk) {
+ if ((status != -EINTR) || fatal_signal_pending(current) || !waiter->bulk_waiter.bulk) {
struct vchiq_bulk *bulk = waiter->bulk_waiter.bulk;
if (bulk) {
@@ -984,7 +984,7 @@ vchiq_blocking_bulk_transfer(unsigned int handle, void *data, unsigned int size,
return status;
}
-static enum vchiq_status
+static int
add_completion(struct vchiq_instance *instance, enum vchiq_reason reason,
struct vchiq_header *header, struct user_service *user_service,
void *bulk_userdata)
@@ -1002,10 +1002,10 @@ add_completion(struct vchiq_instance *instance, enum vchiq_reason reason,
DEBUG_COUNT(COMPLETION_QUEUE_FULL_COUNT);
if (wait_for_completion_interruptible(&instance->remove_event)) {
vchiq_log_info(vchiq_arm_log_level, "service_callback interrupted");
- return VCHIQ_RETRY;
+ return -EINTR;
} else if (instance->closing) {
vchiq_log_info(vchiq_arm_log_level, "service_callback closing");
- return VCHIQ_SUCCESS;
+ return 0;
}
DEBUG_TRACE(SERVICE_CALLBACK_LINE);
}
@@ -1042,10 +1042,10 @@ add_completion(struct vchiq_instance *instance, enum vchiq_reason reason,
complete(&instance->insert_event);
- return VCHIQ_SUCCESS;
+ return 0;
}
-enum vchiq_status
+int
service_callback(enum vchiq_reason reason, struct vchiq_header *header,
unsigned int handle, void *bulk_userdata)
{
@@ -1068,7 +1068,7 @@ service_callback(enum vchiq_reason reason, struct vchiq_header *header,
service = handle_to_service(handle);
if (WARN_ON(!service)) {
rcu_read_unlock();
- return VCHIQ_SUCCESS;
+ return 0;
}
user_service = (struct user_service *)service->base.userdata;
@@ -1076,7 +1076,7 @@ service_callback(enum vchiq_reason reason, struct vchiq_header *header,
if (!instance || instance->closing) {
rcu_read_unlock();
- return VCHIQ_SUCCESS;
+ return 0;
}
/*
@@ -1106,14 +1106,14 @@ service_callback(enum vchiq_reason reason, struct vchiq_header *header,
*/
if ((user_service->message_available_pos -
instance->completion_remove) < 0) {
- enum vchiq_status status;
+ int status;
vchiq_log_info(vchiq_arm_log_level,
"Inserting extra MESSAGE_AVAILABLE");
DEBUG_TRACE(SERVICE_CALLBACK_LINE);
status = add_completion(instance, reason, NULL, user_service,
bulk_userdata);
- if (status != VCHIQ_SUCCESS) {
+ if (status) {
DEBUG_TRACE(SERVICE_CALLBACK_LINE);
vchiq_service_put(service);
return status;
@@ -1125,12 +1125,12 @@ service_callback(enum vchiq_reason reason, struct vchiq_header *header,
vchiq_log_info(vchiq_arm_log_level, "%s interrupted", __func__);
DEBUG_TRACE(SERVICE_CALLBACK_LINE);
vchiq_service_put(service);
- return VCHIQ_RETRY;
+ return -EINTR;
} else if (instance->closing) {
vchiq_log_info(vchiq_arm_log_level, "%s closing", __func__);
DEBUG_TRACE(SERVICE_CALLBACK_LINE);
vchiq_service_put(service);
- return VCHIQ_ERROR;
+ return -EINVAL;
}
DEBUG_TRACE(SERVICE_CALLBACK_LINE);
spin_lock(&msg_queue_spinlock);
@@ -1161,7 +1161,7 @@ service_callback(enum vchiq_reason reason, struct vchiq_header *header,
vchiq_service_put(service);
if (skip_completion)
- return VCHIQ_SUCCESS;
+ return 0;
return add_completion(instance, reason, header, user_service,
bulk_userdata);
@@ -1317,7 +1317,7 @@ vchiq_get_state(void)
* Autosuspend related functionality
*/
-static enum vchiq_status
+static int
vchiq_keepalive_vchiq_callback(enum vchiq_reason reason,
struct vchiq_header *header,
unsigned int service_user, void *bulk_user)
@@ -1332,7 +1332,7 @@ vchiq_keepalive_thread_func(void *v)
struct vchiq_state *state = (struct vchiq_state *)v;
struct vchiq_arm_state *arm_state = vchiq_platform_get_arm_state(state);
- enum vchiq_status status;
+ int status;
struct vchiq_instance *instance;
unsigned int ka_handle;
int ret;
@@ -1352,14 +1352,14 @@ vchiq_keepalive_thread_func(void *v)
}
status = vchiq_connect(instance);
- if (status != VCHIQ_SUCCESS) {
+ if (status) {
vchiq_log_error(vchiq_susp_log_level, "%s vchiq_connect failed %d", __func__,
status);
goto shutdown;
}
status = vchiq_add_service(instance, ¶ms, &ka_handle);
- if (status != VCHIQ_SUCCESS) {
+ if (status) {
vchiq_log_error(vchiq_susp_log_level, "%s vchiq_open_service failed %d", __func__,
status);
goto shutdown;
@@ -1388,14 +1388,14 @@ vchiq_keepalive_thread_func(void *v)
while (uc--) {
atomic_inc(&arm_state->ka_use_ack_count);
status = vchiq_use_service(ka_handle);
- if (status != VCHIQ_SUCCESS) {
+ if (status) {
vchiq_log_error(vchiq_susp_log_level,
"%s vchiq_use_service error %d", __func__, status);
}
}
while (rc--) {
status = vchiq_release_service(ka_handle);
- if (status != VCHIQ_SUCCESS) {
+ if (status) {
vchiq_log_error(vchiq_susp_log_level,
"%s vchiq_release_service error %d", __func__,
status);
@@ -1448,13 +1448,13 @@ vchiq_use_internal(struct vchiq_state *state, struct vchiq_service *service,
write_unlock_bh(&arm_state->susp_res_lock);
if (!ret) {
- enum vchiq_status status = VCHIQ_SUCCESS;
+ int status = 0;
long ack_cnt = atomic_xchg(&arm_state->ka_use_ack_count, 0);
- while (ack_cnt && (status == VCHIQ_SUCCESS)) {
+ while (ack_cnt && (!status)) {
/* Send the use notify to videocore */
status = vchiq_send_remote_use_active(state);
- if (status == VCHIQ_SUCCESS)
+ if (!status)
ack_cnt--;
else
atomic_add(ack_cnt, &arm_state->ka_use_ack_count);
@@ -1589,10 +1589,10 @@ vchiq_instance_set_trace(struct vchiq_instance *instance, int trace)
instance->trace = (trace != 0);
}
-enum vchiq_status
+int
vchiq_use_service(unsigned int handle)
{
- enum vchiq_status ret = VCHIQ_ERROR;
+ int ret = -EINVAL;
struct vchiq_service *service = find_service_by_handle(handle);
if (service) {
@@ -1603,10 +1603,10 @@ vchiq_use_service(unsigned int handle)
}
EXPORT_SYMBOL(vchiq_use_service);
-enum vchiq_status
+int
vchiq_release_service(unsigned int handle)
{
- enum vchiq_status ret = VCHIQ_ERROR;
+ int ret = -EINVAL;
struct vchiq_service *service = find_service_by_handle(handle);
if (service) {
@@ -1697,11 +1697,11 @@ vchiq_dump_service_use_state(struct vchiq_state *state)
kfree(service_data);
}
-enum vchiq_status
+int
vchiq_check_service(struct vchiq_service *service)
{
struct vchiq_arm_state *arm_state;
- enum vchiq_status ret = VCHIQ_ERROR;
+ int ret = -EINVAL;
if (!service || !service->state)
goto out;
@@ -1710,10 +1710,10 @@ vchiq_check_service(struct vchiq_service *service)
read_lock_bh(&arm_state->susp_res_lock);
if (service->service_use_count)
- ret = VCHIQ_SUCCESS;
+ ret = 0;
read_unlock_bh(&arm_state->susp_res_lock);
- if (ret == VCHIQ_ERROR) {
+ if (ret) {
vchiq_log_error(vchiq_susp_log_level,
"%s ERROR - %c%c%c%c:%d service count %d, state count %d", __func__,
VCHIQ_FOURCC_AS_4CHARS(service->base.fourcc), service->client_id,
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.h
index 2aa46b119a46..03c2780594ea 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.h
@@ -85,13 +85,13 @@ extern struct vchiq_state g_state;
extern struct vchiq_state *
vchiq_get_state(void);
-enum vchiq_status
+int
vchiq_use_service(unsigned int handle);
-extern enum vchiq_status
+extern int
vchiq_release_service(unsigned int handle);
-extern enum vchiq_status
+extern int
vchiq_check_service(struct vchiq_service *service);
extern void
@@ -100,10 +100,10 @@ vchiq_dump_platform_use_state(struct vchiq_state *state);
extern void
vchiq_dump_service_use_state(struct vchiq_state *state);
-extern enum vchiq_status
+extern int
vchiq_use_internal(struct vchiq_state *state, struct vchiq_service *service,
enum USE_TYPE_E use_type);
-extern enum vchiq_status
+extern int
vchiq_release_internal(struct vchiq_state *state,
struct vchiq_service *service);
@@ -137,7 +137,7 @@ static inline int vchiq_register_chrdev(struct device *parent) { return 0; }
#endif /* IS_ENABLED(CONFIG_VCHIQ_CDEV) */
-extern enum vchiq_status
+extern int
service_callback(enum vchiq_reason reason, struct vchiq_header *header,
unsigned int handle, void *bulk_userdata);
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 8f99272dbd6f..3b08560b52a0 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
@@ -457,21 +457,21 @@ mark_service_closing(struct vchiq_service *service)
mark_service_closing_internal(service, 0);
}
-static inline enum vchiq_status
+static inline int
make_service_callback(struct vchiq_service *service, enum vchiq_reason reason,
struct vchiq_header *header, void *bulk_userdata)
{
- enum vchiq_status status;
+ int status;
vchiq_log_trace(vchiq_core_log_level, "%d: callback:%d (%s, %pK, %pK)",
service->state->id, service->localport, reason_names[reason],
header, bulk_userdata);
status = service->base.callback(reason, header, service->handle, bulk_userdata);
- if (status == VCHIQ_ERROR) {
+ if (status && (status != -EINTR)) {
vchiq_log_warning(vchiq_core_log_level,
"%d: ignoring ERROR from callback to service %x",
service->state->id, service->handle);
- status = VCHIQ_SUCCESS;
+ status = 0;
}
if (reason != VCHIQ_MESSAGE_AVAILABLE)
@@ -891,7 +891,7 @@ copy_message_data(ssize_t (*copy_callback)(void *context, void *dest, size_t off
}
/* Called by the slot handler and application threads */
-static enum vchiq_status
+static int
queue_message(struct vchiq_state *state, struct vchiq_service *service,
int msgid,
ssize_t (*copy_callback)(void *context, void *dest,
@@ -913,7 +913,7 @@ queue_message(struct vchiq_state *state, struct vchiq_service *service,
if (!(flags & QMFLAGS_NO_MUTEX_LOCK) &&
mutex_lock_killable(&state->slot_mutex))
- return VCHIQ_RETRY;
+ return -EINTR;
if (type == VCHIQ_MSG_DATA) {
int tx_end_index;
@@ -921,7 +921,7 @@ queue_message(struct vchiq_state *state, struct vchiq_service *service,
if (!service) {
WARN(1, "%s: service is NULL\n", __func__);
mutex_unlock(&state->slot_mutex);
- return VCHIQ_ERROR;
+ return -EINVAL;
}
WARN_ON(flags & (QMFLAGS_NO_MUTEX_LOCK |
@@ -930,7 +930,7 @@ queue_message(struct vchiq_state *state, struct vchiq_service *service,
if (service->closing) {
/* The service has been closed */
mutex_unlock(&state->slot_mutex);
- return VCHIQ_ERROR;
+ return -EINVAL;
}
quota = &state->service_quotas[service->localport];
@@ -954,7 +954,7 @@ queue_message(struct vchiq_state *state, struct vchiq_service *service,
mutex_unlock(&state->slot_mutex);
if (wait_for_completion_interruptible(&state->data_quota_event))
- return VCHIQ_RETRY;
+ return -EINTR;
mutex_lock(&state->slot_mutex);
spin_lock("a_spinlock);
@@ -978,15 +978,15 @@ queue_message(struct vchiq_state *state, struct vchiq_service *service,
VCHIQ_SERVICE_STATS_INC(service, quota_stalls);
mutex_unlock(&state->slot_mutex);
if (wait_for_completion_interruptible("a->quota_event))
- return VCHIQ_RETRY;
+ return -EINTR;
if (service->closing)
- return VCHIQ_ERROR;
+ return -EINVAL;
if (mutex_lock_killable(&state->slot_mutex))
- return VCHIQ_RETRY;
+ return -EINTR;
if (service->srvstate != VCHIQ_SRVSTATE_OPEN) {
/* The service has been closed */
mutex_unlock(&state->slot_mutex);
- return VCHIQ_ERROR;
+ return -EINVAL;
}
spin_lock("a_spinlock);
tx_end_index = SLOT_QUEUE_INDEX_FROM_POS(state->local_tx_pos + stride - 1);
@@ -1006,7 +1006,7 @@ queue_message(struct vchiq_state *state, struct vchiq_service *service,
*/
if (!(flags & QMFLAGS_NO_MUTEX_LOCK))
mutex_unlock(&state->slot_mutex);
- return VCHIQ_RETRY;
+ return -EINTR;
}
if (type == VCHIQ_MSG_DATA) {
@@ -1028,7 +1028,7 @@ queue_message(struct vchiq_state *state, struct vchiq_service *service,
if (callback_result < 0) {
mutex_unlock(&state->slot_mutex);
VCHIQ_SERVICE_STATS_INC(service, error_count);
- return VCHIQ_ERROR;
+ return -EINVAL;
}
if (SRVTRACE_ENABLED(service,
@@ -1126,11 +1126,11 @@ queue_message(struct vchiq_state *state, struct vchiq_service *service,
remote_event_signal(&state->remote->trigger);
- return VCHIQ_SUCCESS;
+ return 0;
}
/* Called by the slot handler and application threads */
-static enum vchiq_status
+static int
queue_message_sync(struct vchiq_state *state, struct vchiq_service *service,
int msgid,
ssize_t (*copy_callback)(void *context, void *dest,
@@ -1145,7 +1145,7 @@ queue_message_sync(struct vchiq_state *state, struct vchiq_service *service,
if (VCHIQ_MSG_TYPE(msgid) != VCHIQ_MSG_RESUME &&
mutex_lock_killable(&state->sync_mutex))
- return VCHIQ_RETRY;
+ return -EINTR;
remote_event_wait(&state->sync_release_event, &local->sync_release);
@@ -1175,7 +1175,7 @@ queue_message_sync(struct vchiq_state *state, struct vchiq_service *service,
if (callback_result < 0) {
mutex_unlock(&state->slot_mutex);
VCHIQ_SERVICE_STATS_INC(service, error_count);
- return VCHIQ_ERROR;
+ return -EINVAL;
}
if (service) {
@@ -1213,7 +1213,7 @@ queue_message_sync(struct vchiq_state *state, struct vchiq_service *service,
if (VCHIQ_MSG_TYPE(msgid) != VCHIQ_MSG_PAUSE)
mutex_unlock(&state->sync_mutex);
- return VCHIQ_SUCCESS;
+ return 0;
}
static inline void
@@ -1289,11 +1289,11 @@ get_bulk_reason(struct vchiq_bulk *bulk)
}
/* Called by the slot handler - don't hold the bulk mutex */
-static enum vchiq_status
+static int
notify_bulks(struct vchiq_service *service, struct vchiq_bulk_queue *queue,
int retry_poll)
{
- enum vchiq_status status = VCHIQ_SUCCESS;
+ int status = 0;
vchiq_log_trace(vchiq_core_log_level, "%d: nb:%d %cx - p=%x rn=%x r=%x", service->state->id,
service->localport, (queue == &service->bulk_tx) ? 't' : 'r',
@@ -1338,7 +1338,7 @@ notify_bulks(struct vchiq_service *service, struct vchiq_bulk_queue *queue,
get_bulk_reason(bulk);
status = make_service_callback(service, reason, NULL,
bulk->userdata);
- if (status == VCHIQ_RETRY)
+ if (status == -EINTR)
break;
}
}
@@ -1347,9 +1347,9 @@ notify_bulks(struct vchiq_service *service, struct vchiq_bulk_queue *queue,
complete(&service->bulk_remove_event);
}
if (!retry_poll)
- status = VCHIQ_SUCCESS;
+ status = 0;
- if (status == VCHIQ_RETRY)
+ if (status == -EINTR)
request_poll(service->state, service, (queue == &service->bulk_tx) ?
VCHIQ_POLL_TXNOTIFY : VCHIQ_POLL_RXNOTIFY);
@@ -1388,13 +1388,12 @@ poll_services_of_group(struct vchiq_state *state, int group)
*/
service->public_fourcc = VCHIQ_FOURCC_INVALID;
- if (vchiq_close_service_internal(service, NO_CLOSE_RECVD) !=
- VCHIQ_SUCCESS)
+ if (vchiq_close_service_internal(service, NO_CLOSE_RECVD))
request_poll(state, service, VCHIQ_POLL_REMOVE);
} else if (service_flags & BIT(VCHIQ_POLL_TERMINATE)) {
vchiq_log_info(vchiq_core_log_level, "%d: ps - terminate %d<->%d",
state->id, service->localport, service->remoteport);
- if (vchiq_close_service_internal(service, NO_CLOSE_RECVD) != VCHIQ_SUCCESS)
+ if (vchiq_close_service_internal(service, NO_CLOSE_RECVD))
request_poll(state, service, VCHIQ_POLL_TERMINATE);
}
if (service_flags & BIT(VCHIQ_POLL_TXNOTIFY))
@@ -1517,14 +1516,14 @@ parse_open(struct vchiq_state *state, struct vchiq_header *header)
/* Acknowledge the OPEN */
if (service->sync) {
if (queue_message_sync(state, NULL, openack_id, memcpy_copy_callback,
- &ack_payload, sizeof(ack_payload), 0) == VCHIQ_RETRY)
+ &ack_payload, sizeof(ack_payload), 0) == -EINTR)
goto bail_not_ready;
/* The service is now open */
set_service_state(service, VCHIQ_SRVSTATE_OPENSYNC);
} else {
if (queue_message(state, NULL, openack_id, memcpy_copy_callback,
- &ack_payload, sizeof(ack_payload), 0) == VCHIQ_RETRY)
+ &ack_payload, sizeof(ack_payload), 0) == -EINTR)
goto bail_not_ready;
/* The service is now open */
@@ -1539,7 +1538,7 @@ parse_open(struct vchiq_state *state, struct vchiq_header *header)
fail_open:
/* No available service, or an invalid request - send a CLOSE */
if (queue_message(state, NULL, MAKE_CLOSE(0, VCHIQ_MSG_SRCPORT(msgid)),
- NULL, NULL, 0, 0) == VCHIQ_RETRY)
+ NULL, NULL, 0, 0) == -EINTR)
goto bail_not_ready;
return 1;
@@ -1678,7 +1677,7 @@ parse_message(struct vchiq_state *state, struct vchiq_header *header)
mark_service_closing_internal(service, 1);
- if (vchiq_close_service_internal(service, CLOSE_RECVD) == VCHIQ_RETRY)
+ if (vchiq_close_service_internal(service, CLOSE_RECVD) == -EINTR)
goto bail_not_ready;
vchiq_log_info(vchiq_core_log_level, "Close Service %c%c%c%c s:%u d:%d",
@@ -1695,7 +1694,7 @@ parse_message(struct vchiq_state *state, struct vchiq_header *header)
claim_slot(state->rx_info);
DEBUG_TRACE(PARSE_LINE);
if (make_service_callback(service, VCHIQ_MESSAGE_AVAILABLE, header,
- NULL) == VCHIQ_RETRY) {
+ NULL) == -EINTR) {
DEBUG_TRACE(PARSE_LINE);
goto bail_not_ready;
}
@@ -1793,7 +1792,7 @@ parse_message(struct vchiq_state *state, struct vchiq_header *header)
if (state->conn_state != VCHIQ_CONNSTATE_PAUSE_SENT) {
/* Send a PAUSE in response */
if (queue_message(state, NULL, MAKE_PAUSE, NULL, NULL, 0,
- QMFLAGS_NO_MUTEX_UNLOCK) == VCHIQ_RETRY)
+ QMFLAGS_NO_MUTEX_UNLOCK) == -EINTR)
goto bail_not_ready;
}
/* At this point slot_mutex is held */
@@ -1910,7 +1909,7 @@ handle_poll(struct vchiq_state *state)
case VCHIQ_CONNSTATE_PAUSING:
if (queue_message(state, NULL, MAKE_PAUSE, NULL, NULL, 0,
- QMFLAGS_NO_MUTEX_UNLOCK) != VCHIQ_RETRY) {
+ QMFLAGS_NO_MUTEX_UNLOCK) != -EINTR) {
vchiq_set_conn_state(state, VCHIQ_CONNSTATE_PAUSE_SENT);
} else {
/* Retry later */
@@ -1920,7 +1919,7 @@ handle_poll(struct vchiq_state *state)
case VCHIQ_CONNSTATE_RESUMING:
if (queue_message(state, NULL, MAKE_RESUME, NULL, NULL, 0,
- QMFLAGS_NO_MUTEX_LOCK) != VCHIQ_RETRY) {
+ QMFLAGS_NO_MUTEX_LOCK) != -EINTR) {
vchiq_set_conn_state(state, VCHIQ_CONNSTATE_CONNECTED);
} else {
/*
@@ -2074,9 +2073,9 @@ sync_func(void *v)
if ((service->remoteport == remoteport) &&
(service->srvstate == VCHIQ_SRVSTATE_OPENSYNC)) {
if (make_service_callback(service, VCHIQ_MESSAGE_AVAILABLE, header,
- NULL) == VCHIQ_RETRY)
+ NULL) == -EINTR)
vchiq_log_error(vchiq_sync_log_level,
- "synchronous callback to service %d returns VCHIQ_RETRY",
+ "synchronous callback to service %d has been interrupted",
localport);
}
break;
@@ -2478,7 +2477,7 @@ vchiq_add_service_internal(struct vchiq_state *state,
return service;
}
-enum vchiq_status
+int
vchiq_open_service_internal(struct vchiq_service *service, int client_id)
{
struct vchiq_open_payload payload = {
@@ -2487,7 +2486,7 @@ vchiq_open_service_internal(struct vchiq_service *service, int client_id)
service->version,
service->version_min
};
- enum vchiq_status status = VCHIQ_SUCCESS;
+ int status = 0;
service->client_id = client_id;
vchiq_use_service_internal(service);
@@ -2498,12 +2497,12 @@ vchiq_open_service_internal(struct vchiq_service *service, int client_id)
sizeof(payload),
QMFLAGS_IS_BLOCKING);
- if (status != VCHIQ_SUCCESS)
+ if (status)
return status;
/* Wait for the ACK/NAK */
if (wait_for_completion_interruptible(&service->remove_event)) {
- status = VCHIQ_RETRY;
+ status = -EINTR;
vchiq_release_service_internal(service);
} else if ((service->srvstate != VCHIQ_SRVSTATE_OPEN) &&
(service->srvstate != VCHIQ_SRVSTATE_OPENSYNC)) {
@@ -2513,11 +2512,10 @@ vchiq_open_service_internal(struct vchiq_service *service, int client_id)
service->state->id,
srvstate_names[service->srvstate],
kref_read(&service->ref_count));
- status = VCHIQ_ERROR;
+ status = -EINVAL;
VCHIQ_SERVICE_STATS_INC(service, error_count);
vchiq_release_service_internal(service);
}
-
return status;
}
@@ -2584,7 +2582,7 @@ release_service_messages(struct vchiq_service *service)
static int
do_abort_bulks(struct vchiq_service *service)
{
- enum vchiq_status status;
+ int status;
/* Abort any outstanding bulk transfers */
if (mutex_lock_killable(&service->bulk_mutex))
@@ -2594,17 +2592,17 @@ do_abort_bulks(struct vchiq_service *service)
mutex_unlock(&service->bulk_mutex);
status = notify_bulks(service, &service->bulk_tx, NO_RETRY_POLL);
- if (status != VCHIQ_SUCCESS)
+ if (status)
return 0;
status = notify_bulks(service, &service->bulk_rx, NO_RETRY_POLL);
- return (status == VCHIQ_SUCCESS);
+ return (!status);
}
-static enum vchiq_status
+static int
close_service_complete(struct vchiq_service *service, int failstate)
{
- enum vchiq_status status;
+ int status;
int is_server = (service->public_fourcc != VCHIQ_FOURCC_INVALID);
int newstate;
@@ -2631,12 +2629,12 @@ close_service_complete(struct vchiq_service *service, int failstate)
vchiq_log_error(vchiq_core_log_level, "%s(%x) called in state %s", __func__,
service->handle, srvstate_names[service->srvstate]);
WARN(1, "%s in unexpected state\n", __func__);
- return VCHIQ_ERROR;
+ return -EINVAL;
}
status = make_service_callback(service, VCHIQ_SERVICE_CLOSED, NULL, NULL);
- if (status != VCHIQ_RETRY) {
+ if (status != -EINTR) {
int uc = service->service_use_count;
int i;
/* Complete the close process */
@@ -2661,16 +2659,15 @@ close_service_complete(struct vchiq_service *service, int failstate)
} else {
set_service_state(service, failstate);
}
-
return status;
}
/* Called by the slot handler */
-enum vchiq_status
+int
vchiq_close_service_internal(struct vchiq_service *service, int close_recvd)
{
struct vchiq_state *state = service->state;
- enum vchiq_status status = VCHIQ_SUCCESS;
+ int status = 0;
int is_server = (service->public_fourcc != VCHIQ_FOURCC_INVALID);
int close_id = MAKE_CLOSE(service->localport,
VCHIQ_MSG_DSTPORT(service->remoteport));
@@ -2688,7 +2685,7 @@ vchiq_close_service_internal(struct vchiq_service *service, int close_recvd)
__func__, srvstate_names[service->srvstate]);
} else if (is_server) {
if (service->srvstate == VCHIQ_SRVSTATE_LISTENING) {
- status = VCHIQ_ERROR;
+ status = -EINVAL;
} else {
service->client_id = 0;
service->remoteport = VCHIQ_PORT_FREE;
@@ -2717,16 +2714,16 @@ vchiq_close_service_internal(struct vchiq_service *service, int close_recvd)
case VCHIQ_SRVSTATE_OPEN:
if (close_recvd) {
if (!do_abort_bulks(service))
- status = VCHIQ_RETRY;
+ status = -EINTR;
}
release_service_messages(service);
- if (status == VCHIQ_SUCCESS)
+ if (!status)
status = queue_message(state, service, close_id, NULL,
NULL, 0, QMFLAGS_NO_MUTEX_UNLOCK);
- if (status != VCHIQ_SUCCESS) {
+ if (status) {
if (service->srvstate == VCHIQ_SRVSTATE_OPENSYNC)
mutex_unlock(&state->sync_mutex);
break;
@@ -2756,11 +2753,11 @@ vchiq_close_service_internal(struct vchiq_service *service, int close_recvd)
break;
if (!do_abort_bulks(service)) {
- status = VCHIQ_RETRY;
+ status = -EINTR;
break;
}
- if (status == VCHIQ_SUCCESS)
+ if (!status)
status = close_service_complete(service, VCHIQ_SRVSTATE_CLOSERECVD);
break;
@@ -2824,7 +2821,7 @@ vchiq_free_service_internal(struct vchiq_service *service)
vchiq_service_put(service);
}
-enum vchiq_status
+int
vchiq_connect_internal(struct vchiq_state *state, struct vchiq_instance *instance)
{
struct vchiq_service *service;
@@ -2840,21 +2837,21 @@ vchiq_connect_internal(struct vchiq_state *state, struct vchiq_instance *instanc
if (state->conn_state == VCHIQ_CONNSTATE_DISCONNECTED) {
if (queue_message(state, NULL, MAKE_CONNECT, NULL, NULL, 0,
- QMFLAGS_IS_BLOCKING) == VCHIQ_RETRY)
- return VCHIQ_RETRY;
+ QMFLAGS_IS_BLOCKING) == -EINTR)
+ return -EINTR;
vchiq_set_conn_state(state, VCHIQ_CONNSTATE_CONNECTING);
}
if (state->conn_state == VCHIQ_CONNSTATE_CONNECTING) {
if (wait_for_completion_interruptible(&state->connect))
- return VCHIQ_RETRY;
+ return -EINTR;
vchiq_set_conn_state(state, VCHIQ_CONNSTATE_CONNECTED);
complete(&state->connect);
}
- return VCHIQ_SUCCESS;
+ return 0;
}
void
@@ -2871,15 +2868,15 @@ vchiq_shutdown_internal(struct vchiq_state *state, struct vchiq_instance *instan
}
}
-enum vchiq_status
+int
vchiq_close_service(unsigned int handle)
{
/* Unregister the service */
struct vchiq_service *service = find_service_by_handle(handle);
- enum vchiq_status status = VCHIQ_SUCCESS;
+ int status = 0;
if (!service)
- return VCHIQ_ERROR;
+ return -EINVAL;
vchiq_log_info(vchiq_core_log_level, "%d: close_service:%d",
service->state->id, service->localport);
@@ -2888,14 +2885,14 @@ vchiq_close_service(unsigned int handle)
(service->srvstate == VCHIQ_SRVSTATE_LISTENING) ||
(service->srvstate == VCHIQ_SRVSTATE_HIDDEN)) {
vchiq_service_put(service);
- return VCHIQ_ERROR;
+ return -EINVAL;
}
mark_service_closing(service);
if (current == service->state->slot_handler_thread) {
status = vchiq_close_service_internal(service, NO_CLOSE_RECVD);
- WARN_ON(status == VCHIQ_RETRY);
+ WARN_ON(status == -EINTR);
} else {
/* Mark the service for termination by the slot handler */
request_poll(service->state, service, VCHIQ_POLL_TERMINATE);
@@ -2903,7 +2900,7 @@ vchiq_close_service(unsigned int handle)
while (1) {
if (wait_for_completion_interruptible(&service->remove_event)) {
- status = VCHIQ_RETRY;
+ status = -EINTR;
break;
}
@@ -2918,10 +2915,10 @@ vchiq_close_service(unsigned int handle)
srvstate_names[service->srvstate]);
}
- if ((status == VCHIQ_SUCCESS) &&
+ if ((!status) &&
(service->srvstate != VCHIQ_SRVSTATE_FREE) &&
(service->srvstate != VCHIQ_SRVSTATE_LISTENING))
- status = VCHIQ_ERROR;
+ status = -EINVAL;
vchiq_service_put(service);
@@ -2929,22 +2926,22 @@ vchiq_close_service(unsigned int handle)
}
EXPORT_SYMBOL(vchiq_close_service);
-enum vchiq_status
+int
vchiq_remove_service(unsigned int handle)
{
/* Unregister the service */
struct vchiq_service *service = find_service_by_handle(handle);
- enum vchiq_status status = VCHIQ_SUCCESS;
+ int status = 0;
if (!service)
- return VCHIQ_ERROR;
+ return -EINVAL;
vchiq_log_info(vchiq_core_log_level, "%d: remove_service:%d",
service->state->id, service->localport);
if (service->srvstate == VCHIQ_SRVSTATE_FREE) {
vchiq_service_put(service);
- return VCHIQ_ERROR;
+ return -EINVAL;
}
mark_service_closing(service);
@@ -2958,14 +2955,14 @@ vchiq_remove_service(unsigned int handle)
service->public_fourcc = VCHIQ_FOURCC_INVALID;
status = vchiq_close_service_internal(service, NO_CLOSE_RECVD);
- WARN_ON(status == VCHIQ_RETRY);
+ WARN_ON(status == -EINTR);
} else {
/* Mark the service for removal by the slot handler */
request_poll(service->state, service, VCHIQ_POLL_REMOVE);
}
while (1) {
if (wait_for_completion_interruptible(&service->remove_event)) {
- status = VCHIQ_RETRY;
+ status = -EINTR;
break;
}
@@ -2979,26 +2976,25 @@ vchiq_remove_service(unsigned int handle)
srvstate_names[service->srvstate]);
}
- if ((status == VCHIQ_SUCCESS) &&
+ if ((!status) &&
(service->srvstate != VCHIQ_SRVSTATE_FREE))
- status = VCHIQ_ERROR;
+ status = -EINVAL;
vchiq_service_put(service);
-
return status;
}
/*
* This function may be called by kernel threads or user threads.
- * User threads may receive VCHIQ_RETRY to indicate that a signal has been
+ * User threads may receive -EINTR to indicate that a signal has been
* received and the call should be retried after being returned to user
* context.
* When called in blocking mode, the userdata field points to a bulk_waiter
* structure.
*/
-enum vchiq_status vchiq_bulk_transfer(unsigned int handle, void *offset, void __user *uoffset,
- int size, void *userdata, enum vchiq_bulk_mode mode,
- enum vchiq_bulk_dir dir)
+int vchiq_bulk_transfer(unsigned int handle, void *offset, void __user *uoffset,
+ int size, void *userdata, enum vchiq_bulk_mode mode,
+ enum vchiq_bulk_dir dir)
{
struct vchiq_service *service = find_service_by_handle(handle);
struct vchiq_bulk_queue *queue;
@@ -3008,7 +3004,7 @@ enum vchiq_status vchiq_bulk_transfer(unsigned int handle, void *offset, void __
const char dir_char = (dir == VCHIQ_BULK_TRANSMIT) ? 't' : 'r';
const int dir_msgtype = (dir == VCHIQ_BULK_TRANSMIT) ?
VCHIQ_MSG_BULK_TX : VCHIQ_MSG_BULK_RX;
- enum vchiq_status status = VCHIQ_ERROR;
+ int status = -EINVAL;
int payload[2];
if (!service)
@@ -3020,7 +3016,7 @@ enum vchiq_status vchiq_bulk_transfer(unsigned int handle, void *offset, void __
if (!offset && !uoffset)
goto error_exit;
- if (vchiq_check_service(service) != VCHIQ_SUCCESS)
+ if (vchiq_check_service(service))
goto error_exit;
switch (mode) {
@@ -3047,7 +3043,7 @@ enum vchiq_status vchiq_bulk_transfer(unsigned int handle, void *offset, void __
&service->bulk_tx : &service->bulk_rx;
if (mutex_lock_killable(&service->bulk_mutex)) {
- status = VCHIQ_RETRY;
+ status = -EINTR;
goto error_exit;
}
@@ -3056,11 +3052,11 @@ enum vchiq_status vchiq_bulk_transfer(unsigned int handle, void *offset, void __
do {
mutex_unlock(&service->bulk_mutex);
if (wait_for_completion_interruptible(&service->bulk_remove_event)) {
- status = VCHIQ_RETRY;
+ status = -EINTR;
goto error_exit;
}
if (mutex_lock_killable(&service->bulk_mutex)) {
- status = VCHIQ_RETRY;
+ status = -EINTR;
goto error_exit;
}
} while (queue->local_insert == queue->remove +
@@ -3089,7 +3085,7 @@ enum vchiq_status vchiq_bulk_transfer(unsigned int handle, void *offset, void __
* claim it here to ensure that isn't happening
*/
if (mutex_lock_killable(&state->slot_mutex)) {
- status = VCHIQ_RETRY;
+ status = -EINTR;
goto cancel_bulk_error_exit;
}
@@ -3109,7 +3105,7 @@ enum vchiq_status vchiq_bulk_transfer(unsigned int handle, void *offset, void __
QMFLAGS_IS_BLOCKING |
QMFLAGS_NO_MUTEX_LOCK |
QMFLAGS_NO_MUTEX_UNLOCK);
- if (status != VCHIQ_SUCCESS)
+ if (status)
goto unlock_both_error_exit;
queue->local_insert++;
@@ -3124,14 +3120,14 @@ enum vchiq_status vchiq_bulk_transfer(unsigned int handle, void *offset, void __
waiting:
vchiq_service_put(service);
- status = VCHIQ_SUCCESS;
+ status = 0;
if (bulk_waiter) {
bulk_waiter->bulk = bulk;
if (wait_for_completion_interruptible(&bulk_waiter->event))
- status = VCHIQ_RETRY;
+ status = -EINTR;
else if (bulk_waiter->actual == VCHIQ_BULK_ACTUAL_ABORTED)
- status = VCHIQ_ERROR;
+ status = -EINVAL;
}
return status;
@@ -3149,7 +3145,7 @@ enum vchiq_status vchiq_bulk_transfer(unsigned int handle, void *offset, void __
return status;
}
-enum vchiq_status
+int
vchiq_queue_message(unsigned int handle,
ssize_t (*copy_callback)(void *context, void *dest,
size_t offset, size_t maxsize),
@@ -3157,13 +3153,13 @@ vchiq_queue_message(unsigned int handle,
size_t size)
{
struct vchiq_service *service = find_service_by_handle(handle);
- enum vchiq_status status = VCHIQ_ERROR;
+ int status = -EINVAL;
int data_id;
if (!service)
goto error_exit;
- if (vchiq_check_service(service) != VCHIQ_SUCCESS)
+ if (vchiq_check_service(service))
goto error_exit;
if (!size) {
@@ -3188,7 +3184,7 @@ vchiq_queue_message(unsigned int handle,
copy_callback, context, size, 1);
break;
default:
- status = VCHIQ_ERROR;
+ status = -EINVAL;
break;
}
@@ -3201,18 +3197,18 @@ vchiq_queue_message(unsigned int handle,
int vchiq_queue_kernel_message(unsigned int handle, void *data, unsigned int size)
{
- enum vchiq_status status;
+ int status;
while (1) {
status = vchiq_queue_message(handle, memcpy_copy_callback,
data, size);
/*
- * vchiq_queue_message() may return VCHIQ_RETRY, so we need to
+ * vchiq_queue_message() may be interrupted, so we need to
* implement a retry mechanism since this function is supposed
* to block until queued
*/
- if (status != VCHIQ_RETRY)
+ if (status != -EINTR)
break;
msleep(1);
@@ -3264,27 +3260,25 @@ release_message_sync(struct vchiq_state *state, struct vchiq_header *header)
remote_event_signal(&state->remote->sync_release);
}
-enum vchiq_status
+int
vchiq_get_peer_version(unsigned int handle, short *peer_version)
{
- enum vchiq_status status = VCHIQ_ERROR;
+ int status = -EINVAL;
struct vchiq_service *service = find_service_by_handle(handle);
if (!service)
goto exit;
- if (vchiq_check_service(service) != VCHIQ_SUCCESS)
+ if (vchiq_check_service(service))
goto exit;
if (!peer_version)
goto exit;
*peer_version = service->peer_version;
- status = VCHIQ_SUCCESS;
+ status = 0;
exit:
- if (service)
- vchiq_service_put(service);
return status;
}
EXPORT_SYMBOL(vchiq_get_peer_version);
@@ -3626,18 +3620,18 @@ vchiq_loud_error_footer(void)
"============================================================================");
}
-enum vchiq_status vchiq_send_remote_use(struct vchiq_state *state)
+int vchiq_send_remote_use(struct vchiq_state *state)
{
if (state->conn_state == VCHIQ_CONNSTATE_DISCONNECTED)
- return VCHIQ_RETRY;
+ return -EINVAL;
return queue_message(state, NULL, MAKE_REMOTE_USE, NULL, NULL, 0, 0);
}
-enum vchiq_status vchiq_send_remote_use_active(struct vchiq_state *state)
+int vchiq_send_remote_use_active(struct vchiq_state *state)
{
if (state->conn_state == VCHIQ_CONNSTATE_DISCONNECTED)
- return VCHIQ_RETRY;
+ return -EINVAL;
return queue_message(state, NULL, MAKE_REMOTE_USE_ACTIVE,
NULL, NULL, 0, 0);
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 1ddc661642a9..4ae72f064fff 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
@@ -459,7 +459,7 @@ vchiq_init_slots(void *mem_base, int mem_size);
extern int
vchiq_init_state(struct vchiq_state *state, struct vchiq_slot_zero *slot_zero);
-extern enum vchiq_status
+extern int
vchiq_connect_internal(struct vchiq_state *state, struct vchiq_instance *instance);
struct vchiq_service *
@@ -468,10 +468,10 @@ vchiq_add_service_internal(struct vchiq_state *state,
int srvstate, struct vchiq_instance *instance,
void (*userdata_term)(void *userdata));
-extern enum vchiq_status
+extern int
vchiq_open_service_internal(struct vchiq_service *service, int client_id);
-extern enum vchiq_status
+extern int
vchiq_close_service_internal(struct vchiq_service *service, int close_recvd);
extern void
@@ -486,7 +486,7 @@ vchiq_shutdown_internal(struct vchiq_state *state, struct vchiq_instance *instan
extern void
remote_event_pollall(struct vchiq_state *state);
-extern enum vchiq_status
+extern int
vchiq_bulk_transfer(unsigned int handle, void *offset, void __user *uoffset,
int size, void *userdata, enum vchiq_bulk_mode mode,
enum vchiq_bulk_dir dir);
@@ -547,7 +547,7 @@ vchiq_service_get(struct vchiq_service *service);
extern void
vchiq_service_put(struct vchiq_service *service);
-extern enum vchiq_status
+extern int
vchiq_queue_message(unsigned int handle,
ssize_t (*copy_callback)(void *context, void *dest,
size_t offset, size_t maxsize),
@@ -579,13 +579,13 @@ void vchiq_on_remote_release(struct vchiq_state *state);
int vchiq_platform_init_state(struct vchiq_state *state);
-enum vchiq_status vchiq_check_service(struct vchiq_service *service);
+int vchiq_check_service(struct vchiq_service *service);
void vchiq_on_remote_use_active(struct vchiq_state *state);
-enum vchiq_status vchiq_send_remote_use(struct vchiq_state *state);
+int vchiq_send_remote_use(struct vchiq_state *state);
-enum vchiq_status vchiq_send_remote_use_active(struct vchiq_state *state);
+int vchiq_send_remote_use_active(struct vchiq_state *state);
void vchiq_platform_conn_state_changed(struct vchiq_state *state,
enum vchiq_connstate oldstate,
@@ -595,7 +595,7 @@ void vchiq_set_conn_state(struct vchiq_state *state, enum vchiq_connstate newsta
void vchiq_log_dump_mem(const char *label, u32 addr, const void *void_mem, size_t num_bytes);
-enum vchiq_status vchiq_remove_service(unsigned int service);
+int vchiq_remove_service(unsigned int service);
int vchiq_get_client_id(unsigned int service);
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c
index 66bbfec332ba..062604a95b79 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c
@@ -112,7 +112,7 @@ vchiq_ioc_queue_message(unsigned int handle, struct vchiq_element *elements,
unsigned long count)
{
struct vchiq_io_copy_callback_context context;
- enum vchiq_status status = VCHIQ_SUCCESS;
+ int status = 0;
unsigned long i;
size_t total_size = 0;
@@ -130,11 +130,7 @@ vchiq_ioc_queue_message(unsigned int handle, struct vchiq_element *elements,
status = vchiq_queue_message(handle, vchiq_ioc_copy_element_data,
&context, total_size);
- if (status == VCHIQ_ERROR)
- return -EIO;
- else if (status == VCHIQ_RETRY)
- return -EINTR;
- return 0;
+ return (status == -EINVAL) ? -EIO : status;
}
static int vchiq_ioc_create_service(struct vchiq_instance *instance,
@@ -142,7 +138,7 @@ static int vchiq_ioc_create_service(struct vchiq_instance *instance,
{
struct user_service *user_service = NULL;
struct vchiq_service *service;
- enum vchiq_status status = VCHIQ_SUCCESS;
+ int status = 0;
struct vchiq_service_params_kernel params;
int srvstate;
@@ -190,9 +186,9 @@ static int vchiq_ioc_create_service(struct vchiq_instance *instance,
if (args->is_open) {
status = vchiq_open_service_internal(service, instance->pid);
- if (status != VCHIQ_SUCCESS) {
+ if (status) {
vchiq_remove_service(service->handle);
- return (status == VCHIQ_RETRY) ?
+ return (status == -EINTR) ?
-EINTR : -EIO;
}
}
@@ -338,7 +334,7 @@ static int vchiq_irq_queue_bulk_tx_rx(struct vchiq_instance *instance,
goto out;
}
- if ((status != VCHIQ_RETRY) || fatal_signal_pending(current) ||
+ if ((status != -EINTR) || fatal_signal_pending(current) ||
!waiter->bulk_waiter.bulk) {
if (waiter->bulk_waiter.bulk) {
/* Cancel the signal when the transfer completes. */
@@ -364,9 +360,9 @@ static int vchiq_irq_queue_bulk_tx_rx(struct vchiq_instance *instance,
vchiq_service_put(service);
if (ret)
return ret;
- else if (status == VCHIQ_ERROR)
+ else if (status == -EINVAL)
return -EIO;
- else if (status == VCHIQ_RETRY)
+ else if (status == -EINTR)
return -EINTR;
return 0;
}
@@ -577,7 +573,7 @@ static long
vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
struct vchiq_instance *instance = file->private_data;
- enum vchiq_status status = VCHIQ_SUCCESS;
+ int status = 0;
struct vchiq_service *service = NULL;
long ret = 0;
int i, rc;
@@ -598,12 +594,12 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
instance, &i))) {
status = vchiq_remove_service(service->handle);
vchiq_service_put(service);
- if (status != VCHIQ_SUCCESS)
+ if (status)
break;
}
service = NULL;
- if (status == VCHIQ_SUCCESS) {
+ if (!status) {
/* Wake the completion thread and ask it to exit */
instance->closing = 1;
complete(&instance->insert_event);
@@ -627,7 +623,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
status = vchiq_connect_internal(instance->state, instance);
mutex_unlock(&instance->state->mutex);
- if (status == VCHIQ_SUCCESS)
+ if (!status)
instance->connected = 1;
else
vchiq_log_error(vchiq_arm_log_level,
@@ -675,7 +671,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
status = (cmd == VCHIQ_IOC_CLOSE_SERVICE) ?
vchiq_close_service(service->handle) :
vchiq_remove_service(service->handle);
- if (status != VCHIQ_SUCCESS)
+ if (status)
break;
}
@@ -686,7 +682,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
*/
if (user_service->close_pending &&
wait_for_completion_interruptible(&user_service->close_event))
- status = VCHIQ_RETRY;
+ status = -EINTR;
break;
}
@@ -862,13 +858,13 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
vchiq_service_put(service);
if (ret == 0) {
- if (status == VCHIQ_ERROR)
+ if (status == -EINVAL)
ret = -EIO;
- else if (status == VCHIQ_RETRY)
+ else if (status == -EINTR)
ret = -EINTR;
}
- if ((status == VCHIQ_SUCCESS) && (ret < 0) && (ret != -EINTR) && (ret != -EWOULDBLOCK))
+ if ((!status) && (ret < 0) && (ret != -EINTR) && (ret != -EWOULDBLOCK))
vchiq_log_info(vchiq_arm_log_level,
" ioctl instance %pK, cmd %s -> status %d, %ld",
instance, (_IOC_NR(cmd) <= VCHIQ_IOC_MAX) ?
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h
index 86d77f2eeea5..96f50beace44 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h
@@ -12,10 +12,10 @@
struct vchiq_service_params {
int fourcc;
- enum vchiq_status __user (*callback)(enum vchiq_reason reason,
- struct vchiq_header *header,
- unsigned int handle,
- void *bulk_userdata);
+ int __user (*callback)(enum vchiq_reason reason,
+ struct vchiq_header *header,
+ unsigned int handle,
+ void *bulk_userdata);
void __user *userdata;
short version; /* Increment for non-trivial changes */
short version_min; /* Update for incompatible changes */
--
2.36.1
On Tue, Jul 12, 2022 at 02:19:28PM -0400, Joel Slebodnick wrote:
> Remove all instances of enum vchiq_status from vc04_services and replace
> them with regular linux error values.
>
> VCHIQ_SUCCESS replaced with 0, VCHIQ_ERROR replaced with -EINVAL, and
> VCHIQ_RETRY replaced (for the most part) with -EINTR as VCHIQ_RETRY
> often is returned from an interruptable function call.
>
> The exceptions to this are vchiq_send_remote_use() and
> vchiq_send_remote_use_active() as they return a VCHIQ_RETRY but have
> been changed to return -EINVAL instead of -EINTR. This is because when
> the conn_state is VCHIQ_CONNSTATE_DISCONNECTED, the state is not valid
> to continue on in the function
>
> Signed-off-by: Joel Slebodnick <[email protected]>
> ---
> .../bcm2835-audio/bcm2835-vchiq.c | 10 +-
> .../include/linux/raspberrypi/vchiq.h | 67 +++---
> drivers/staging/vc04_services/interface/TODO | 5 -
> .../interface/vchiq_arm/vchiq_arm.c | 122 +++++-----
> .../interface/vchiq_arm/vchiq_arm.h | 12 +-
> .../interface/vchiq_arm/vchiq_core.c | 220 +++++++++---------
> .../interface/vchiq_arm/vchiq_core.h | 18 +-
> .../interface/vchiq_arm/vchiq_dev.c | 38 ++-
> .../interface/vchiq_arm/vchiq_ioctl.h | 8 +-
> 9 files changed, 238 insertions(+), 262 deletions(-)
>
Hi,
This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him
a patch that has triggered this response. He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created. Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.
You are receiving this message because of the following common error(s)
as indicated below:
- Your patch did many different things all at once, making it difficult
to review. All Linux kernel patches need to only do one thing at a
time. If you need to do multiple things (such as clean up all coding
style issues in a file/driver), do it in a sequence of patches, each
one doing only one thing. This will make it easier to review the
patches to ensure that they are correct, and to help alleviate any
merge issues that larger patches can cause.
If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.
thanks,
greg k-h's patch email bot
Hi Joel,
Am 12.07.22 um 20:19 schrieb Joel Slebodnick:
> Remove all instances of enum vchiq_status from vc04_services and replace
> them with regular linux error values.
thanks. How did you test this changes according to the new TESTING document?
>
> VCHIQ_SUCCESS replaced with 0, VCHIQ_ERROR replaced with -EINVAL, and
> VCHIQ_RETRY replaced (for the most part) with -EINTR as VCHIQ_RETRY
> often is returned from an interruptable function call.
i had used -EAGAIN in this case.
> The exceptions to this are vchiq_send_remote_use() and
> vchiq_send_remote_use_active() as they return a VCHIQ_RETRY but have
> been changed to return -EINVAL instead of -EINTR. This is because when
> the conn_state is VCHIQ_CONNSTATE_DISCONNECTED, the state is not valid
> to continue on in the function
Is there a chance to make this a separate patch?
>
> Signed-off-by: Joel Slebodnick <[email protected]>
> ---
> .../bcm2835-audio/bcm2835-vchiq.c | 10 +-
> .../include/linux/raspberrypi/vchiq.h | 67 +++---
> drivers/staging/vc04_services/interface/TODO | 5 -
Please also make the TODO changes a separate patch.
> .../interface/vchiq_arm/vchiq_arm.c | 122 +++++-----
> .../interface/vchiq_arm/vchiq_arm.h | 12 +-
> .../interface/vchiq_arm/vchiq_core.c | 220 +++++++++---------
> .../interface/vchiq_arm/vchiq_core.h | 18 +-
> .../interface/vchiq_arm/vchiq_dev.c | 38 ++-
> .../interface/vchiq_arm/vchiq_ioctl.h | 8 +-
> 9 files changed, 238 insertions(+), 262 deletions(-)
>
> diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
> index e429b33b4d39..e3c1362b4add 100644
> --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
> +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
> @@ -89,15 +89,15 @@ static int bcm2835_audio_send_simple(struct bcm2835_audio_instance *instance,
> return bcm2835_audio_send_msg(instance, &m, wait);
> }
>
> -static enum vchiq_status audio_vchi_callback(enum vchiq_reason reason,
> - struct vchiq_header *header,
> - unsigned int handle, void *userdata)
> +static int audio_vchi_callback(enum vchiq_reason reason,
> + struct vchiq_header *header,
> + unsigned int handle, void *userdata)
> {
> struct bcm2835_audio_instance *instance = vchiq_get_service_userdata(handle);
> struct vc_audio_msg *m;
>
> if (reason != VCHIQ_MESSAGE_AVAILABLE)
> - return VCHIQ_SUCCESS;
> + return 0;
>
> m = (void *)header->data;
> if (m->type == VC_AUDIO_MSG_TYPE_RESULT) {
> @@ -115,7 +115,7 @@ static enum vchiq_status audio_vchi_callback(enum vchiq_reason reason,
> }
>
> vchiq_release_message(handle, header);
> - return VCHIQ_SUCCESS;
> + return 0;
> }
>
> static int
> diff --git a/drivers/staging/vc04_services/include/linux/raspberrypi/vchiq.h b/drivers/staging/vc04_services/include/linux/raspberrypi/vchiq.h
> index c93f2f3e87bb..81aa87654d3a 100644
> --- a/drivers/staging/vc04_services/include/linux/raspberrypi/vchiq.h
> +++ b/drivers/staging/vc04_services/include/linux/raspberrypi/vchiq.h
> @@ -17,12 +17,6 @@ enum vchiq_reason {
> VCHIQ_BULK_RECEIVE_ABORTED /* service, -, bulk_userdata */
> };
>
> -enum vchiq_status {
> - VCHIQ_ERROR = -1,
> - VCHIQ_SUCCESS = 0,
> - VCHIQ_RETRY = 1
> -};
> -
> enum vchiq_bulk_mode {
> VCHIQ_BULK_MODE_CALLBACK,
> VCHIQ_BULK_MODE_BLOCKING,
> @@ -55,10 +49,10 @@ struct vchiq_element {
>
> struct vchiq_service_base {
> int fourcc;
> - enum vchiq_status (*callback)(enum vchiq_reason reason,
> - struct vchiq_header *header,
> - unsigned int handle,
> - void *bulk_userdata);
> + int (*callback)(enum vchiq_reason reason,
> + struct vchiq_header *header,
> + unsigned int handle,
> + void *bulk_userdata);
> void *userdata;
> };
>
> @@ -71,10 +65,10 @@ struct vchiq_completion_data_kernel {
>
> struct vchiq_service_params_kernel {
> int fourcc;
> - enum vchiq_status (*callback)(enum vchiq_reason reason,
> - struct vchiq_header *header,
> - unsigned int handle,
> - void *bulk_userdata);
> + int (*callback)(enum vchiq_reason reason,
> + struct vchiq_header *header,
> + unsigned int handle,
> + void *bulk_userdata);
> void *userdata;
> short version; /* Increment for non-trivial changes */
> short version_min; /* Update for incompatible changes */
> @@ -82,29 +76,26 @@ struct vchiq_service_params_kernel {
>
> struct vchiq_instance;
>
> -extern enum vchiq_status vchiq_initialise(struct vchiq_instance **pinstance);
> -extern enum vchiq_status vchiq_shutdown(struct vchiq_instance *instance);
> -extern enum vchiq_status vchiq_connect(struct vchiq_instance *instance);
> -extern enum vchiq_status vchiq_open_service(struct vchiq_instance *instance,
> - const struct vchiq_service_params_kernel *params,
> - unsigned int *pservice);
> -extern enum vchiq_status vchiq_close_service(unsigned int service);
> -extern enum vchiq_status vchiq_use_service(unsigned int service);
> -extern enum vchiq_status vchiq_release_service(unsigned int service);
> -extern void vchiq_msg_queue_push(unsigned int handle, struct vchiq_header *header);
> -extern void vchiq_release_message(unsigned int service,
> - struct vchiq_header *header);
> -extern int vchiq_queue_kernel_message(unsigned int handle, void *data,
> - unsigned int size);
> -extern enum vchiq_status vchiq_bulk_transmit(unsigned int service,
> - const void *data, unsigned int size, void *userdata,
> - enum vchiq_bulk_mode mode);
> -extern enum vchiq_status vchiq_bulk_receive(unsigned int service,
> - void *data, unsigned int size, void *userdata,
> - enum vchiq_bulk_mode mode);
> -extern void *vchiq_get_service_userdata(unsigned int service);
> -extern enum vchiq_status vchiq_get_peer_version(unsigned int handle,
> - short *peer_version);
> -extern struct vchiq_header *vchiq_msg_hold(unsigned int handle);
> +int vchiq_initialise(struct vchiq_instance **pinstance);
> +int vchiq_shutdown(struct vchiq_instance *instance);
> +int vchiq_connect(struct vchiq_instance *instance);
> +int vchiq_open_service(struct vchiq_instance *instance,
> + const struct vchiq_service_params_kernel *params,
> + unsigned int *pservice);
> +int vchiq_close_service(unsigned int service);
> +int vchiq_use_service(unsigned int service);
> +int vchiq_release_service(unsigned int service);
> +void vchiq_msg_queue_push(unsigned int handle, struct vchiq_header *header);
> +void vchiq_release_message(unsigned int service, struct vchiq_header *header);
> +int vchiq_queue_kernel_message(unsigned int handle, void *data,
> + unsigned int size);
> +int vchiq_bulk_transmit(unsigned int service, const void *data,
> + unsigned int size, void *userdata,
> + enum vchiq_bulk_mode mode);
> +int vchiq_bulk_receive(unsigned int service, void *data, unsigned int size,
> + void *userdata, enum vchiq_bulk_mode mode);
> +void *vchiq_get_service_userdata(unsigned int service);
> +int vchiq_get_peer_version(unsigned int handle, short *peer_version);
> +struct vchiq_header *vchiq_msg_hold(unsigned int handle);
>
> #endif /* VCHIQ_H */
> diff --git a/drivers/staging/vc04_services/interface/TODO b/drivers/staging/vc04_services/interface/TODO
> index 97085a0b3223..6d9d4a800aa7 100644
> --- a/drivers/staging/vc04_services/interface/TODO
> +++ b/drivers/staging/vc04_services/interface/TODO
> @@ -40,11 +40,6 @@ beneficial to go over all of them and, if correct, comment on their merits.
> Extra points to whomever confidently reviews the remote_event_*() family of
> functions.
>
> -* Get rid of custom function return values
> -
> -Most functions use a custom set of return values, we should force proper Linux
> -error numbers. Special care is needed for VCHIQ_RETRY.
> -
> * Reformat core code with more sane indentations
>
> The code follows the 80 characters limitation yet tends to go 3 or 4 levels of
> 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 0596ac61e286..c87b2ef5a59c 100644
> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> @@ -152,7 +152,7 @@ static struct device *g_dev;
>
> static DEFINE_SEMAPHORE(g_free_fragments_mutex);
>
> -static enum vchiq_status
> +static int
> vchiq_blocking_bulk_transfer(unsigned int handle, void *data,
> unsigned int size, enum vchiq_bulk_dir dir);
>
> @@ -720,13 +720,13 @@ void free_bulk_waiter(struct vchiq_instance *instance)
> }
> }
>
> -enum vchiq_status vchiq_shutdown(struct vchiq_instance *instance)
> +int vchiq_shutdown(struct vchiq_instance *instance)
> {
> - enum vchiq_status status = VCHIQ_SUCCESS;
> + int status = 0;
> struct vchiq_state *state = instance->state;
>
> if (mutex_lock_killable(&state->mutex))
> - return VCHIQ_RETRY;
> + return -EINTR;
>
> /* Remove all services */
> vchiq_shutdown_internal(state, instance);
> @@ -747,19 +747,19 @@ static int vchiq_is_connected(struct vchiq_instance *instance)
> return instance->connected;
> }
>
> -enum vchiq_status vchiq_connect(struct vchiq_instance *instance)
> +int vchiq_connect(struct vchiq_instance *instance)
> {
> - enum vchiq_status status;
> + int status;
> struct vchiq_state *state = instance->state;
>
> if (mutex_lock_killable(&state->mutex)) {
> vchiq_log_trace(vchiq_core_log_level, "%s: call to mutex_lock failed", __func__);
> - status = VCHIQ_RETRY;
> + status = -EINTR;
> goto failed;
> }
> status = vchiq_connect_internal(state, instance);
>
> - if (status == VCHIQ_SUCCESS)
> + if (!status)
> instance->connected = 1;
>
> mutex_unlock(&state->mutex);
> @@ -771,12 +771,12 @@ enum vchiq_status vchiq_connect(struct vchiq_instance *instance)
> }
> EXPORT_SYMBOL(vchiq_connect);
>
> -static enum vchiq_status
> +static int
> vchiq_add_service(struct vchiq_instance *instance,
> const struct vchiq_service_params_kernel *params,
> unsigned int *phandle)
> {
> - enum vchiq_status status;
> + int status;
> struct vchiq_state *state = instance->state;
> struct vchiq_service *service = NULL;
> int srvstate;
> @@ -791,9 +791,9 @@ vchiq_add_service(struct vchiq_instance *instance,
>
> if (service) {
> *phandle = service->handle;
> - status = VCHIQ_SUCCESS;
> + status = 0;
> } else {
> - status = VCHIQ_ERROR;
> + status = -EINVAL;
> }
>
> vchiq_log_trace(vchiq_core_log_level, "%s(%p): returning %d", __func__, instance, status);
> @@ -801,12 +801,12 @@ vchiq_add_service(struct vchiq_instance *instance,
> return status;
> }
>
> -enum vchiq_status
> +int
> vchiq_open_service(struct vchiq_instance *instance,
> const struct vchiq_service_params_kernel *params,
> unsigned int *phandle)
> {
> - enum vchiq_status status = VCHIQ_ERROR;
> + int status = -EINVAL;
> struct vchiq_state *state = instance->state;
> struct vchiq_service *service = NULL;
>
> @@ -820,7 +820,7 @@ vchiq_open_service(struct vchiq_instance *instance,
> if (service) {
> *phandle = service->handle;
> status = vchiq_open_service_internal(service, current->pid);
> - if (status != VCHIQ_SUCCESS) {
> + if (status) {
> vchiq_remove_service(service->handle);
> *phandle = VCHIQ_SERVICE_HANDLE_INVALID;
> }
> @@ -833,11 +833,11 @@ vchiq_open_service(struct vchiq_instance *instance,
> }
> EXPORT_SYMBOL(vchiq_open_service);
>
> -enum vchiq_status
> +int
> vchiq_bulk_transmit(unsigned int handle, const void *data, unsigned int size,
> void *userdata, enum vchiq_bulk_mode mode)
> {
> - enum vchiq_status status;
> + int status;
>
> while (1) {
> switch (mode) {
> @@ -853,15 +853,15 @@ vchiq_bulk_transmit(unsigned int handle, const void *data, unsigned int size,
> VCHIQ_BULK_TRANSMIT);
> break;
> default:
> - return VCHIQ_ERROR;
> + return -EINVAL;
> }
>
> /*
> - * vchiq_*_bulk_transfer() may return VCHIQ_RETRY, so we need
> + * vchiq_*_bulk_transfer() may be interrupted, so we need
> * to implement a retry mechanism since this function is
> * supposed to block until queued
> */
> - if (status != VCHIQ_RETRY)
> + if (status != -EINTR)
> break;
>
> msleep(1);
> @@ -871,11 +871,11 @@ vchiq_bulk_transmit(unsigned int handle, const void *data, unsigned int size,
> }
> EXPORT_SYMBOL(vchiq_bulk_transmit);
>
> -enum vchiq_status vchiq_bulk_receive(unsigned int handle, void *data,
> - unsigned int size, void *userdata,
> - enum vchiq_bulk_mode mode)
> +int vchiq_bulk_receive(unsigned int handle, void *data,
> + unsigned int size, void *userdata,
> + enum vchiq_bulk_mode mode)
> {
> - enum vchiq_status status;
> + int status;
>
> while (1) {
> switch (mode) {
> @@ -890,15 +890,15 @@ enum vchiq_status vchiq_bulk_receive(unsigned int handle, void *data,
> VCHIQ_BULK_RECEIVE);
> break;
> default:
> - return VCHIQ_ERROR;
> + return -EINVAL;
> }
>
> /*
> - * vchiq_*_bulk_transfer() may return VCHIQ_RETRY, so we need
> + * vchiq_*_bulk_transfer() may be interrupted, so we need
> * to implement a retry mechanism since this function is
> * supposed to block until queued
> */
> - if (status != VCHIQ_RETRY)
> + if (status != -EINTR)
> break;
>
> msleep(1);
> @@ -908,18 +908,18 @@ enum vchiq_status vchiq_bulk_receive(unsigned int handle, void *data,
> }
> EXPORT_SYMBOL(vchiq_bulk_receive);
>
> -static enum vchiq_status
> +static int
> vchiq_blocking_bulk_transfer(unsigned int handle, void *data, unsigned int size,
> enum vchiq_bulk_dir dir)
> {
> struct vchiq_instance *instance;
> struct vchiq_service *service;
> - enum vchiq_status status;
> + int status;
> struct bulk_waiter_node *waiter = NULL, *iter;
>
> service = find_service_by_handle(handle);
> if (!service)
> - return VCHIQ_ERROR;
> + return -EINVAL;
>
> instance = service->instance;
>
> @@ -955,14 +955,14 @@ vchiq_blocking_bulk_transfer(unsigned int handle, void *data, unsigned int size,
> waiter = kzalloc(sizeof(*waiter), GFP_KERNEL);
> if (!waiter) {
> vchiq_log_error(vchiq_core_log_level, "%s - out of memory", __func__);
> - return VCHIQ_ERROR;
> + return -EINVAL;
> }
> }
>
> status = vchiq_bulk_transfer(handle, data, NULL, size,
> &waiter->bulk_waiter,
> VCHIQ_BULK_MODE_BLOCKING, dir);
> - if ((status != VCHIQ_RETRY) || fatal_signal_pending(current) || !waiter->bulk_waiter.bulk) {
> + if ((status != -EINTR) || fatal_signal_pending(current) || !waiter->bulk_waiter.bulk) {
> struct vchiq_bulk *bulk = waiter->bulk_waiter.bulk;
>
> if (bulk) {
> @@ -984,7 +984,7 @@ vchiq_blocking_bulk_transfer(unsigned int handle, void *data, unsigned int size,
> return status;
> }
>
> -static enum vchiq_status
> +static int
> add_completion(struct vchiq_instance *instance, enum vchiq_reason reason,
> struct vchiq_header *header, struct user_service *user_service,
> void *bulk_userdata)
> @@ -1002,10 +1002,10 @@ add_completion(struct vchiq_instance *instance, enum vchiq_reason reason,
> DEBUG_COUNT(COMPLETION_QUEUE_FULL_COUNT);
> if (wait_for_completion_interruptible(&instance->remove_event)) {
> vchiq_log_info(vchiq_arm_log_level, "service_callback interrupted");
> - return VCHIQ_RETRY;
> + return -EINTR;
> } else if (instance->closing) {
> vchiq_log_info(vchiq_arm_log_level, "service_callback closing");
> - return VCHIQ_SUCCESS;
> + return 0;
> }
> DEBUG_TRACE(SERVICE_CALLBACK_LINE);
> }
> @@ -1042,10 +1042,10 @@ add_completion(struct vchiq_instance *instance, enum vchiq_reason reason,
>
> complete(&instance->insert_event);
>
> - return VCHIQ_SUCCESS;
> + return 0;
> }
>
> -enum vchiq_status
> +int
> service_callback(enum vchiq_reason reason, struct vchiq_header *header,
> unsigned int handle, void *bulk_userdata)
> {
> @@ -1068,7 +1068,7 @@ service_callback(enum vchiq_reason reason, struct vchiq_header *header,
> service = handle_to_service(handle);
> if (WARN_ON(!service)) {
> rcu_read_unlock();
> - return VCHIQ_SUCCESS;
> + return 0;
> }
>
> user_service = (struct user_service *)service->base.userdata;
> @@ -1076,7 +1076,7 @@ service_callback(enum vchiq_reason reason, struct vchiq_header *header,
>
> if (!instance || instance->closing) {
> rcu_read_unlock();
> - return VCHIQ_SUCCESS;
> + return 0;
> }
>
> /*
> @@ -1106,14 +1106,14 @@ service_callback(enum vchiq_reason reason, struct vchiq_header *header,
> */
> if ((user_service->message_available_pos -
> instance->completion_remove) < 0) {
> - enum vchiq_status status;
> + int status;
>
> vchiq_log_info(vchiq_arm_log_level,
> "Inserting extra MESSAGE_AVAILABLE");
> DEBUG_TRACE(SERVICE_CALLBACK_LINE);
> status = add_completion(instance, reason, NULL, user_service,
> bulk_userdata);
> - if (status != VCHIQ_SUCCESS) {
> + if (status) {
> DEBUG_TRACE(SERVICE_CALLBACK_LINE);
> vchiq_service_put(service);
> return status;
> @@ -1125,12 +1125,12 @@ service_callback(enum vchiq_reason reason, struct vchiq_header *header,
> vchiq_log_info(vchiq_arm_log_level, "%s interrupted", __func__);
> DEBUG_TRACE(SERVICE_CALLBACK_LINE);
> vchiq_service_put(service);
> - return VCHIQ_RETRY;
> + return -EINTR;
> } else if (instance->closing) {
> vchiq_log_info(vchiq_arm_log_level, "%s closing", __func__);
> DEBUG_TRACE(SERVICE_CALLBACK_LINE);
> vchiq_service_put(service);
> - return VCHIQ_ERROR;
> + return -EINVAL;
> }
> DEBUG_TRACE(SERVICE_CALLBACK_LINE);
> spin_lock(&msg_queue_spinlock);
> @@ -1161,7 +1161,7 @@ service_callback(enum vchiq_reason reason, struct vchiq_header *header,
> vchiq_service_put(service);
>
> if (skip_completion)
> - return VCHIQ_SUCCESS;
> + return 0;
>
> return add_completion(instance, reason, header, user_service,
> bulk_userdata);
> @@ -1317,7 +1317,7 @@ vchiq_get_state(void)
> * Autosuspend related functionality
> */
>
> -static enum vchiq_status
> +static int
> vchiq_keepalive_vchiq_callback(enum vchiq_reason reason,
> struct vchiq_header *header,
> unsigned int service_user, void *bulk_user)
> @@ -1332,7 +1332,7 @@ vchiq_keepalive_thread_func(void *v)
> struct vchiq_state *state = (struct vchiq_state *)v;
> struct vchiq_arm_state *arm_state = vchiq_platform_get_arm_state(state);
>
> - enum vchiq_status status;
> + int status;
> struct vchiq_instance *instance;
> unsigned int ka_handle;
> int ret;
> @@ -1352,14 +1352,14 @@ vchiq_keepalive_thread_func(void *v)
> }
>
> status = vchiq_connect(instance);
> - if (status != VCHIQ_SUCCESS) {
> + if (status) {
> vchiq_log_error(vchiq_susp_log_level, "%s vchiq_connect failed %d", __func__,
> status);
> goto shutdown;
> }
>
> status = vchiq_add_service(instance, ¶ms, &ka_handle);
> - if (status != VCHIQ_SUCCESS) {
> + if (status) {
> vchiq_log_error(vchiq_susp_log_level, "%s vchiq_open_service failed %d", __func__,
> status);
> goto shutdown;
> @@ -1388,14 +1388,14 @@ vchiq_keepalive_thread_func(void *v)
> while (uc--) {
> atomic_inc(&arm_state->ka_use_ack_count);
> status = vchiq_use_service(ka_handle);
> - if (status != VCHIQ_SUCCESS) {
> + if (status) {
> vchiq_log_error(vchiq_susp_log_level,
> "%s vchiq_use_service error %d", __func__, status);
> }
> }
> while (rc--) {
> status = vchiq_release_service(ka_handle);
> - if (status != VCHIQ_SUCCESS) {
> + if (status) {
> vchiq_log_error(vchiq_susp_log_level,
> "%s vchiq_release_service error %d", __func__,
> status);
> @@ -1448,13 +1448,13 @@ vchiq_use_internal(struct vchiq_state *state, struct vchiq_service *service,
> write_unlock_bh(&arm_state->susp_res_lock);
>
> if (!ret) {
> - enum vchiq_status status = VCHIQ_SUCCESS;
> + int status = 0;
> long ack_cnt = atomic_xchg(&arm_state->ka_use_ack_count, 0);
>
> - while (ack_cnt && (status == VCHIQ_SUCCESS)) {
> + while (ack_cnt && (!status)) {
> /* Send the use notify to videocore */
> status = vchiq_send_remote_use_active(state);
> - if (status == VCHIQ_SUCCESS)
> + if (!status)
> ack_cnt--;
> else
> atomic_add(ack_cnt, &arm_state->ka_use_ack_count);
> @@ -1589,10 +1589,10 @@ vchiq_instance_set_trace(struct vchiq_instance *instance, int trace)
> instance->trace = (trace != 0);
> }
>
> -enum vchiq_status
> +int
> vchiq_use_service(unsigned int handle)
> {
> - enum vchiq_status ret = VCHIQ_ERROR;
> + int ret = -EINVAL;
> struct vchiq_service *service = find_service_by_handle(handle);
>
> if (service) {
> @@ -1603,10 +1603,10 @@ vchiq_use_service(unsigned int handle)
> }
> EXPORT_SYMBOL(vchiq_use_service);
>
> -enum vchiq_status
> +int
> vchiq_release_service(unsigned int handle)
> {
> - enum vchiq_status ret = VCHIQ_ERROR;
> + int ret = -EINVAL;
> struct vchiq_service *service = find_service_by_handle(handle);
>
> if (service) {
> @@ -1697,11 +1697,11 @@ vchiq_dump_service_use_state(struct vchiq_state *state)
> kfree(service_data);
> }
>
> -enum vchiq_status
> +int
> vchiq_check_service(struct vchiq_service *service)
> {
> struct vchiq_arm_state *arm_state;
> - enum vchiq_status ret = VCHIQ_ERROR;
> + int ret = -EINVAL;
>
> if (!service || !service->state)
> goto out;
> @@ -1710,10 +1710,10 @@ vchiq_check_service(struct vchiq_service *service)
>
> read_lock_bh(&arm_state->susp_res_lock);
> if (service->service_use_count)
> - ret = VCHIQ_SUCCESS;
> + ret = 0;
> read_unlock_bh(&arm_state->susp_res_lock);
>
> - if (ret == VCHIQ_ERROR) {
> + if (ret) {
> vchiq_log_error(vchiq_susp_log_level,
> "%s ERROR - %c%c%c%c:%d service count %d, state count %d", __func__,
> VCHIQ_FOURCC_AS_4CHARS(service->base.fourcc), service->client_id,
> diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.h
> index 2aa46b119a46..03c2780594ea 100644
> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.h
> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.h
> @@ -85,13 +85,13 @@ extern struct vchiq_state g_state;
> extern struct vchiq_state *
> vchiq_get_state(void);
>
> -enum vchiq_status
> +int
> vchiq_use_service(unsigned int handle);
>
> -extern enum vchiq_status
> +extern int
> vchiq_release_service(unsigned int handle);
>
> -extern enum vchiq_status
> +extern int
> vchiq_check_service(struct vchiq_service *service);
>
> extern void
> @@ -100,10 +100,10 @@ vchiq_dump_platform_use_state(struct vchiq_state *state);
> extern void
> vchiq_dump_service_use_state(struct vchiq_state *state);
>
> -extern enum vchiq_status
> +extern int
> vchiq_use_internal(struct vchiq_state *state, struct vchiq_service *service,
> enum USE_TYPE_E use_type);
> -extern enum vchiq_status
> +extern int
> vchiq_release_internal(struct vchiq_state *state,
> struct vchiq_service *service);
>
> @@ -137,7 +137,7 @@ static inline int vchiq_register_chrdev(struct device *parent) { return 0; }
>
> #endif /* IS_ENABLED(CONFIG_VCHIQ_CDEV) */
>
> -extern enum vchiq_status
> +extern int
> service_callback(enum vchiq_reason reason, struct vchiq_header *header,
> unsigned int handle, void *bulk_userdata);
>
> 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 8f99272dbd6f..3b08560b52a0 100644
> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
> @@ -457,21 +457,21 @@ mark_service_closing(struct vchiq_service *service)
> mark_service_closing_internal(service, 0);
> }
>
> -static inline enum vchiq_status
> +static inline int
> make_service_callback(struct vchiq_service *service, enum vchiq_reason reason,
> struct vchiq_header *header, void *bulk_userdata)
> {
> - enum vchiq_status status;
> + int status;
>
> vchiq_log_trace(vchiq_core_log_level, "%d: callback:%d (%s, %pK, %pK)",
> service->state->id, service->localport, reason_names[reason],
> header, bulk_userdata);
> status = service->base.callback(reason, header, service->handle, bulk_userdata);
> - if (status == VCHIQ_ERROR) {
> + if (status && (status != -EINTR)) {
> vchiq_log_warning(vchiq_core_log_level,
> "%d: ignoring ERROR from callback to service %x",
> service->state->id, service->handle);
> - status = VCHIQ_SUCCESS;
> + status = 0;
> }
>
> if (reason != VCHIQ_MESSAGE_AVAILABLE)
> @@ -891,7 +891,7 @@ copy_message_data(ssize_t (*copy_callback)(void *context, void *dest, size_t off
> }
>
> /* Called by the slot handler and application threads */
> -static enum vchiq_status
> +static int
> queue_message(struct vchiq_state *state, struct vchiq_service *service,
> int msgid,
> ssize_t (*copy_callback)(void *context, void *dest,
> @@ -913,7 +913,7 @@ queue_message(struct vchiq_state *state, struct vchiq_service *service,
>
> if (!(flags & QMFLAGS_NO_MUTEX_LOCK) &&
> mutex_lock_killable(&state->slot_mutex))
> - return VCHIQ_RETRY;
> + return -EINTR;
>
> if (type == VCHIQ_MSG_DATA) {
> int tx_end_index;
> @@ -921,7 +921,7 @@ queue_message(struct vchiq_state *state, struct vchiq_service *service,
> if (!service) {
> WARN(1, "%s: service is NULL\n", __func__);
> mutex_unlock(&state->slot_mutex);
> - return VCHIQ_ERROR;
> + return -EINVAL;
> }
>
> WARN_ON(flags & (QMFLAGS_NO_MUTEX_LOCK |
> @@ -930,7 +930,7 @@ queue_message(struct vchiq_state *state, struct vchiq_service *service,
> if (service->closing) {
> /* The service has been closed */
> mutex_unlock(&state->slot_mutex);
> - return VCHIQ_ERROR;
> + return -EINVAL;
> }
>
> quota = &state->service_quotas[service->localport];
> @@ -954,7 +954,7 @@ queue_message(struct vchiq_state *state, struct vchiq_service *service,
> mutex_unlock(&state->slot_mutex);
>
> if (wait_for_completion_interruptible(&state->data_quota_event))
> - return VCHIQ_RETRY;
> + return -EINTR;
>
> mutex_lock(&state->slot_mutex);
> spin_lock("a_spinlock);
> @@ -978,15 +978,15 @@ queue_message(struct vchiq_state *state, struct vchiq_service *service,
> VCHIQ_SERVICE_STATS_INC(service, quota_stalls);
> mutex_unlock(&state->slot_mutex);
> if (wait_for_completion_interruptible("a->quota_event))
> - return VCHIQ_RETRY;
> + return -EINTR;
> if (service->closing)
> - return VCHIQ_ERROR;
> + return -EINVAL;
> if (mutex_lock_killable(&state->slot_mutex))
> - return VCHIQ_RETRY;
> + return -EINTR;
> if (service->srvstate != VCHIQ_SRVSTATE_OPEN) {
> /* The service has been closed */
> mutex_unlock(&state->slot_mutex);
> - return VCHIQ_ERROR;
> + return -EINVAL;
> }
> spin_lock("a_spinlock);
> tx_end_index = SLOT_QUEUE_INDEX_FROM_POS(state->local_tx_pos + stride - 1);
> @@ -1006,7 +1006,7 @@ queue_message(struct vchiq_state *state, struct vchiq_service *service,
> */
> if (!(flags & QMFLAGS_NO_MUTEX_LOCK))
> mutex_unlock(&state->slot_mutex);
> - return VCHIQ_RETRY;
> + return -EINTR;
> }
>
> if (type == VCHIQ_MSG_DATA) {
> @@ -1028,7 +1028,7 @@ queue_message(struct vchiq_state *state, struct vchiq_service *service,
> if (callback_result < 0) {
> mutex_unlock(&state->slot_mutex);
> VCHIQ_SERVICE_STATS_INC(service, error_count);
> - return VCHIQ_ERROR;
> + return -EINVAL;
> }
>
> if (SRVTRACE_ENABLED(service,
> @@ -1126,11 +1126,11 @@ queue_message(struct vchiq_state *state, struct vchiq_service *service,
>
> remote_event_signal(&state->remote->trigger);
>
> - return VCHIQ_SUCCESS;
> + return 0;
> }
>
> /* Called by the slot handler and application threads */
> -static enum vchiq_status
> +static int
> queue_message_sync(struct vchiq_state *state, struct vchiq_service *service,
> int msgid,
> ssize_t (*copy_callback)(void *context, void *dest,
> @@ -1145,7 +1145,7 @@ queue_message_sync(struct vchiq_state *state, struct vchiq_service *service,
>
> if (VCHIQ_MSG_TYPE(msgid) != VCHIQ_MSG_RESUME &&
> mutex_lock_killable(&state->sync_mutex))
> - return VCHIQ_RETRY;
> + return -EINTR;
>
> remote_event_wait(&state->sync_release_event, &local->sync_release);
>
> @@ -1175,7 +1175,7 @@ queue_message_sync(struct vchiq_state *state, struct vchiq_service *service,
> if (callback_result < 0) {
> mutex_unlock(&state->slot_mutex);
> VCHIQ_SERVICE_STATS_INC(service, error_count);
> - return VCHIQ_ERROR;
> + return -EINVAL;
> }
>
> if (service) {
> @@ -1213,7 +1213,7 @@ queue_message_sync(struct vchiq_state *state, struct vchiq_service *service,
> if (VCHIQ_MSG_TYPE(msgid) != VCHIQ_MSG_PAUSE)
> mutex_unlock(&state->sync_mutex);
>
> - return VCHIQ_SUCCESS;
> + return 0;
> }
>
> static inline void
> @@ -1289,11 +1289,11 @@ get_bulk_reason(struct vchiq_bulk *bulk)
> }
>
> /* Called by the slot handler - don't hold the bulk mutex */
> -static enum vchiq_status
> +static int
> notify_bulks(struct vchiq_service *service, struct vchiq_bulk_queue *queue,
> int retry_poll)
> {
> - enum vchiq_status status = VCHIQ_SUCCESS;
> + int status = 0;
>
> vchiq_log_trace(vchiq_core_log_level, "%d: nb:%d %cx - p=%x rn=%x r=%x", service->state->id,
> service->localport, (queue == &service->bulk_tx) ? 't' : 'r',
> @@ -1338,7 +1338,7 @@ notify_bulks(struct vchiq_service *service, struct vchiq_bulk_queue *queue,
> get_bulk_reason(bulk);
> status = make_service_callback(service, reason, NULL,
> bulk->userdata);
> - if (status == VCHIQ_RETRY)
> + if (status == -EINTR)
> break;
> }
> }
> @@ -1347,9 +1347,9 @@ notify_bulks(struct vchiq_service *service, struct vchiq_bulk_queue *queue,
> complete(&service->bulk_remove_event);
> }
> if (!retry_poll)
> - status = VCHIQ_SUCCESS;
> + status = 0;
>
> - if (status == VCHIQ_RETRY)
> + if (status == -EINTR)
> request_poll(service->state, service, (queue == &service->bulk_tx) ?
> VCHIQ_POLL_TXNOTIFY : VCHIQ_POLL_RXNOTIFY);
>
> @@ -1388,13 +1388,12 @@ poll_services_of_group(struct vchiq_state *state, int group)
> */
> service->public_fourcc = VCHIQ_FOURCC_INVALID;
>
> - if (vchiq_close_service_internal(service, NO_CLOSE_RECVD) !=
> - VCHIQ_SUCCESS)
> + if (vchiq_close_service_internal(service, NO_CLOSE_RECVD))
> request_poll(state, service, VCHIQ_POLL_REMOVE);
> } else if (service_flags & BIT(VCHIQ_POLL_TERMINATE)) {
> vchiq_log_info(vchiq_core_log_level, "%d: ps - terminate %d<->%d",
> state->id, service->localport, service->remoteport);
> - if (vchiq_close_service_internal(service, NO_CLOSE_RECVD) != VCHIQ_SUCCESS)
> + if (vchiq_close_service_internal(service, NO_CLOSE_RECVD))
> request_poll(state, service, VCHIQ_POLL_TERMINATE);
> }
> if (service_flags & BIT(VCHIQ_POLL_TXNOTIFY))
> @@ -1517,14 +1516,14 @@ parse_open(struct vchiq_state *state, struct vchiq_header *header)
> /* Acknowledge the OPEN */
> if (service->sync) {
> if (queue_message_sync(state, NULL, openack_id, memcpy_copy_callback,
> - &ack_payload, sizeof(ack_payload), 0) == VCHIQ_RETRY)
> + &ack_payload, sizeof(ack_payload), 0) == -EINTR)
> goto bail_not_ready;
>
> /* The service is now open */
> set_service_state(service, VCHIQ_SRVSTATE_OPENSYNC);
> } else {
> if (queue_message(state, NULL, openack_id, memcpy_copy_callback,
> - &ack_payload, sizeof(ack_payload), 0) == VCHIQ_RETRY)
> + &ack_payload, sizeof(ack_payload), 0) == -EINTR)
> goto bail_not_ready;
>
> /* The service is now open */
> @@ -1539,7 +1538,7 @@ parse_open(struct vchiq_state *state, struct vchiq_header *header)
> fail_open:
> /* No available service, or an invalid request - send a CLOSE */
> if (queue_message(state, NULL, MAKE_CLOSE(0, VCHIQ_MSG_SRCPORT(msgid)),
> - NULL, NULL, 0, 0) == VCHIQ_RETRY)
> + NULL, NULL, 0, 0) == -EINTR)
> goto bail_not_ready;
>
> return 1;
> @@ -1678,7 +1677,7 @@ parse_message(struct vchiq_state *state, struct vchiq_header *header)
>
> mark_service_closing_internal(service, 1);
>
> - if (vchiq_close_service_internal(service, CLOSE_RECVD) == VCHIQ_RETRY)
> + if (vchiq_close_service_internal(service, CLOSE_RECVD) == -EINTR)
> goto bail_not_ready;
>
> vchiq_log_info(vchiq_core_log_level, "Close Service %c%c%c%c s:%u d:%d",
> @@ -1695,7 +1694,7 @@ parse_message(struct vchiq_state *state, struct vchiq_header *header)
> claim_slot(state->rx_info);
> DEBUG_TRACE(PARSE_LINE);
> if (make_service_callback(service, VCHIQ_MESSAGE_AVAILABLE, header,
> - NULL) == VCHIQ_RETRY) {
> + NULL) == -EINTR) {
> DEBUG_TRACE(PARSE_LINE);
> goto bail_not_ready;
> }
> @@ -1793,7 +1792,7 @@ parse_message(struct vchiq_state *state, struct vchiq_header *header)
> if (state->conn_state != VCHIQ_CONNSTATE_PAUSE_SENT) {
> /* Send a PAUSE in response */
> if (queue_message(state, NULL, MAKE_PAUSE, NULL, NULL, 0,
> - QMFLAGS_NO_MUTEX_UNLOCK) == VCHIQ_RETRY)
> + QMFLAGS_NO_MUTEX_UNLOCK) == -EINTR)
> goto bail_not_ready;
> }
> /* At this point slot_mutex is held */
> @@ -1910,7 +1909,7 @@ handle_poll(struct vchiq_state *state)
>
> case VCHIQ_CONNSTATE_PAUSING:
> if (queue_message(state, NULL, MAKE_PAUSE, NULL, NULL, 0,
> - QMFLAGS_NO_MUTEX_UNLOCK) != VCHIQ_RETRY) {
> + QMFLAGS_NO_MUTEX_UNLOCK) != -EINTR) {
> vchiq_set_conn_state(state, VCHIQ_CONNSTATE_PAUSE_SENT);
> } else {
> /* Retry later */
> @@ -1920,7 +1919,7 @@ handle_poll(struct vchiq_state *state)
>
> case VCHIQ_CONNSTATE_RESUMING:
> if (queue_message(state, NULL, MAKE_RESUME, NULL, NULL, 0,
> - QMFLAGS_NO_MUTEX_LOCK) != VCHIQ_RETRY) {
> + QMFLAGS_NO_MUTEX_LOCK) != -EINTR) {
> vchiq_set_conn_state(state, VCHIQ_CONNSTATE_CONNECTED);
> } else {
> /*
> @@ -2074,9 +2073,9 @@ sync_func(void *v)
> if ((service->remoteport == remoteport) &&
> (service->srvstate == VCHIQ_SRVSTATE_OPENSYNC)) {
> if (make_service_callback(service, VCHIQ_MESSAGE_AVAILABLE, header,
> - NULL) == VCHIQ_RETRY)
> + NULL) == -EINTR)
> vchiq_log_error(vchiq_sync_log_level,
> - "synchronous callback to service %d returns VCHIQ_RETRY",
> + "synchronous callback to service %d has been interrupted",
> localport);
> }
> break;
> @@ -2478,7 +2477,7 @@ vchiq_add_service_internal(struct vchiq_state *state,
> return service;
> }
>
> -enum vchiq_status
> +int
> vchiq_open_service_internal(struct vchiq_service *service, int client_id)
> {
> struct vchiq_open_payload payload = {
> @@ -2487,7 +2486,7 @@ vchiq_open_service_internal(struct vchiq_service *service, int client_id)
> service->version,
> service->version_min
> };
> - enum vchiq_status status = VCHIQ_SUCCESS;
> + int status = 0;
>
> service->client_id = client_id;
> vchiq_use_service_internal(service);
> @@ -2498,12 +2497,12 @@ vchiq_open_service_internal(struct vchiq_service *service, int client_id)
> sizeof(payload),
> QMFLAGS_IS_BLOCKING);
>
> - if (status != VCHIQ_SUCCESS)
> + if (status)
> return status;
>
> /* Wait for the ACK/NAK */
> if (wait_for_completion_interruptible(&service->remove_event)) {
> - status = VCHIQ_RETRY;
> + status = -EINTR;
> vchiq_release_service_internal(service);
> } else if ((service->srvstate != VCHIQ_SRVSTATE_OPEN) &&
> (service->srvstate != VCHIQ_SRVSTATE_OPENSYNC)) {
> @@ -2513,11 +2512,10 @@ vchiq_open_service_internal(struct vchiq_service *service, int client_id)
> service->state->id,
> srvstate_names[service->srvstate],
> kref_read(&service->ref_count));
> - status = VCHIQ_ERROR;
> + status = -EINVAL;
> VCHIQ_SERVICE_STATS_INC(service, error_count);
> vchiq_release_service_internal(service);
> }
> -
looks unrelated
> return status;
> }
>
> @@ -2584,7 +2582,7 @@ release_service_messages(struct vchiq_service *service)
> static int
> do_abort_bulks(struct vchiq_service *service)
> {
> - enum vchiq_status status;
> + int status;
>
> /* Abort any outstanding bulk transfers */
> if (mutex_lock_killable(&service->bulk_mutex))
> @@ -2594,17 +2592,17 @@ do_abort_bulks(struct vchiq_service *service)
> mutex_unlock(&service->bulk_mutex);
>
> status = notify_bulks(service, &service->bulk_tx, NO_RETRY_POLL);
> - if (status != VCHIQ_SUCCESS)
> + if (status)
> return 0;
>
> status = notify_bulks(service, &service->bulk_rx, NO_RETRY_POLL);
> - return (status == VCHIQ_SUCCESS);
> + return (!status);
> }
>
> -static enum vchiq_status
> +static int
> close_service_complete(struct vchiq_service *service, int failstate)
> {
> - enum vchiq_status status;
> + int status;
> int is_server = (service->public_fourcc != VCHIQ_FOURCC_INVALID);
> int newstate;
>
> @@ -2631,12 +2629,12 @@ close_service_complete(struct vchiq_service *service, int failstate)
> vchiq_log_error(vchiq_core_log_level, "%s(%x) called in state %s", __func__,
> service->handle, srvstate_names[service->srvstate]);
> WARN(1, "%s in unexpected state\n", __func__);
> - return VCHIQ_ERROR;
> + return -EINVAL;
> }
>
> status = make_service_callback(service, VCHIQ_SERVICE_CLOSED, NULL, NULL);
>
> - if (status != VCHIQ_RETRY) {
> + if (status != -EINTR) {
> int uc = service->service_use_count;
> int i;
> /* Complete the close process */
> @@ -2661,16 +2659,15 @@ close_service_complete(struct vchiq_service *service, int failstate)
> } else {
> set_service_state(service, failstate);
> }
> -
looks unrelated
> return status;
> }
>
> /* Called by the slot handler */
> -enum vchiq_status
> +int
> vchiq_close_service_internal(struct vchiq_service *service, int close_recvd)
> {
> struct vchiq_state *state = service->state;
> - enum vchiq_status status = VCHIQ_SUCCESS;
> + int status = 0;
> int is_server = (service->public_fourcc != VCHIQ_FOURCC_INVALID);
> int close_id = MAKE_CLOSE(service->localport,
> VCHIQ_MSG_DSTPORT(service->remoteport));
> @@ -2688,7 +2685,7 @@ vchiq_close_service_internal(struct vchiq_service *service, int close_recvd)
> __func__, srvstate_names[service->srvstate]);
> } else if (is_server) {
> if (service->srvstate == VCHIQ_SRVSTATE_LISTENING) {
> - status = VCHIQ_ERROR;
> + status = -EINVAL;
> } else {
> service->client_id = 0;
> service->remoteport = VCHIQ_PORT_FREE;
> @@ -2717,16 +2714,16 @@ vchiq_close_service_internal(struct vchiq_service *service, int close_recvd)
> case VCHIQ_SRVSTATE_OPEN:
> if (close_recvd) {
> if (!do_abort_bulks(service))
> - status = VCHIQ_RETRY;
> + status = -EINTR;
> }
>
> release_service_messages(service);
>
> - if (status == VCHIQ_SUCCESS)
> + if (!status)
> status = queue_message(state, service, close_id, NULL,
> NULL, 0, QMFLAGS_NO_MUTEX_UNLOCK);
>
> - if (status != VCHIQ_SUCCESS) {
> + if (status) {
> if (service->srvstate == VCHIQ_SRVSTATE_OPENSYNC)
> mutex_unlock(&state->sync_mutex);
> break;
> @@ -2756,11 +2753,11 @@ vchiq_close_service_internal(struct vchiq_service *service, int close_recvd)
> break;
>
> if (!do_abort_bulks(service)) {
> - status = VCHIQ_RETRY;
> + status = -EINTR;
> break;
> }
>
> - if (status == VCHIQ_SUCCESS)
> + if (!status)
> status = close_service_complete(service, VCHIQ_SRVSTATE_CLOSERECVD);
> break;
>
> @@ -2824,7 +2821,7 @@ vchiq_free_service_internal(struct vchiq_service *service)
> vchiq_service_put(service);
> }
>
> -enum vchiq_status
> +int
> vchiq_connect_internal(struct vchiq_state *state, struct vchiq_instance *instance)
> {
> struct vchiq_service *service;
> @@ -2840,21 +2837,21 @@ vchiq_connect_internal(struct vchiq_state *state, struct vchiq_instance *instanc
>
> if (state->conn_state == VCHIQ_CONNSTATE_DISCONNECTED) {
> if (queue_message(state, NULL, MAKE_CONNECT, NULL, NULL, 0,
> - QMFLAGS_IS_BLOCKING) == VCHIQ_RETRY)
> - return VCHIQ_RETRY;
> + QMFLAGS_IS_BLOCKING) == -EINTR)
> + return -EINTR;
>
> vchiq_set_conn_state(state, VCHIQ_CONNSTATE_CONNECTING);
> }
>
> if (state->conn_state == VCHIQ_CONNSTATE_CONNECTING) {
> if (wait_for_completion_interruptible(&state->connect))
> - return VCHIQ_RETRY;
> + return -EINTR;
>
> vchiq_set_conn_state(state, VCHIQ_CONNSTATE_CONNECTED);
> complete(&state->connect);
> }
>
> - return VCHIQ_SUCCESS;
> + return 0;
> }
>
> void
> @@ -2871,15 +2868,15 @@ vchiq_shutdown_internal(struct vchiq_state *state, struct vchiq_instance *instan
> }
> }
>
> -enum vchiq_status
> +int
> vchiq_close_service(unsigned int handle)
> {
> /* Unregister the service */
> struct vchiq_service *service = find_service_by_handle(handle);
> - enum vchiq_status status = VCHIQ_SUCCESS;
> + int status = 0;
>
> if (!service)
> - return VCHIQ_ERROR;
> + return -EINVAL;
>
> vchiq_log_info(vchiq_core_log_level, "%d: close_service:%d",
> service->state->id, service->localport);
> @@ -2888,14 +2885,14 @@ vchiq_close_service(unsigned int handle)
> (service->srvstate == VCHIQ_SRVSTATE_LISTENING) ||
> (service->srvstate == VCHIQ_SRVSTATE_HIDDEN)) {
> vchiq_service_put(service);
> - return VCHIQ_ERROR;
> + return -EINVAL;
> }
>
> mark_service_closing(service);
>
> if (current == service->state->slot_handler_thread) {
> status = vchiq_close_service_internal(service, NO_CLOSE_RECVD);
> - WARN_ON(status == VCHIQ_RETRY);
> + WARN_ON(status == -EINTR);
> } else {
> /* Mark the service for termination by the slot handler */
> request_poll(service->state, service, VCHIQ_POLL_TERMINATE);
> @@ -2903,7 +2900,7 @@ vchiq_close_service(unsigned int handle)
>
> while (1) {
> if (wait_for_completion_interruptible(&service->remove_event)) {
> - status = VCHIQ_RETRY;
> + status = -EINTR;
> break;
> }
>
> @@ -2918,10 +2915,10 @@ vchiq_close_service(unsigned int handle)
> srvstate_names[service->srvstate]);
> }
>
> - if ((status == VCHIQ_SUCCESS) &&
> + if ((!status) &&
> (service->srvstate != VCHIQ_SRVSTATE_FREE) &&
> (service->srvstate != VCHIQ_SRVSTATE_LISTENING))
> - status = VCHIQ_ERROR;
> + status = -EINVAL;
>
> vchiq_service_put(service);
>
> @@ -2929,22 +2926,22 @@ vchiq_close_service(unsigned int handle)
> }
> EXPORT_SYMBOL(vchiq_close_service);
>
> -enum vchiq_status
> +int
> vchiq_remove_service(unsigned int handle)
> {
> /* Unregister the service */
> struct vchiq_service *service = find_service_by_handle(handle);
> - enum vchiq_status status = VCHIQ_SUCCESS;
> + int status = 0;
>
> if (!service)
> - return VCHIQ_ERROR;
> + return -EINVAL;
>
> vchiq_log_info(vchiq_core_log_level, "%d: remove_service:%d",
> service->state->id, service->localport);
>
> if (service->srvstate == VCHIQ_SRVSTATE_FREE) {
> vchiq_service_put(service);
> - return VCHIQ_ERROR;
> + return -EINVAL;
> }
>
> mark_service_closing(service);
> @@ -2958,14 +2955,14 @@ vchiq_remove_service(unsigned int handle)
> service->public_fourcc = VCHIQ_FOURCC_INVALID;
>
> status = vchiq_close_service_internal(service, NO_CLOSE_RECVD);
> - WARN_ON(status == VCHIQ_RETRY);
> + WARN_ON(status == -EINTR);
> } else {
> /* Mark the service for removal by the slot handler */
> request_poll(service->state, service, VCHIQ_POLL_REMOVE);
> }
> while (1) {
> if (wait_for_completion_interruptible(&service->remove_event)) {
> - status = VCHIQ_RETRY;
> + status = -EINTR;
> break;
> }
>
> @@ -2979,26 +2976,25 @@ vchiq_remove_service(unsigned int handle)
> srvstate_names[service->srvstate]);
> }
>
> - if ((status == VCHIQ_SUCCESS) &&
> + if ((!status) &&
> (service->srvstate != VCHIQ_SRVSTATE_FREE))
> - status = VCHIQ_ERROR;
> + status = -EINVAL;
>
> vchiq_service_put(service);
> -
> return status;
> }
>
> /*
> * This function may be called by kernel threads or user threads.
> - * User threads may receive VCHIQ_RETRY to indicate that a signal has been
> + * User threads may receive -EINTR to indicate that a signal has been
> * received and the call should be retried after being returned to user
> * context.
> * When called in blocking mode, the userdata field points to a bulk_waiter
> * structure.
> */
> -enum vchiq_status vchiq_bulk_transfer(unsigned int handle, void *offset, void __user *uoffset,
> - int size, void *userdata, enum vchiq_bulk_mode mode,
> - enum vchiq_bulk_dir dir)
> +int vchiq_bulk_transfer(unsigned int handle, void *offset, void __user *uoffset,
> + int size, void *userdata, enum vchiq_bulk_mode mode,
> + enum vchiq_bulk_dir dir)
> {
> struct vchiq_service *service = find_service_by_handle(handle);
> struct vchiq_bulk_queue *queue;
> @@ -3008,7 +3004,7 @@ enum vchiq_status vchiq_bulk_transfer(unsigned int handle, void *offset, void __
> const char dir_char = (dir == VCHIQ_BULK_TRANSMIT) ? 't' : 'r';
> const int dir_msgtype = (dir == VCHIQ_BULK_TRANSMIT) ?
> VCHIQ_MSG_BULK_TX : VCHIQ_MSG_BULK_RX;
> - enum vchiq_status status = VCHIQ_ERROR;
> + int status = -EINVAL;
> int payload[2];
>
> if (!service)
> @@ -3020,7 +3016,7 @@ enum vchiq_status vchiq_bulk_transfer(unsigned int handle, void *offset, void __
> if (!offset && !uoffset)
> goto error_exit;
>
> - if (vchiq_check_service(service) != VCHIQ_SUCCESS)
> + if (vchiq_check_service(service))
> goto error_exit;
>
> switch (mode) {
> @@ -3047,7 +3043,7 @@ enum vchiq_status vchiq_bulk_transfer(unsigned int handle, void *offset, void __
> &service->bulk_tx : &service->bulk_rx;
>
> if (mutex_lock_killable(&service->bulk_mutex)) {
> - status = VCHIQ_RETRY;
> + status = -EINTR;
> goto error_exit;
> }
>
> @@ -3056,11 +3052,11 @@ enum vchiq_status vchiq_bulk_transfer(unsigned int handle, void *offset, void __
> do {
> mutex_unlock(&service->bulk_mutex);
> if (wait_for_completion_interruptible(&service->bulk_remove_event)) {
> - status = VCHIQ_RETRY;
> + status = -EINTR;
> goto error_exit;
> }
> if (mutex_lock_killable(&service->bulk_mutex)) {
> - status = VCHIQ_RETRY;
> + status = -EINTR;
> goto error_exit;
> }
> } while (queue->local_insert == queue->remove +
> @@ -3089,7 +3085,7 @@ enum vchiq_status vchiq_bulk_transfer(unsigned int handle, void *offset, void __
> * claim it here to ensure that isn't happening
> */
> if (mutex_lock_killable(&state->slot_mutex)) {
> - status = VCHIQ_RETRY;
> + status = -EINTR;
> goto cancel_bulk_error_exit;
> }
>
> @@ -3109,7 +3105,7 @@ enum vchiq_status vchiq_bulk_transfer(unsigned int handle, void *offset, void __
> QMFLAGS_IS_BLOCKING |
> QMFLAGS_NO_MUTEX_LOCK |
> QMFLAGS_NO_MUTEX_UNLOCK);
> - if (status != VCHIQ_SUCCESS)
> + if (status)
> goto unlock_both_error_exit;
>
> queue->local_insert++;
> @@ -3124,14 +3120,14 @@ enum vchiq_status vchiq_bulk_transfer(unsigned int handle, void *offset, void __
> waiting:
> vchiq_service_put(service);
>
> - status = VCHIQ_SUCCESS;
> + status = 0;
>
> if (bulk_waiter) {
> bulk_waiter->bulk = bulk;
> if (wait_for_completion_interruptible(&bulk_waiter->event))
> - status = VCHIQ_RETRY;
> + status = -EINTR;
> else if (bulk_waiter->actual == VCHIQ_BULK_ACTUAL_ABORTED)
> - status = VCHIQ_ERROR;
> + status = -EINVAL;
> }
>
> return status;
> @@ -3149,7 +3145,7 @@ enum vchiq_status vchiq_bulk_transfer(unsigned int handle, void *offset, void __
> return status;
> }
>
> -enum vchiq_status
> +int
> vchiq_queue_message(unsigned int handle,
> ssize_t (*copy_callback)(void *context, void *dest,
> size_t offset, size_t maxsize),
> @@ -3157,13 +3153,13 @@ vchiq_queue_message(unsigned int handle,
> size_t size)
> {
> struct vchiq_service *service = find_service_by_handle(handle);
> - enum vchiq_status status = VCHIQ_ERROR;
> + int status = -EINVAL;
> int data_id;
>
> if (!service)
> goto error_exit;
>
> - if (vchiq_check_service(service) != VCHIQ_SUCCESS)
> + if (vchiq_check_service(service))
> goto error_exit;
>
> if (!size) {
> @@ -3188,7 +3184,7 @@ vchiq_queue_message(unsigned int handle,
> copy_callback, context, size, 1);
> break;
> default:
> - status = VCHIQ_ERROR;
> + status = -EINVAL;
> break;
> }
>
> @@ -3201,18 +3197,18 @@ vchiq_queue_message(unsigned int handle,
>
> int vchiq_queue_kernel_message(unsigned int handle, void *data, unsigned int size)
> {
> - enum vchiq_status status;
> + int status;
>
> while (1) {
> status = vchiq_queue_message(handle, memcpy_copy_callback,
> data, size);
>
> /*
> - * vchiq_queue_message() may return VCHIQ_RETRY, so we need to
> + * vchiq_queue_message() may be interrupted, so we need to
> * implement a retry mechanism since this function is supposed
> * to block until queued
> */
> - if (status != VCHIQ_RETRY)
> + if (status != -EINTR)
> break;
>
> msleep(1);
> @@ -3264,27 +3260,25 @@ release_message_sync(struct vchiq_state *state, struct vchiq_header *header)
> remote_event_signal(&state->remote->sync_release);
> }
>
> -enum vchiq_status
> +int
> vchiq_get_peer_version(unsigned int handle, short *peer_version)
> {
> - enum vchiq_status status = VCHIQ_ERROR;
> + int status = -EINVAL;
> struct vchiq_service *service = find_service_by_handle(handle);
>
> if (!service)
> goto exit;
>
> - if (vchiq_check_service(service) != VCHIQ_SUCCESS)
> + if (vchiq_check_service(service))
> goto exit;
>
> if (!peer_version)
> goto exit;
>
> *peer_version = service->peer_version;
> - status = VCHIQ_SUCCESS;
> + status = 0;
>
> exit:
> - if (service)
> - vchiq_service_put(service);
> return status;
> }
> EXPORT_SYMBOL(vchiq_get_peer_version);
> @@ -3626,18 +3620,18 @@ vchiq_loud_error_footer(void)
> "============================================================================");
> }
>
> -enum vchiq_status vchiq_send_remote_use(struct vchiq_state *state)
> +int vchiq_send_remote_use(struct vchiq_state *state)
> {
> if (state->conn_state == VCHIQ_CONNSTATE_DISCONNECTED)
> - return VCHIQ_RETRY;
> + return -EINVAL;
>
> return queue_message(state, NULL, MAKE_REMOTE_USE, NULL, NULL, 0, 0);
> }
>
> -enum vchiq_status vchiq_send_remote_use_active(struct vchiq_state *state)
> +int vchiq_send_remote_use_active(struct vchiq_state *state)
> {
> if (state->conn_state == VCHIQ_CONNSTATE_DISCONNECTED)
> - return VCHIQ_RETRY;
> + return -EINVAL;
>
> return queue_message(state, NULL, MAKE_REMOTE_USE_ACTIVE,
> NULL, NULL, 0, 0);
> 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 1ddc661642a9..4ae72f064fff 100644
> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
> @@ -459,7 +459,7 @@ vchiq_init_slots(void *mem_base, int mem_size);
> extern int
> vchiq_init_state(struct vchiq_state *state, struct vchiq_slot_zero *slot_zero);
>
> -extern enum vchiq_status
> +extern int
> vchiq_connect_internal(struct vchiq_state *state, struct vchiq_instance *instance);
>
> struct vchiq_service *
> @@ -468,10 +468,10 @@ vchiq_add_service_internal(struct vchiq_state *state,
> int srvstate, struct vchiq_instance *instance,
> void (*userdata_term)(void *userdata));
>
> -extern enum vchiq_status
> +extern int
> vchiq_open_service_internal(struct vchiq_service *service, int client_id);
>
> -extern enum vchiq_status
> +extern int
> vchiq_close_service_internal(struct vchiq_service *service, int close_recvd);
>
> extern void
> @@ -486,7 +486,7 @@ vchiq_shutdown_internal(struct vchiq_state *state, struct vchiq_instance *instan
> extern void
> remote_event_pollall(struct vchiq_state *state);
>
> -extern enum vchiq_status
> +extern int
> vchiq_bulk_transfer(unsigned int handle, void *offset, void __user *uoffset,
> int size, void *userdata, enum vchiq_bulk_mode mode,
> enum vchiq_bulk_dir dir);
> @@ -547,7 +547,7 @@ vchiq_service_get(struct vchiq_service *service);
> extern void
> vchiq_service_put(struct vchiq_service *service);
>
> -extern enum vchiq_status
> +extern int
> vchiq_queue_message(unsigned int handle,
> ssize_t (*copy_callback)(void *context, void *dest,
> size_t offset, size_t maxsize),
> @@ -579,13 +579,13 @@ void vchiq_on_remote_release(struct vchiq_state *state);
>
> int vchiq_platform_init_state(struct vchiq_state *state);
>
> -enum vchiq_status vchiq_check_service(struct vchiq_service *service);
> +int vchiq_check_service(struct vchiq_service *service);
>
> void vchiq_on_remote_use_active(struct vchiq_state *state);
>
> -enum vchiq_status vchiq_send_remote_use(struct vchiq_state *state);
> +int vchiq_send_remote_use(struct vchiq_state *state);
>
> -enum vchiq_status vchiq_send_remote_use_active(struct vchiq_state *state);
> +int vchiq_send_remote_use_active(struct vchiq_state *state);
>
> void vchiq_platform_conn_state_changed(struct vchiq_state *state,
> enum vchiq_connstate oldstate,
> @@ -595,7 +595,7 @@ void vchiq_set_conn_state(struct vchiq_state *state, enum vchiq_connstate newsta
>
> void vchiq_log_dump_mem(const char *label, u32 addr, const void *void_mem, size_t num_bytes);
>
> -enum vchiq_status vchiq_remove_service(unsigned int service);
> +int vchiq_remove_service(unsigned int service);
>
> int vchiq_get_client_id(unsigned int service);
>
> diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c
> index 66bbfec332ba..062604a95b79 100644
> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c
> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c
> @@ -112,7 +112,7 @@ vchiq_ioc_queue_message(unsigned int handle, struct vchiq_element *elements,
> unsigned long count)
> {
> struct vchiq_io_copy_callback_context context;
> - enum vchiq_status status = VCHIQ_SUCCESS;
> + int status = 0;
> unsigned long i;
> size_t total_size = 0;
>
> @@ -130,11 +130,7 @@ vchiq_ioc_queue_message(unsigned int handle, struct vchiq_element *elements,
> status = vchiq_queue_message(handle, vchiq_ioc_copy_element_data,
> &context, total_size);
>
> - if (status == VCHIQ_ERROR)
> - return -EIO;
> - else if (status == VCHIQ_RETRY)
> - return -EINTR;
> - return 0;
> + return (status == -EINVAL) ? -EIO : status;
> }
>
> static int vchiq_ioc_create_service(struct vchiq_instance *instance,
> @@ -142,7 +138,7 @@ static int vchiq_ioc_create_service(struct vchiq_instance *instance,
> {
> struct user_service *user_service = NULL;
> struct vchiq_service *service;
> - enum vchiq_status status = VCHIQ_SUCCESS;
> + int status = 0;
> struct vchiq_service_params_kernel params;
> int srvstate;
>
> @@ -190,9 +186,9 @@ static int vchiq_ioc_create_service(struct vchiq_instance *instance,
>
> if (args->is_open) {
> status = vchiq_open_service_internal(service, instance->pid);
> - if (status != VCHIQ_SUCCESS) {
> + if (status) {
> vchiq_remove_service(service->handle);
> - return (status == VCHIQ_RETRY) ?
> + return (status == -EINTR) ?
> -EINTR : -EIO;
> }
> }
> @@ -338,7 +334,7 @@ static int vchiq_irq_queue_bulk_tx_rx(struct vchiq_instance *instance,
> goto out;
> }
>
> - if ((status != VCHIQ_RETRY) || fatal_signal_pending(current) ||
> + if ((status != -EINTR) || fatal_signal_pending(current) ||
> !waiter->bulk_waiter.bulk) {
> if (waiter->bulk_waiter.bulk) {
> /* Cancel the signal when the transfer completes. */
> @@ -364,9 +360,9 @@ static int vchiq_irq_queue_bulk_tx_rx(struct vchiq_instance *instance,
> vchiq_service_put(service);
> if (ret)
> return ret;
> - else if (status == VCHIQ_ERROR)
> + else if (status == -EINVAL)
> return -EIO;
> - else if (status == VCHIQ_RETRY)
> + else if (status == -EINTR)
> return -EINTR;
> return 0;
> }
> @@ -577,7 +573,7 @@ static long
> vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
> {
> struct vchiq_instance *instance = file->private_data;
> - enum vchiq_status status = VCHIQ_SUCCESS;
> + int status = 0;
> struct vchiq_service *service = NULL;
> long ret = 0;
> int i, rc;
> @@ -598,12 +594,12 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
> instance, &i))) {
> status = vchiq_remove_service(service->handle);
> vchiq_service_put(service);
> - if (status != VCHIQ_SUCCESS)
> + if (status)
> break;
> }
> service = NULL;
>
> - if (status == VCHIQ_SUCCESS) {
> + if (!status) {
> /* Wake the completion thread and ask it to exit */
> instance->closing = 1;
> complete(&instance->insert_event);
> @@ -627,7 +623,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
> status = vchiq_connect_internal(instance->state, instance);
> mutex_unlock(&instance->state->mutex);
>
> - if (status == VCHIQ_SUCCESS)
> + if (!status)
> instance->connected = 1;
> else
> vchiq_log_error(vchiq_arm_log_level,
> @@ -675,7 +671,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
> status = (cmd == VCHIQ_IOC_CLOSE_SERVICE) ?
> vchiq_close_service(service->handle) :
> vchiq_remove_service(service->handle);
> - if (status != VCHIQ_SUCCESS)
> + if (status)
> break;
> }
>
> @@ -686,7 +682,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
> */
> if (user_service->close_pending &&
> wait_for_completion_interruptible(&user_service->close_event))
> - status = VCHIQ_RETRY;
> + status = -EINTR;
> break;
> }
>
> @@ -862,13 +858,13 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
> vchiq_service_put(service);
>
> if (ret == 0) {
> - if (status == VCHIQ_ERROR)
> + if (status == -EINVAL)
> ret = -EIO;
> - else if (status == VCHIQ_RETRY)
> + else if (status == -EINTR)
> ret = -EINTR;
> }
>
> - if ((status == VCHIQ_SUCCESS) && (ret < 0) && (ret != -EINTR) && (ret != -EWOULDBLOCK))
> + if ((!status) && (ret < 0) && (ret != -EINTR) && (ret != -EWOULDBLOCK))
> vchiq_log_info(vchiq_arm_log_level,
> " ioctl instance %pK, cmd %s -> status %d, %ld",
> instance, (_IOC_NR(cmd) <= VCHIQ_IOC_MAX) ?
> diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h
> index 86d77f2eeea5..96f50beace44 100644
> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h
> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h
> @@ -12,10 +12,10 @@
>
> struct vchiq_service_params {
> int fourcc;
> - enum vchiq_status __user (*callback)(enum vchiq_reason reason,
> - struct vchiq_header *header,
> - unsigned int handle,
> - void *bulk_userdata);
> + int __user (*callback)(enum vchiq_reason reason,
> + struct vchiq_header *header,
> + unsigned int handle,
> + void *bulk_userdata);
> void __user *userdata;
> short version; /* Increment for non-trivial changes */
> short version_min; /* Update for incompatible changes */
On Tue, Jul 12, 2022 at 02:19:28PM -0400, Joel Slebodnick wrote:
> @@ -3264,27 +3260,25 @@ release_message_sync(struct vchiq_state *state, struct vchiq_header *header)
> remote_event_signal(&state->remote->sync_release);
> }
>
> -enum vchiq_status
> +int
> vchiq_get_peer_version(unsigned int handle, short *peer_version)
> {
> - enum vchiq_status status = VCHIQ_ERROR;
> + int status = -EINVAL;
> struct vchiq_service *service = find_service_by_handle(handle);
>
> if (!service)
> goto exit;
>
> - if (vchiq_check_service(service) != VCHIQ_SUCCESS)
> + if (vchiq_check_service(service))
> goto exit;
>
> if (!peer_version)
> goto exit;
>
> *peer_version = service->peer_version;
> - status = VCHIQ_SUCCESS;
> + status = 0;
>
> exit:
> - if (service)
> - vchiq_service_put(service);
Too aggressive with the delete key.
> return status;
> }
regards,
dan carpenter
Hi Joel,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on v5.19-rc6]
[also build test ERROR on linus/master]
[cannot apply to staging/staging-testing next-20220720]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Joel-Slebodnick/remove-custom-return-values-in-vc04_services/20220713-022038
base: 32346491ddf24599decca06190ebca03ff9de7f8
config: powerpc-randconfig-r001-20220718 (https://download.01.org/0day-ci/archive/20220721/[email protected]/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project dd5635541cd7bbd62cd59b6694dfb759b6e9a0d8)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install powerpc cross compiling tool for clang build
# apt-get install binutils-powerpc-linux-gnu
# https://github.com/intel-lab-lkp/linux/commit/cc7c5d7c4bbc057cd5426e71360c064d43018aba
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Joel-Slebodnick/remove-custom-return-values-in-vc04_services/20220713-022038
git checkout cc7c5d7c4bbc057cd5426e71360c064d43018aba
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=powerpc SHELL=/bin/bash drivers/staging/vc04_services/vchiq-mmal/
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <[email protected]>
All errors (new ones prefixed by >>):
>> drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c:551:26: error: incomplete result type 'enum vchiq_status' in function definition
static enum vchiq_status service_callback(enum vchiq_reason reason,
^
drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c:551:13: note: forward declaration of 'enum vchiq_status'
static enum vchiq_status service_callback(enum vchiq_reason reason,
^
>> drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c:562:10: error: use of undeclared identifier 'VCHIQ_SUCCESS'
return VCHIQ_SUCCESS;
^
drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c:646:9: error: use of undeclared identifier 'VCHIQ_SUCCESS'
return VCHIQ_SUCCESS;
^
3 errors generated.
vim +551 drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 549
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 550 /* incoming event service callback */
3c5da06f996995 drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c Nicolas Saenz Julienne 2020-06-29 @551 static enum vchiq_status service_callback(enum vchiq_reason reason,
3c5da06f996995 drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c Nicolas Saenz Julienne 2020-06-29 552 struct vchiq_header *header,
1e5f7325636abd drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c Baidyanath Kundu 2020-07-13 553 unsigned int handle, void *bulk_ctx)
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 554 {
3c5da06f996995 drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c Nicolas Saenz Julienne 2020-06-29 555 struct vchiq_mmal_instance *instance = vchiq_get_service_userdata(handle);
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 556 u32 msg_len;
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 557 struct mmal_msg *msg;
4e6bafdfb9f394 drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c Michael Zoran 2017-03-08 558 struct mmal_msg_context *msg_context;
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 559
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 560 if (!instance) {
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 561 pr_err("Message callback passed NULL instance\n");
3c5da06f996995 drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c Nicolas Saenz Julienne 2020-06-29 @562 return VCHIQ_SUCCESS;
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 563 }
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 564
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 565 switch (reason) {
469fbb24ced37f drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c Nicolas Saenz Julienne 2020-06-29 566 case VCHIQ_MESSAGE_AVAILABLE:
3c5da06f996995 drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c Nicolas Saenz Julienne 2020-06-29 567 msg = (void *)header->data;
3c5da06f996995 drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c Nicolas Saenz Julienne 2020-06-29 568 msg_len = header->size;
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 569
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 570 DBG_DUMP_MSG(msg, msg_len, "<<< reply message");
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 571
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 572 /* handling is different for buffer messages */
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 573 switch (msg->h.type) {
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 574 case MMAL_MSG_TYPE_BUFFER_FROM_HOST:
3c5da06f996995 drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c Nicolas Saenz Julienne 2020-06-29 575 vchiq_release_message(handle, header);
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 576 break;
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 577
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 578 case MMAL_MSG_TYPE_EVENT_TO_HOST:
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 579 event_to_host_cb(instance, msg, msg_len);
3c5da06f996995 drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c Nicolas Saenz Julienne 2020-06-29 580 vchiq_release_message(handle, header);
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 581
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 582 break;
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 583
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 584 case MMAL_MSG_TYPE_BUFFER_TO_HOST:
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 585 buffer_to_host_cb(instance, msg, msg_len);
3c5da06f996995 drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c Nicolas Saenz Julienne 2020-06-29 586 vchiq_release_message(handle, header);
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 587 break;
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 588
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 589 default:
60d5c020bbc0e4 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 590 /* messages dependent on header context to complete */
4bc58d16753b99 drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c Aishwarya Pant 2017-02-28 591 if (!msg->h.context) {
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 592 pr_err("received message context was null!\n");
3c5da06f996995 drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c Nicolas Saenz Julienne 2020-06-29 593 vchiq_release_message(handle, header);
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 594 break;
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 595 }
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 596
4e6bafdfb9f394 drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c Michael Zoran 2017-03-08 597 msg_context = lookup_msg_context(instance,
4e6bafdfb9f394 drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c Michael Zoran 2017-03-08 598 msg->h.context);
4e6bafdfb9f394 drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c Michael Zoran 2017-03-08 599 if (!msg_context) {
4e6bafdfb9f394 drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c Michael Zoran 2017-03-08 600 pr_err("received invalid message context %u!\n",
4e6bafdfb9f394 drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c Michael Zoran 2017-03-08 601 msg->h.context);
3c5da06f996995 drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c Nicolas Saenz Julienne 2020-06-29 602 vchiq_release_message(handle, header);
4e6bafdfb9f394 drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c Michael Zoran 2017-03-08 603 break;
4e6bafdfb9f394 drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c Michael Zoran 2017-03-08 604 }
4e6bafdfb9f394 drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c Michael Zoran 2017-03-08 605
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 606 /* fill in context values */
3c5da06f996995 drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c Nicolas Saenz Julienne 2020-06-29 607 msg_context->u.sync.msg_handle = header;
4e6bafdfb9f394 drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c Michael Zoran 2017-03-08 608 msg_context->u.sync.msg = msg;
4e6bafdfb9f394 drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c Michael Zoran 2017-03-08 609 msg_context->u.sync.msg_len = msg_len;
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 610
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 611 /* todo: should this check (completion_done()
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 612 * == 1) for no one waiting? or do we need a
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 613 * flag to tell us the completion has been
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 614 * interrupted so we can free the message and
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 615 * its context. This probably also solves the
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 616 * message arriving after interruption todo
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 617 * below
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 618 */
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 619
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 620 /* complete message so caller knows it happened */
4e6bafdfb9f394 drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c Michael Zoran 2017-03-08 621 complete(&msg_context->u.sync.cmplt);
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 622 break;
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 623 }
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 624
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 625 break;
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 626
469fbb24ced37f drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c Nicolas Saenz Julienne 2020-06-29 627 case VCHIQ_BULK_RECEIVE_DONE:
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 628 bulk_receive_cb(instance, bulk_ctx);
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 629 break;
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 630
469fbb24ced37f drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c Nicolas Saenz Julienne 2020-06-29 631 case VCHIQ_BULK_RECEIVE_ABORTED:
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 632 bulk_abort_cb(instance, bulk_ctx);
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 633 break;
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 634
469fbb24ced37f drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c Nicolas Saenz Julienne 2020-06-29 635 case VCHIQ_SERVICE_CLOSED:
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 636 /* TODO: consider if this requires action if received when
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 637 * driver is not explicitly closing the service
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 638 */
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 639 break;
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 640
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 641 default:
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 642 pr_err("Received unhandled message reason %d\n", reason);
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 643 break;
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 644 }
3c5da06f996995 drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c Nicolas Saenz Julienne 2020-06-29 645
3c5da06f996995 drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c Nicolas Saenz Julienne 2020-06-29 646 return VCHIQ_SUCCESS;
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 647 }
7b3ad5abf027b7 drivers/staging/media/platform/bcm2835/mmal-vchiq.c Eric Anholt 2017-01-27 648
--
0-DAY CI Kernel Test Service
https://01.org/lkp