Skip to contentSkip to conversation

package/wilc-driver: fix build failure with Linux 6.3+

PATCH Superseded Giulio Benetti 3 participants 4 messages Sep 27, 2023 – Sep 30, 2023

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/wilc-driver: fix build failure with Linux 6.3+

Add local patches pending upstream to fix build failure on Linux 6.3+

Fixes:
http://autobuild.buildroot.net/results/3b954399aa3ffab9609da1fc381f38f28bd8eb9f

---
 .../wilc-driver/0006-Support-Linux-6.3.patch  | 48 +++++++++++++++++++
 .../wilc-driver/0007-Support-Linux-6.4.patch  | 36 ++++++++++++++
 2 files changed, 84 insertions(+)
 create mode 100644 package/wilc-driver/0006-Support-Linux-6.3.patch
 create mode 100644 package/wilc-driver/0007-Support-Linux-6.4.patch
package/wilc-driver/0006-Support-Linux-6.3.patch new file +48 -0
new file mode 100644
index 0000000000..58239b5dc9
@@ -0,0 +1,48 @@
+From 1b6e5e4acfcca58094fb4bb6e2bfc0461c5b411d Mon Sep 17 00:00:00 2001
+From: Giulio Benetti <[email protected]>
+Date: Wed, 27 Sep 2023 10:54:18 +0200
+Subject: [PATCH] Support Linux 6.3
+
+With Linux 6.3 commit:
+https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=40fc56ee608cdb20022c225ac6f1e4b7ba63f8f1
+function of_get_named_gpio_flags() has been dropped but it was only a
+wrapper to call of_get_named_gpio() if the flags passed was NULL and this
+is the case. So let's use of_get_named_gpio() in place of
+of_get_named_gpio_flags() if Linux version >= 6.3
+
+Upstream: https://github.com/embeddedTS/wilc3000-external-module/pull/4
+
+Signed-off-by: Giulio Benetti <[email protected]>
+---
+ power.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/power.c b/power.c
+index 6c59e0b..c957c7b 100644
+--- a/power.c
++++ b/power.c
+@@ -25,13 +25,21 @@ int wilc_of_parse_power_pins(struct wilc *wilc)
+ 	const struct wilc_power_gpios *gpios = &default_gpios[0];
+ 	int ret;
+ 
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)
++	power->gpios.reset = of_get_named_gpio(of, "reset-gpios", 0);
++#else
+ 	power->gpios.reset = of_get_named_gpio_flags(of, "reset-gpios", 0,
+ 						     NULL);
++#endif
+ 	if (!gpio_is_valid(power->gpios.reset))
+ 		power->gpios.reset = gpios->reset;
+ 
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)
++	power->gpios.chip_en = of_get_named_gpio(of, "chip_en-gpios", 0);
++#else
+ 	power->gpios.chip_en = of_get_named_gpio_flags(of, "chip_en-gpios", 0,
+ 						       NULL);
++#endif
+ 	if (!gpio_is_valid(power->gpios.chip_en))
+ 		power->gpios.chip_en = gpios->chip_en;
+ 
+-- 
+2.34.1
+
package/wilc-driver/0007-Support-Linux-6.4.patch new file +36 -0
new file mode 100644
index 0000000000..8339cc3cb6
@@ -0,0 +1,36 @@
+From 94fc4594659494b8c5cbdf1a719aea4d66d3398d Mon Sep 17 00:00:00 2001
+From: Giulio Benetti <[email protected]>
+Date: Wed, 27 Sep 2023 11:20:50 +0200
+Subject: [PATCH] Support Linux 6.4
+
+With Linux 6.4 commit:
+https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1aaba11da9aa7d7d6b52a74d45b31cac118295a1
+class_create() doesn't require first argument THIS_MODULE anymore so let's
+drop first argument if Linux version >= 6.4
+
+Upstream: https://github.com/embeddedTS/wilc3000-external-module/pull/5
+
+Signed-off-by: Giulio Benetti <[email protected]>
+---
+ bt.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/bt.c b/bt.c
+index 48a5302..a752457 100644
+--- a/bt.c
++++ b/bt.c
+@@ -135,7 +135,11 @@ static void wilc_bt_create_device(void)
+ 	ret = alloc_chrdev_region(&chc_dev_no, 0, 1, "atmel");
+ 	if (ret < 0)
+ 		return;
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 4, 0)
++	chc_dev_class = class_create("atmel");
++#else
+ 	chc_dev_class = class_create(THIS_MODULE, "atmel");
++#endif
+ 	if (IS_ERR(chc_dev_class)) {
+ 		unregister_chrdev_region(chc_dev_no, 1);
+ 		return;
+-- 
+2.34.1
+
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Reviewed-by Kris Bahnsen on v1 1/1
#1 lore raw
Quoted 116 lines · Giulio Benetti

Add local patches pending upstream to fix build failure on Linux 6.3+

Fixes:
http://autobuild.buildroot.net/results/3b954399aa3ffab9609da1fc381f38f28bd8eb9f

---
 .../wilc-driver/0006-Support-Linux-6.3.patch  | 48
+++++++++++++++++++
 .../wilc-driver/0007-Support-Linux-6.4.patch  | 36 ++++++++++++++

 2 files changed, 84 insertions(+)

 create mode 100644 package/wilc-driver/0006-Support-Linux-6.3.patch create mode 100644 package/wilc-driver/0007-Support-Linux-6.4.patch

package/wilc-driver/0006-Support-Linux-6.3.patch new file +1 -0
new file mode 100644
index 0000000000..58239b5dc9
@@ -0,0 +1,48 @@
+From 1b6e5e4acfcca58094fb4bb6e2bfc0461c5b411d Mon Sep 17 00:00:00

2001

package/wilc-driver/0006-Support-Linux-6.3.patch new file +6 -0
+From: Giulio Benetti <[email protected]>
+Date: Wed, 27 Sep 2023 10:54:18 +0200
+Subject: [PATCH] Support Linux 6.3
+
+With Linux 6.3 commit:
+

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=40fc56ee608cdb20022c225ac6f1e4b7ba63f8f1
+function of_get_named_gpio_flags() has been dropped but it was only a
+wrapper to call of_get_named_gpio() if the flags passed was NULL and this

package/wilc-driver/0006-Support-Linux-6.3.patch new file +4 -0
+is the case. So let's use of_get_named_gpio() in place of
+of_get_named_gpio_flags() if Linux version >= 6.3
+
+Upstream: 

https://github.com/embeddedTS/wilc3000-external-module/pull/4

package/wilc-driver/0006-Support-Linux-6.3.patch new file +2 -0
+
+Signed-off-by: Giulio Benetti

<[email protected]>

+---
+ power.c | 8 ++++++++

+ 1 file changed, 8 insertions(+)

package/wilc-driver/0006-Support-Linux-6.3.patch new file +13 -0
+
+diff --git a/power.c b/power.c
+index 6c59e0b..c957c7b 100644
+--- a/power.c
++++ b/power.c
+@@ -25,13 +25,21 @@ int wilc_of_parse_power_pins(struct wilc *wilc)
+       const struct wilc_power_gpios *gpios = &default_gpios[0];
+       int ret;
+ 
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)
++      power->gpios.reset = of_get_named_gpio(of, "reset-gpios", 0);
++#else
+       power->gpios.reset = of_get_named_gpio_flags(of, "reset-

gpios", 0,
+                                                    NULL); ++#endif
+       if (!gpio_is_valid(power->gpios.reset))
+               power->gpios.reset = gpios->reset;
+
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0)
++      power->gpios.chip_en = of_get_named_gpio(of, "chip_en-gpios", 0);
++#else
+       power->gpios.chip_en = of_get_named_gpio_flags(of, "chip_en- gpios", 0,
+                                                      NULL); ++#endif
+       if (!gpio_is_valid(power->gpios.chip_en))
+               power->gpios.chip_en = gpios->chip_en;
+
+--
+2.34.1

package/wilc-driver/0006-Support-Linux-6.3.patch new file +1 -0
+
package/wilc-driver/0007-Support-Linux-6.4.patch new file +1 -0
new file mode 100644
index 0000000000..8339cc3cb6
@@ -0,0 +1,36 @@
+From 94fc4594659494b8c5cbdf1a719aea4d66d3398d Mon Sep 17 00:00:00

2001

package/wilc-driver/0007-Support-Linux-6.4.patch new file +6 -0
+From: Giulio Benetti <[email protected]>
+Date: Wed, 27 Sep 2023 11:20:50 +0200
+Subject: [PATCH] Support Linux 6.4
+
+With Linux 6.4 commit:
+

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1aaba11da9aa7d7d6b52a74d45b31cac118295a1
+class_create() doesn't require first argument THIS_MODULE anymore so let's

package/wilc-driver/0007-Support-Linux-6.4.patch new file +3 -0
+drop first argument if Linux version >= 6.4
+
+Upstream: 

https://github.com/embeddedTS/wilc3000-external-module/pull/5

package/wilc-driver/0007-Support-Linux-6.4.patch new file +2 -0
+
+Signed-off-by: Giulio Benetti

<[email protected]>

+---
+ bt.c | 4 ++++

+ 1 file changed, 4 insertions(+)

package/wilc-driver/0007-Support-Linux-6.4.patch new file +10 -0
+
+diff --git a/bt.c b/bt.c
+index 48a5302..a752457 100644
+--- a/bt.c
++++ b/bt.c
+@@ -135,7 +135,11 @@ static void wilc_bt_create_device(void)
+       ret = alloc_chrdev_region(&chc_dev_no, 0, 1, "atmel");
+       if (ret < 0)
+               return;
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 4, 0)

package/wilc-driver/0007-Support-Linux-6.4.patch line 36

Quoted 10 lines
package/wilc-driver/0007-Support-Linux-6.4.patch new file +10 -0
++      chc_dev_class = class_create("atmel");
++#else
+       chc_dev_class = class_create(THIS_MODULE, "atmel");
++#endif
+       if (IS_ERR(chc_dev_class)) {
+               unregister_chrdev_region(chc_dev_no, 1);
+               return;
+-- 
+2.34.1
+

Giulio,

Thanks for this work.

All,

In regards to the PRs opened in our repo, we are unlikely to merge them at this time. We're trying to keep this tree as close to Microchip's implementation as possible (https://github.com/linux4sam/linux-at91) as they are otherwise not planning on upstreaming support to the kernel nor are they providing an external module source tree as they have in the past. So please merge these patches in to Buildroot for the time being.

It looks like now they do have kernel 6.1 support, so in the near future we will be reviewing and integrating those changes depending on if they are breaking to LTS kernels or not. At which time I'll submit a patch to Buildroot that takes those changes in to account. Hopefully we can clean up some of the loose Buildroot only patch files then.

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

#2 lore raw
In reply to Giulio Benetti
Quoted 21 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Giulio" == Giulio Benetti <[email protected]> writes:

Add local patches pending upstream to fix build failure on Linux 6.3+ Fixes:
http://autobuild.buildroot.net/results/3b954399aa3ffab9609da1fc381f38f28bd8eb9f

---
 .../wilc-driver/0006-Support-Linux-6.3.patch  | 48 +++++++++++++++++++
 .../wilc-driver/0007-Support-Linux-6.4.patch  | 36 ++++++++++++++
 2 files changed, 84 insertions(+)
 create mode 100644 package/wilc-driver/0006-Support-Linux-6.3.patch
 create mode 100644 package/wilc-driver/0007-Support-Linux-6.4.patch
package/wilc-driver/0006-Support-Linux-6.3.patch new file +1 -0
new file mode 100644
index 0000000000..58239b5dc9
@@ -0,0 +1,48 @@
+From 1b6e5e4acfcca58094fb4bb6e2bfc0461c5b411d Mon Sep 17 00:00:00 2001

package/wilc-driver/0006-Support-Linux-6.3.patch line 11

Quoted 10 lines
package/wilc-driver/0006-Support-Linux-6.3.patch new file +10 -0
+From: Giulio Benetti <[email protected]>
+Date: Wed, 27 Sep 2023 10:54:18 +0200
+Subject: [PATCH] Support Linux 6.3
+
+With Linux 6.3 commit:
+https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=40fc56ee608cdb20022c225ac6f1e4b7ba63f8f1
+function of_get_named_gpio_flags() has been dropped but it was only a
+wrapper to call of_get_named_gpio() if the flags passed was NULL and this
+is the case. So let's use of_get_named_gpio() in place of
+of_get_named_gpio_flags() if Linux version >= 6.3

So if of_get_named_gpio() is equivalent to of_get_named_gpio_flags(.., NULL), why don't we unconditionally use that instead of the version check?

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

Hi Peter,

Quoted 27 lines · Peter Korsgaard
Quoted 27 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Giulio" == Giulio Benetti <[email protected]> writes:

Add local patches pending upstream to fix build failure on Linux 6.3+ Fixes:
http://autobuild.buildroot.net/results/3b954399aa3ffab9609da1fc381f38f28bd8eb9f

---
 .../wilc-driver/0006-Support-Linux-6.3.patch  | 48 +++++++++++++++++++
 .../wilc-driver/0007-Support-Linux-6.4.patch  | 36 ++++++++++++++
 2 files changed, 84 insertions(+)
 create mode 100644 package/wilc-driver/0006-Support-Linux-6.3.patch
 create mode 100644 package/wilc-driver/0007-Support-Linux-6.4.patch
package/wilc-driver/0006-Support-Linux-6.3.patch new file +7 -0
new file mode 100644
index 0000000000..58239b5dc9
@@ -0,0 +1,48 @@
+From 1b6e5e4acfcca58094fb4bb6e2bfc0461c5b411d Mon Sep 17 00:00:00 2001
+From: Giulio Benetti <[email protected]>
+Date: Wed, 27 Sep 2023 10:54:18 +0200
+Subject: [PATCH] Support Linux 6.3
+
+With Linux 6.3 commit:
+https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=40fc56ee608cdb20022c225ac6f1e4b7ba63f8f1
Quoted 8 lines

package/wilc-driver/0006-Support-Linux-6.3.patch line 11

Quoted 4 lines
package/wilc-driver/0006-Support-Linux-6.3.patch new file +4 -0
+function of_get_named_gpio_flags() has been dropped but it was only a
+wrapper to call of_get_named_gpio() if the flags passed was NULL and this
+is the case. So let's use of_get_named_gpio() in place of
+of_get_named_gpio_flags() if Linux version >= 6.3

So if of_get_named_gpio() is equivalent to of_get_named_gpio_flags(.., NULL), why don't we unconditionally use that instead of the version check?

You're right, I'm going to modifying the patch according to your suggestion.

Thanks for reviewing!

Best regards

Signature · 6 lines
Giulio Benetti
CEO&CTO@Benetti Engineering sas
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot