mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
staging: vchiq_core: avoid indention in poll_services_of_group
By converting the first and the third if statement into continue early the function poll_services_of_group() can avoid 2 indention levels. Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Link: https://lore.kernel.org/r/1621105859-30215-8-git-send-email-stefan.wahren@i2se.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
20ebcf0bf1
commit
2f440843a7
@@ -1325,59 +1325,54 @@ poll_services_of_group(struct vchiq_state *state, int group)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; flags; i++) {
|
for (i = 0; flags; i++) {
|
||||||
if (flags & BIT(i)) {
|
struct vchiq_service *service;
|
||||||
struct vchiq_service *service =
|
u32 service_flags;
|
||||||
find_service_by_port(state,
|
|
||||||
(group<<5) + i);
|
|
||||||
u32 service_flags;
|
|
||||||
|
|
||||||
flags &= ~BIT(i);
|
if ((flags & BIT(i)) == 0)
|
||||||
if (!service)
|
continue;
|
||||||
continue;
|
|
||||||
service_flags =
|
|
||||||
atomic_xchg(&service->poll_flags, 0);
|
|
||||||
if (service_flags &
|
|
||||||
BIT(VCHIQ_POLL_REMOVE)) {
|
|
||||||
vchiq_log_info(vchiq_core_log_level,
|
|
||||||
"%d: ps - remove %d<->%d",
|
|
||||||
state->id, service->localport,
|
|
||||||
service->remoteport);
|
|
||||||
|
|
||||||
/*
|
service = find_service_by_port(state, (group << 5) + i);
|
||||||
* Make it look like a client, because
|
flags &= ~BIT(i);
|
||||||
* it must be removed and not left in
|
|
||||||
* the LISTENING state.
|
|
||||||
*/
|
|
||||||
service->public_fourcc =
|
|
||||||
VCHIQ_FOURCC_INVALID;
|
|
||||||
|
|
||||||
if (vchiq_close_service_internal(
|
if (!service)
|
||||||
service, 0/*!close_recvd*/) !=
|
continue;
|
||||||
VCHIQ_SUCCESS)
|
|
||||||
request_poll(state, service,
|
service_flags = atomic_xchg(&service->poll_flags, 0);
|
||||||
VCHIQ_POLL_REMOVE);
|
if ((service_flags & BIT(VCHIQ_POLL_REMOVE)) == 0)
|
||||||
} else if (service_flags &
|
continue;
|
||||||
BIT(VCHIQ_POLL_TERMINATE)) {
|
|
||||||
vchiq_log_info(vchiq_core_log_level,
|
vchiq_log_info(vchiq_core_log_level, "%d: ps - remove %d<->%d",
|
||||||
"%d: ps - terminate %d<->%d",
|
state->id, service->localport,
|
||||||
state->id, service->localport,
|
service->remoteport);
|
||||||
service->remoteport);
|
|
||||||
if (vchiq_close_service_internal(
|
/*
|
||||||
service, 0/*!close_recvd*/) !=
|
* Make it look like a client, because
|
||||||
VCHIQ_SUCCESS)
|
* it must be removed and not left in
|
||||||
request_poll(state, service,
|
* the LISTENING state.
|
||||||
VCHIQ_POLL_TERMINATE);
|
*/
|
||||||
}
|
service->public_fourcc = VCHIQ_FOURCC_INVALID;
|
||||||
if (service_flags & BIT(VCHIQ_POLL_TXNOTIFY))
|
|
||||||
notify_bulks(service,
|
if (vchiq_close_service_internal(service, 0/*!close_recvd*/) !=
|
||||||
&service->bulk_tx,
|
VCHIQ_SUCCESS) {
|
||||||
1/*retry_poll*/);
|
request_poll(state, service, VCHIQ_POLL_REMOVE);
|
||||||
if (service_flags & BIT(VCHIQ_POLL_RXNOTIFY))
|
} else if (service_flags & BIT(VCHIQ_POLL_TERMINATE)) {
|
||||||
notify_bulks(service,
|
vchiq_log_info(vchiq_core_log_level,
|
||||||
&service->bulk_rx,
|
"%d: ps - terminate %d<->%d",
|
||||||
1/*retry_poll*/);
|
state->id, service->localport,
|
||||||
unlock_service(service);
|
service->remoteport);
|
||||||
|
if (vchiq_close_service_internal(
|
||||||
|
service, 0/*!close_recvd*/) !=
|
||||||
|
VCHIQ_SUCCESS)
|
||||||
|
request_poll(state, service,
|
||||||
|
VCHIQ_POLL_TERMINATE);
|
||||||
}
|
}
|
||||||
|
if (service_flags & BIT(VCHIQ_POLL_TXNOTIFY))
|
||||||
|
notify_bulks(service, &service->bulk_tx,
|
||||||
|
1/*retry_poll*/);
|
||||||
|
if (service_flags & BIT(VCHIQ_POLL_RXNOTIFY))
|
||||||
|
notify_bulks(service, &service->bulk_rx,
|
||||||
|
1/*retry_poll*/);
|
||||||
|
unlock_service(service);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user