scripts: Add scripts for platform_driver remove

In Linux v6.11, the 'platform_driver' structure 'remove' callback was
updated to return void instead of 'int'. This change impacts all OOT
platform drivers and so instead of editing each manually, add a
coccinelle script to handle updating all platform drivers. This script
is ran by executing the following command ...

 $ spatch --in-place \
   --sp-file /path/to/scripts/coccinelle/platform_driver_remove.cocci
   <driver-source-directory>

Finally, add a test to the conftest script that is used to detect if the
platform driver 'remove' callback returns 'void'.

Bug 4749580

Change-Id: I53d25cc36cc3be97a6eeeb4ccbdf9b7dfda338a9
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3176834
(cherry picked from commit 24826db83f)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3202689
Reviewed-by: Brad Griffis <bgriffis@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Jon Hunter
2024-06-13 16:22:31 +01:00
committed by mobile promotions
parent cc74d1fe1b
commit c463c63993
3 changed files with 96 additions and 0 deletions

View File

@@ -7554,6 +7554,24 @@ compile_test() {
compile_check_conftest "$CODE" "NV_PCI_EPC_EVENT_OPS_STRUCT_HAS_CORE_DEINIT" "" "types"
;;
platform_driver_struct_remove_returns_void)
#
# Determine if the 'platform_driver' structure 'remove' function
# pointer returns void.
#
# Commit 0edb555a65d1 ("platform: Make platform_driver::remove()
# return void") update the platform_driver structure 'remove'
# callback to return void instead of int.
#
CODE="
#include <linux/platform_device.h>
void conftest_platform_driver_struct_remove_returns_void(struct platform_driver *driver) {
void (*fn)(struct platform_device *) = driver->remove;
}"
compile_check_conftest "$CODE" "NV_PLATFORM_DRIVER_STRUCT_REMOVE_RETURNS_VOID" "" "types"
;;
register_shrinker_has_fmt_arg)
#
# Determine if the 'register_shrinker' function