summaryrefslogtreecommitdiffstats
path: root/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
AgeCommit message (Collapse)AuthorFilesLines
2022-06-27staging: vchiq_arm: Add missing memory barrier commentsPhil Elwell1-0/+9
One of points on the TODO list was to comment the memory barriers. This patch addresses the missing ones in order to help reviewers. Link: https://github.com/raspberrypi/linux/pull/5066 Signed-off-by: Phil Elwell <phil@raspberrypi.com> Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Link: https://lore.kernel.org/r/20220624163902.6913-1-stefan.wahren@i2se.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-06-06staging: vchiq_arm: remove global 'vchiq_states' arrayAdrien Thierry1-8/+0
Remove global 'vchiq_states' array, which is not used anymore. This is part of an effort to address TODO item "Get rid of all non essential global structures and create a proper per device structure" Tested-by: Stefan Wahren <stefan.wahren@i2se.com> Signed-off-by: Adrien Thierry <athierry@redhat.com> Link: https://lore.kernel.org/r/20220518191126.60396-10-athierry@redhat.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-06-06staging: vchiq_arm: use state from vchiq instanceAdrien Thierry1-0/+7
In 'handle_to_service', access the vchiq state from the vchiq instance instead of the global 'vchiq_states' array. This will allow getting rid of the global 'vchiq_states' array. Tested-by: Stefan Wahren <stefan.wahren@i2se.com> Signed-off-by: Adrien Thierry <athierry@redhat.com> Link: https://lore.kernel.org/r/20220518191126.60396-9-athierry@redhat.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-06-06staging: vchiq_arm: pass vchiq instance to 'handle_to_service'Adrien Thierry1-5/+5
In order to remove the 'vchiq_states' global array, we need to pass the vchiq_instance reference to the 'handle_to_service' function. This will allow accessing the vchiq state through the vchiq instance instead of through the global array. Tested-by: Stefan Wahren <stefan.wahren@i2se.com> Signed-off-by: Adrien Thierry <athierry@redhat.com> Link: https://lore.kernel.org/r/20220518191126.60396-8-athierry@redhat.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-06-06staging: vchiq_arm: pass vchiq instance to 'vchiq_get_service_userdata'Adrien Thierry1-1/+1
In order to remove the 'vchiq_states' global array, we need to pass the vchiq_instance reference to the 'handle_to_service' function, as well as to all functions that call 'handle_to_service'. This will allow accessing the vchiq state through the vchiq instance instead of through the global array. 'handle_to_service' is called by 'vchiq_get_service_userdata'. Therefore, pass the vchiq instance reference to it. Tested-by: Stefan Wahren <stefan.wahren@i2se.com> Signed-off-by: Adrien Thierry <athierry@redhat.com> Link: https://lore.kernel.org/r/20220518191126.60396-7-athierry@redhat.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-06-06staging: vchiq_arm: pass vchiq instance to 'vchiq_get_client_id'Adrien Thierry1-1/+1
In order to remove the 'vchiq_states' global array, we need to pass the vchiq_instance reference to the 'handle_to_service' function, as well as to all functions that call 'handle_to_service'. This will allow accessing the vchiq state through the vchiq instance instead of through the global array. 'handle_to_service' is called by 'vchiq_get_client_id'. Therefore, pass the vchiq instance reference to it. Tested-by: Stefan Wahren <stefan.wahren@i2se.com> Signed-off-by: Adrien Thierry <athierry@redhat.com> Link: https://lore.kernel.org/r/20220518191126.60396-6-athierry@redhat.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-06-06staging: vchiq_arm: pass vchiq instance to 'find_service_by_handle'Adrien Thierry1-22/+25
In order to remove the 'vchiq_states' global array, we need to pass the vchiq_instance reference to the 'handle_to_service' function, as well as to all functions that call 'handle_to_service'. This will allow accessing the vchiq state through the vchiq instance instead of through the global array. 'handle_to_service' is called by 'find_service_by_handle'. Therefore, pass the vchiq instance reference to 'find_service_by_handle' and to its callers. Tested-by: Stefan Wahren <stefan.wahren@i2se.com> Signed-off-by: Adrien Thierry <athierry@redhat.com> Link: https://lore.kernel.org/r/20220518191126.60396-5-athierry@redhat.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-06-06staging: vchiq_arm: pass vchiq instance to service callbacksAdrien Thierry1-1/+2
In order to remove the 'vchiq_states' global array, we need to pass the vchiq_instance reference to the 'handle_to_service' function, as well as to all functions that call 'handle_to_service'. This will allow accessing the vchiq state through the vchiq instance instead of through the global array. 'handle_to_service' is called by 'service_callback'. Therefore, pass the vchiq instance reference to 'service_callback'. This also requires adding the vchiq instance reference to the service callbacks prototype, and update all other callbacks accordingly. Tested-by: Stefan Wahren <stefan.wahren@i2se.com> Signed-off-by: Adrien Thierry <athierry@redhat.com> Link: https://lore.kernel.org/r/20220518191126.60396-4-athierry@redhat.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-06-06staging: vchiq_arm: get rid of global device structureAdrien Thierry1-7/+7
Get rid of the global g_dev structure. This is part of an effort to address TODO item "Get rid of all non essential global structures and create a proper per device structure" I chose to pass the vchiq_instance around instead of the device reference because in order to get rid of the 'vchiq_states' global array in the future, we will need another way to access the vchiq_state in the 'handle_to_service' function. Therefore, we will need to pass the vchiq_instance to it (or the vchiq_state), and also pass it to functions higher up in the caller chain, such as 'vchiq_bulk_transmit' and friends which are used in the bcm2835-audio consumer. Tested-by: Stefan Wahren <stefan.wahren@i2se.com> Signed-off-by: Adrien Thierry <athierry@redhat.com> Link: https://lore.kernel.org/r/20220518191126.60396-3-athierry@redhat.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-06-06staging: vchiq_arm: add reference to vchiq device in vchiq_stateAdrien Thierry1-1/+3
Add a reference to the vchiq device in the vchiq_state structure. This allows the device structure to be passed around, which will be useful in order to get rid of the global g_dev structure. This change will also make it possible to use standard kernel logging macros instead of the custom ones. Tested-by: Stefan Wahren <stefan.wahren@i2se.com> Signed-off-by: Adrien Thierry <athierry@redhat.com> Link: https://lore.kernel.org/r/20220518191126.60396-2-athierry@redhat.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-01-25staging: vchiq_core: handle NULL result of find_service_by_handleStefan Wahren1-0/+6
In case of an invalid handle the function find_servive_by_handle returns NULL. So take care of this and avoid a NULL pointer dereference. Reviewed-by: Nicolas Saenz Julienne <nsaenz@kernel.org> Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Link: https://lore.kernel.org/r/1642968143-19281-18-git-send-email-stefan.wahren@i2se.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-01-25staging: vchiq_core: use min_t macroStefan Wahren1-6/+3
Don't try to open code min_t(). Reviewed-by: Nicolas Saenz Julienne <nsaenz@kernel.org> Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Link: https://lore.kernel.org/r/1642968143-19281-15-git-send-email-stefan.wahren@i2se.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-01-25staging: vchiq_core: avoid ternary operator for set_service_stateStefan Wahren1-4/+6
There is already a check for service->sync, so use this instead of a separate ternary operator to update the service state. Reviewed-by: Nicolas Saenz Julienne <nsaenz@kernel.org> Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Link: https://lore.kernel.org/r/1642968143-19281-14-git-send-email-stefan.wahren@i2se.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-01-25staging: vchiq_core: fix alignmentStefan Wahren1-3/+2
This fixes some alignment found by checkpatch.pl. Reviewed-by: Nicolas Saenz Julienne <nsaenz@kernel.org> Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Link: https://lore.kernel.org/r/1642968143-19281-13-git-send-email-stefan.wahren@i2se.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-01-25staging: vchiq_core: reduce multi-line statementsStefan Wahren1-7/+4
In order to improvement readability try to reduce the multi-line statements. Reviewed-by: Nicolas Saenz Julienne <nsaenz@kernel.org> Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Link: https://lore.kernel.org/r/1642968143-19281-12-git-send-email-stefan.wahren@i2se.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-01-25staging: vchiq_core: drop prefix of vchiq_set_service_stateStefan Wahren1-16/+15
The name of this static function is unnecessary longish. So drop the prefix. This gives us the chance to avoid some multi-line statements or fix some indentations later. Reviewed-by: Nicolas Saenz Julienne <nsaenz@kernel.org> Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Link: https://lore.kernel.org/r/1642968143-19281-11-git-send-email-stefan.wahren@i2se.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-01-25staging: vchiq_core: align return statements in msg_type_strStefan Wahren1-15/+15
The return statements aren't properly aligned. So fix this by using tabs. Reviewed-by: Nicolas Saenz Julienne <nsaenz@kernel.org> Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Link: https://lore.kernel.org/r/1642968143-19281-10-git-send-email-stefan.wahren@i2se.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-01-25staging: vchiq_core: simplify vchiq_add_service_internalStefan Wahren1-22/+1
Better use kzalloc to properly init vchiq_service with zero. As a result this saves us all the zero assignments. Reviewed-by: Nicolas Saenz Julienne <nsaenz@kernel.org> Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Link: https://lore.kernel.org/r/1642968143-19281-9-git-send-email-stefan.wahren@i2se.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-01-25staging: vchiq_core: fix type of parameter localportStefan Wahren1-3/+3
The whole vchiq driver uses unsigned int for "localport" except of find_service_by_port(). So fix this and get the rid of this suspicous cast. Reviewed-by: Nicolas Saenz Julienne <nsaenz@kernel.org> Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Link: https://lore.kernel.org/r/1642968143-19281-8-git-send-email-stefan.wahren@i2se.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-01-25staging: vchiq_core: fix indentation in vchiq_log_dump_memStefan Wahren1-4/+4
This align the indentation in the var declaration of vchiq_log_dump_mem to the other code. Reviewed-by: Nicolas Saenz Julienne <nsaenz@kernel.org> Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Link: https://lore.kernel.org/r/1642968143-19281-2-git-send-email-stefan.wahren@i2se.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-10-30staging: vchiq_core: get rid of typedefGaston Gonzalez1-3/+3
The typedef BITSET_T is acting as a synonym of u32. However, using the type u32 directly makes the code more readable. Furthermore, typedef should only be used in some cases, [1]. Hence, get rid of it. [1] Documentation/process/coding-style.rst Signed-off-by: Gaston Gonzalez <gascoar@gmail.com> Link: https://lore.kernel.org/r/20211029200012.45986-1-gascoar@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-10-25staging: vchiq_core: fix quoted strings split across linesGaston Gonzalez1-7/+3
Quoted strings should not be split across lines. As put it in [1]: "never break user-visible strings such as printk messages because that breaks the ability to grep for them." While at it, fix the alignment of the arguments in the sentence. Note: this introduce a checkpatch CHECK: line length of 123 exceeds 100 columns, as the line now is: vchiq_loud_error("%d: service %d (%c%c%c%c) version mismatch - local (%d, min %d) vs. remote (%d, min %d)", But now the string is grep-able and the whole function call more clear. Reported by checkpatch.pl [1] Documentation/process/coding-style.rst Signed-off-by: Gaston Gonzalez <gascoar@gmail.com> Link: https://lore.kernel.org/r/20211024213839.370830-1-gascoar@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-10-25staging: vchiq_core: cleanup lines that end with '(' or '['Gaston Gonzalez1-20/+10
Fix lines that end with '(' or '['. Reported by checkpatch.pl Signed-off-by: Gaston Gonzalez <gascoar@gmail.com> Link: https://lore.kernel.org/r/20211024212524.370078-8-gascoar@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-10-25staging: vchiq: drop trailing semicolon in macro definitionGaston Gonzalez1-3/+3
As reported by checkpatch.pl, macro definitions should not use a trailing semicolon. Signed-off-by: Gaston Gonzalez <gascoar@gmail.com> Link: https://lore.kernel.org/r/20211024212524.370078-6-gascoar@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-10-25staging: vchiq_core: cleanup code alignment issuesGaston Gonzalez1-433/+282
Fix code alignment issues reported by checkpatch.pl Signed-off-by: Gaston Gonzalez <gascoar@gmail.com> Link: https://lore.kernel.org/r/20211024212524.370078-3-gascoar@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-10-25staging: vchiq_core: cleanup blank linesGaston Gonzalez1-2/+0
Remove unnecessary blank lines. Reported by checkpatch.pl Signed-off-by: Gaston Gonzalez <gascoar@gmail.com> Link: https://lore.kernel.org/r/20211024212524.370078-2-gascoar@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-09-13staging: vchiq: Replace function typedefs with equivalent declarationOjaswin Mujoo1-1/+1
Replace function typedefs with the equivalent declarations to better align with the linux kenel coding style The following typedefs were changed: * VCHIQ_CONNECTED_CALLBACK_T * vchiq_userdata_term Signed-off-by: Ojaswin Mujoo <ojaswin98@gmail.com> Link: https://lore.kernel.org/r/a8e4e0457b5fcc88c7f297f9d669dfb7e7d91ed5.1631366317.git.ojaswin98@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-07-29staging/vc04_services: Remove all strcpy() uses in favor of strscpy()Len Baker1-1/+1
strcpy() performs no bounds checking on the destination buffer. This could result in linear overflows beyond the end of the buffer, leading to all kinds of misbehaviors. The safe replacement is strscpy(). Signed-off-by: Len Baker <len.baker@gmx.com> Link: https://lore.kernel.org/r/20210718131217.3806-1-len.baker@gmx.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-06-04staging: vchiq_core: introduce handle_pollStefan Wahren1-40/+52
The function slot_handler_func() has very deep indentations. Moving the poll handling into separate function could improve the readability. Use the return value to keep the poll_needed handling at the same place. Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Link: https://lore.kernel.org/r/1622735405-9980-17-git-send-email-stefan.wahren@i2se.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-06-04staging: vchiq_core: store message id in local variableStefan Wahren1-16/+12
Some queue_message() calls are still rather complex to read. So store the message ids in a local variable in those cases. Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Link: https://lore.kernel.org/r/1622735405-9980-15-git-send-email-stefan.wahren@i2se.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-06-04staging: vchiq_core: reduce indentation in parse_openStefan Wahren1-76/+70
The function parse_open() already has bail out sections like fail_open. So use a goto for the other error cases like payload size is too small and listening service cannot be found. This avoids two indentation levels. Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Link: https://lore.kernel.org/r/1622735405-9980-14-git-send-email-stefan.wahren@i2se.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-06-04staging: vchiq_core: introduce process_free_data_messageStefan Wahren1-60/+64
This moves the special handling for data messages from process_free_queue() into a new function. After this process_free_queue() has less extreme indentation and should be easier to read. Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Link: https://lore.kernel.org/r/1622735405-9980-13-git-send-email-stefan.wahren@i2se.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-06-04staging: vchiq_arm: tidy up service function namingStefan Wahren1-23/+23
During a recent review Dan Carpenter reported that the function naming of (un)lock_service is misleading. They are like wrapper around kref_get / kref_put and don't have anything to do with locking. So use a name which represent more the actual behavior. Btw add the vchiq prefix to avoid possible name conflicts. Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Link: https://lore.kernel.org/r/1622735405-9980-12-git-send-email-stefan.wahren@i2se.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-06-04staging: vchiq_core: simplify WARN_ON conditionsStefan Wahren1-6/+6
During a recent review Dan Carpenter noticed a double negation in a WARN_ON. But a quick search revealed more unnecessary complex WARN_ON conditions. This change should simplify them. Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Link: https://lore.kernel.org/r/1622735405-9980-11-git-send-email-stefan.wahren@i2se.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-06-04staging: vchiq_core: introduce message specific make macrosStefan Wahren1-35/+29
VCHIQ_MAKE_MSG isn't optimal because a lot of message types doesn't need a parameter. So better define a macro for every message type which is used. Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Link: https://lore.kernel.org/r/1622735405-9980-10-git-send-email-stefan.wahren@i2se.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-06-04staging: vchiq_core: use define for message type shiftStefan Wahren1-2/+4
Make it clear and use a define for shifting the message type. Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Link: https://lore.kernel.org/r/1622735405-9980-9-git-send-email-stefan.wahren@i2se.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-06-04staging: vchiq_core: avoid precedence issuesStefan Wahren1-7/+7
Add () around macro argument to avoid precedence issues Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Link: https://lore.kernel.org/r/1622735405-9980-8-git-send-email-stefan.wahren@i2se.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-06-04staging: vchiq_core: put spaces around operatorsStefan Wahren1-6/+6
This fixes the checkpatch issues regarding missing spaces around operators. Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Link: https://lore.kernel.org/r/1622735405-9980-7-git-send-email-stefan.wahren@i2se.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-06-04staging: vchiq_core: get the rid of vchiq_static_assertStefan Wahren1-5/+5
Use static_assert from the kernel instead of opencode it. Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Link: https://lore.kernel.org/r/1622735405-9980-6-git-send-email-stefan.wahren@i2se.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-06-04staging: vchiq_core: get the rid of IS_POW2Stefan Wahren1-4/+13
The macro IS_POW2 is only used to ensure some size are powers of 2. Better use BUILD_BUG_ON_NOT_POWER_OF_2 for this. Since this must be done in a function, merge all these checks in a new function. Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Link: https://lore.kernel.org/r/1622735405-9980-5-git-send-email-stefan.wahren@i2se.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-06-04staging: vchiq_core: move internals to C sourceStefan Wahren1-0/+61
There is no need to export those definitions, so keep them in the source file. Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Link: https://lore.kernel.org/r/1622735405-9980-4-git-send-email-stefan.wahren@i2se.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-06-04staging: vchiq_core: fix logic in poll_services_of_groupStefan Wahren1-15/+13
Commit "staging: vchiq_core: avoid indention in poll_services_of_group" tries to reduce the indention, but the parts regarding the third if statement breaks the logic. So restore them and prevent vchiq_test from hanging during the ping test. Fixes: 2f440843a7d4 ("staging: vchiq_core: avoid indention in poll_services_of_group") Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Link: https://lore.kernel.org/r/1622735405-9980-2-git-send-email-stefan.wahren@i2se.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-05-19staging: vchiq_core: introduce defines for retry_pollStefan Wahren1-7/+8
Use descriptive defines instead of a number with a comment. Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Link: https://lore.kernel.org/r/1621106030-30363-1-git-send-email-stefan.wahren@i2se.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-05-19staging: vchiq_core: introduce defines for close_recvdStefan Wahren1-7/+8
Use descriptive defines instead of a number with a comment. Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Link: https://lore.kernel.org/r/1621105859-30215-20-git-send-email-stefan.wahren@i2se.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-05-19staging: vchiq_core: introduce parse_messageStefan Wahren1-292/+313
The function parse_rx_slots is very longer. So move at least the message parsing into a separate function to improve readability. In good case the function returns the message payload length which is necessary to move to the next message. Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Link: https://lore.kernel.org/r/1621105859-30215-19-git-send-email-stefan.wahren@i2se.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-05-19staging: vchiq_arm: Avoid unnecessary line breaksStefan Wahren1-12/+6
There are a few statements which are unnecessary broken into multiple lines. Let's join them into a single line to improve readability. Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Link: https://lore.kernel.org/r/1621105859-30215-18-git-send-email-stefan.wahren@i2se.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-05-19staging: vchiq_arm: make vchiq_shutdown_internal return voidStefan Wahren1-3/+1
The function vchiq_shutdown_internal always returns VCHIQ_SUCCESS. So change the return type to void and simplify the logic in vchiq_shutdown. Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Link: https://lore.kernel.org/r/1621105859-30215-17-git-send-email-stefan.wahren@i2se.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-05-19staging: vchiq_core: fix comment in vchiq_shutdown_internalStefan Wahren1-1/+1
The comment seems to be copied from vchiq_connect_internal(). So change it to match the actual behavior. Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Link: https://lore.kernel.org/r/1621105859-30215-16-git-send-email-stefan.wahren@i2se.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-05-19staging: vchiq_core: reduce indention in release_service_messagesStefan Wahren1-35/+36
It's possible to convert the if statement into a continue early and save an indention level. Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Link: https://lore.kernel.org/r/1621105859-30215-15-git-send-email-stefan.wahren@i2se.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-05-19staging: vchiq_core: avoid indention in poll_services_of_groupStefan Wahren1-51/+46
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>