1
0
Fork 0
Commit Graph

109 Commits (f27a965b042f8c25acef470dc19723487d2263b5)

Author SHA1 Message Date
Phil Elwell f27a965b04 staging: vchiq_arm: Add a matching unregister call
[ Upstream commit 5d9272e28a ]

All the registered children of vchiq have a corresponding call to
platform_device_unregister except bcm2835_audio. Fix that.

Fixes: 25c7597af2 ("staging: vchiq_arm: Register a platform device for audio")

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Link: https://lore.kernel.org/r/20200629150945.10720-9-nsaenzjulienne@suse.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-08-19 08:16:09 +02:00
Marcelo Diop-Gonzalez 2aaf1e194e staging: vchiq: call unregister_chrdev_region() when driver registration fails
commit d2cdb20507 upstream.

This undoes the previous call to alloc_chrdev_region() on failure,
and is probably what was meant originally given the label name.

Signed-off-by: Marcelo Diop-Gonzalez <marcgonzalez@google.com>
Cc: stable <stable@vger.kernel.org>
Fixes: 187ac53e59 ("staging: vchiq_arm: rework probe and init functions")
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Link: https://lore.kernel.org/r/20191203153921.70540-1-marcgonzalez@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-17 19:55:34 +01:00
YueHaibing db0e6a573e staging: vc04_services: fix unused-but-set-variable warning
Fix gcc used-but-set-variable warning:

drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c: In function vchiq_release_internal:
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:2827:16: warning:
 variable local_entity_uc set but not used [-Wunused-but-set-variable]
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:2827:6: warning:
 variable local_uc set but not used [-Wunused-but-set-variable]

Remove the unused variables 'local_entity_uc' and 'local_uc'

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Acked-by: Stefan Wahren <wahrenst@gmx.net>
Link: https://lore.kernel.org/r/20190727013524.33168-1-yuehaibing@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-07-30 09:52:04 +02:00
Nishka Dasgupta 4a808fa3aa staging: vc04_services: Remove function block_resume()
Remove function block_resume as it was only called by
vchiq_arm_force_suspend, which was removed in a previous patch.
Issue found with Coccinelle.

Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-26 09:58:48 +08:00
Nishka Dasgupta efe06b2317 staging: vc04_services: Remove function output_timeout_error()
Remove function output_timeout_error as it was only called by
vchiq_arm_force_suspend, which was deleted in a previous patch.
Issue found with Coccinelle.

Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-26 09:58:48 +08:00
Nishka Dasgupta 6795dbb860 staging: vc04_services: Remove vchiq_use_service_no_resume()
Remove unused function vchiq_use_service_no_resume.
Issue found with Coccinelle.

Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-26 09:58:48 +08:00
Nishka Dasgupta 248a58a3d7 staging: vc04_services: Remove vchiq_arm_force_suspend()
Remove unused function vchiq_arm_force_suspend.
Issue found with Coccinelle.

Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-26 09:58:47 +08:00
Nishka Dasgupta 49bc145285 staging: vc04_services: Remove function vchiq_arm_allow_resume()
Remove unused function vchiq_arm_allow_resume.
Issue found with Coccinelle.

Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-26 09:58:47 +08:00
Nicolas Saenz Julienne 023dbe17dd staging: vchiq: stop explicitly comparing with zero to catch errors
The vchiq code tends to follow a coding pattern that's not accepted as
per the Linux kernel coding style

We have this:
	if (expression != 0)

We want this:
	if (expression)

We make an exception if the expression refers to a size, in which case
it's accepted for the sake of clarity.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Acked-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-20 07:40:42 +02:00
Nicolas Saenz Julienne 086efbabdc staging: vchiq: revert "switch to wait_for_completion_killable"
The killable version of wait_for_completion() is meant to be used on
situations where it should not fail at all costs, but still have the
convenience of being able to kill it if really necessary. VCHIQ doesn't
fit this criteria, as it's mainly used as an interface to V4L2 and ALSA
devices.

Fixes: a772f11670 ("staging: vchiq: switch to wait_for_completion_killable")
Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Acked-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-05-20 07:40:42 +02:00
Fuqian Huang e9f1040f47 staging: vchiq_arm: Fix misuse of %x
Pointers should be printed with %p or %px rather than
cast to unsigned long type and printed with %lx.
Change %lx to %pK to print the pointers.

Signed-off-by: Fuqian Huang <huangfq.daxian@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-25 12:04:48 +02:00
Greg Kroah-Hartman 3baad68a97 staging: vc04_services: remove remaining redundant license text
Now that the SPDX tag is in all vc04_services files, that identifies the
license in a specific and legally-defined manner.  So the extra GPL and
BSD text wording can be removed as it is no longer needed at all.

This is done on a quest to remove the 700+ different ways that files in
the kernel describe the license text.

No copyright headers or other non-license-description text was removed.

Cc: Eric Anholt <eric@anholt.net>
Cc: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
Cc: Aymen Qader <qader.aymen@gmail.com>
Cc: "Tobias Büttner" <tobias.buettner@fau.de>
Cc: Dominic Braun <inf.braun@fau.de>
Cc: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Cc: Alejandro Ismael Silva <silva.alejandro.ismael@gmail.com>
Cc: Phil Elwell <phil@raspberrypi.org>
Cc: Luis Chamberlain <mcgrof@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Acked-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-03 11:10:16 +02:00
Greg Kroah-Hartman 371ebdbe1b staging: vc04_services: add proper SPDX identifier for dual licensed files
There are a number of vc04_services files that are dual licensed under
the GPL2 and BSD-3 licenses.  They currently do not have a SPDX
identifier on them, so fix that up and add the proper identifier so that
tools can pick it up easily.

Cc: Eric Anholt <eric@anholt.net>
Cc: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
Cc: Aymen Qader <qader.aymen@gmail.com>
Cc: "Tobias Büttner" <tobias.buettner@fau.de>
Cc: Dominic Braun <inf.braun@fau.de>
Cc: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Cc: Alejandro Ismael Silva <silva.alejandro.ismael@gmail.com>
Cc: Phil Elwell <phil@raspberrypi.org>
Cc: Luis Chamberlain <mcgrof@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Acked-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-03 11:10:16 +02:00
Mario Balan 9fc6eeb7cb staging: vchiq_arm: remove space after open '('
Fix checkpatch error "ERROR: space prohibited after that open
parenthesis '('" in vchiq_arm.c:563.

Signed-off-by: Mario Balan <mario.balan@gmail.com>
Acked-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-03 11:08:01 +02:00
Greg Kroah-Hartman b397f82585 Merge 5.1-rc3 into staging-next
We want those fixes and this resolves an erofs merge conflict.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-01 07:49:24 +02:00
Jasminko Dedic ffb99752e9 staging: vc04_services: add missing __user annotations
This patch fixes the following sparse warnings by adding missing __user
annotations. It also cleans up two related unnecessary casts by reuseing
casts already made a few lines up. Remaining sparse warnings are of a
different type.

vchiq_arm.c:1606:14: warning: incorrect type in assignment (different address spaces)
vchiq_arm.c:1606:14:    expected struct vchiq_queue_message *args
vchiq_arm.c:1606:14:    got void [noderef] <asn:1> *

vchiq_arm.c:1612:13: warning: incorrect type in argument 1 (different address spaces)
vchiq_arm.c:1612:13:    expected void const volatile [noderef] <asn:1> *
vchiq_arm.c:1612:13:    got unsigned int *

vchiq_arm.c:1613:13: warning: incorrect type in argument 1 (different address spaces)
vchiq_arm.c:1613:13:    expected void const volatile [noderef] <asn:1> *
vchiq_arm.c:1613:13:    got unsigned int *

vchiq_arm.c:1614:13: warning: incorrect type in argument 1 (different address spaces)
vchiq_arm.c:1614:13:    expected void const volatile [noderef] <asn:1> *
vchiq_arm.c:1614:13:    got struct vchiq_element const [noderef] <asn:1> **

vchiq_arm.c:1638:21: warning: incorrect type in argument 1 (different address spaces)
vchiq_arm.c:1638:21:    expected void const volatile [noderef] <asn:1> *
vchiq_arm.c:1638:21:    got struct vchiq_element const [noderef] <asn:1> **

