Skip to contentSkip to conversation

package/dahdi-linux: add patch to support Linux 6.11+

PATCH Applied Peter Korsgaard 2 participants 3 messages Dec 13, 2024 – Dec 26, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/dahdi-linux: add patch to support Linux 6.11+

Fixes:
http://autobuild.buildroot.net/results/23f0f7386f7d430c402b24f3b58b1c20c1c8344a/

Linux commit d69d8048459 "driver core: have match() callback in struct bus_type take a const *", which was added in 6.11-rc1, changed the interface for sysfs match callback to accept a const struct device_driver, breaking the build of dahdi-linux:

CC [M] build/dahdi-linux-3.3.0/drivers/dahdi/dahdi-sysfs.o
build/dahdi-linux-3.3.0/drivers/dahdi/dahdi-sysfs.c:275:27: error: initialization
of "int (*)(struct device *, const struct device_driver *)" from incompatible pointer type "int (*)(struct device *, struct device_driver *)" [-Werror=incompatible-pointer-types]
275 | .match = span_match,

Add a patch submitted upstream to fix that.

---
 ...const-struct-device_device-if-needed.patch | 82 +++++++++++++++++++
 1 file changed, 82 insertions(+)
 create mode 100644 package/dahdi-linux/0003-xpp-sysfs-Use-const-struct-device_device-if-needed.patch
package/dahdi-linux/0003-xpp-sysfs-Use-const-struct-device_device-if-needed.patch new file +82 -0
new file mode 100644
index 0000000000..becb82a6d2
@@ -0,0 +1,82 @@
+From ce9de5d1bf9d21c088b01ce9da6f7ff02b0d863d Mon Sep 17 00:00:00 2001
+From: InterLinked1 <[email protected]>
+Date: Mon, 23 Sep 2024 08:04:54 -0400
+Subject: [PATCH] xpp, sysfs: Use const struct device_device if needed.
+
+Kernel commit d69d804845985c29ab5be5a4b3b1f4787893daf8
+changed struct device_driver to be const, so make the
+arguments const on kernels 6.11 and newer.
+
+Resolves: #63
+
+Upstream: https://github.com/asterisk/dahdi-linux/pull/64
+Signed-off-by: Peter Korsgaard <[email protected]>
+---
+ drivers/dahdi/dahdi-sysfs-chan.c | 4 ++++
+ drivers/dahdi/dahdi-sysfs.c      | 4 ++++
+ drivers/dahdi/xpp/xbus-sysfs.c   | 8 ++++++++
+ 3 files changed, 16 insertions(+)
+
+diff --git a/drivers/dahdi/dahdi-sysfs-chan.c b/drivers/dahdi/dahdi-sysfs-chan.c
+index 09d7317..35b7bd4 100644
+--- a/drivers/dahdi/dahdi-sysfs-chan.c
++++ b/drivers/dahdi/dahdi-sysfs-chan.c
+@@ -220,7 +220,11 @@ static void chan_release(struct device *dev)
+ 	chan_dbg(DEVICES, chan, "SYSFS\n");
+ }
+ 
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 11, 0)
++static int chan_match(struct device *dev, const struct device_driver *driver)
++#else
+ static int chan_match(struct device *dev, struct device_driver *driver)
++#endif /* LINUX_VERSION_CODE */
+ {
+ 	struct dahdi_chan *chan;
+ 
+diff --git a/drivers/dahdi/dahdi-sysfs.c b/drivers/dahdi/dahdi-sysfs.c
+index 7477ebc..246514c 100644
+--- a/drivers/dahdi/dahdi-sysfs.c
++++ b/drivers/dahdi/dahdi-sysfs.c
+@@ -42,7 +42,11 @@ module_param(tools_rootdir, charp, 0444);
+ MODULE_PARM_DESC(tools_rootdir,
+ 		"root directory of all tools paths (default /)");
+ 
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 11, 0)
++static int span_match(struct device *dev, const struct device_driver *driver)
++#else
+ static int span_match(struct device *dev, struct device_driver *driver)
++#endif /* LINUX_VERSION_CODE */
+ {
+ 	return 1;
+ }
+diff --git a/drivers/dahdi/xpp/xbus-sysfs.c b/drivers/dahdi/xpp/xbus-sysfs.c
+index 177048b..f78a15e 100644
+--- a/drivers/dahdi/xpp/xbus-sysfs.c
++++ b/drivers/dahdi/xpp/xbus-sysfs.c
+@@ -397,7 +397,11 @@ static struct attribute *xbus_dev_attrs[] = {
+ ATTRIBUTE_GROUPS(xbus_dev);
+ #endif
+ 
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 11, 0)
++static int astribank_match(struct device *dev, const struct device_driver *driver)
++#else
+ static int astribank_match(struct device *dev, struct device_driver *driver)
++#endif /* LINUX_VERSION_CODE */
+ {
+ 	DBG(DEVICES, "SYSFS MATCH: dev->bus_id = %s, driver->name = %s\n",
+ 	    dev_name(dev), driver->name);
+@@ -771,7 +775,11 @@ static DEVICE_ATTR_READER(refcount_xpd_show, dev, buf)
+ 	return len;
+ }
+ 
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 11, 0)
++static int xpd_match(struct device *dev, const struct device_driver *driver)
++#else
+ static int xpd_match(struct device *dev, struct device_driver *driver)
++#endif /* LINUX_VERSION_CODE */
+ {
+ 	struct xpd_driver *xpd_driver;
+ 	xpd_t *xpd;
+-- 
+2.39.5
+
Signature · 6 lines
2.39.5

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw
Quoted 16 lines · Peter Korsgaard

Fixes:
http://autobuild.buildroot.net/results/23f0f7386f7d430c402b24f3b58b1c20c1c8344a/

Linux commit d69d8048459 "driver core: have match() callback in struct bus_type take a const *", which was added in 6.11-rc1, changed the interface for sysfs match callback to accept a const struct device_driver, breaking the build of dahdi-linux:

CC [M] build/dahdi-linux-3.3.0/drivers/dahdi/dahdi-sysfs.o
build/dahdi-linux-3.3.0/drivers/dahdi/dahdi-sysfs.c:275:27: error: initialization
of "int (*)(struct device *, const struct device_driver *)" from
incompatible
pointer type "int (*)(struct device *, struct device_driver *)" [-Werror=incompatible-pointer-types]
275 | .match = span_match,

Quoted 3 lines

Add a patch submitted upstream to fix that.

Applied to master, thanks.

Quoted 109 lines
---
 ...const-struct-device_device-if-needed.patch | 82 +++++++++++++++++++
 1 file changed, 82 insertions(+)
 create mode 100644 

package/dahdi-linux/0003-xpp-sysfs-Use-const-struct-device_device-if-needed.patch

(quoted diff) +0 -0
new file mode 100644
index 0000000000..becb82a6d2

b/package/dahdi-linux/0003-xpp-sysfs-Use-const-struct-device_device-if-needed.patch

package/dahdi-linux/0003-xpp-sysfs-Use-const-struct-device_device-if-needed.patch new file +20 -0
@@ -0,0 +1,82 @@
+From ce9de5d1bf9d21c088b01ce9da6f7ff02b0d863d Mon Sep 17 00:00:00 2001
+From: InterLinked1 <[email protected]>
+Date: Mon, 23 Sep 2024 08:04:54 -0400
+Subject: [PATCH] xpp, sysfs: Use const struct device_device if needed.
+
+Kernel commit d69d804845985c29ab5be5a4b3b1f4787893daf8
+changed struct device_driver to be const, so make the
+arguments const on kernels 6.11 and newer.
+
+Resolves: #63
+
+Upstream: https://github.com/asterisk/dahdi-linux/pull/64
+Signed-off-by: Peter Korsgaard <[email protected]>
+---
+ drivers/dahdi/dahdi-sysfs-chan.c | 4 ++++
+ drivers/dahdi/dahdi-sysfs.c      | 4 ++++
+ drivers/dahdi/xpp/xbus-sysfs.c   | 8 ++++++++
+ 3 files changed, 16 insertions(+)
+
+diff --git a/drivers/dahdi/dahdi-sysfs-chan.c 

b/drivers/dahdi/dahdi-sysfs-chan.c

package/dahdi-linux/0003-xpp-sysfs-Use-const-struct-device_device-if-needed.patch new file +9 -0
+index 09d7317..35b7bd4 100644
+--- a/drivers/dahdi/dahdi-sysfs-chan.c
++++ b/drivers/dahdi/dahdi-sysfs-chan.c
+@@ -220,7 +220,11 @@ static void chan_release(struct device *dev)
+ 	chan_dbg(DEVICES, chan, "SYSFS\n");
+ }
+
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 11, 0)
++static int chan_match(struct device *dev, const struct device_driver 

*driver)
++#else
+ static int chan_match(struct device *dev, struct device_driver *driver)
++#endif /* LINUX_VERSION_CODE */
+ {

package/dahdi-linux/0003-xpp-sysfs-Use-const-struct-device_device-if-needed.patch new file +12 -0
+ 	struct dahdi_chan *chan;
+
+diff --git a/drivers/dahdi/dahdi-sysfs.c b/drivers/dahdi/dahdi-sysfs.c
+index 7477ebc..246514c 100644
+--- a/drivers/dahdi/dahdi-sysfs.c
++++ b/drivers/dahdi/dahdi-sysfs.c
+@@ -42,7 +42,11 @@ module_param(tools_rootdir, charp, 0444);
+ MODULE_PARM_DESC(tools_rootdir,
+ 		"root directory of all tools paths (default /)");
+
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 11, 0)
++static int span_match(struct device *dev, const struct device_driver 

*driver)
++#else
+ static int span_match(struct device *dev, struct device_driver *driver)
++#endif /* LINUX_VERSION_CODE */
+ {

package/dahdi-linux/0003-xpp-sysfs-Use-const-struct-device_device-if-needed.patch new file +3 -0
+ 	return 1;
+ }
+diff --git a/drivers/dahdi/xpp/xbus-sysfs.c 

b/drivers/dahdi/xpp/xbus-sysfs.c

package/dahdi-linux/0003-xpp-sysfs-Use-const-struct-device_device-if-needed.patch new file +9 -0
+index 177048b..f78a15e 100644
+--- a/drivers/dahdi/xpp/xbus-sysfs.c
++++ b/drivers/dahdi/xpp/xbus-sysfs.c
+@@ -397,7 +397,11 @@ static struct attribute *xbus_dev_attrs[] = {
+ ATTRIBUTE_GROUPS(xbus_dev);
+ #endif
+
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 11, 0)
++static int astribank_match(struct device *dev, const struct 

device_driver *driver)
++#else
+ static int astribank_match(struct device *dev, struct device_driver *driver)
++#endif /* LINUX_VERSION_CODE */
+ {

package/dahdi-linux/0003-xpp-sysfs-Use-const-struct-device_device-if-needed.patch new file +3 -0
+ 	DBG(DEVICES, "SYSFS MATCH: dev->bus_id = %s, driver->name = %s\n",
+ 	    dev_name(dev), driver->name);
+@@ -771,7 +775,11 @@ static DEVICE_ATTR_READER(refcount_xpd_show, dev, 

buf)

package/dahdi-linux/0003-xpp-sysfs-Use-const-struct-device_device-if-needed.patch new file +5 -0
+ 	return len;
+ }
+
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 11, 0)
++static int xpd_match(struct device *dev, const struct device_driver 

*driver)
++#else
+ static int xpd_match(struct device *dev, struct device_driver *driver)
++#endif /* LINUX_VERSION_CODE */
+ {

package/dahdi-linux/0003-xpp-sysfs-Use-const-struct-device_device-if-needed.patch new file +5 -1
+ 	struct xpd_driver *xpd_driver;
+ 	xpd_t *xpd;
+--
+2.39.5
+
--

2.39.5

Quoted 4 lines

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#2 lore raw
In reply to Peter Korsgaard
Quoted 15 lines · Peter Korsgaard

Fixes:
http://autobuild.buildroot.net/results/23f0f7386f7d430c402b24f3b58b1c20c1c8344a/

Linux commit d69d8048459 "driver core: have match() callback in struct bus_type take a const *", which was added in 6.11-rc1, changed the interface for sysfs match callback to accept a const struct device_driver, breaking the build of dahdi-linux:

CC [M] build/dahdi-linux-3.3.0/drivers/dahdi/dahdi-sysfs.o
build/dahdi-linux-3.3.0/drivers/dahdi/dahdi-sysfs.c:275:27: error: initialization
of "int (*)(struct device *, const struct device_driver *)" from incompatible pointer type "int (*)(struct device *, struct device_driver *)" [-Werror=incompatible-pointer-types]
275 | .match = span_match,

Quoted 3 lines

Add a patch submitted upstream to fix that.

Committed to 2024.11.x, thanks.

Signature · 5 lines
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot