Skip to contentSkip to conversation

package/igh-ethercat: backport fix to build with Linux 6.9

PATCH Applied Thomas Petazzoni via buildroot 1 participant 2 messages Jul 19, 2024 – Jul 30, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/igh-ethercat: backport fix to build with Linux 6.9

This commit backports a patch from upstream that fixes the build with Linux 6.9.

Fixes:

http://autobuild.buildroot.net/results/db2462b1c5c6797a0edca66a513c121dbddd8888/

---
 ...Remove-dev_base_lock-for-linux-6.9.0.patch | 51 +++++++++++++++++++
 1 file changed, 51 insertions(+)
 create mode 100644 package/igh-ethercat/0001-Remove-dev_base_lock-for-linux-6.9.0.patch
package/igh-ethercat/0001-Remove-dev_base_lock-for-linux-6.9.0.patch new file +51 -0
new file mode 100644
index 0000000000..a71edb7be6
@@ -0,0 +1,51 @@
+From 09eb1b9f73d677d10d18039305b9d974e52cc6d5 Mon Sep 17 00:00:00 2001
+From: Nicola Fontana <[email protected]>
+Date: Mon, 3 Jun 2024 12:45:48 +0200
+Subject: [PATCH] Remove dev_base_lock for linux >= 6.9.0
+
+Kernel commit 1b3ef46cb7f2618cc0b507393220a69810f6da12 removed
+`dev_base_lock` from v6.9 onward.
+
+Use the alternate iterator `for_each_netdev_rcu` introduced by commit
+c6d14c84566d6b70ad9dc1618db0dec87cca9300 in 2.6.33+.
+
+Upstream: https://gitlab.com/etherlab.org/ethercat/-/commit/95c25b50711ca7e1f990bdcbca8fa713c942ab01
+Signed-off-by: Thomas Petazzoni <[email protected]>
+---
+ devices/generic.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/devices/generic.c b/devices/generic.c
+index 4d4d9bbd..f30f1e17 100644
+--- a/devices/generic.c
++++ b/devices/generic.c
+@@ -420,14 +420,14 @@ int __init ec_gen_init_module(void)
+     INIT_LIST_HEAD(&generic_devices);
+     INIT_LIST_HEAD(&descs);
+ 
+-    read_lock(&dev_base_lock);
+-    for_each_netdev(&init_net, netdev) {
++    rcu_read_lock();
++    for_each_netdev_rcu(&init_net, netdev) {
+         if (netdev->type != ARPHRD_ETHER)
+             continue;
+         desc = kmalloc(sizeof(ec_gen_interface_desc_t), GFP_ATOMIC);
+         if (!desc) {
+             ret = -ENOMEM;
+-            read_unlock(&dev_base_lock);
++            rcu_read_unlock();
+             goto out_err;
+         }
+         strncpy(desc->name, netdev->name, IFNAMSIZ);
+@@ -436,7 +436,7 @@ int __init ec_gen_init_module(void)
+         memcpy(desc->dev_addr, netdev->dev_addr, ETH_ALEN);
+         list_add_tail(&desc->list, &descs);
+     }
+-    read_unlock(&dev_base_lock);
++    rcu_read_unlock();
+ 
+     list_for_each_entry_safe(desc, next, &descs, list) {
+         ret = offer_device(desc);
+-- 
+2.45.2
+
Signature · 6 lines
2.45.2

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw
Quoted 5 lines · On Fri, 19 Jul 2024 22:39:33 +0200 Thomas Petazzoni via buildroot…

This commit backports a patch from upstream that fixes the build with Linux 6.9.

Fixes:

Quoted 7 lines

http://autobuild.buildroot.net/results/db2462b1c5c6797a0edca66a513c121dbddd8888/

---
 ...Remove-dev_base_lock-for-linux-6.9.0.patch | 51 +++++++++++++++++++
 1 file changed, 51 insertions(+)
 create mode 100644 package/igh-ethercat/0001-Remove-dev_base_lock-for-linux-6.9.0.patch

Applied to master, thanks.

Thomas

Signature · 7 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot