backports.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hauke Mehrtens <hauke@hauke-m.de>
To: backports@vger.kernel.org
Cc: Hauke Mehrtens <hauke@hauke-m.de>
Subject: [PATCH 21/47] headers: Adapt signature of of_get_mac_address()
Date: Tue, 19 Oct 2021 23:42:54 +0200	[thread overview]
Message-ID: <20211019214320.2035704-22-hauke@hauke-m.de> (raw)
In-Reply-To: <20211019214320.2035704-1-hauke@hauke-m.de>

The function signature of of_get_mac_address() changed in kernel 5.13.
This code converts calls using the new signature to the old API.
The return value changed in kernel 5.2, which is still taken care of.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 backport/backport-include/linux/of_net.h | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/backport/backport-include/linux/of_net.h b/backport/backport-include/linux/of_net.h
index 866aec57..9b9276f1 100644
--- a/backport/backport-include/linux/of_net.h
+++ b/backport/backport-include/linux/of_net.h
@@ -2,19 +2,23 @@
 #define _BP_OF_NET_H
 #include_next <linux/of_net.h>
 #include <linux/version.h>
+#include <linux/etherdevice.h>
 
 /* The behavior of of_get_mac_address() changed in kernel 5.2, it now
  * returns an error code and not NULL in case of an error.
  */
-#if LINUX_VERSION_IS_LESS(5,2,0)
-static inline const void *backport_of_get_mac_address(struct device_node *np)
+#if LINUX_VERSION_IS_LESS(5,13,0)
+static inline int backport_of_get_mac_address(struct device_node *np, u8 *mac_out)
 {
 	const void *mac = of_get_mac_address(np);
 
 	if (!mac)
-		return ERR_PTR(-ENODEV);
-
-	return mac;
+		return -ENODEV;
+	if (IS_ERR(mac))
+		return PTR_ERR(mac);
+	ether_addr_copy(mac_out, mac);
+	
+	return 0;
 }
 #define of_get_mac_address LINUX_BACKPORT(of_get_mac_address)
 #endif /* < 5.2 */
-- 
2.30.2

