Commit fd11b55d authored by Stefan Wahren's avatar Stefan Wahren Committed by Greg Kroah-Hartman

staging: vchiq_core: drop vchiq_status from vchiq_init_state

Replace the custom set of return values with proper Linux error codes for
vchiq_init_state().
Reviewed-by: default avatarNicolas Saenz Julienne <nsaenz@kernel.org>
Signed-off-by: default avatarStefan Wahren <stefan.wahren@i2se.com>
Link: https://lore.kernel.org/r/1619347863-16080-12-git-send-email-stefan.wahren@i2se.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent abf2836a
...@@ -132,8 +132,9 @@ int vchiq_platform_init(struct platform_device *pdev, struct vchiq_state *state) ...@@ -132,8 +132,9 @@ int vchiq_platform_init(struct platform_device *pdev, struct vchiq_state *state)
*(char **)&g_fragments_base[i * g_fragments_size] = NULL; *(char **)&g_fragments_base[i * g_fragments_size] = NULL;
sema_init(&g_free_fragments_sema, MAX_FRAGMENTS); sema_init(&g_free_fragments_sema, MAX_FRAGMENTS);
if (vchiq_init_state(state, vchiq_slot_zero) != VCHIQ_SUCCESS) err = vchiq_init_state(state, vchiq_slot_zero);
return -EINVAL; if (err)
return err;
g_regs = devm_platform_ioremap_resource(pdev, 0); g_regs = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(g_regs)) if (IS_ERR(g_regs))
......
...@@ -2162,13 +2162,12 @@ vchiq_init_state(struct vchiq_state *state, struct vchiq_slot_zero *slot_zero) ...@@ -2162,13 +2162,12 @@ vchiq_init_state(struct vchiq_state *state, struct vchiq_slot_zero *slot_zero)
{ {
struct vchiq_shared_state *local; struct vchiq_shared_state *local;
struct vchiq_shared_state *remote; struct vchiq_shared_state *remote;
enum vchiq_status status = VCHIQ_SUCCESS;
char threadname[16]; char threadname[16];
int i, ret; int i, ret;
if (vchiq_states[0]) { if (vchiq_states[0]) {
pr_err("%s: VCHIQ state already initialized\n", __func__); pr_err("%s: VCHIQ state already initialized\n", __func__);
return VCHIQ_ERROR; return -EINVAL;
} }
local = &slot_zero->slave; local = &slot_zero->slave;
...@@ -2181,7 +2180,7 @@ vchiq_init_state(struct vchiq_state *state, struct vchiq_slot_zero *slot_zero) ...@@ -2181,7 +2180,7 @@ vchiq_init_state(struct vchiq_state *state, struct vchiq_slot_zero *slot_zero)
else else
vchiq_loud_error("master/slave mismatch two slaves"); vchiq_loud_error("master/slave mismatch two slaves");
vchiq_loud_error_footer(); vchiq_loud_error_footer();
return VCHIQ_ERROR; return -EINVAL;
} }
memset(state, 0, sizeof(struct vchiq_state)); memset(state, 0, sizeof(struct vchiq_state));
...@@ -2248,7 +2247,7 @@ vchiq_init_state(struct vchiq_state *state, struct vchiq_slot_zero *slot_zero) ...@@ -2248,7 +2247,7 @@ vchiq_init_state(struct vchiq_state *state, struct vchiq_slot_zero *slot_zero)
ret = vchiq_platform_init_state(state); ret = vchiq_platform_init_state(state);
if (ret) if (ret)
return VCHIQ_ERROR; return ret;
/* /*
* bring up slot handler thread * bring up slot handler thread
...@@ -2262,7 +2261,7 @@ vchiq_init_state(struct vchiq_state *state, struct vchiq_slot_zero *slot_zero) ...@@ -2262,7 +2261,7 @@ vchiq_init_state(struct vchiq_state *state, struct vchiq_slot_zero *slot_zero)
vchiq_loud_error_header(); vchiq_loud_error_header();
vchiq_loud_error("couldn't create thread %s", threadname); vchiq_loud_error("couldn't create thread %s", threadname);
vchiq_loud_error_footer(); vchiq_loud_error_footer();
return VCHIQ_ERROR; return PTR_ERR(state->slot_handler_thread);
} }
set_user_nice(state->slot_handler_thread, -19); set_user_nice(state->slot_handler_thread, -19);
...@@ -2274,6 +2273,7 @@ vchiq_init_state(struct vchiq_state *state, struct vchiq_slot_zero *slot_zero) ...@@ -2274,6 +2273,7 @@ vchiq_init_state(struct vchiq_state *state, struct vchiq_slot_zero *slot_zero)
vchiq_loud_error_header(); vchiq_loud_error_header();
vchiq_loud_error("couldn't create thread %s", threadname); vchiq_loud_error("couldn't create thread %s", threadname);
vchiq_loud_error_footer(); vchiq_loud_error_footer();
ret = PTR_ERR(state->recycle_thread);
goto fail_free_handler_thread; goto fail_free_handler_thread;
} }
set_user_nice(state->recycle_thread, -19); set_user_nice(state->recycle_thread, -19);
...@@ -2286,6 +2286,7 @@ vchiq_init_state(struct vchiq_state *state, struct vchiq_slot_zero *slot_zero) ...@@ -2286,6 +2286,7 @@ vchiq_init_state(struct vchiq_state *state, struct vchiq_slot_zero *slot_zero)
vchiq_loud_error_header(); vchiq_loud_error_header();
vchiq_loud_error("couldn't create thread %s", threadname); vchiq_loud_error("couldn't create thread %s", threadname);
vchiq_loud_error_footer(); vchiq_loud_error_footer();
ret = PTR_ERR(state->sync_thread);
goto fail_free_recycle_thread; goto fail_free_recycle_thread;
} }
set_user_nice(state->sync_thread, -20); set_user_nice(state->sync_thread, -20);
...@@ -2299,14 +2300,14 @@ vchiq_init_state(struct vchiq_state *state, struct vchiq_slot_zero *slot_zero) ...@@ -2299,14 +2300,14 @@ vchiq_init_state(struct vchiq_state *state, struct vchiq_slot_zero *slot_zero)
/* Indicate readiness to the other side */ /* Indicate readiness to the other side */
local->initialised = 1; local->initialised = 1;
return status; return 0;
fail_free_recycle_thread: fail_free_recycle_thread:
kthread_stop(state->recycle_thread); kthread_stop(state->recycle_thread);
fail_free_handler_thread: fail_free_handler_thread:
kthread_stop(state->slot_handler_thread); kthread_stop(state->slot_handler_thread);
return VCHIQ_ERROR; return ret;
} }
void vchiq_msg_queue_push(unsigned int handle, struct vchiq_header *header) void vchiq_msg_queue_push(unsigned int handle, struct vchiq_header *header)
......
...@@ -539,7 +539,7 @@ get_conn_state_name(enum vchiq_connstate conn_state); ...@@ -539,7 +539,7 @@ get_conn_state_name(enum vchiq_connstate conn_state);
extern struct vchiq_slot_zero * extern struct vchiq_slot_zero *
vchiq_init_slots(void *mem_base, int mem_size); vchiq_init_slots(void *mem_base, int mem_size);
extern enum vchiq_status extern int
vchiq_init_state(struct vchiq_state *state, struct vchiq_slot_zero *slot_zero); vchiq_init_state(struct vchiq_state *state, struct vchiq_slot_zero *slot_zero);
extern enum vchiq_status extern enum vchiq_status
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment