summaryrefslogtreecommitdiff
path: root/drivers/staging/vc04_services
AgeCommit message (Collapse)AuthorFilesLines
2024-03-05Staging: vc04_services: bcm2835-camera: fix brace code style checkMoritz C. Weber1-32/+28
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. Weber1-1/+0
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. Marliere2-2/+2
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 Jain1-1/+1
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 Jain1-4/+3
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 Jain5-161/+106
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 Jain4-95/+78
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 Jain3-35/+29
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 Jain5-117/+101
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 Jain2-3/+5
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 Jain1-3/+3
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 Wahren6-258/+107
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 Wahren1-7/+12
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 Wahren2-87/+85
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 Carpenter1-2/+1
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. Marliere2-9/+9
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 Jain4-40/+33
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 Jain5-175/+33
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 Jain1-2/+0
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 Jain4-43/+55
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>
2023-10-25staging: vc04: Convert(and rename) vchiq_log_info() to use dynamic debugUmang Jain4-128/+137
Convert(and rename) vchiq_log_info() custom logging wrapping based on printk to use dynamic debug. The wrapper is now renamed to vchiq_log_debug() since most of the usage is around printing debug information. The log category is dictated by enum vchiq_log_category which will become the part of the debug string format that will be logged to dynamic debug (for grep). All the vchiq_log_info() calls are adjusted to use the modified wrapper vchiq_log_debug(). The existing custom logging for vchiq_log_info() also tries to log trace messages using SRVTRACE_LEVEL. This is simply moved to use the vchiq_log_debug() directly. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Link: https://lore.kernel.org/r/20231024114428.443528-6-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-10-25staging: vc04: Convert vchiq_log_warning() to use dynamic debugUmang Jain3-14/+15
Move vchiq_log_warning() custom logging wrapper based on printk to use dynamic debug. The log category is dictated by vchiq_log_category which will become the part of the warning string format that will be logged to dynamic debug (for grep). All the vchiq_log_warning() calls are adjusted to use the modified wrapper. While at that, remove the extraneous "----" from few of the warning string text. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Link: https://lore.kernel.org/r/20231024114428.443528-5-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-10-25staging: vc04: Convert vchiq_log_error() to use dynamic debugUmang Jain5-94/+88
Move vchiq_log_error() custom logging wrapper based on printk, to use dynamic debug. To categorise, enum vchiq_log_category has been introduced, which will become the part of the error string format that will be logged to dynamic debug (for grep). All the vchiq_log_error() calls are adjusted to use the dynamic debug wrapper. vchiq_loud_error_*() has been removed as a part of this patch and replaced with dev_err (so that they directly end up in kernel log, even if dynamic debug isn't enabled), which serves the purpose. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Link: https://lore.kernel.org/r/20231024114428.443528-4-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-10-25staging: vc04_services: Pass struct device to vchiq_init_slots()Umang Jain3-3/+3
Pass struct device pointer to vchiq_init_slots(). In subsequent commits, vchiq_log_* macros will be ported to use dynamic debug (dev_dbg()), hence they need access to a struct device pointer. No functional changes intended in this commit. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Link: https://lore.kernel.org/r/20231024114428.443528-3-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-10-25staging: vc04_services: Pass struct device to vchiq_log_dump_mem()Umang Jain2-6/+8
Pass struct device pointer to vchiq_log_dump_mem(). In subsequent commits, vchiq_log_* macros will be ported to use dynamic debug (dev_dbg()), hence they need access to a struct device pointer. No functional changes intended in this commit. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Link: https://lore.kernel.org/r/20231024114428.443528-2-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-10-21staging: bcm2835-audio: remove function snd_bcm2835_new_ctl()Calvince Otieno1-1/+0
The function snd_bcm2835_new_ctl() is declared but not defined. Its definition was removed 1 year ago in the commit 143b67f19ba1 ("staging: bcm2835-audio: remove compat ALSA card") Signed-off-by: Calvince Otieno <calvncce@gmail.com> Link: https://lore.kernel.org/r/ZTDap2d5X7eXXPo2@lab-ubuntu Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-10-21staging: vc04_services: bcm2835-camera: Drop MODULE_ALIASUmang Jain1-1/+7
Drop MODULE_ALIAS in favour of MODULE_DEVICE_TABLE as the module alias should be picked from there. 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/20231019090128.430297-4-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-10-21staging: vc04_services: bcm2835-audio: Drop MODULE_ALIASUmang Jain1-1/+7
Drop MODULE_ALIAS in favour of MODULE_DEVICE_TABLE as the module alias should be dropped from there. 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/20231019090128.430297-3-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-10-21staging: vc04_services: Support module autoloading using MODULE_DEVICE_TABLEUmang Jain2-1/+4
VC04 has now a independent bus vchiq_bus to register its devices. However, the module auto-loading for bcm2835-audio and bcm2835-camera currently happens through MODULE_ALIAS() macro specified explicitly. The correct way to auto-load a module, is when the alias is picked out from MODULE_DEVICE_TABLE(). In order to get there, we need to introduce vchiq_device_id and add relevant entries in file2alias.c infrastructure so that aliases can be generated. This patch targets adding vchiq_device_id and do_vchiq_entry, in order to generate those alias using the /script/mod/file2alias.c. Going forward the MODULE_ALIAS() from bcm2835-camera and bcm2835-audio will be dropped, in favour of MODULE_DEVICE_TABLE being used there. The alias format for vchiq_bus devices will be "vchiq:<dev_name>". Adjust the vchiq_bus_uevent() to reflect that. 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/20231019090128.430297-2-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-10-21staging: vc04_services: vchiq_bus: Do not kfree deviceUmang Jain1-1/+0
As per device_register() documentation, this kfree() on error path will crash. The call to put_device() is all that is needed here to free the memory. Fixes: 027e5703de6b ("staging: vc04_services: vchiq_arm: Add new bus type and device type") Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Stefan Wahren <stefan.wahren@i2se.com> Link: https://lore.kernel.org/r/20231018055228.825524-1-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-10-05staging: bcm2835-audio: Register bcm2835-audio with vchiq_bus_typeUmang Jain2-35/+12
Similar to how bcm2385-camera device is registered, register the bcm2835-audio with vchiq_bus_type as well. Since we moved away bcm2835-audio from platform driver/device, we have to set the DMA mask explicitly. Set the DMA mask at probe time. Meanwhile at it, change the name and module alias from "bcm2835_audio" to "bcm2835-audio" to be consistent with bcm2835-camera device. This does not brings any functional change as '-' and '_' are interchangeable as per modprobe man pages. Also, drop vchiq_register_child() helper which is no longer needed after this patch. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Link: https://lore.kernel.org/r/20230923143200.268063-7-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-10-05staging: bcm2835-camera: Register bcm2835-camera with vchiq_bus_typeUmang Jain2-13/+19
Register the bcm2835-camera with the vchiq_bus_type instead of using platform driver/device. Since we moved away bcm2835-camera from platform driver/device, we have to set the DMA mask explicitly. Set the DMA mask at probe time. Also the VCHIQ firmware doesn't support device enumeration, hence one has to maintain a list of devices to be registered in the interface. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Link: https://lore.kernel.org/r/20230923143200.268063-6-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-10-05staging: vc04_services: vchiq_arm: Register vchiq_bus_typeUmang Jain1-1/+12
Register the vchiq_bus_type bus with the vchiq interface. The bcm2835-camera and bcm2835_audio will be registered to this bus type going ahead. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Link: https://lore.kernel.org/r/20230923143200.268063-5-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-10-05staging: vc04_services: vchiq_arm: Add new bus type and device typeUmang Jain3-0/+155
The devices that the vchiq interface registers (bcm2835-audio, bcm2835-camera) are implemented and exposed by the VC04 firmware. The device tree describes the VC04 itself with the resources required to communicate with it through a mailbox interface. However, the vchiq interface registers these devices as platform devices. This also means the specific drivers for these devices are getting registered as platform drivers. This is not correct and a blatant abuse of platform device/driver. Add a new bus type, vchiq_bus_type and device type (struct vchiq_device) which will be used to migrate child devices that the vchiq interfaces creates/registers from the platform device/driver. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Link: https://lore.kernel.org/r/20230923143200.268063-4-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-10-05staging: vc04_services: bcm2835-audio: Explicitly set DMA maskUmang Jain1-0/+7
In the following patches, vchiq_arm will be migrated to create and use its own bus and all the vchiq drivers (bcm2835-camera, bcm2835-audio) will be registered to it. Since the platform driver/device model internally sets the DMA mask for its registered devices, we would have to do it ourself when we remove the platform driver/device registration for vchiq devices. This patch explicitly sets the DMA mask to bcm2835-audio so as not to introduce a regression when we move away from platform device/driver model. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Link: https://lore.kernel.org/r/20230923143200.268063-3-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-10-05staging: vc04_services: bcm2835-camera: Explicitly set DMA maskUmang Jain1-0/+6
In the following patches, vchiq_arm will be migrated to create and use its own bus and all the vchiq drivers (bcm2835-camera, bcm2835-audio) will be registered to it. Since the platform driver/device model internally sets the DMA mask for its registered devices, we would have to do it ourself when we remove the platform driver/device registration for vchiq devices. This patch explicitly sets the DMA mask to bcm2835-camera so as not to introduce a regression when we move away from platform device/driver model. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Link: https://lore.kernel.org/r/20230923143200.268063-2-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-06-20staging: vchiq_arm: Remove extra struct vchiq_instance declarationUmang Jain1-2/+0
Additional declaration of struct vchiq_instance was introduced in the commit 726e79f8a648 ("staging: vchiq_arm: pass vchiq instance to service callbacks"). Drop the extra declaration. Fixes: 726e79f8a648 ("staging: vchiq_arm: pass vchiq instance to service callbacks") Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Stefan Wahren <stefan.wahren@i2se.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Link: https://lore.kernel.org/r/20221221074047.233473-1-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-05-28staging: vchiq_arm: mark vchiq_platform_init() staticArnd Bergmann1-2/+2
This function has no callers from other files, and the declaration was removed a while ago, causing a W=1 warning: drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:465:5: error: no previous prototype for 'vchiq_platform_init' Marking it static solves this problem but introduces a new warning since gcc determines that 'g_fragments_base' is never initialized in some kernel configurations: In file included from include/linux/string.h:254, from include/linux/bitmap.h:11, from include/linux/cpumask.h:12, from include/linux/mm_types_task.h:14, from include/linux/mm_types.h:5, from include/linux/buildid.h:5, from include/linux/module.h:14, from drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:8: In function 'memcpy_to_page', inlined from 'free_pagelist' at drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:433:4: include/linux/fortify-string.h:57:33: error: argument 2 null where non-null expected [-Werror=nonnull] include/linux/highmem.h:427:9: note: in expansion of macro 'memcpy' 427 | memcpy(to + offset, from, len); | ^~~~~~ Add a NULL pointer check for this in addition to the static annotation to avoid both. Fixes: 89cc4218f640 ("staging: vchiq_arm: drop unnecessary declarations") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Link: https://lore.kernel.org/r/20230516202603.560554-1-arnd@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-04-28Merge tag 'modules-6.4-rc1' of ↵Linus Torvalds1-1/+1
git://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux Pull module updates from Luis Chamberlain: "The summary of the changes for this pull requests is: - Song Liu's new struct module_memory replacement - Nick Alcock's MODULE_LICENSE() removal for non-modules - My cleanups and enhancements to reduce the areas where we vmalloc module memory for duplicates, and the respective debug code which proves the remaining vmalloc pressure comes from userspace. Most of the changes have been in linux-next for quite some time except the minor fixes I made to check if a module was already loaded prior to allocating the final module memory with vmalloc and the respective debug code it introduces to help clarify the issue. Although the functional change is small it is rather safe as it can only *help* reduce vmalloc space for duplicates and is confirmed to fix a bootup issue with over 400 CPUs with KASAN enabled. I don't expect stable kernels to pick up that fix as the cleanups would have also had to have been picked up. Folks on larger CPU systems with modules will want to just upgrade if vmalloc space has been an issue on bootup. Given the size of this request, here's some more elaborate details: The functional change change in this pull request is the very first patch from Song Liu which replaces the 'struct module_layout' with a new 'struct module_memory'. The old data structure tried to put together all types of supported module memory types in one data structure, the new one abstracts the differences in memory types in a module to allow each one to provide their own set of details. This paves the way in the future so we can deal with them in a cleaner way. If you look at changes they also provide a nice cleanup of how we handle these different memory areas in a module. This change has been in linux-next since before the merge window opened for v6.3 so to provide more than a full kernel cycle of testing. It's a good thing as quite a bit of fixes have been found for it. Jason Baron then made dynamic debug a first class citizen module user by using module notifier callbacks to allocate / remove module specific dynamic debug information. Nick Alcock has done quite a bit of work cross-tree to remove module license tags from things which cannot possibly be module at my request so to: a) help him with his longer term tooling goals which require a deterministic evaluation if a piece a symbol code could ever be part of a module or not. But quite recently it is has been made clear that tooling is not the only one that would benefit. Disambiguating symbols also helps efforts such as live patching, kprobes and BPF, but for other reasons and R&D on this area is active with no clear solution in sight. b) help us inch closer to the now generally accepted long term goal of automating all the MODULE_LICENSE() tags from SPDX license tags In so far as a) is concerned, although module license tags are a no-op for non-modules, tools which would want create a mapping of possible modules can only rely on the module license tag after the commit 8b41fc4454e ("kbuild: create modules.builtin without Makefile.modbuiltin or tristate.conf"). Nick has been working on this *for years* and AFAICT I was the only one to suggest two alternatives to this approach for tooling. The complexity in one of my suggested approaches lies in that we'd need a possible-obj-m and a could-be-module which would check if the object being built is part of any kconfig build which could ever lead to it being part of a module, and if so define a new define -DPOSSIBLE_MODULE [0]. A more obvious yet theoretical approach I've suggested would be to have a tristate in kconfig imply the same new -DPOSSIBLE_MODULE as well but that means getting kconfig symbol names mapping to modules always, and I don't think that's the case today. I am not aware of Nick or anyone exploring either of these options. Quite recently Josh Poimboeuf has pointed out that live patching, kprobes and BPF would benefit from resolving some part of the disambiguation as well but for other reasons. The function granularity KASLR (fgkaslr) patches were mentioned but Joe Lawrence has clarified this effort has been dropped with no clear solution in sight [1]. In the meantime removing module license tags from code which could never be modules is welcomed for both objectives mentioned above. Some developers have also welcomed these changes as it has helped clarify when a module was never possible and they forgot to clean this up, and so you'll see quite a bit of Nick's patches in other pull requests for this merge window. I just picked up the stragglers after rc3. LWN has good coverage on the motivation behind this work [2] and the typical cross-tree issues he ran into along the way. The only concrete blocker issue he ran into was that we should not remove the MODULE_LICENSE() tags from files which have no SPDX tags yet, even if they can never be modules. Nick ended up giving up on his efforts due to having to do this vetting and backlash he ran into from folks who really did *not understand* the core of the issue nor were providing any alternative / guidance. I've gone through his changes and dropped the patches which dropped the module license tags where an SPDX license tag was missing, it only consisted of 11 drivers. To see if a pull request deals with a file which lacks SPDX tags you can just use: ./scripts/spdxcheck.py -f \ $(git diff --name-only commid-id | xargs echo) You'll see a core module file in this pull request for the above, but that's not related to his changes. WE just need to add the SPDX license tag for the kernel/module/kmod.c file in the future but it demonstrates the effectiveness of the script. Most of Nick's changes were spread out through different trees, and I just picked up the slack after rc3 for the last kernel was out. Those changes have been in linux-next for over two weeks. The cleanups, debug code I added and final fix I added for modules were motivated by David Hildenbrand's report of boot failing on a systems with over 400 CPUs when KASAN was enabled due to running out of virtual memory space. Although the functional change only consists of 3 lines in the patch "module: avoid allocation if module is already present and ready", proving that this was the best we can do on the modules side took quite a bit of effort and new debug code. The initial cleanups I did on the modules side of things has been in linux-next since around rc3 of the last kernel, the actual final fix for and debug code however have only been in linux-next for about a week or so but I think it is worth getting that code in for this merge window as it does help fix / prove / evaluate the issues reported with larger number of CPUs. Userspace is not yet fixed as it is taking a bit of time for folks to understand the crux of the issue and find a proper resolution. Worst come to worst, I have a kludge-of-concept [3] of how to make kernel_read*() calls for modules unique / converge them, but I'm currently inclined to just see if userspace can fix this instead" Link: https://lore.kernel.org/all/Y/kXDqW+7d71C4wz@bombadil.infradead.org/ [0] Link: https://lkml.kernel.org/r/025f2151-ce7c-5630-9b90-98742c97ac65@redhat.com [1] Link: https://lwn.net/Articles/927569/ [2] Link: https://lkml.kernel.org/r/20230414052840.1994456-3-mcgrof@kernel.org [3] * tag 'modules-6.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux: (121 commits) module: add debugging auto-load duplicate module support module: stats: fix invalid_mod_bytes typo module: remove use of uninitialized variable len module: fix building stats for 32-bit targets module: stats: include uapi/linux/module.h module: avoid allocation if module is already present and ready module: add debug stats to help identify memory pressure module: extract patient module check into helper modules/kmod: replace implementation with a semaphore Change DEFINE_SEMAPHORE() to take a number argument module: fix kmemleak annotations for non init ELF sections module: Ignore L0 and rename is_arm_mapping_symbol() module: Move is_arm_mapping_symbol() to module_symbol.h module: Sync code of is_arm_mapping_symbol() scripts/gdb: use mem instead of core_layout to get the module address interconnect: remove module-related code interconnect: remove MODULE_LICENSE in non-modules zswap: remove MODULE_LICENSE in non-modules zpool: remove MODULE_LICENSE in non-modules x86/mm/dump_pagetables: remove MODULE_LICENSE in non-modules ...
2023-04-18Change DEFINE_SEMAPHORE() to take a number argumentPeter Zijlstra1-1/+1
Fundamentally semaphores are a counted primitive, but DEFINE_SEMAPHORE() does not expose this and explicitly creates a binary semaphore. Change DEFINE_SEMAPHORE() to take a number argument and use that in the few places that open-coded it using __SEMAPHORE_INITIALIZER(). Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> [mcgrof: add some tribal knowledge about why some folks prefer binary sempahores over mutexes] Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org> Reviewed-by: Davidlohr Bueso <dave@stgolabs.net> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
2023-04-03staging: vc04_services: vchiq_arm: Convert to platform remove callback ↵Uwe Kleine-König1-4/+2
returning void The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230403154014.2564054-25-u.kleine-koenig@pengutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-04-03staging: vc04_services: bcm2835-camera: Convert to platform remove callback ↵Uwe Kleine-König1-4/+2
returning void The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230403154014.2564054-24-u.kleine-koenig@pengutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-01-31staging: vc04_services: mmal-vchiq: fix typo in commentJongwoo Han1-1/+1
Correct typo from 'witin' to 'within' in comment. Signed-off-by: Jongwoo Han <jongwooo.han@gmail.com> Link: https://lore.kernel.org/r/20230130164250.51877-1-jongwooo.han@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-01-27staging: vchiq_arm: Improve error log for vchiq_platform_initStefan Wahren1-3/+9
During sending the base address of the slots to the VideoCore firmware via mailbox property, issues could happened on the ARM and on the VideoCore side. So better separate the error handling in order to provide more details. This should help to narrow down the possible cause. Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Link: https://lore.kernel.org/r/20230123191629.21019-1-stefan.wahren@i2se.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-01-23staging: vc04_services: interface: Drop include Makefile directiveUmang Jain3-4/+3
Drop the include directive. They can break the build, when one only wants to build a subdirectory. Replace with "../" for the includes, in the interface/ files instead. Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Link: https://lore.kernel.org/r/20230120201104.606876-6-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-01-23staging: vc04_services: vchiq-mmal: Drop include Makefile directiveUmang Jain2-5/+1
Drop the include directive. They can break the build, when one only wants to build a subdirectory. Replace with "../" for the includes, in the mmal-vchiq.c instead. Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Link: https://lore.kernel.org/r/20230120201104.606876-5-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-01-23staging: vc04_services: bcm2835-camera: Drop include Makefile directiveUmang Jain3-12/+8
Drop the include directive. They can break the build, when one only wants to build a subdirectory. Replace with "../" for the includes, in the bcm2835-camera files instead. Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Link: https://lore.kernel.org/r/20230120201104.606876-4-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-01-23staging: vc04_services: bcm2835-audio: Drop include Makefile directiveUmang Jain2-3/+2
Drop the include directive. They can break the build, when one only wants to build a subdirectory. Replace with "../" for the includes, in the bcm2835.h instead. Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Link: https://lore.kernel.org/r/20230120201104.606876-3-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-01-23staging: vc04_services: Drop __VCCOREVER__ remnantsUmang Jain3-5/+3
Commit 8ba5f91bab63 ("staging: vc04_services: remove __VCCOREVER__") was meant to remove all of __VCCOREVER__ definitions but missed to remove a few. Hence, drop them now. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Link: https://lore.kernel.org/r/20230120201104.606876-2-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-01-17staging: vc04_services: vchiq: Drop custom return values from TODOUmang Jain1-5/+0
The custom return values (enum vchiq_status) has been dropped. Remove the TODO entry for the same. Signed-off-by: Umang Jain <umang.jain@ideasonboard.com> Tested-by: Stefan Wahren <stefan.wahren@i2se.com> Link: https://lore.kernel.org/r/20221223122404.170585-8-umang.jain@ideasonboard.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>