diff mbox series

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

Message ID 20240719203934.2090944-1-thomas.petazzoni@bootlin.com
State Accepted
Headers show
Series package/igh-ethercat: backport fix to build with Linux 6.9 | expand

Commit Message

Thomas Petazzoni July 19, 2024, 8:39 p.m. UTC
This commit backports a patch from upstream that fixes the build with
Linux 6.9.

Fixes:

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

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 ...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

Comments

Thomas Petazzoni July 30, 2024, 7:35 a.m. UTC | #1
On Fri, 19 Jul 2024 22:39:33 +0200
Thomas Petazzoni via buildroot <buildroot@buildroot.org> wrote:

> This commit backports a patch from upstream that fixes the build with
> Linux 6.9.
> 
> Fixes:
> 
>   http://autobuild.buildroot.net/results/db2462b1c5c6797a0edca66a513c121dbddd8888/
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> ---
>  ...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
diff mbox series

Patch

diff --git a/package/igh-ethercat/0001-Remove-dev_base_lock-for-linux-6.9.0.patch b/package/igh-ethercat/0001-Remove-dev_base_lock-for-linux-6.9.0.patch
new file mode 100644
index 0000000000..a71edb7be6
--- /dev/null
+++ b/package/igh-ethercat/0001-Remove-dev_base_lock-for-linux-6.9.0.patch
@@ -0,0 +1,51 @@ 
+From 09eb1b9f73d677d10d18039305b9d974e52cc6d5 Mon Sep 17 00:00:00 2001
+From: Nicola Fontana <ntd@entidi.it>
+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 <thomas.petazzoni@bootlin.com>
+---
+ 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
+