[PATCH RESEND] coccinelle: platform_no_drv_owner: Handle also built-in drivers

From: Krzysztof Kozlowski

Date: Thu Sep 11 2025 - 14:47:38 EST


builtin_platform_driver() and others also use macro
platform_driver_register() which sets the .owner=THIS_MODULE, so extend
the cocci script to detect these as well.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx>

---

Resend of resend, so I think Julia does not pick up Coccinelle patches.
Andrew or someone from KBuild maintainers, maybe you could grab it?

previouos tries:
https://lore.kernel.org/all/20250104141414.114971-1-krzysztof.kozlowski@xxxxxxxxxx/
https://lore.kernel.org/all/20250501145810.73031-2-krzysztof.kozlowski@xxxxxxxxxx/
---
scripts/coccinelle/api/platform_no_drv_owner.cocci | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/scripts/coccinelle/api/platform_no_drv_owner.cocci b/scripts/coccinelle/api/platform_no_drv_owner.cocci
index 8fa050eeb7e5..5e869858bda8 100644
--- a/scripts/coccinelle/api/platform_no_drv_owner.cocci
+++ b/scripts/coccinelle/api/platform_no_drv_owner.cocci
@@ -10,12 +10,21 @@ virtual org
virtual report

@match1@
+declarer name builtin_i2c_driver;
+declarer name builtin_platform_driver;
+declarer name builtin_platform_driver_probe;
declarer name module_i2c_driver;
declarer name module_platform_driver;
declarer name module_platform_driver_probe;
identifier __driver;
@@
(
+ builtin_i2c_driver(__driver);
+|
+ builtin_platform_driver(__driver);
+|
+ builtin_platform_driver_probe(__driver, ...);
+|
module_i2c_driver(__driver);
|
module_platform_driver(__driver);
--
2.48.1