--
To unsubscribe from this list: send the line "unsubscribe backports" in

  parent reply	other threads:[~2021-10-19 21:43 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-19 21:42 [PATCH 00/47] backports: Update to kernel 5.15-rc6 Hauke Mehrtens
2021-10-19 21:42 ` [PATCH 01/47] patches: Refresh on kernel 5.11.22 Hauke Mehrtens
2021-10-19 21:42 ` [PATCH 02/47] backports: Add dev_get_tstats64() and bp_dev_get_tstats64() Hauke Mehrtens
2021-10-19 21:42 ` [PATCH 03/47] backports: Add empty implementation for skb_get_kcov_handle() Hauke Mehrtens
2021-10-19 21:42 ` [PATCH 04/47] backports: Add linux/math.h Hauke Mehrtens
2021-10-19 21:42 ` [PATCH 05/47] backports: Add dev_sw_netstats_rx_add() and dev_sw_netstats_tx_add() Hauke Mehrtens
2021-10-19 21:42 ` [PATCH 06/47] headers: Add linux/kcov.h Hauke Mehrtens
2021-10-19 21:42 ` [PATCH 07/47] patches: Do not use rx_list in mt76 on older kernel versions Hauke Mehrtens
2021-10-19 21:42 ` [PATCH 08/47] dependencies: Build mt7915 only on kernel >= 4.6 Hauke Mehrtens
2021-10-19 21:42 ` [PATCH 09/47] patches: Remove const from struct rchan_callbacks Hauke Mehrtens
2021-10-19 21:42 ` [PATCH 10/47] patches: Refresh patches on top of kernel 5.12.19 Hauke Mehrtens
2021-10-19 21:42 ` [PATCH 11/47] patches: include linux/modules.h in mt76/mt76_connac_mcu.c Hauke Mehrtens
2021-10-19 21:42 ` [PATCH 12/47] patches: Do not use rx_list in mt76/mt7921 driver on older kernel versions Hauke Mehrtens
2021-10-19 21:42 ` [PATCH 13/47] patches: Do not use rx_list in mt7601u " Hauke Mehrtens
2021-10-19 21:42 ` [PATCH 14/47] dependencies: Build mt7921 only on kernel >= 4.6 Hauke Mehrtens
2021-10-19 21:42 ` [PATCH 15/47] dependencies: Build NL80211_TESTMODE only on kernel >= 4.18 Hauke Mehrtens
2021-10-19 21:42 ` [PATCH 16/47] headers: Add DECLARE_STATIC_KEY_FALSE Hauke Mehrtens
2021-10-19 21:42 ` [PATCH 17/47] headers: Add ETH_P_MAP Hauke Mehrtens
2021-10-19 21:42 ` [PATCH 18/47] patches: Refresh on top of kernel 5.13.19 Hauke Mehrtens
2021-10-19 21:42 ` [PATCH 19/47] headers: Add tasklet_disable_in_atomic() Hauke Mehrtens
2021-10-19 21:42 ` [PATCH 20/47] headers: Add lockdep_assert_not_held() Hauke Mehrtens
2021-10-19 21:42 ` Hauke Mehrtens [this message]
2021-10-19 21:42 ` [PATCH 22/47] headers: Add rfkill_set_hw_state_reason() Hauke Mehrtens
2021-10-19 21:42 ` [PATCH 23/47] patches: Remove usage of threaded NAPI from mt76 Hauke Mehrtens
2021-10-19 21:42 ` [PATCH 24/47] headers: Adapt signature of thermal_zone_device_update() Hauke Mehrtens
2021-10-19 21:42 ` [PATCH 25/47] headers: Add time_after32() Hauke Mehrtens
2021-10-19 21:42 ` [PATCH 26/47] patches: Refresh on top of kernel 5.14.13 Hauke Mehrtens
2021-10-19 21:43 ` [PATCH 27/47] headers: Add FW_ACTION_NOUEVENT and FW_ACTION_UEVENT Hauke Mehrtens
2021-10-19 21:43 ` [PATCH 28/47] headers: Add linux/wwan.h file Hauke Mehrtens
2021-10-19 21:43 ` [PATCH 29/47] headers: Add DEVICE_ATTR_ADMIN_RW Hauke Mehrtens
2021-10-19 21:43 ` [PATCH 30/47] headers: Add get_unaligned_be24 Hauke Mehrtens
2021-10-19 21:43 ` [PATCH 31/47] headers: Add rbtree cached Hauke Mehrtens
2021-10-19 21:43 ` [PATCH 32/47] headers: Adapt signature of hrtimer_forward_now() Hauke Mehrtens
2021-10-19 21:43 ` [PATCH 33/47] dependencies: Build RTL8723BS only on kernel >= 5.4 Hauke Mehrtens
2021-10-19 21:43 ` [PATCH 34/47] backports: Remove rtl8188eu driver Hauke Mehrtens
2021-10-19 21:43 ` [PATCH 35/47] backports: Remove prism54 driver Hauke Mehrtens
2021-10-19 21:43 ` [PATCH 36/47] patches: Refresh on top of kernel 5.15-rc6 Hauke Mehrtens
2021-10-19 21:43 ` [PATCH 37/47] backports: Remove old CISCO airo driver Hauke Mehrtens
2021-10-19 21:43 ` [PATCH 38/47] backports: Remove intersil hostap driver Hauke Mehrtens
2021-10-19 21:43 ` [PATCH 39/47] patches: Adapt signature of bus_type->remove callback Hauke Mehrtens
2021-10-19 21:43 ` [PATCH 40/47] patches: Adapt signature of ethtool_ops->set_coalesce callback Hauke Mehrtens
2021-10-19 21:43 ` [PATCH 41/47] patches: Do not set mhi_controller->reg_len on older kernel versions Hauke Mehrtens
2021-10-19 21:43 ` [PATCH 42/47] backports: Update wifi defconfig Hauke Mehrtens
2021-10-19 21:43 ` [PATCH 43/47] backports: Add new r8188eu driver Hauke Mehrtens
2021-10-19 21:43 ` [PATCH 44/47] headers: Add new include/linux/bits.h Hauke Mehrtens
2021-10-19 21:43 ` [PATCH 45/47] headers: Add function devm_clk_get_optional() Hauke Mehrtens
2021-10-19 21:43 ` [PATCH 46/47] patches: Remove usage of DMI_PRODUCT_SKU Hauke Mehrtens
2021-10-19 21:43 ` [PATCH 47/47] headers: Check for NULL in dev_put() and dev_hold() Hauke Mehrtens
2021-10-20 12:22 ` [PATCH 00/47] backports: Update to kernel 5.15-rc6 Janusz Dziedzic
2021-10-20 18:27   ` Hauke Mehrtens
2021-10-20 20:09     ` Robert Marko

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=20211019214320.2035704-22-hauke@hauke-m.de \
    --to=hauke@hauke-m.de \
    --cc=backports@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).