Signed-off-by: Jasminko Dedic <betelge@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-03-27 23:37:30 +09:00
Dan Carpenter 9b9c87cf51 staging: vc04_services: Fix an error code in vchiq_probe()
We need to set "err" on this error path.

Fixes: 187ac53e59 ("staging: vchiq_arm: rework probe and init functions")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-03-26 05:54:18 +09:00
Dominic Braun 2d0a029113 staging: vc04_services: Remove VCHIQ_STATE_T typedef
Typedefing structs is not encouraged in the kernel.

Signed-off-by: Dominic Braun <inf.braun@fau.de>
Signed-off-by: Tobias Büttner <tobias.buettner@fau.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-17 14:47:45 +01:00
Dominic Braun 4f0922c87d staging: vc04_services: Remove VCHIQ_SET_SERVICE_OPTION_T typedef
Typedefing structs is not encouraged in the kernel.

Signed-off-by: Dominic Braun <inf.braun@fau.de>
Signed-off-by: Tobias Büttner <tobias.buettner@fau.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-17 14:47:44 +01:00
Dominic Braun 7926c328d9 staging: vc04_services: Remove VCHIQ_SERVICE_T typedef
Typedefing structs is not encouraged in the kernel.

Signed-off-by: Dominic Braun <inf.braun@fau.de>
Signed-off-by: Tobias Büttner <tobias.buettner@fau.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-17 14:47:44 +01:00
Dominic Braun 0b53ca3127 staging: vc04_services: Remove VCHIQ_SERVICE_PARAMS_T typedef
Typedefing structs is not encouraged in the kernel.

Signed-off-by: Dominic Braun <inf.braun@fau.de>
Signed-off-by: Tobias Büttner <tobias.buettner@fau.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-17 14:47:44 +01:00
Dominic Braun 87c091aadf staging: vc04_services: Remove VCHIQ_QUEUE_MESSAGE_T typedef
Typedefing structs is not encouraged in the kernel.

Signed-off-by: Dominic Braun <inf.braun@fau.de>
Signed-off-by: Tobias Büttner <tobias.buettner@fau.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-17 14:46:22 +01:00
Dominic Braun 4040a7ee53 staging: vc04_services: Remove VCHIQ_QUEUE_BULK_TRANSFER_T typedef
Typedefing structs is not encouraged in the kernel.

Signed-off-by: Dominic Braun <inf.braun@fau.de>
Signed-off-by: Tobias Büttner <tobias.buettner@fau.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-17 14:46:22 +01:00
Dominic Braun e896852528 staging: vc04_services: Remove VCHIQ_HEADER_T typedef
Typedefing structs is not encouraged in the kernel.

Signed-off-by: Dominic Braun <inf.braun@fau.de>
Signed-off-by: Tobias Büttner <tobias.buettner@fau.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-17 14:46:22 +01:00
Dominic Braun 3515279e6e staging: vc04_services: Remove VCHIQ_GET_CONFIG_T typedef
Typedefing structs is not encouraged in the kernel.

Signed-off-by: Dominic Braun <inf.braun@fau.de>
Signed-off-by: Tobias Büttner <tobias.buettner@fau.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-17 14:45:12 +01:00
Dominic Braun 8ca743a19a staging: vc04_services: Remove VCHIQ_DEQUEUE_MESSAGE_T typedef
Typedefing structs is not encouraged in the kernel.

Signed-off-by: Dominic Braun <inf.braun@fau.de>
Signed-off-by: Tobias Büttner <tobias.buettner@fau.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-17 14:34:25 +01:00
Dominic Braun aa987e5513 staging: vc04_services: Remove VCHIQ_DEBUGFS_NODE_T typedef
Typedefing structs is not encouraged in the kernel.

Signed-off-by: Dominic Braun <inf.braun@fau.de>
Signed-off-by: Tobias Büttner <tobias.buettner@fau.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-17 14:34:25 +01:00
Dominic Braun 562943286c staging: vc04_services: Remove VCHIQ_CREATE_SERVICE_T typedef
Typedefing structs is not encouraged in the kernel.

Signed-off-by: Dominic Braun <inf.braun@fau.de>
Signed-off-by: Tobias Büttner <tobias.buettner@fau.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-17 14:34:25 +01:00
Dominic Braun 8b86744753 staging: vc04_services: Remove VCHIQ_CONFIG_T typedef
Typedefing structs is not encouraged in the kernel.

Signed-off-by: Dominic Braun <inf.braun@fau.de>
Signed-off-by: Tobias Büttner <tobias.buettner@fau.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-17 14:31:47 +01:00
Dominic Braun e69106e55d staging: vc04_services: Remove VCHIQ_COMPLETION_DATA_T typedef
Typedefing structs is not encouraged in the kernel.

Signed-off-by: Dominic Braun <inf.braun@fau.de>
Signed-off-by: Tobias Büttner <tobias.buettner@fau.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-17 14:31:47 +01:00
Dominic Braun bc96a5f0f7 staging: vc04_services: Remove VCHIQ_BULK_T typedef
Typedefing structs is not encouraged in the kernel.

Signed-off-by: Dominic Braun <inf.braun@fau.de>
Signed-off-by: Tobias Büttner <tobias.buettner@fau.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-17 14:31:47 +01:00
Dominic Braun cf69fc5216 staging: vc04_services: Remove VCHIQ_AWAIT_COMPLETION_T typedef
Typedefing structs is not encouraged in the kernel.

Signed-off-by: Dominic Braun <inf.braun@fau.de>
Signed-off-by: Tobias Büttner <tobias.buettner@fau.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-17 14:31:47 +01:00
Dominic Braun e376ef3535 staging: vc04_services: Remove VCHIQ_ARM_STATE_T typedef
Typedefing structs is not encouraged in the kernel.

Signed-off-by: Dominic Braun <inf.braun@fau.de>
Signed-off-by: Tobias Büttner <tobias.buettner@fau.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-17 14:31:47 +01:00
Dominic Braun 4dfc415fc2 staging: vc04_services: Remove USER_SERVICE_T typedef
Typedefing structs is not encouraged in the kernel.

Signed-off-by: Dominic Braun <inf.braun@fau.de>
Signed-off-by: Tobias Büttner <tobias.buettner@fau.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-17 14:31:47 +01:00
Dominic Braun 4eef62d61c staging: vc04_services: Remove DUMP_CONTEXT_T typedef
Typedefing structs is not encouraged in the kernel.

