Skip to content

Commit 56df512

Browse files
lategoodbyegregkh
authored andcommitted
staging: vchiq_arm: Unify return code variable
The file vchiq_arm uses a wild mixture of variable names for return codes. Unify them by using the common name "ret". Signed-off-by: Stefan Wahren <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 13cc095 commit 56df512

File tree

1 file changed

+69
-72
lines changed
  • drivers/staging/vc04_services/interface/vchiq_arm

1 file changed

+69
-72
lines changed

drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c

Lines changed: 69 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -758,8 +758,8 @@ void free_bulk_waiter(struct vchiq_instance *instance)
758758

759759
int vchiq_shutdown(struct vchiq_instance *instance)
760760
{
761-
int status = 0;
762761
struct vchiq_state *state = instance->state;
762+
int ret = 0;
763763

764764
if (mutex_lock_killable(&state->mutex))
765765
return -EAGAIN;
@@ -769,12 +769,12 @@ int vchiq_shutdown(struct vchiq_instance *instance)
769769

770770
mutex_unlock(&state->mutex);
771771

772-
dev_dbg(state->dev, "core: (%p): returning %d\n", instance, status);
772+
dev_dbg(state->dev, "core: (%p): returning %d\n", instance, ret);
773773

774774
free_bulk_waiter(instance);
775775
kfree(instance);
776776

777-
return status;
777+
return ret;
778778
}
779779
EXPORT_SYMBOL(vchiq_shutdown);
780780

@@ -785,26 +785,26 @@ static int vchiq_is_connected(struct vchiq_instance *instance)
785785

786786
int vchiq_connect(struct vchiq_instance *instance)
787787
{
788-
int status;
789788
struct vchiq_state *state = instance->state;
789+
int ret;
790790

791791
if (mutex_lock_killable(&state->mutex)) {
792792
dev_dbg(state->dev,
793793
"core: call to mutex_lock failed\n");
794-
status = -EAGAIN;
794+
ret = -EAGAIN;
795795
goto failed;
796796
}
797-
status = vchiq_connect_internal(state, instance);
797+
ret = vchiq_connect_internal(state, instance);
798798

799-
if (!status)
799+
if (!ret)
800800
instance->connected = 1;
801801

802802
mutex_unlock(&state->mutex);
803803

804804
failed:
805-
dev_dbg(state->dev, "core: (%p): returning %d\n", instance, status);
805+
dev_dbg(state->dev, "core: (%p): returning %d\n", instance, ret);
806806

807-
return status;
807+
return ret;
808808
}
809809
EXPORT_SYMBOL(vchiq_connect);
810810

@@ -813,10 +813,9 @@ vchiq_add_service(struct vchiq_instance *instance,
813813
const struct vchiq_service_params_kernel *params,
814814
unsigned int *phandle)
815815
{
816-
int status;
817816
struct vchiq_state *state = instance->state;
818817
struct vchiq_service *service = NULL;
819-
int srvstate;
818+
int srvstate, ret;
820819

821820
*phandle = VCHIQ_SERVICE_HANDLE_INVALID;
822821

@@ -828,24 +827,24 @@ vchiq_add_service(struct vchiq_instance *instance,
828827

829828
if (service) {
830829
*phandle = service->handle;
831-
status = 0;
830+
ret = 0;
832831
} else {
833-
status = -EINVAL;
832+
ret = -EINVAL;
834833
}
835834

836-
dev_dbg(state->dev, "core: (%p): returning %d\n", instance, status);
835+
dev_dbg(state->dev, "core: (%p): returning %d\n", instance, ret);
837836

838-
return status;
837+
return ret;
839838
}
840839

841840
int
842841
vchiq_open_service(struct vchiq_instance *instance,
843842
const struct vchiq_service_params_kernel *params,
844843
unsigned int *phandle)
845844
{
846-
int status = -EINVAL;
847845
struct vchiq_state *state = instance->state;
848846
struct vchiq_service *service = NULL;
847+
int ret = -EINVAL;
849848

850849
*phandle = VCHIQ_SERVICE_HANDLE_INVALID;
851850

@@ -856,38 +855,38 @@ vchiq_open_service(struct vchiq_instance *instance,
856855

857856
if (service) {
858857
*phandle = service->handle;
859-
status = vchiq_open_service_internal(service, current->pid);
860-
if (status) {
858+
ret = vchiq_open_service_internal(service, current->pid);
859+
if (ret) {
861860
vchiq_remove_service(instance, service->handle);
862861
*phandle = VCHIQ_SERVICE_HANDLE_INVALID;
863862
}
864863
}
865864

866865
failed:
867-
dev_dbg(state->dev, "core: (%p): returning %d\n", instance, status);
866+
dev_dbg(state->dev, "core: (%p): returning %d\n", instance, ret);
868867

869-
return status;
868+
return ret;
870869
}
871870
EXPORT_SYMBOL(vchiq_open_service);
872871

873872
int
874873
vchiq_bulk_transmit(struct vchiq_instance *instance, unsigned int handle, const void *data,
875874
unsigned int size, void *userdata, enum vchiq_bulk_mode mode)
876875
{
877-
int status;
876+
int ret;
878877

879878
while (1) {
880879
switch (mode) {
881880
case VCHIQ_BULK_MODE_NOCALLBACK:
882881
case VCHIQ_BULK_MODE_CALLBACK:
883-
status = vchiq_bulk_transfer(instance, handle,
884-
(void *)data, NULL,
885-
size, userdata, mode,
886-
VCHIQ_BULK_TRANSMIT);
882+
ret = vchiq_bulk_transfer(instance, handle,
883+
(void *)data, NULL,
884+
size, userdata, mode,
885+
VCHIQ_BULK_TRANSMIT);
887886
break;
888887
case VCHIQ_BULK_MODE_BLOCKING:
889-
status = vchiq_blocking_bulk_transfer(instance, handle, (void *)data, size,
890-
VCHIQ_BULK_TRANSMIT);
888+
ret = vchiq_blocking_bulk_transfer(instance, handle, (void *)data, size,
889+
VCHIQ_BULK_TRANSMIT);
891890
break;
892891
default:
893892
return -EINVAL;
@@ -898,33 +897,33 @@ vchiq_bulk_transmit(struct vchiq_instance *instance, unsigned int handle, const
898897
* to implement a retry mechanism since this function is
899898
* supposed to block until queued
900899
*/
901-
if (status != -EAGAIN)
900+
if (ret != -EAGAIN)
902901
break;
903902

904903
msleep(1);
905904
}
906905

907-
return status;
906+
return ret;
908907
}
909908
EXPORT_SYMBOL(vchiq_bulk_transmit);
910909

911910
int vchiq_bulk_receive(struct vchiq_instance *instance, unsigned int handle,
912911
void *data, unsigned int size, void *userdata,
913912
enum vchiq_bulk_mode mode)
914913
{
915-
int status;
914+
int ret;
916915

917916
while (1) {
918917
switch (mode) {
919918
case VCHIQ_BULK_MODE_NOCALLBACK:
920919
case VCHIQ_BULK_MODE_CALLBACK:
921-
status = vchiq_bulk_transfer(instance, handle, data, NULL,
922-
size, userdata,
923-
mode, VCHIQ_BULK_RECEIVE);
920+
ret = vchiq_bulk_transfer(instance, handle, data, NULL,
921+
size, userdata,
922+
mode, VCHIQ_BULK_RECEIVE);
924923
break;
925924
case VCHIQ_BULK_MODE_BLOCKING:
926-
status = vchiq_blocking_bulk_transfer(instance, handle, (void *)data, size,
927-
VCHIQ_BULK_RECEIVE);
925+
ret = vchiq_blocking_bulk_transfer(instance, handle, (void *)data, size,
926+
VCHIQ_BULK_RECEIVE);
928927
break;
929928
default:
930929
return -EINVAL;
@@ -935,13 +934,13 @@ int vchiq_bulk_receive(struct vchiq_instance *instance, unsigned int handle,
935934
* to implement a retry mechanism since this function is
936935
* supposed to block until queued
937936
*/
938-
if (status != -EAGAIN)
937+
if (ret != -EAGAIN)
939938
break;
940939

941940
msleep(1);
942941
}
943942

944-
return status;
943+
return ret;
945944
}
946945
EXPORT_SYMBOL(vchiq_bulk_receive);
947946

@@ -950,8 +949,8 @@ vchiq_blocking_bulk_transfer(struct vchiq_instance *instance, unsigned int handl
950949
unsigned int size, enum vchiq_bulk_dir dir)
951950
{
952951
struct vchiq_service *service;
953-
int status;
954952
struct bulk_waiter_node *waiter = NULL, *iter;
953+
int ret;
955954

956955
service = find_service_by_handle(instance, handle);
957956
if (!service)
@@ -991,10 +990,10 @@ vchiq_blocking_bulk_transfer(struct vchiq_instance *instance, unsigned int handl
991990
return -ENOMEM;
992991
}
993992

994-
status = vchiq_bulk_transfer(instance, handle, data, NULL, size,
995-
&waiter->bulk_waiter,
996-
VCHIQ_BULK_MODE_BLOCKING, dir);
997-
if ((status != -EAGAIN) || fatal_signal_pending(current) || !waiter->bulk_waiter.bulk) {
993+
ret = vchiq_bulk_transfer(instance, handle, data, NULL, size,
994+
&waiter->bulk_waiter,
995+
VCHIQ_BULK_MODE_BLOCKING, dir);
996+
if ((ret != -EAGAIN) || fatal_signal_pending(current) || !waiter->bulk_waiter.bulk) {
998997
struct vchiq_bulk *bulk = waiter->bulk_waiter.bulk;
999998

1000999
if (bulk) {
@@ -1013,7 +1012,7 @@ vchiq_blocking_bulk_transfer(struct vchiq_instance *instance, unsigned int handl
10131012
waiter, current->pid);
10141013
}
10151014

1016-
return status;
1015+
return ret;
10171016
}
10181017

10191018
static int
@@ -1137,17 +1136,17 @@ service_callback(struct vchiq_instance *instance, enum vchiq_reason reason,
11371136
*/
11381137
if ((user_service->message_available_pos -
11391138
instance->completion_remove) < 0) {
1140-
int status;
1139+
int ret;
11411140

11421141
dev_dbg(instance->state->dev,
11431142
"arm: Inserting extra MESSAGE_AVAILABLE\n");
11441143
DEBUG_TRACE(SERVICE_CALLBACK_LINE);
1145-
status = add_completion(instance, reason, NULL, user_service,
1146-
bulk_userdata);
1147-
if (status) {
1144+
ret = add_completion(instance, reason, NULL, user_service,
1145+
bulk_userdata);
1146+
if (ret) {
11481147
DEBUG_TRACE(SERVICE_CALLBACK_LINE);
11491148
vchiq_service_put(service);
1150-
return status;
1149+
return ret;
11511150
}
11521151
}
11531152

@@ -1294,8 +1293,6 @@ vchiq_keepalive_thread_func(void *v)
12941293
{
12951294
struct vchiq_state *state = (struct vchiq_state *)v;
12961295
struct vchiq_arm_state *arm_state = vchiq_platform_get_arm_state(state);
1297-
1298-
int status;
12991296
struct vchiq_instance *instance;
13001297
unsigned int ka_handle;
13011298
int ret;
@@ -1313,16 +1310,16 @@ vchiq_keepalive_thread_func(void *v)
13131310
goto exit;
13141311
}
13151312

1316-
status = vchiq_connect(instance);
1317-
if (status) {
1318-
dev_err(state->dev, "suspend: %s: vchiq_connect failed %d\n", __func__, status);
1313+
ret = vchiq_connect(instance);
1314+
if (ret) {
1315+
dev_err(state->dev, "suspend: %s: vchiq_connect failed %d\n", __func__, ret);
13191316
goto shutdown;
13201317
}
13211318

1322-
status = vchiq_add_service(instance, &params, &ka_handle);
1323-
if (status) {
1319+
ret = vchiq_add_service(instance, &params, &ka_handle);
1320+
if (ret) {
13241321
dev_err(state->dev, "suspend: %s: vchiq_open_service failed %d\n",
1325-
__func__, status);
1322+
__func__, ret);
13261323
goto shutdown;
13271324
}
13281325

@@ -1348,17 +1345,17 @@ vchiq_keepalive_thread_func(void *v)
13481345
*/
13491346
while (uc--) {
13501347
atomic_inc(&arm_state->ka_use_ack_count);
1351-
status = vchiq_use_service(instance, ka_handle);
1352-
if (status) {
1348+
ret = vchiq_use_service(instance, ka_handle);
1349+
if (ret) {
13531350
dev_err(state->dev, "suspend: %s: vchiq_use_service error %d\n",
1354-
__func__, status);
1351+
__func__, ret);
13551352
}
13561353
}
13571354
while (rc--) {
1358-
status = vchiq_release_service(instance, ka_handle);
1359-
if (status) {
1355+
ret = vchiq_release_service(instance, ka_handle);
1356+
if (ret) {
13601357
dev_err(state->dev, "suspend: %s: vchiq_release_service error %d\n",
1361-
__func__, status);
1358+
__func__, ret);
13621359
}
13631360
}
13641361
}
@@ -1408,13 +1405,13 @@ vchiq_use_internal(struct vchiq_state *state, struct vchiq_service *service,
14081405
write_unlock_bh(&arm_state->susp_res_lock);
14091406

14101407
if (!ret) {
1411-
int status = 0;
1408+
int ret = 0;
14121409
long ack_cnt = atomic_xchg(&arm_state->ka_use_ack_count, 0);
14131410

1414-
while (ack_cnt && !status) {
1411+
while (ack_cnt && !ret) {
14151412
/* Send the use notify to videocore */
1416-
status = vchiq_send_remote_use_active(state);
1417-
if (!status)
1413+
ret = vchiq_send_remote_use_active(state);
1414+
if (!ret)
14181415
ack_cnt--;
14191416
else
14201417
atomic_add(ack_cnt, &arm_state->ka_use_ack_count);
@@ -1730,7 +1727,7 @@ static int vchiq_probe(struct platform_device *pdev)
17301727
struct device_node *fw_node;
17311728
const struct vchiq_platform_info *info;
17321729
struct vchiq_drv_mgmt *mgmt;
1733-
int err;
1730+
int ret;
17341731

17351732
info = of_device_get_match_data(&pdev->dev);
17361733
if (!info)
@@ -1755,8 +1752,8 @@ static int vchiq_probe(struct platform_device *pdev)
17551752
mgmt->info = info;
17561753
platform_set_drvdata(pdev, mgmt);
17571754

1758-
err = vchiq_platform_init(pdev, &mgmt->state);
1759-
if (err)
1755+
ret = vchiq_platform_init(pdev, &mgmt->state);
1756+
if (ret)
17601757
goto failed_platform_init;
17611758

17621759
vchiq_debugfs_init(&mgmt->state);
@@ -1768,8 +1765,8 @@ static int vchiq_probe(struct platform_device *pdev)
17681765
* Simply exit on error since the function handles cleanup in
17691766
* cases of failure.
17701767
*/
1771-
err = vchiq_register_chrdev(&pdev->dev);
1772-
if (err) {
1768+
ret = vchiq_register_chrdev(&pdev->dev);
1769+
if (ret) {
17731770
dev_err(&pdev->dev, "arm: Failed to initialize vchiq cdev\n");
17741771
goto error_exit;
17751772
}
@@ -1782,7 +1779,7 @@ static int vchiq_probe(struct platform_device *pdev)
17821779
failed_platform_init:
17831780
dev_err(&pdev->dev, "arm: Could not initialize vchiq platform\n");
17841781
error_exit:
1785-
return err;
1782+
return ret;
17861783
}
17871784

17881785
static void vchiq_remove(struct platform_device *pdev)

0 commit comments

Comments
 (0)