aports/testing/ddcci-driver-linux-src/e0605c9cdff7bf3fe9587434614473ba8b7e5f63.patch
Hugo Osvaldo Barrera ca53f86937 testing/ddcci-driver-linux-src: fix builds with linux 6.8 thru 6.11
All three patches are merged (but not yet released) upstream.

See: f53b127ca9.patch
See: 7853cbfc28.patch
See: e0605c9cdf.patch
2025-03-17 16:42:07 +00:00

64 lines
2.3 KiB
Diff

commit e0605c9cdff7bf3fe9587434614473ba8b7e5f63
Author: Kamila Wojciechowska <nullbytepl@gmail.com>
Date: Fri Sep 27 18:00:52 2024 +0200
Patch-Source: https://gitlab.com/ddcci-driver-linux/ddcci-driver-linux/-/commit/e0605c9cdff7bf3fe9587434614473ba8b7e5f63.patch
Adjust to bus_type changes in 6.11+
Reference: https://lore.kernel.org/all/2024070136-wrongdoer-busily-01e8@gregkh/
Adds a new macro (DDCCI_DRV_CONST) to avoid LINUX_VERSION_CODE conditionals everywhere.
diff --git a/ddcci/ddcci.c b/ddcci/ddcci.c
index 13ddb85..6b41eab 100644
--- a/ddcci/ddcci.c
+++ b/ddcci/ddcci.c
@@ -1228,10 +1228,10 @@ static const struct ddcci_device_id *ddcci_match_id(const struct ddcci_device_id
return NULL;
}
-static int ddcci_device_match(struct device *dev, struct device_driver *drv)
+static int ddcci_device_match(struct device *dev, DDCCI_DRV_CONST struct device_driver *drv)
{
struct ddcci_device *device = ddcci_verify_device(dev);
- struct ddcci_driver *driver;
+ DDCCI_DRV_CONST struct ddcci_driver *driver;
if (!device)
return 0;
@@ -1247,7 +1247,7 @@ static int ddcci_device_match(struct device *dev, struct device_driver *drv)
static int ddcci_device_probe(struct device *dev)
{
struct ddcci_device *device = ddcci_verify_device(dev);
- struct ddcci_driver *driver;
+ DDCCI_DRV_CONST struct ddcci_driver *driver;
const struct ddcci_device_id *id;
int ret = 0;
@@ -1268,7 +1268,7 @@ static int ddcci_device_probe(struct device *dev)
static int ddcci_device_remove(struct device *dev)
{
struct ddcci_device *device = ddcci_verify_device(dev);
- struct ddcci_driver *driver;
+ DDCCI_DRV_CONST struct ddcci_driver *driver;
int ret = 0;
if (!device)
diff --git a/include/linux/ddcci.h b/include/linux/ddcci.h
index f847c22..f2999d5 100644
--- a/include/linux/ddcci.h
+++ b/include/linux/ddcci.h
@@ -131,7 +131,13 @@ struct ddcci_driver {
struct device_driver driver;
struct ddcci_device_id *id_table;
};
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 11, 0)
+#define to_ddcci_driver(d) container_of_const(d, struct ddcci_driver, driver)
+#define DDCCI_DRV_CONST const
+#else
#define to_ddcci_driver(d) container_of(d, struct ddcci_driver, driver)
+#define DDCCI_DRV_CONST
+#endif
int ddcci_register_driver(struct module *owner, struct ddcci_driver *driver);
#define ddcci_add_driver(driver) \