All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergey Kuzminov <kuzminov.sergey81@gmail.com>
To: Giulio Benetti <giulio.benetti@benettiengineering.com>,
	buildroot@buildroot.org
Subject: Re: [Buildroot] [PATCH v2] package/xr819-xradio: add patch to build with Linux >= 5.13
Date: Tue, 18 Jan 2022 20:45:55 +0300	[thread overview]
Message-ID: <834ad33f-d02f-4663-8e99-4bc939cbb9f6@gmail.com> (raw)
In-Reply-To: <20220118063531.2039729-1-giulio.benetti@benettiengineering.com>

Hi All, Giulio.
I checked the patch, everything works.

18.01.2022 09:35, Giulio Benetti пишет:
> As explained in the local patch itself of_get_mac_address() has changed, so
> we need to check against Linux version and use it slightly differently.
>
> Patch is pending upstream:
> https://github.com/fifteenhex/xradio/pull/15
> I've realized only later there was already an opened PR for this, anyway
> IMHO I think my patch is written a little better, so please accept it.
> And most of all Sergey already tested it and it works:
> https://lists.buildroot.org/pipermail/buildroot/2022-January/634084.html
>
> Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
> ---
> V1->V2:
> * update local patch to build correctly also with Linux >= 5.12.1 < 5.13.0
> ---
>   ...fix-building-with-Linux-version-5.13.patch | 68 +++++++++++++++++++
>   1 file changed, 68 insertions(+)
>   create mode 100644 package/xr819-xradio/0001-main.c-fix-building-with-Linux-version-5.13.patch
>
> diff --git a/package/xr819-xradio/0001-main.c-fix-building-with-Linux-version-5.13.patch b/package/xr819-xradio/0001-main.c-fix-building-with-Linux-version-5.13.patch
> new file mode 100644
> index 0000000000..3b9742012e
> --- /dev/null
> +++ b/package/xr819-xradio/0001-main.c-fix-building-with-Linux-version-5.13.patch
> @@ -0,0 +1,68 @@
> +From 4873746fa9d42a8edbc1e192899e00c29ed3d32a Mon Sep 17 00:00:00 2001
> +From: Giulio Benetti <giulio.benetti@benettiengineering.com>
> +Date: Mon, 17 Jan 2022 12:26:00 +0100
> +Subject: [PATCH] main.c: fix building with Linux version >= 5.13
> +
> +of_get_mac_address() on Linux version >= 5.13 requires mac pointer as
> +second argument and return an int. So let's deal with it by checking linux
> +version to make it compatible with both Linux version >= 5.13 and not.
> +
> +Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
> +---
> + main.c | 17 +++++++++++++++++
> + 1 file changed, 17 insertions(+)
> +
> +diff --git a/main.c b/main.c
> +index b60e18d..06cb1f6 100644
> +--- a/main.c
> ++++ b/main.c
> +@@ -13,6 +13,7 @@
> + #include <net/cfg80211.h>
> + #include <linux/of_net.h>
> + #include <linux/mmc/sdio_func.h>
> ++#include <linux/version.h>
> +
> + #include "xradio.h"
> + #include "fwio.h"
> +@@ -499,8 +500,12 @@ int xradio_core_init(struct sdio_func* func)
> + 	int if_id;
> + 	struct ieee80211_hw *dev;
> + 	struct xradio_common *hw_priv;
> ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 13, 0)
> ++	unsigned char addr[ETH_ALEN];
> ++#else
> + 	unsigned char randomaddr[ETH_ALEN];
> + 	const unsigned char *addr = NULL;
> ++#endif
> +
> + 	//init xradio_common
> + 	dev = xradio_init_common(sizeof(struct xradio_common));
> +@@ -513,6 +518,16 @@ int xradio_core_init(struct sdio_func* func)
> + 	hw_priv->sdio_func = func;
> + 	sdio_set_drvdata(func, hw_priv);
> +
> ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 13, 0)
> ++	// fill in mac addresses
> ++	if (hw_priv->pdev->of_node) {
> ++		err = of_get_mac_address(hw_priv->pdev->of_node, addr);
> ++	}
> ++	if (err < 0) {
> ++		dev_warn(hw_priv->pdev, "no mac address provided, using random\n");
> ++		eth_random_addr(addr);
> ++	}
> ++#else
> + 	// fill in mac addresses
> + 	if (hw_priv->pdev->of_node) {
> + 		addr = of_get_mac_address(hw_priv->pdev->of_node);
> +@@ -522,6 +537,8 @@ int xradio_core_init(struct sdio_func* func)
> + 		eth_random_addr(randomaddr);
> + 		addr = randomaddr;
> + 	}
> ++#endif
> ++
> + 	memcpy(hw_priv->addresses[0].addr, addr, ETH_ALEN);
> + 	memcpy(hw_priv->addresses[1].addr, addr, ETH_ALEN);
> + 	hw_priv->addresses[1].addr[5] += 0x01;
> +--
> +2.25.1
> +


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

  reply	other threads:[~2022-01-18 17:46 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-17 21:07 [Buildroot] [PATCH] package/xr819-xradio: add patch to build with Linux > 5.12 Giulio Benetti
2022-01-17 21:50 ` Giulio Benetti
2022-01-18  6:35   ` [Buildroot] [PATCH v2] package/xr819-xradio: add patch to build with Linux >= 5.13 Giulio Benetti
2022-01-18 17:45     ` Sergey Kuzminov [this message]
2022-01-18 17:53       ` Giulio Benetti
2022-01-18 18:10         ` Sergey Kuzminov
2022-01-21 10:14           ` Giulio Benetti
2022-01-21 10:33             ` [Buildroot] [PATCH] package/xr819-xradio: bump to latest version to fix Linux >= 5.13 building Giulio Benetti
2022-01-21 16:43               ` Sergey Kuzminov
2022-01-21 16:45               ` Sergey Kuzminov
2022-01-22 12:16               ` Thomas Petazzoni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=834ad33f-d02f-4663-8e99-4bc939cbb9f6@gmail.com \
    --to=kuzminov.sergey81@gmail.com \
    --cc=buildroot@buildroot.org \
    --cc=giulio.benetti@benettiengineering.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.