Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] package/wilc-driver: fix build failure with Linux 6.3+
@ 2023-09-27  9:28 Giulio Benetti
  2023-09-27 22:35 ` Kris Bahnsen via buildroot
  2023-09-30  7:35 ` Peter Korsgaard
  0 siblings, 2 replies; 4+ messages in thread
From: Giulio Benetti @ 2023-09-27  9:28 UTC (permalink / raw)
  To: buildroot; +Cc: Giulio Benetti, Kris Bahnsen

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

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

Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
---
 .../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

diff --git a/package/wilc-driver/0006-Support-Linux-6.3.patch b/package/wilc-driver/0006-Support-Linux-6.3.patch
new file mode 100644
index 0000000000..58239b5dc9
--- /dev/null
+++ b/package/wilc-driver/0006-Support-Linux-6.3.patch
@@ -0,0 +1,48 @@
+From 1b6e5e4acfcca58094fb4bb6e2bfc0461c5b411d Mon Sep 17 00:00:00 2001
+From: Giulio Benetti <giulio.benetti@benettiengineering.com>
+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 <giulio.benetti@benettiengineering.com>
+---
+ 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
+
diff --git a/package/wilc-driver/0007-Support-Linux-6.4.patch b/package/wilc-driver/0007-Support-Linux-6.4.patch
new file mode 100644
index 0000000000..8339cc3cb6
--- /dev/null
+++ b/package/wilc-driver/0007-Support-Linux-6.4.patch
@@ -0,0 +1,36 @@
+From 94fc4594659494b8c5cbdf1a719aea4d66d3398d Mon Sep 17 00:00:00 2001
+From: Giulio Benetti <giulio.benetti@benettiengineering.com>
+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 <giulio.benetti@benettiengineering.com>
+---
+ 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
+
-- 
2.34.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Buildroot] [PATCH] package/wilc-driver: fix build failure with Linux 6.3+
  2023-09-27  9:28 [Buildroot] [PATCH] package/wilc-driver: fix build failure with Linux 6.3+ Giulio Benetti
@ 2023-09-27 22:35 ` Kris Bahnsen via buildroot
  2023-09-30  7:35 ` Peter Korsgaard
  1 sibling, 0 replies; 4+ messages in thread
From: Kris Bahnsen via buildroot @ 2023-09-27 22:35 UTC (permalink / raw)
  To: Giulio Benetti, buildroot

On Wed, 2023-09-27 at 11:28 +0200, Giulio Benetti wrote:
> Add local patches pending upstream to fix build failure on Linux 6.3+
> 
> Fixes:
> http://autobuild.buildroot.net/results/3b954399aa3ffab9609da1fc381f38f28bd8eb9f
> 
> Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
> ---
>  .../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
> 
> diff --git a/package/wilc-driver/0006-Support-Linux-6.3.patch
> b/package/wilc-driver/0006-Support-Linux-6.3.patch
> new file mode 100644
> index 0000000000..58239b5dc9
> --- /dev/null
> +++ b/package/wilc-driver/0006-Support-Linux-6.3.patch
> @@ -0,0 +1,48 @@
> +From 1b6e5e4acfcca58094fb4bb6e2bfc0461c5b411d Mon Sep 17 00:00:00
> 2001
> +From: Giulio Benetti <giulio.benetti@benettiengineering.com>
> +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
> <giulio.benetti@benettiengineering.com>
> +---
> + 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
> +
> diff --git a/package/wilc-driver/0007-Support-Linux-6.4.patch
> b/package/wilc-driver/0007-Support-Linux-6.4.patch
> new file mode 100644
> index 0000000000..8339cc3cb6
> --- /dev/null
> +++ b/package/wilc-driver/0007-Support-Linux-6.4.patch
> @@ -0,0 +1,36 @@
> +From 94fc4594659494b8c5cbdf1a719aea4d66d3398d Mon Sep 17 00:00:00
> 2001
> +From: Giulio Benetti <giulio.benetti@benettiengineering.com>
> +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
> <giulio.benetti@benettiengineering.com>
> +---
> + 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
> +

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.

Reviewed-by: Kris Bahnsen <kris@embeddedTS.com>


_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Buildroot] [PATCH] package/wilc-driver: fix build failure with Linux 6.3+
  2023-09-27  9:28 [Buildroot] [PATCH] package/wilc-driver: fix build failure with Linux 6.3+ Giulio Benetti
  2023-09-27 22:35 ` Kris Bahnsen via buildroot
@ 2023-09-30  7:35 ` Peter Korsgaard
  2023-09-30 20:28   ` Giulio Benetti
  1 sibling, 1 reply; 4+ messages in thread
From: Peter Korsgaard @ 2023-09-30  7:35 UTC (permalink / raw)
  To: Giulio Benetti; +Cc: Kris Bahnsen, buildroot

>>>>> "Giulio" == Giulio Benetti <giulio.benetti@benettiengineering.com> writes:

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

 > Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
 > ---
 >  .../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

 > diff --git a/package/wilc-driver/0006-Support-Linux-6.3.patch b/package/wilc-driver/0006-Support-Linux-6.3.patch
 > new file mode 100644
 > index 0000000000..58239b5dc9
 > --- /dev/null
 > +++ b/package/wilc-driver/0006-Support-Linux-6.3.patch
 > @@ -0,0 +1,48 @@
 > +From 1b6e5e4acfcca58094fb4bb6e2bfc0461c5b411d Mon Sep 17 00:00:00 2001
 > +From: Giulio Benetti <giulio.benetti@benettiengineering.com>
 > +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?

-- 
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Buildroot] [PATCH] package/wilc-driver: fix build failure with Linux 6.3+
  2023-09-30  7:35 ` Peter Korsgaard
@ 2023-09-30 20:28   ` Giulio Benetti
  0 siblings, 0 replies; 4+ messages in thread
From: Giulio Benetti @ 2023-09-30 20:28 UTC (permalink / raw)
  To: Peter Korsgaard; +Cc: Kris Bahnsen, buildroot

Hi Peter,

On 30/09/23 09:35, Peter Korsgaard wrote:
>>>>>> "Giulio" == Giulio Benetti <giulio.benetti@benettiengineering.com> writes:
> 
>   > Add local patches pending upstream to fix build failure on Linux 6.3+
>   > Fixes:
>   > http://autobuild.buildroot.net/results/3b954399aa3ffab9609da1fc381f38f28bd8eb9f
> 
>   > Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
>   > ---
>   >  .../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
> 
>   > diff --git a/package/wilc-driver/0006-Support-Linux-6.3.patch b/package/wilc-driver/0006-Support-Linux-6.3.patch
>   > new file mode 100644
>   > index 0000000000..58239b5dc9
>   > --- /dev/null
>   > +++ b/package/wilc-driver/0006-Support-Linux-6.3.patch
>   > @@ -0,0 +1,48 @@
>   > +From 1b6e5e4acfcca58094fb4bb6e2bfc0461c5b411d Mon Sep 17 00:00:00 2001
>   > +From: Giulio Benetti <giulio.benetti@benettiengineering.com>
>   > +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?

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

Thanks for reviewing!

Best regards
-- 
Giulio Benetti
CEO&CTO@Benetti Engineering sas
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-09-30 20:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-27  9:28 [Buildroot] [PATCH] package/wilc-driver: fix build failure with Linux 6.3+ Giulio Benetti
2023-09-27 22:35 ` Kris Bahnsen via buildroot
2023-09-30  7:35 ` Peter Korsgaard
2023-09-30 20:28   ` Giulio Benetti

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox