summaryrefslogtreecommitdiff
path: root/drivers/staging/vc04_services
AgeCommit message (Collapse)Author
2024-05-04staging: vchiq_core: Add missing blank linesStefan Wahren
checkpatch.pl noticed about missing blank line after 2 declarations. So add them for better readability. Signed-off-by: Stefan Wahren <wahrenst@gmx.net> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Link: https://lore.kernel.org/r/20240425165852.6681-6-wahrenst@gmx.net Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-05-04staging: vchiq_core: Drop unnecessary blank linesStefan Wahren
checkpatch.pl noticed CHECK: Please don't use multiple blank lines So drop them. Signed-off-by: Stefan Wahren <wahrenst@gmx.net> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Link: https://lore.kernel.org/r/20240425165852.6681-5-wahrenst@gmx.net Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-05-04staging: vchiq_core: Add parentheses to VCHIQ_MSG_SRCPORTStefan Wahren
checkpatch.pl complains ERROR: Macros with complex values should be enclosed in parentheses +#define VCHIQ_MSG_SRCPORT(msgid) \ + (unsigned short)(((unsigned int)(msgid) >> 12) & 0xfff) Signed-off-by: Stefan Wahren <wahrenst@gmx.net> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Link: https://lore.kernel.org/r/20240425165852.6681-4-wahrenst@gmx.net Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-05-04staging: vchiq_core: Use printk messages for devicesStefan Wahren
Now that struct vchiq_state has a device reference, we can convert the remaining printk message helpers. Signed-off-by: Stefan Wahren <wahrenst@gmx.net> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Link: https://lore.kernel.org/r/20240425165852.6681-3-wahrenst@gmx.net Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-05-04staging: vchiq_arm: Drop unnecessary NULL checkStefan Wahren
Looking at the handling of service instance within the VCHIQ driver shows that it's not possible that service_callback is called with instance is a NULL pointer. So drop the unnecessary NULL check and fix: vchiq_arm.c:1109 service_callback() warn: variable dereferenced before check 'instance' (see line 1091) Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/linux-arm-kernel/202404230315.vx7ESZ3r-lkp@intel.com/ Signed-off-by: Stefan Wahren <wahrenst@gmx.net> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Link: https://lore.kernel.org/r/20240425165852.6681-2-wahrenst@gmx.net Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-05-04staging: vc04_services: Delete unnecessary NULL checkDan Carpenter
The "state" pointer points to an offset in the middle of the "mgmt" struct so it can't possibly be NULL. And also we dereferenced it on the line before. So this NULL check is pointless. Delete it. Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Reviewed-by: Stefan Wahren <wahrenst@gmx.net> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Link: https://lore.kernel.org/r/526ec2ff-6277-4d5d-b2d9-63b087a97c7c@moroto.mountain Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-05-04staging: vc04_services: vchiq_arm: Fix NULL ptr dereferencesStefan Wahren
The commit 8c9753f63905 ("staging: vc04_services: vchiq_arm: Drop g_cache_line_size") introduced NULL pointer dereferences by using the wrong device. Fixes: 8c9753f63905 ("staging: vc04_services: vchiq_arm: Drop g_cache_line_size") Signed-off-by: Stefan Wahren <wahrenst@gmx.net> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Link: https://lore.kernel.org/r/20240420091240.9552-1-wahrenst@gmx.net Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-04-18staging: vc04_services: Drop completed TODO itemUmang Jain
The memory barrier comments are added in commit f6c99d86246a ("staging: vchiq_arm: Add missing memory barrier comments") Drop the respective item from the TODO list. Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Link: https://lore.kernel.org/r/20240412075743.60712-12-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-04-18staging: vc04_services: Move global g_state to vchiq_stateUmang Jain
The patch intended to drop the g_state pointer. g_state is supposed to be a central place to track the state via vchiq_state. This is now moved to be contained in the struct vchiq_drv_mgmt. As a result vchiq_get_state() is also removed. In order to have access to vchiq_drv_mgmt, vchiq_initialise() and vchiq_mmal_init() are modified to receive a struct device pointer as one of their function parameter The vchiq_state pointer is now passed directly to vchiq_dump_platform_instances() to get access to the state instead getting it via vchiq_get_state(). For the char device, struct miscdevice is retrieved by struct file's private data in vchiq_open and struct vchiq_drv_mgmt is retrieved thereafter. Removal of global variable members is now addressed hence, drop the corresponding item from the TODO list. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Link: https://lore.kernel.org/r/20240412075743.60712-11-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-04-18staging: vc04_services: vchiq_mmal: Rename service_callback()Umang Jain
Rename the service_callback static function to mmal_service_callback() since the function signature conflicts with: extern int service_callback(struct vchiq_instance *vchiq_instance, enum vchiq_reason reason, struct vchiq_header *header, unsigned int handle, void *bulk_userdata); in vc04_services/interface/vchiq_arm/vchiq_arm.h In a subsequent patch, we will include vchiq_arm.h header to mmal-vchiq.c, which will then complain of this conflict. Hence, this patch is meant to handle the conflict beforehand. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Stefan Wahren <wahrenst@gmx.net> Link: https://lore.kernel.org/r/20240412075743.60712-10-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-04-18staging: vc04_services: Move spinlocks to vchiq_stateUmang Jain
The msg_queue_spinlock, quota_spinlock and bulk_waiter_spinlock are allocated globally. Instead move them to struct vchiq_state and initialise them in vchiq_init_state(). Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Stefan Wahren <wahrenst@gmx.net> Link: https://lore.kernel.org/r/20240412075743.60712-9-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-04-18staging: vc04_services: Move global memory mapped pointerUmang Jain
g_regs stores the remapped memory pointer for the vchiq platform. It can be moved to struct vchiq_drv_mgmt instead of being global. Adjust the affected functions accordingly. Pass vchiq_state pointer wherever necessary to access struct vchiq_drv_mgmt. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Link: https://lore.kernel.org/r/20240412075743.60712-8-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-04-18staging: vc04_services: Move global variables tracking allocated pagesUmang Jain
The variables tracking allocated pages fragments in vchiq_arm.c can be easily moved to struct vchiq_drv_mgmt instead of being global. This helps us to drop the non-essential global variables in the vchiq interface. No functional changes intended in this patch. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Stefan Wahren <wahrenst@gmx.net> Link: https://lore.kernel.org/r/20240412075743.60712-7-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-04-18staging: vc04_services: Drop vchiq_connected.[ch] filesUmang Jain
The vchiq_connected.[ch] just implements two function: - vchiq_add_connected_callback() - vchiq_call_connected_callbacks() for the deferred vchiq callbacks. Those can easily live in vchiq_arm.[ch], hence move them. This allows making the vchiq_call_connected_callbacks() function static. The move doesn't copy over MAX_CALLBACKS because it is the same as VCHIQ_DRV_MAX_CALLBACKS. Hence, it now being used in vchiq_add_connected_callback(). No functional changes intended in this patch. Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Link: https://lore.kernel.org/r/20240412075743.60712-6-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-04-18staging: vc04_services: Move variables for tracking connectionsUmang Jain
Connections to the vchiq driver are tracked using global variables. Drop those and introduce them as members of struct vchiq_drv_mgmt. Hence, struct vchiq_drv_mgmt will be used to track the connections. Also, store a vchiq_drv_mgmt pointer to struct vchiq_device to have easy access to struct vchiq_drv_mgmt across vchiq devices. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Link: https://lore.kernel.org/r/20240412075743.60712-5-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-04-18staging: vc04_services: vchiq_arm: Drop g_cache_line_sizeUmang Jain
The cache-line-size is cached in struct vchiq_platform_info. There is no need to cache this again via g_cache_line_size and use it. Instead use the value from vchiq_platform_info directly. While at it, move the comment about L2 cache line size in the kerneldoc block of struct vchiq_platform_info. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Stefan Wahren <wahrenst@gmx.net> Link: https://lore.kernel.org/r/20240412075743.60712-4-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-04-18staging: vc04_services: vchiq_arm: Split driver static and runtime dataUmang Jain
vchiq_drvdata combines two types of book-keeping data. There is platform-specific static data (for e.g. cache lines size) and then data needed for book-keeping at runtime. Split the data into two structures: struct vchiq_platform_info and struct vchiq_drv_mgmt. The vchiq_drv_mgmt is allocated at runtime during probe and will be extended in subsequent patches to remove all global variables allocated. No functional changes intended in this patch. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Stefan Wahren <wahrenst@gmx.net> Link: https://lore.kernel.org/r/20240412075743.60712-3-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-04-18staging: vc04_services: Drop g_once_init global variableUmang Jain
g_once_init is not used in a meaningful way anywhere. Drop it along with connected_init() which sets it. Suggested-by: Dan Carpenter <dan.carpenter@linaro.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Stefan Wahren <wahrenst@gmx.net> Link: https://lore.kernel.org/r/20240412075743.60712-2-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-04-18staging: vc04_services: Re-align function parametersSumadhura Kalyan
Checkpatch complains that: CHECK: Lines should not end with a '(' +typedef void (*vchiq_mmal_buffer_cb)( Re-align the function parameters to make checkpatch happy. Signed-off-by: Sumadhura Kalyan <opensourcecond@gmail.com> Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org> Link: https://lore.kernel.org/r/20240415171138.5849-1-opensourcecond@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-04-18staging: vchiq: Reformat Kconfig help textsStefan Wahren
The lines in the VCHIQ Kconfig help texts are too long, which makes it hard to read the menuconfig. So reformat them to restore the readability. Signed-off-by: Stefan Wahren <wahrenst@gmx.net> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Link: https://lore.kernel.org/r/20240414192257.6011-1-wahrenst@gmx.net Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-04-09staging: bcm2835-audio: add terminating new line to KconfigPrasad Pandit
Add terminating new line to the Kconfig file. It helps while displaying file with cat(1) command. Signed-off-by: Prasad Pandit <pjp@fedoraproject.org> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com> Acked-by: Dan Carpenter <dan.carpenter@linaro.org> Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org> Link: https://lore.kernel.org/r/20240330040411.3273337-1-ppandit@redhat.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-04-09Revert "staging: vc04_services: vchiq_core: Stop kthreads on shutdown"Umang Jain
This reverts commit d9c60badccc183eb971e0941bb86f9475d4b9551. It has been reported that stopping kthreads corrupts the VC04 firmware and creates issues at boot time [1]. A fix-up version of this patch bac670144384 ("staging: vc04_services: Stop kthreads on .remove") [2] was also attempted but it also doesn't properly fix the TODO (i.e. clean module unload) and similar errors were observed when stopping these khthreads on RaspberryPi 3. Hence, revert the entire patch for now since it is not very clear why stopping the kthreads breaks the firmware. [1]: https://lore.kernel.org/linux-staging/CAPY8ntBaz_RGr2sboQqbuUv+xZNfRct6-sckDLYPTig_HWyXEw@mail.gmail.com/t/#me90b9a9bc91599f18cd65ceb7eedd40e5fee0cdd [2]: https://lore.kernel.org/linux-staging/171161507013.3072637.12125782507523919379@ping.linuxembedded.co.uk/T/#m1d3de7d2fa73b2447274858353bbd4a0c3a8ba14 Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Stefan Wahren <wahrenst@gmx.net> Link: https://lore.kernel.org/r/20240403052100.2794-1-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-04-01Merge 6.9-rc2 into staging-nextGreg Kroah-Hartman
We need the staging fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-03-25staging: vc04_services: fix information leak in create_component()Dan Carpenter
The m.u.component_create.pid field is for debugging and in the mainline kernel it's not used anything. However, it still needs to be set to something to prevent disclosing uninitialized stack data. Set it to zero. Fixes: 7b3ad5abf027 ("staging: Import the BCM2835 MMAL-based V4L2 camera driver.") Cc: stable <stable@kernel.org> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Link: https://lore.kernel.org/r/2d972847-9ebd-481b-b6f9-af390f5aabd3@moroto.mountain Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-03-25staging: vc04_services: changen strncpy() to strscpy_pad()Arnd Bergmann
gcc-14 warns about this strncpy() that results in a non-terminated string for an overflow: In file included from include/linux/string.h:369, from drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c:20: In function 'strncpy', inlined from 'create_component' at drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c:940:2: include/linux/fortify-string.h:108:33: error: '__builtin_strncpy' specified bound 128 equals destination size [-Werror=stringop-truncation] Change it to strscpy_pad(), which produces a properly terminated and zero-padded string. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org> Link: https://lore.kernel.org/r/20240313163712.224585-1-arnd@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-03-25staging: vc04_services: vchiq_core: Stop kthreads on shutdownUmang Jain
The various kthreads thread functions (slot_handler_func, sync_func, recycle_func) in vchiq_core and vchiq_keepalive_thread_func in vchiq_arm should be stopped on vchiq_shutdown(). This also address the following TODO item: * Fix kernel module support hence drop it from the TODO item list. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Link: https://lore.kernel.org/r/20240321130737.898154-6-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-03-25staging: vc04_services: Implement vchiq_bus .removeUmang Jain
Implement the struct vchiq_bus .remove() so that cleanup paths can be executed by the devices registered to this bus, when being removed. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Link: https://lore.kernel.org/r/20240321130737.898154-5-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-03-25staging: vc04_services: Do not log error on kzalloc()Umang Jain
Do not log any error for kzalloc() error path. kzalloc() already reports such errors. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Link: https://lore.kernel.org/r/20240321130737.898154-4-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-03-25staging: vc04_services: vchiq_arm: Use appropriate dev_* log helpersUmang Jain
Re-evaluate logs on error code paths and fix a few error logs with appropriate dev_* logging helpers. No functional changes intended in this patch. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Link: https://lore.kernel.org/r/20240321130737.898154-3-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-03-25staging: vc04_services: Remove unused function declarationsUmang Jain
vchiq_loud_error-* are not implemented hence, remove their declarations. This seem to be remnants of custom logging helpers which were removed earlier. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Link: https://lore.kernel.org/r/20240321130737.898154-2-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-03-05Staging: vc04_services: bcm2835-camera: fix brace code style checkMoritz C. Weber
Reformat function parameters to fix checkpatch check: Increase readability and consistency Signed-off-by: "Moritz C. Weber" <mo.c.weber@gmail.com> Link: https://lore.kernel.org/r/20240219112234.8673-3-mo.c.weber@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-03-05Staging: vc04_services: bcm2835-camera: fix blank line style checkMoritz C. Weber
Remove blank line to fix checkpatch check: Increase readability and consistency Signed-off-by: "Moritz C. Weber" <mo.c.weber@gmail.com> Link: https://lore.kernel.org/r/20240219112234.8673-2-mo.c.weber@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-02-17staging: vc04_services: vchiq_arm: make vchiq_bus_type constRicardo B. Marliere
Now that the driver core can properly handle constant struct bus_type, move the vchiq_bus_type variable to be a constant structure as well, placing it into read-only memory which can not be modified at runtime. Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Ricardo B. Marliere <ricardo@marliere.net> Link: https://lore.kernel.org/r/20240208-bus_cleanup-staging2-v1-1-cfe906133a2c@marliere.net Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-12-09staging: vc04_services: vchiq_dev: Use %p to log pointer addressUmang Jain
Solves the following Smatch warnings: vchiq_release() warn: argument 7 to %lx specifier is cast from pointer %p will print the hashed pointer to dynamic debug. In order to print the unmodified pointer address, one can use the `no_hash_pointers` via kernel parameters. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Link: https://lore.kernel.org/r/20231207083837.153843-3-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-12-09staging: vc04_services: vchiq_arm: Use %p to log pointer addressUmang Jain
Solves the following Smatch warnings: service_callback() warn: argument 7 to %lx specifier is cast from pointer service_callback() warn: argument 11 to %lx specifier is cast from pointer service_callback() warn: argument 12 to %lx specifier is cast from pointer service_callback() warn: argument 13 to %lx specifier is cast from pointer %p will print the hashed pointer to dynamic debug. In order to print the unmodified pointer address, one can use the `no_hash_pointers` via kernel parameters. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Link: https://lore.kernel.org/r/20231207083837.153843-2-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-12-07staging: vc04_services: Drop vchiq_log_debug() in favour of dev_dbgUmang Jain
Drop vchiq_log_debug() macro which wraps dev_dbg(). Introduce the usage of dev_dbg() directly. Meanwhile at it, drop the usage of __func__ from the logs. Dynamic debug supports this via the 'f' decorator flag. Remove the entry from TODO regarding custom logging. VC04 is now aligned according to the standard kernel logging mechanisms. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Link: https://lore.kernel.org/r/20231205084157.73819-5-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-12-07staging: vc04_services: Drop vchiq_log_trace() in favour of dev_dbgUmang Jain
Drop vchiq_log_trace() macro which wraps dev_dbg(). Introduce the usage of dev_dbg() directly. Meanwhile at it, drop the usage of __func__ from the logs. Dynamic debug supports this via the 'f' decorator flag. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Link: https://lore.kernel.org/r/20231205084157.73819-4-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-12-07staging: vc04_services: Drop vchiq_log_warning() in favour of dev_warnUmang Jain
Drop vchiq_log_warning() macro which wraps dev_dbg(). Introduce the usage of dev_warn() directly. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Link: https://lore.kernel.org/r/20231205084157.73819-3-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-12-07staging: vc04_services: Drop vchiq_log_error() in favour of dev_errUmang Jain
Drop vchiq_log_error() macro which wraps dev_dbg(). Introduce the usage of dev_err() directly. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Link: https://lore.kernel.org/r/20231205084157.73819-2-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-12-04staging: vc04_services: Do not pass NULL to vchiq_log_error()Umang Jain
vchiq_add_connected_callback() logs using vchiq_log_error() macro, but passes NULL instead of a struct device pointer. Fix it. vchiq_add_connected_callback() is not used anywhere in the vc04_services as of now. It will be used when we add new drivers(VC shared memory and bcm2835-isp), hence it kept as it is for now. Fixes: 1d8915cf8899 ("staging: vc04: Convert vchiq_log_error() to use dynamic debug") Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Link: https://lore.kernel.org/r/20231128201926.489269-2-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-12-04staging: vc04_services: vchiq_core: Log through struct vchiq_instanceUmang Jain
The handle_to_service() helper can return NULL, so `service` pointer can indeed be set to NULL. So, do not log through service pointer (which can cause NULL-deference), instead, use the vchiq_instance function argument to get access to the struct device. Fixes: f67af5940d6d ("staging: vc04: Convert(and rename) vchiq_log_info() to use dynamic debug") Reviewed-by: Ricardo B. Marliere <ricardo@marliere.net> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Link: https://lore.kernel.org/r/20231128201845.489237-1-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-11-23staging: vchiq_arm: move state dump to debugfsStefan Wahren
Besides the IOCTL interface the VCHIQ character device also provides a state dump of the whole VCHIQ driver via read. Moving the state dump function to debugfs has a lot advantages: - following changes on state dump doesn't break userspace ABI - debug doesn't depend on VCHIQ_CDEV - dump code simplifies a lot and reduce the chance of buffer overflows Signed-off-by: Stefan Wahren <wahrenst@gmx.net> Tested-by: "Ricardo B. Marliere" <ricardo@marliere.net> Link: https://lore.kernel.org/r/20231029124837.119832-4-wahrenst@gmx.net Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-11-23staging: vchiq_core: Shorten bulk TX/RX pending dumpStefan Wahren
The calculation for the bulk TX/RX pending is complex and reaches 99 chars per line. So move the size determination below the pending calculation and get the rid of the ternary operator. Signed-off-by: Stefan Wahren <wahrenst@gmx.net> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Link: https://lore.kernel.org/r/20231029124837.119832-3-wahrenst@gmx.net Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-11-23staging: vchiq_core: Make vchiq_dump_service_state staticStefan Wahren
The function vchiq_dump_service_state() is only used by vchiq_dump_state() within vchiq_core.c. So move the definition of vchiq_dump_state() below vchiq_dump_service_state() in order to make it static. Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Stefan Wahren <wahrenst@gmx.net> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Link: https://lore.kernel.org/r/20231029124837.119832-2-wahrenst@gmx.net Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-11-23staging: vc04_services: remove unnecessary NULL checkDan Carpenter
We ensured that "service" as non-NULL in the previous if statement so there is no need to check again here. Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Link: https://lore.kernel.org/r/1dff4d9b-d067-4525-95e0-ffdc1185cccd@moroto.mountain Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-10-27staging: vc04_services: use snprintf instead of sprintfRicardo B. Marliere
All the occurrences of sprintf usage under vc04_services can be safely replaced by snprintf, so as to avoid any possible overflow. Suggested-by: Dan Carpenter <dan.carpenter@linaro.org> Suggested-by: Umang Jain <umang.jain@ideasonboard.com> Signed-off-by: "Ricardo B. Marliere" <ricardo@marliere.net> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Link: https://lore.kernel.org/r/20231025122632.307385-4-ricardo@marliere.net Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-10-25staging: vc04_services: Use %p4cc format modifier to print FourCC codesUmang Jain
Drop VCHIQ_FOURCC_AS_4CHARS macro in favour of %p4cc format modifier to print FourCC codes in the logs. vchiq_use_internal() and vchiq_release_internal() uses entity character-array to store a transient string that contains a FourCC code. Increase the length of entity array(to 64 bytes) since %p4cc requires more bytes to hold the output characters. Suggested-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Link: https://lore.kernel.org/r/20231025060717.71895-2-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-10-25staging: vc04_services: Drop log level mechanismsUmang Jain
Drop the log level remnants since the logs are now ported to use dynamic logging. Drop macros, externs and global variables which were used in the log level mechanisms along with debugfs log entries. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Link: https://lore.kernel.org/r/20231024114428.443528-9-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-10-25staging: vc04_services: Drop VCHIQ_LOG_PREFIX macroUmang Jain
The macro is not used anymore, so drop it. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Link: https://lore.kernel.org/r/20231024114428.443528-8-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-10-25staging: vc04: Convert vchiq_log_trace() to use dynamic debugUmang Jain
Move vchiq_log_trace() custom logging wrapper based on printk to use dynamic debug. The log category is dictated by enum vchiq_log_category which will become the part of the trace string format that will be logged to dynamic debug (for grep). All the vchiq_log_trace() calls are adjusted to use the modified wrapper. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Link: https://lore.kernel.org/r/20231024114428.443528-7-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>