Signed-off-by: Dominic Braun <inf.braun@fau.de>
Signed-off-by: Tobias Büttner <tobias.buettner@fau.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-17 14:30:07 +01:00
Nicolas Saenz Julienne 2da56630b1 staging: vchiq: delete vchiq_killable.h
There are no users for that header file.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-17 14:20:37 +01:00
Nicolas Saenz Julienne a772f11670 staging: vchiq: switch to wait_for_completion_killable
This fixes f27e47bc6b ("staging: vchiq: use completions instead of
semaphores") as it neglected the subtle down_interruptible() macro
override in vchiq_killable.h. Hence all completions should be killable
instead of interruptible.

Fixes: f27e47bc6b ("staging: vchiq: use completions instead of semaphores")
Reported-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-17 14:20:37 +01:00
Stefan Wahren 25c7597af2 staging: vchiq_arm: Register a platform device for audio
Following Eric's commit 37b7b3087a ("staging/vc04_services: Register a
platform device for the camera driver.") this register the audio driver as
a platform device, too.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-12 11:56:47 +01:00
Stefan Wahren 405e2f9863 staging: vchiq_arm: Fix camera device registration
Since the camera driver isn't probed via DT, we need to properly setup DMA.

Fixes: 37b7b3087a ("staging/vc04_services: Register a platform device for the camera driver.")
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-12 11:56:47 +01:00
Szilveszter Székely 0ff8c980c7 staging: vchiq_arm: add __user pointer annotations
Add __user to pointers based on context and suggestions by sparse.

Other sparse warnings still remain, in cases where more change would be
required apart from adding __user.

Signed-off-by: Szilveszter Székely <szekelyszilv@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-05 09:44:05 +01:00
Greg Kroah-Hartman d5d12ce229 Merge 4.20-rc5 into staging-next
We need the staging fixes in here as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-03 07:55:28 +01:00
Nicolas Saenz Julienne 4ab0f5ce5f staging: vchiq_arm: fix open/release cdev functions
Both functions checked the minor number of the cdev prior running the
code. This was useless since the number of devices is already limited by
alloc_chrdev_region.

This removes the check and reindents the code where relevant.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Acked-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-27 10:13:37 +01:00
Nicolas Saenz Julienne 187ac53e59 staging: vchiq_arm: rework probe and init functions
Moves the allocation of a chardev region and class creation to the init
function of the driver since those functions are meant to be run on a
per driver basis, as opposed to the code run in the probe function which
is run in a per device basis.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Acked-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-27 10:13:37 +01:00
Nicolas Saenz Julienne f27e47bc6b staging: vchiq: use completions instead of semaphores
It is preferred in the kernel to avoid using semaphores to wait for
events, as they are optimised for the opposite situation; where the
common case is that they are available and may block only occasionally.
FYI see this thread: https://lkml.org/lkml/2008/4/11/323.

Also completions are semantically more explicit in this case.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Acked-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-27 10:13:37 +01:00
Nicolas Saenz Julienne 44c1e1bcbc staging: vchiq_arm: rework vchiq_ioc_copy_element_data
The function is passed to vchiq_core.c for it to go trough all the
transfer elements (an array of pointers to data) and copy them into the
actual transfer memory (contiguous memory).

The logic in the function was "copy an element and return, except when
the element is empty, in which case look for the next non-empty element
and copy it. The function will be called as many times as necessary until
all the elements are copied".

Now, this approach already forces the function to loop around elements
and felt convoluted, so it was changed to a more straightforward "Copy
all the elements into memory as long as they fit".

The resulting function is shorter and simpler.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Acked-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-27 10:13:36 +01:00
Nicolas Saenz Julienne ee43f74585 staging: vchiq_arm: get rid of vchi_mh.h
The concept of VCHI_MEM_HANDLE_T is introduced by this header file and
was meant to be used with bulk transfers. After a quick look in
vchiq_core.c it is pretty clear that it actually accomplishes nothing
nor alters the bulk transfers in any way.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Acked-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-27 10:12:17 +01:00
Nicolas Saenz Julienne 46e4b9ec4f staging: vchiq_arm: use list_for_each_entry when accessing bulk_waiter_list
The resulting code is way more readeable and intuitive compared to plain
list_for_each.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Acked-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-27 10:10:09 +01:00
Nicolas Saenz Julienne ddd7536ad4 staging: vchiq_arm: rework close/remove_service IOCTLS
The implementation of both IOCTLS was the same except for one function
call. This joins both implementations and updates the code to avoid
unneeded indentations.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Acked-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-27 10:10:09 +01:00
Nicolas Saenz Julienne 49fa9157a4 staging: vchiq_core: rework vchiq_get_config
The function is overly complicated for what it's ultimately achieving.
It's simply filling up a structure.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Acked-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-27 10:10:09 +01:00
Ben Wolsieffer 5a96b2d38d staging: vchiq_arm: fix compat VCHIQ_IOC_AWAIT_COMPLETION
The compatibility ioctl wrapper for VCHIQ_IOC_AWAIT_COMPLETION assumes that
the native ioctl always uses a message buffer and decrements msgbufcount.
Certain message types do not use a message buffer and in this case
msgbufcount is not decremented, and completion->header for the message is
NULL. Because the wrapper unconditionally decrements msgbufcount, the
calling process may assume that a message buffer has been used even when
it has not.

This results in a memory leak in the userspace code that interfaces with
this driver. When msgbufcount is decremented, the userspace code assumes
that the buffer can be freed though the reference in completion->header,
which cannot happen when the reference is NULL.

This patch causes the wrapper to only decrement msgbufcount when the
native ioctl decrements it. Note that we cannot simply copy the native
ioctl's value of msgbufcount, because the wrapper only retrieves messages
from the native ioctl one at a time, while userspace may request multiple
messages.

See https://github.com/raspberrypi/linux/pull/2703 for more discussion of
this patch.

Fixes: 5569a12609 ("staging: vchiq_arm: Add compatibility wrappers for ioctls")
Signed-off-by: Ben Wolsieffer <benwolsieffer@gmail.com>
Acked-by: Stefan Wahren <stefan.wahren@i2se.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-11 11:47:39 -08:00