diff options
| author | Stefan Wahren <[email protected]> | 2021-04-11 20:11:35 +0200 |
|---|---|---|
| committer | Greg Kroah-Hartman <[email protected]> | 2021-04-12 11:41:22 +0200 |
| commit | 63276d45bac52bd0ecfc35f613b81522fadf26c1 (patch) | |
| tree | 1924b0439a83e8c524c5e16a75733a7c70f45116 | |
| parent | b3582ed4269d1654680ee9daafc1976ca1d9c119 (diff) | |
staging: vchiq_core: introduce service skip
In case there is no service pointer provided, we can skip these polling.
Use a goto to reduce the indentation, which is necessary for the following
patches. Btw fix the brace alignment of the loops.
Signed-off-by: Stefan Wahren <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
| -rw-r--r-- | drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c index e67ba54eafdd..be0ea1e29569 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -538,21 +538,22 @@ request_poll(struct vchiq_state *state, struct vchiq_service *service, { u32 value; - if (service) { - do { - value = atomic_read(&service->poll_flags); - } while (atomic_cmpxchg(&service->poll_flags, value, - value | BIT(poll_type)) != value); + if (!service) + goto skip_service; - do { - value = atomic_read(&state->poll_services[ - service->localport>>5]); - } while (atomic_cmpxchg( - &state->poll_services[service->localport>>5], - value, value | BIT(service->localport & 0x1f)) - != value); - } + do { + value = atomic_read(&service->poll_flags); + } while (atomic_cmpxchg(&service->poll_flags, value, + value | BIT(poll_type)) != value); + + do { + value = atomic_read(&state->poll_services[ + service->localport>>5]); + } while (atomic_cmpxchg( + &state->poll_services[service->localport>>5], value, + value | BIT(service->localport & 0x1f)) != value); +skip_service: state->poll_needed = 1; wmb(); |