From f53b127ca9d7fc0969c0ee3499d8c55aebfe8116 Mon Sep 17 00:00:00 2001
From: Kamila Wojciechowska <nullbytepl@gmail.com>
Date: Mon, 29 Jul 2024 21:12:16 +0200
Subject: [PATCH] Actually fix building on Linux 6.8+
Patch-Source: https://gitlab.com/ddcci-driver-linux/ddcci-driver-linux/-/commit/f53b127ca9d7fc0969c0ee3499d8c55aebfe8116.patch

Since the previous patch adding compatiblity with Linux 6.8 (7f851f5f),
auto-probing has been broken anyway, so we might as well completely drop
the deprecated class mechanism (when building on 6.8+), as other I2C
device classes will get removed in the future anyway (like I2C_CLASS_SPD
has in 6.10).
---
 ddcci/ddcci.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/ddcci/ddcci.c b/ddcci/ddcci.c
index d107f8c..13ddb85 100644
--- a/ddcci/ddcci.c
+++ b/ddcci/ddcci.c
@@ -1824,7 +1824,9 @@ static struct i2c_driver ddcci_driver = {
 	#else
 	.remove		= ddcci_remove,
 	#endif
-	.class		= I2C_CLASS_SPD,
+	#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 8, 0)
+	.class		= I2C_CLASS_DDC,
+	#endif
 	.detect		= ddcci_detect,
 	.address_list	= I2C_ADDRS(
 		DDCCI_DEFAULT_DEVICE_ADDR>>1
@@ -1840,6 +1842,11 @@ static int __init ddcci_module_init(void)
 	int ret;
 
 	pr_debug("initializing ddcci driver\n");
+
+	#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 8, 0)
+	pr_warn("WARNING: Auto-probing of displays is not available on kernel 6.8 and later\n");
+	#endif
+
 	/* Allocate a device number region for the character devices */
 	ret = alloc_chrdev_region(&ddcci_cdev_first, 0, 128, DEVICE_NAME);
 	if (ret < 0) {
-- 
GitLab