aboutsummaryrefslogtreecommitdiff
path: root/drivers/staging/vc04_services
AgeCommit message (Collapse)AuthorFilesLines
2025-11-09platform/raspberrypi: Destage VCHIQ MMAL driverJai Luthra13-3734/+0
Destage the VCHIQ MMAL driver to drivers/platform/raspberrypi. Signed-off-by: Jai Luthra <jai.luthra@ideasonboard.com> Link: https://patch.msgid.link/20251029-vchiq-destage-v3-7-da8d6c83c2c5@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-11-09platform/raspberrypi: Destage VCHIQ interfaceJai Luthra10-7412/+0
Destage the VCHIQ interface driver to drivers/platform/raspberrypi. There is still the remaining TODO item of improving the documentation, which can be handled post destaging. Secondly, multimedia drivers like codec and ISP that rely on this interface need to be upstreamed. And lastly, the drivers that facilitate the shared memory between VideoCore and Linux, like the vc-sm-cma driver and vc_mem char driver also need to be upstreamed. Signed-off-by: Jai Luthra <jai.luthra@ideasonboard.com> Link: https://patch.msgid.link/20251029-vchiq-destage-v3-6-da8d6c83c2c5@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-11-09staging: vc04_services: Cleanup VCHIQ TODO entriesJai Luthra1-24/+0
Raspberry Pi downstream drivers using VCHIQ have changed a lot since kernel version 4.4 mentioned in the TODO, and are tangential to the destaing process - so drop those items from the list. Secondly, the code indentation for the vchiq interface driver is not so bad anymore since Umang's series (linked below) got merged, so drop it from the TODO. Link: https://lore.kernel.org/all/20241013112128.397249-1-umang.jain@ideasonboard.com/ Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jai Luthra <jai.luthra@ideasonboard.com> Reviewed-by: Stefan Wahren <wahrenst@gmx.net> Link: https://patch.msgid.link/20251029-vchiq-destage-v3-5-da8d6c83c2c5@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-11-09include: linux: Destage VCHIQ interface headersJai Luthra16-1068/+26
Move the VCHIQ headers from drivers/staging/vc04_services/include to include/linux/raspberrypi This is done so that they can be shared between the VCHIQ interface (which is going to be de-staged in a subsequent commit from staging) and the VCHIQ drivers left in the staging/vc04_services (namely bcm2835-audio, bcm2835-camera). The include/linux/raspberrypi/ provides a central location to serve both of these areas. Co-developed-by: Umang Jain <umang.jain@ideasonboard.com> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jai Luthra <jai.luthra@ideasonboard.com> Link: https://patch.msgid.link/20251029-vchiq-destage-v3-4-da8d6c83c2c5@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-11-09staging: vchiq_arm: Improve inline documentationPhil Elwell2-4/+60
Add more comments to the VCHIQ driver, which provides some high-level descriptions how things work. Link: https://github.com/raspberrypi/linux/pull/6801 Signed-off-by: Phil Elwell <phil@raspberrypi.com> [wahrenst@gmx.net: Rewrite commit log] Signed-off-by: Stefan Wahren <wahrenst@gmx.net> Signed-off-by: Jai Luthra <jai.luthra@ideasonboard.com> Link: https://patch.msgid.link/20251029-vchiq-destage-v3-3-da8d6c83c2c5@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-11-09staging: vchiq_arm: Remove bcm2835_camera from vchiqJai Luthra1-3/+0
As bcm2835_camera driver is dropped, also drop the loading/unloading support for it in vchiq. Signed-off-by: Jai Luthra <jai.luthra@ideasonboard.com> Reviewed-by: Stefan Wahren <wahrenst@gmx.net> Link: https://patch.msgid.link/20251029-vchiq-destage-v3-2-da8d6c83c2c5@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-11-09staging: vc04_services: Drop bcm2835-camera driverJai Luthra8-3591/+0
The bcm2835-camera driver is replaced by the V4L2 bcm2835-unicam driver that is already upstream. So drop it from staging. This also simplifies destaging of VCHIQ MMAL, by reducing the users of the MMAL API (this driver is one of them). Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jai Luthra <jai.luthra@ideasonboard.com> Acked-by: Stefan Wahren <wahrenst@gmx.net> Link: https://patch.msgid.link/20251029-vchiq-destage-v3-1-da8d6c83c2c5@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-11-09staging: vchiq_arm: delete unnecessary checkDan Carpenter1-4/+1
Both sides of this if else statement print exactly the same thing. Delete the unnecessary if statement. Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Reviewed-by: Umang Jain <uajain@igalia.com> Link: https://patch.msgid.link/aQIS6Q73Ss8xyJTD@stanley.mountain Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-08-13staging: vc04_services/vchiq-mmal: fix typos in commentsYuri Martins3-3/+3
Fix three spelling mistakes found in comments across the vchiq-mmal driver component: - recived -> received - servie -> service - enque -> enqueues Signed-off-by: Yuri Martins <yurimartins2004@hotmail.com> Link: https://lore.kernel.org/r/20250812015524.64413-1-yurimartins2004@hotmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-07-16staging: vchiq_arm: Make vchiq_shutdown never failStefan Wahren1-2/+1
Most of the users of vchiq_shutdown ignore the return value, which is bad because this could lead to resource leaks. So instead of changing all calls to vchiq_shutdown, it's easier to make vchiq_shutdown never fail. Fixes: 71bad7f08641 ("staging: add bcm2708 vchiq driver") Signed-off-by: Stefan Wahren <wahrenst@gmx.net> Link: https://lore.kernel.org/r/20250715161108.3411-4-wahrenst@gmx.net Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-07-16Revert "staging: vchiq_arm: Create keep-alive thread during probe"Stefan Wahren1-34/+35
The commit 86bc88217006 ("staging: vchiq_arm: Create keep-alive thread during probe") introduced a regression for certain configurations, which doesn't have a VCHIQ user. This results in a unused and hanging keep-alive thread: INFO: task vchiq-keep/0:85 blocked for more than 120 seconds. Not tainted 6.12.34-v8-+ #13 "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. task:vchiq-keep/0 state:D stack:0 pid:85 tgid:85 ppid:2 Call trace: __switch_to+0x188/0x230 __schedule+0xa54/0xb28 schedule+0x80/0x120 schedule_preempt_disabled+0x30/0x50 kthread+0xd4/0x1a0 ret_from_fork+0x10/0x20 Fixes: 86bc88217006 ("staging: vchiq_arm: Create keep-alive thread during probe") Reported-by: Maíra Canal <mcanal@igalia.com> Closes: https://lore.kernel.org/linux-staging/ba35b960-a981-4671-9f7f-060da10feaa1@usp.br/ Cc: stable@kernel.org Signed-off-by: Stefan Wahren <wahrenst@gmx.net> Reviewed-by: Maíra Canal <mcanal@igalia.com> Link: https://lore.kernel.org/r/20250715161108.3411-3-wahrenst@gmx.net Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-07-16Revert "staging: vchiq_arm: Improve initial VCHIQ connect"Stefan Wahren3-10/+21
The commit 3e5def4249b9 ("staging: vchiq_arm: Improve initial VCHIQ connect") based on the assumption that in good case the VCHIQ connect always happen and therefore the keep-alive thread is guaranteed to be woken up. This is wrong, because in certain configurations there are no VCHIQ users and so the VCHIQ connect never happen. So revert it. Fixes: 3e5def4249b9 ("staging: vchiq_arm: Improve initial VCHIQ connect") Reported-by: Maíra Canal <mcanal@igalia.com> Closes: https://lore.kernel.org/linux-staging/ba35b960-a981-4671-9f7f-060da10feaa1@usp.br/ Cc: stable@kernel.org Signed-off-by: Stefan Wahren <wahrenst@gmx.net> Reviewed-by: Maíra Canal <mcanal@igalia.com> Link: https://lore.kernel.org/r/20250715161108.3411-2-wahrenst@gmx.net Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-05-13Merge 6.15-rc6 into staging-nextGreg Kroah-Hartman1-0/+1
We need the staging changes in here as well Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-04-25staging: bcm2835-camera: Initialise dev in v4l2_devDave Stevenson1-0/+1
Commit 42a2f6664e18 ("staging: vc04_services: Move global g_state to vchiq_state") changed mmal_init to pass dev->v4l2_dev.dev to vchiq_mmal_init, however nothing iniitialised dev->v4l2_dev, so we got a NULL pointer dereference. Set dev->v4l2_dev.dev during bcm2835_mmal_probe. The device pointer could be passed into v4l2_device_register to set it, however that also has other effects that would need additional changes. Fixes: 42a2f6664e18 ("staging: vc04_services: Move global g_state to vchiq_state") Cc: stable@vger.kernel.org Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com> Reviewed-by: Stefan Wahren <wahrenst@gmx.net> Link: https://lore.kernel.org/r/20250423-staging-bcm2835-v4l2-fix-v2-1-3227f0ba4700@raspberrypi.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-04-15staging: bcm2835-audio: Validate values written to controlsMark Brown1-0/+6
The bcm2835-audio driver makes no effort to validate the values it accepts from userspace, causing it to accept invalid values: # # PCM Playback Switch.0 Invalid boolean value 2 # not ok 5 write_invalid.Headphones.1 # # PCM Playback Volume.0 value -10240 less than minimum -10239 # # PCM Playback Volume.0 value 401 more than maximum 400 # not ok 12 write_invalid.Headphones.0 Add validation. Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20250415-staging-bcm2835-alsa-limit-v1-1-4ed816e9c0fc@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-04-07staging: bcm2835-camera: Modify function call formattingAbraham Samuel Adekunle1-8/+6
The line is a function call which ends with an opening parenthesis thereby not adhering to the Linux kernel coding style. Modify the function call to include parameters on the same line as the opening parenthesis to improve readability and consistency while adhering to Linux coding styles. Reported by checkpatch: CHECK: Lines should not end with '(' Signed-off-by: Abraham Samuel Adekunle <abrahamadekunle50@gmail.com> Link: https://lore.kernel.org/r/Z97ZFURPvDcTkjjf@HP-650 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-03-20staging: vchiq_arm: Improve initial VCHIQ connectStefan Wahren3-21/+10
The code to start the keep-alive thread on initial VCHIQ connect within vchiq_platform_conn_state_changed is unnecessary complex. Move the keep-alive thread wake-up into a separate function and call it during VCHIQ connect. Signed-off-by: Stefan Wahren <wahrenst@gmx.net> Link: https://lore.kernel.org/r/20250309125014.37166-6-wahrenst@gmx.net Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-03-20staging: vchiq_arm: Create keep-alive thread during probeStefan Wahren1-35/+34
Creating the keep-alive thread in vchiq_platform_init_state have the following advantages: - abort driver probe if kthread_create fails (more consistent behavior) - make resource release process easier Since vchiq_keepalive_thread_func is defined below vchiq_platform_init_state, the latter must be moved. Signed-off-by: Stefan Wahren <wahrenst@gmx.net> Link: https://lore.kernel.org/r/20250309125014.37166-5-wahrenst@gmx.net Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-03-20staging: vchiq_arm: Stop kthreads if vchiq cdev register failsStefan Wahren1-9/+16
In case the vchiq character device cannot be registered during probe, all kthreads needs to be stopped to avoid resource leaks. Fixes: 863a756aaf49 ("staging: vc04_services: vchiq_core: Stop kthreads on vchiq module unload") Signed-off-by: Stefan Wahren <wahrenst@gmx.net> Link: https://lore.kernel.org/r/20250309125014.37166-4-wahrenst@gmx.net Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-03-20staging: vchiq_arm: Fix possible NPR of keep-alive threadStefan Wahren1-1/+2
In case vchiq_platform_conn_state_changed() is never called or fails before driver removal, ka_thread won't be a valid pointer to a task_struct. So do the necessary checks before calling kthread_stop to avoid a crash. Fixes: 863a756aaf49 ("staging: vc04_services: vchiq_core: Stop kthreads on vchiq module unload") Signed-off-by: Stefan Wahren <wahrenst@gmx.net> Link: https://lore.kernel.org/r/20250309125014.37166-3-wahrenst@gmx.net Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-03-20staging: vchiq_arm: Register debugfs after cdevStefan Wahren1-2/+2
The commit 2a4d15a4ae98 ("staging: vchiq: Refactor vchiq cdev code") moved the debugfs directory creation before vchiq character device registration. In case the latter fails, the debugfs directory won't be cleaned up. Fixes: 2a4d15a4ae98 ("staging: vchiq: Refactor vchiq cdev code") Signed-off-by: Stefan Wahren <wahrenst@gmx.net> Link: https://lore.kernel.org/r/20250309125014.37166-2-wahrenst@gmx.net Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-03-20staging: vchiq_arm: Don't use %pK through printkThomas Weißschuh3-42/+42
In the past %pK was preferable to %p as it would not leak raw pointer values into the kernel log. Since commit ad67b74d2469 ("printk: hash addresses printed with %p") the regular %p has been improved to avoid this issue. Furthermore, restricted pointers ("%pK") were never meant to be used through printk(). They can still unintentionally leak raw pointers or acquire sleeping looks in atomic contexts. Switch to the regular pointer formatting which is safer and easier to reason about. There are still a few users of %pK left, but these use it through seq_file, for which its usage is safe. Link: https://lore.kernel.org/lkml/20250113171731-dc10e3c1-da64-4af0-b767-7c7070468023@linutronix.de/ Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de> Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org> Link: https://lore.kernel.org/r/20250311-restricted-pointers-vchiq_arm-v2-1-a14e1c0681fc@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-02-03staging: bcm2835-camera: drop vb2_ops_wait_prepare/finishHans Verkuil1-2/+0
Since commit 88785982a19d ("media: vb2: use lock if wait_prepare/finish are NULL") it is no longer needed to set the wait_prepare/finish vb2_ops callbacks as long as the lock field in vb2_queue is set. Since the vb2_ops_wait_prepare/finish callbacks already rely on that field, we can safely drop these callbacks. This simplifies the code and this is a step towards the goal of deleting these callbacks. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Link: https://lore.kernel.org/r/f01dc977-bc4a-46f5-abd7-35089c8f2031@xs4all.nl Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-01-12staging: vc04_services: convert timeouts to secs_to_jiffies()Easwar Hariharan1-1/+1
Commit b35108a51cf7 ("jiffies: Define secs_to_jiffies()") introduced secs_to_jiffies(). As the value here is a multiple of 1000, use secs_to_jiffies() instead of msecs_to_jiffies to avoid the multiplication. This is converted using scripts/coccinelle/misc/secs_to_jiffies.cocci with the following Coccinelle rules: @@ constant C; @@ - msecs_to_jiffies(C * 1000) + secs_to_jiffies(C) @@ constant C; @@ - msecs_to_jiffies(C * MSEC_PER_SEC) + secs_to_jiffies(C) Link: https://lkml.kernel.org/r/20241210-converge-secs-to-jiffies-v3-16-ddfefd7e9f2a@linux.microsoft.com Signed-off-by: Easwar Hariharan <eahariha@linux.microsoft.com> Cc: Alexander Gordeev <agordeev@linux.ibm.com> Cc: Andrew Lunn <andrew+netdev@lunn.ch> Cc: Anna-Maria Behnsen <anna-maria@linutronix.de> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Christian Borntraeger <borntraeger@linux.ibm.com> Cc: Christophe Leroy <christophe.leroy@csgroup.eu> Cc: Daniel Mack <daniel@zonque.org> Cc: David Airlie <airlied@gmail.com> Cc: David S. Miller <davem@davemloft.net> Cc: Dick Kennedy <dick.kennedy@broadcom.com> Cc: Eric Dumazet <edumazet@google.com> Cc: Florian Fainelli <florian.fainelli@broadcom.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Haojian Zhuang <haojian.zhuang@gmail.com> Cc: Heiko Carstens <hca@linux.ibm.com> Cc: Ilya Dryomov <idryomov@gmail.com> Cc: Jack Wang <jinpu.wang@cloud.ionos.com> Cc: Jakub Kicinski <kuba@kernel.org> Cc: James Bottomley <James.Bottomley@HansenPartnership.com> Cc: James Smart <james.smart@broadcom.com> Cc: Jaroslav Kysela <perex@perex.cz> Cc: Jeff Johnson <jjohnson@kernel.org> Cc: Jeff Johnson <quic_jjohnson@quicinc.com> Cc: Jens Axboe <axboe@kernel.dk> Cc: Jeroen de Borst <jeroendb@google.com> Cc: Jiri Kosina <jikos@kernel.org> Cc: Joe Lawrence <joe.lawrence@redhat.com> Cc: Johan Hedberg <johan.hedberg@gmail.com> Cc: Josh Poimboeuf <jpoimboe@kernel.org> Cc: Jozsef Kadlecsik <kadlec@netfilter.org> Cc: Julia Lawall <julia.lawall@inria.fr> Cc: Kalle Valo <kvalo@kernel.org> Cc: Louis Peens <louis.peens@corigine.com> Cc: Lucas De Marchi <lucas.demarchi@intel.com> Cc: Luiz Augusto von Dentz <luiz.dentz@gmail.com> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Cc: Madhavan Srinivasan <maddy@linux.ibm.com> Cc: Marcel Holtmann <marcel@holtmann.org> Cc: Martin K. Petersen <martin.petersen@oracle.com> Cc: Maxime Ripard <mripard@kernel.org> Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: Miroslav Benes <mbenes@suse.cz> Cc: Naveen N Rao <naveen@kernel.org> Cc: Nicholas Piggin <npiggin@gmail.com> Cc: Nicolas Palix <nicolas.palix@imag.fr> Cc: Oded Gabbay <ogabbay@kernel.org> Cc: Ofir Bitton <obitton@habana.ai> Cc: Pablo Neira Ayuso <pablo@netfilter.org> Cc: Paolo Abeni <pabeni@redhat.com> Cc: Petr Mladek <pmladek@suse.com> Cc: Praveen Kaligineedi <pkaligineedi@google.com> Cc: Ray Jui <rjui@broadcom.com> Cc: Robert Jarzmik <robert.jarzmik@free.fr> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com> Cc: Roger Pau Monné <roger.pau@citrix.com> Cc: Russell King <linux@armlinux.org.uk> Cc: Scott Branden <sbranden@broadcom.com> Cc: Shailend Chand <shailend@google.com> Cc: Simona Vetter <simona@ffwll.ch> Cc: Simon Horman <horms@kernel.org> Cc: Sven Schnelle <svens@linux.ibm.com> Cc: Takashi Iwai <tiwai@suse.com> Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com> Cc: Thomas Zimmermann <tzimmermann@suse.de> Cc: Vasily Gorbik <gor@linux.ibm.com> Cc: Xiubo Li <xiubli@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2024-11-29Merge tag 'staging-6.13-rc1' of ↵Linus Torvalds13-705/+679
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging Pull staging driver updates from Greg KH: "Here is the big set of staging driver changes for 6.13-rc1. Lots of changes this merge cycle, drivers removed and drivers added. Highlights include: - removals of the following staging drivers due to no forward progress and no one having either the hardware or the time/energy to deal with them anymore: - fieldbus - gdm724x - olpc_dcon - rtl8712 - rts5208 - vt6655 - vt6656 If anyone has this hardware and wants to work on the drivers, it can be an easy revert to get them back. - addition of the gpib driver subsystem. Lots of drivers for really old and semi-old interfaces to lab equipments. We expect lots of churn in these drivers as they get cleaned up to "working" order. These were added at the request of a user and the maintainer/author of them is helping out with the effort - loads and loads of tiny coding style cleanups for almost all staging drivers. Too many to list, see the shortlog for details. All of these have been in linux-next for a very long time with no reported issues" * tag 'staging-6.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (216 commits) Staging: gpib: gpib_os.c - Remove unnecessary OOM message staging: gpib: avoid unintended sign extension staging: vchiq_debugfs: Use forward declarations staging: vchiq_core: Rectify header include for vchiq_dump_state() staging: vc04_services: Cleanup TODO entry staging: most: Remove TODO contact information staging: rtl8723bs: Remove TODO contact information staging: sm750fb: Remove TODO contact information staging: iio: Remove TODO file staging: greybus: uart: Fix atomicity violation in get_serial_info() staging: rtl8723bs: Remove unused function Efuse_GetCurrentSize staging: rtl8723bs: Remove unused function efuse_WordEnableDataRead staging: rtl8723bs: Remove function hal_EfusePgPacketWrite1ByteHeader staging: rtl8723bs: Remove function hal_EfusePgPacketWrite2ByteHeader staging: rtl8723bs: Remove unused function hal_EfusePgCheckAvailableAddr staging: rtl8723bs: Remove unused function hal_EfuseConstructPGPkt staging: rtl8723bs: Remove unused function hal_EfusePartialWriteCheck staging: rtl8723bs: Remove unused function hal_EfusePgPacketWriteHeader staging: rtl8723bs: Remove unused function hal_EfusePgPacketWriteData staging: rtl8723bs: Remove unused function Hal_EfusePgPacketWrite_BT ...
2024-11-10staging: vchiq_debugfs: Use forward declarationsUmang Jain1-1/+2
Use forward declarations for struct vchiq_state and vchiq_instance. We can then drop the vchiq_core.h header from vchiq_debugfs.h. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Link: https://lore.kernel.org/r/20241107194806.90408-4-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-11-10staging: vchiq_core: Rectify header include for vchiq_dump_state()Umang Jain1-1/+1
The header vchiq_core.h does not need <linux/debugfs.h>. It needs the <linux/seq_file.h> for vchiq_dump_state() to dump the vchiq state through vchiq_debugfs.[ch]. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Link: https://lore.kernel.org/r/20241107194806.90408-3-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-11-10staging: vc04_services: Cleanup TODO entryUmang Jain1-9/+0
The TODO entry "Fix behvaiour of message handling" no longer applies due to killable completions [1]. Drop the entry from TODO list. [1] https://lore.kernel.org/all/20240918163100.870596-1-umang.jain@ideasonboard.com/ Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Link: https://lore.kernel.org/r/20241107194806.90408-2-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-11-04staging: vchiq_arm: Track bulk user data pointer separatelyUmang Jain9-34/+38
A bulk callback transfer can be initiated from two places - inside kernel interface or from user interface. However, the callback data pointer 'cb_data' is used for tracking both sets of data pointer. This commit tracks the callback data pointer from user interface (named as 'cb_userdata') separately, in the bulk transfer service callback. This is esentially done by adding a 'void __user *cb_userdata' for tracking __user pointers in vchiq_bulk and vchiq_completion_data structs. Furthermore, the 'cb_userdata' data pointer is appended to the vchiq_service's callback signature. Separating the two callback data pointers ('cb_data' and 'cb_userdata') fixes the sparse warnings around mixing userspace and kernel space pointers. As there are no additional sparse warnings left for vc04_services, drop the relevant entry from the TODO. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Link: https://lore.kernel.org/r/20241023110406.885199-7-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-11-04staging: vchiq_core: Pass vchiq_bulk pointer to make_service_callback()Umang Jain1-3/+10
Pass struct vchiq_bulk pointer to make_service_callback() instead of just passing the bulk->cb_data. This is a preparatory change when we need to pass the callback data user pointer (__user) in a subsequent commit. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Link: https://lore.kernel.org/r/20241023110406.885199-6-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-11-04staging: vchiq: Rename vchiq_completion_data 'bulk_userdata'Umang Jain4-8/+8
In a previous commit, struct vchiq_bulk 'userdata' got renamed to 'cb_data' since it is the data pointer passed in VCHIQ_BULK_CALLBACK_MODE's callback. Since struct vchiq_completion_data* structs also has 'bulk_userdata' for completion records, rename 'bulk_userdata' member to 'cb_data' for these structs as well. This brings consistency and clarity for the struct members. No functional change in this patch. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Link: https://lore.kernel.org/r/20241023110406.885199-5-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-11-04staging: vchiq_core: Rename struct vchiq_bulk 'userdata'Umang Jain4-10/+10
Rename the struct vchiq_bulk 'userdata' member to 'cb_data' to clarify its purpose. 'cb_data' is meant to be passed to service callback function in VCHIQ_BULK_MODE_CALLBACK mode. No functional changes in this patch. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Link: https://lore.kernel.org/r/20241023110406.885199-4-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-11-04staging: vchiq_core: Bulk waiter should not piggy back on bulk userdataUmang Jain4-10/+12
Currently, struct bulk_waiter is allocated for VCHIQ_BULK_MODE_BLOCKING bulk transfer and its pointer is assigned to vchiq_bulk->userdata. Avoid this kind of piggybacking and introduce a dedicate 'waiter' member in struct vchiq_bulk. The 'userdata' is meant for VCHIQ_BULK_MODE_CALLBACK mode, to pass user specified parameter to the actual callback function. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Link: https://lore.kernel.org/r/20241023110406.885199-3-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-11-04staging: vchiq_arm: Rename a struct vchiq_bulk memberUmang Jain3-8/+8
Rename the struct vchiq_bulk's 'data' member to 'dma_addr' for better readability. No functional changes intended in this patch. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Link: https://lore.kernel.org/r/20241023110406.885199-2-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-11-04staging: vchiq_core: Remove unnecessary blank linesRohit Chavan1-2/+0
This commit cleans up the formatting in by removing extraneous blank lines, improving code readability without changing functionality. Signed-off-by: Rohit Chavan <roheetchavan@gmail.com> Link: https://lore.kernel.org/r/20241029063901.1857067-1-roheetchavan@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-10-19staging: vchiq_arm: Use devm_kzalloc() for drv_mgmt allocationUmang Jain1-3/+1
The struct drv_mgmt 'mgmt' is currently allocated dynamically using kzalloc(). Unfortunately, it is subjected to memory leaks in the error handling paths of the probe() function. To address this issue, use device resource management helper devm_kzalloc(), to ensure cleanup after the allocation. Cc: stable@vger.kernel.org Fixes: 1c9e16b73166 ("staging: vc04_services: vchiq_arm: Split driver static and runtime data") Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org> Link: https://lore.kernel.org/r/20241016130225.61024-3-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-10-19staging: vchiq_arm: Use devm_kzalloc() for vchiq_arm_state allocationUmang Jain1-1/+1
The struct vchiq_arm_state 'platform_state' is currently allocated dynamically using kzalloc(). Unfortunately, it is never freed and is subjected to memory leaks in the error handling paths of the probe() function. To address the issue, use device resource management helper devm_kzalloc(), to ensure cleanup after its allocation. Fixes: 71bad7f08641 ("staging: add bcm2708 vchiq driver") Cc: stable@vger.kernel.org Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org> Link: https://lore.kernel.org/r/20241016130225.61024-2-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-10-19staging: vchiq_dev: Drop userdata local pointerUmang Jain1-3/+2
The 'userdata' local pointer can be dropped which is set to bulk_waiter. We can directly pass the waiter->bulk_waiter pointer to vchiq_bulk_xfer_waiting(). Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Link: https://lore.kernel.org/r/20241017133629.216672-7-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-10-19staging: vchiq_core: Simplify bulk transfer queue message functionUmang Jain1-23/+16
vchiq_bulk_xfer_queue_msg_killable() is a common function between various bulk transfer code paths (blocking, callback and no-callback). These code paths were simplified earlier by passing a populated struct vchiq_bulk pointer in order to avoid open-coding the parameters required to initiate a bulk transfer. Now simplify the vchiq_bulk_xfer_queue_msg_killable() in a similar way i.e. avoid open-coding the function parameters and pass the struct vchiq_bulk pointer directly, coming from the various bulk transfer code paths. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Link: https://lore.kernel.org/r/20241017133629.216672-6-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-10-19staging: vc04_services: Simplify (no)callback bulk transfer code pathsUmang Jain4-21/+31
The (no)callback mode bulk transfer tends to open-code every function parameter needed to initiate the bulk transfer. Instead of doing that, simply pass a populated struct vchiq_bulk down the function chain. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Link: https://lore.kernel.org/r/20241017133629.216672-5-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-10-19staging: vc04_services: Simplify block bulk transfer code pathsUmang Jain4-23/+37
Blocking bulk transfer functions tend to open-code every function parameter needed to initiate the bulk transfer. Instead of doing that, simply pass a populated struct vchiq_bulk down the function chain. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Link: https://lore.kernel.org/r/20241017133629.216672-4-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-10-19staging: vchiq_core: Simplify bulk data preparatory functionsUmang Jain1-9/+7
Two functions create_pagelist() and vchiq_prepare_bulk_data() open code bulk data arguments ('size' and 'dir') in their function signatures which can easily be obtained by struct vchiq_bulk pointer. Retrieve the arguments from vchiq_bulk pointer instead and reduce the number of arguments passed in create_pagelist() and vchiq_bulk_prepare_data(). No functional changes intended in this patch. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Link: https://lore.kernel.org/r/20241017133629.216672-3-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-10-19staging: vchiq_core: Subsume 'offset' in struct vchiq_bulkUmang Jain2-12/+17
Subsume offset and uoffset inside struct vchiq_bulk instead of open-coding them in vchiq_prepare_bulk_data() function. It helps in reducing function parameters and can be easily retrieved from the struct vchiq_bulk pointer for creating pagelist. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Link: https://lore.kernel.org/r/20241017133629.216672-2-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-10-16staging: vchiq_arm: Fix missing refcount decrement in error path for fw_nodeJavier Carrasco1-4/+2
An error path was introduced without including the required call to of_node_put() to decrement the node's refcount and avoid leaking memory. If the call to kzalloc() for 'mgmt' fails, the probe returns without decrementing the refcount. Use the automatic cleanup facility to fix the bug and protect the code against new error paths where the call to of_node_put() might be missing again. Cc: stable@vger.kernel.org Fixes: 1c9e16b73166 ("staging: vc04_services: vchiq_arm: Split driver static and runtime data") Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com> Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Link: https://lore.kernel.org/r/20241014-vchiq_arm-of_node_put-v2-2-cafe0a4c2666@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-10-16staging: vchiq_arm: refactor goto instructions in vchiq_probe()Javier Carrasco1-8/+5
The 'failed_platform_init' and 'error_exit' labels do not simplify the code, there is a single jump to them in the code, and the actions taken from then on can be easily carried out where the goto occurs. Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com> Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Link: https://lore.kernel.org/r/20241014-vchiq_arm-of_node_put-v2-1-cafe0a4c2666@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-10-13staging: vchiq_core: Lower indentation in vchiq_close_service_internalUmang Jain1-11/+13
Reduce indentation of the conditional nesting in vchiq_close_service_internal() switch case by checking the error paths first and break early. This helps to reduce conditional branching and reduce indentation levels. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org> Link: https://lore.kernel.org/r/20241013112128.397249-7-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-10-13staging: vchiq_core: Lower indentation in parse_open()Umang Jain1-22/+26
If the service is not in VCHIQ_SRVSTATE_LISTENING state, it is implied that the message is dealt with and parse_open() should return. If this is the case, simply jump the code flow to return site using 'goto done;' statement. This helps to lower the indentation of if (service->srvstate == VCHIQ_SRVSTATE_LISTENING) conditional branch. No functional changes intended in this patch. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Stefan Wahren <wahrenst@gmx.net> Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org> Link: https://lore.kernel.org/r/20241013112128.397249-6-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-10-13staging: vchiq_core: Refactor notify_bulks()Umang Jain1-31/+40
Move the statistics and bulk completion events handling to a separate function. This helps to improve readability for notify_bulks(). No functional changes intended in this patch. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org> Link: https://lore.kernel.org/r/20241013112128.397249-5-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-10-13staging: vchiq_core: Indent copy_message_data() on a single lineUmang Jain1-3/+2
Fix the copy_message_data() indentation in queue_message_sync(). Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Stefan Wahren <wahrenst@gmx.net> Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org> Link: https://lore.kernel.org/r/20241013112128.397249-4-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-10-13staging: vchiq_core: Do not log debug in a separate scopeUmang Jain1-10/+7
Do not log a dev_dbg() with a separate scope. Drop the {..} scope and align the dev_dbg() to make it more readable. No functional changes intended in this patch. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Stefan Wahren <wahrenst@gmx.net> Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org> Link: https://lore.kernel.org/r/20241013112128.397249-3-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>