[PATCH 2/2] driver core: class: warn if a compatibility class is registered

Heiner Kallweit
2024-09-02T19:02:17Z

Kernel doc for this function states:
"Compatibility class are meant as a temporary user-space compatibility
workaround when converting a family of class devices to a bus devices."

Therefore remind any potential user of the old ABI that support for it
will be dropped soon.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
drivers/base/class.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/base/class.c b/drivers/base/class.c
index 7b38fdf8e..f12a43736 100644
--- a/drivers/base/class.c
+++ b/drivers/base/class.c
@@ -556,6 +556,9 @@ struct class_compat *class_compat_register(const char *name)
{
struct class_compat *cls;

+ pr_warn("Compatibility class %s will go away soon, please migrate userspace tools to use bus devices\n",
+ name);
+
cls = kmalloc(sizeof(struct class_compat), GFP_KERNEL);
if (!cls)
return NULL;
--
2.46.0