From: Michael Walle <michael@walle.cc>
To: ath9k-devel@qca.qualcomm.com, UNGLinuxDriver@microchip.com,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
netdev@vger.kernel.org, linux-mediatek@lists.infradead.org,
linux-renesas-soc@vger.kernel.org,
linux-stm32@st-md-mailman.stormreply.com,
linux-amlogic@lists.infradead.org, linux-oxnas@groups.io,
linux-omap@vger.kernel.org, linux-wireless@vger.kernel.org,
devicetree@vger.kernel.org, linux-staging@lists.linux.dev
Cc: "Andrew Lunn" <andrew@lunn.ch>,
"Gregory Clement" <gregory.clement@bootlin.com>,
"Sebastian Hesselbarth" <sebastian.hesselbarth@gmail.com>,
"Russell King" <linux@armlinux.org.uk>,
"Michael Ellerman" <mpe@ellerman.id.au>,
"Benjamin Herrenschmidt" <benh@kernel.crashing.org>,
"Paul Mackerras" <paulus@samba.org>,
"Andreas Larsson" <andreas@gaisler.com>,
"David S . Miller" <davem@davemloft.net>,
"Jakub Kicinski" <kuba@kernel.org>,
"Maxime Ripard" <mripard@kernel.org>,
"Chen-Yu Tsai" <wens@csie.org>,
"Jernej Skrabec" <jernej.skrabec@siol.net>,
"Joyce Ooi" <joyce.ooi@intel.com>,
"Chris Snook" <chris.snook@gmail.com>,
"Rafał Miłecki" <rafal@milecki.pl>,
bcm-kernel-feedback-list@broadcom.com,
"Florian Fainelli" <f.fainelli@gmail.com>,
"Nicolas Ferre" <nicolas.ferre@microchip.com>,
"Claudiu Beznea" <claudiu.beznea@microchip.com>,
"Sunil Goutham" <sgoutham@marvell.com>,
"Fugang Duan" <fugang.duan@nxp.com>,
"Madalin Bucur" <madalin.bucur@nxp.com>,
"Pantelis Antoniou" <pantelis.antoniou@gmail.com>,
"Claudiu Manoil" <claudiu.manoil@nxp.com>,
"Li Yang" <leoyang.li@nxp.com>,
"Yisen Zhuang" <yisen.zhuang@huawei.com>,
"Salil Mehta" <salil.mehta@huawei.com>,
"Hauke Mehrtens" <hauke@hauke-m.de>,
"Thomas Petazzoni" <thomas.petazzoni@bootlin.com>,
"Vadym Kochan" <vkochan@marvell.com>,
"Taras Chornyi" <tchornyi@marvell.com>,
"Mirko Lindner" <mlindner@marvell.com>,
"Stephen Hemminger" <stephen@networkplumber.org>,
"Felix Fietkau" <nbd@nbd.name>, "John Crispin" <john@phrozen.org>,
"Sean Wang" <sean.wang@mediatek.com>,
"Mark Lee" <Mark-MC.Lee@mediatek.com>,
"Matthias Brugger" <matthias.bgg@gmail.com>,
"Bryan Whitehead" <bryan.whitehead@microchip.com>,
"Vladimir Zapolskiy" <vz@mleia.com>,
"Sergei Shtylyov" <sergei.shtylyov@gmail.com>,
"Byungho An" <bh74.an@samsung.com>,
"Kunihiko Hayashi" <hayashi.kunihiko@socionext.com>,
"Giuseppe Cavallaro" <peppe.cavallaro@st.com>,
"Alexandre Torgue" <alexandre.torgue@st.com>,
"Jose Abreu" <joabreu@synopsys.com>,
"Maxime Coquelin" <mcoquelin.stm32@gmail.com>,
"Shawn Guo" <shawnguo@kernel.org>,
"Sascha Hauer" <s.hauer@pengutronix.de>,
"Pengutronix Kernel Team" <kernel@pengutronix.de>,
"Fabio Estevam" <festevam@gmail.com>,
"NXP Linux Team" <linux-imx@nxp.com>,
"Kevin Hilman" <khilman@baylibre.com>,
"Neil Armstrong" <narmstrong@baylibre.com>,
"Jerome Brunet" <jbrunet@baylibre.com>,
"Martin Blumenstingl" <martin.blumenstingl@googlemail.com>,
"Vinod Koul" <vkoul@kernel.org>,
"Nobuhiro Iwamatsu" <nobuhiro1.iwamatsu@toshiba.co.jp>,
"Grygorii Strashko" <grygorii.strashko@ti.com>,
"Wingman Kwok" <w-kwok2@ti.com>,
"Murali Karicheri" <m-karicheri2@ti.com>,
"Michal Simek" <michal.simek@xilinx.com>,
"Radhey Shyam Pandey" <radhey.shyam.pandey@xilinx.com>,
"Kalle Valo" <kvalo@codeaurora.org>,
"Lorenzo Bianconi" <lorenzo.bianconi83@gmail.com>,
"Ryder Lee" <ryder.lee@mediatek.com>,
"Stanislaw Gruszka" <stf_xl@wp.pl>,
"Helmut Schaa" <helmut.schaa@googlemail.com>,
"Heiner Kallweit" <hkallweit1@gmail.com>,
"Rob Herring" <robh+dt@kernel.org>,
"Frank Rowand" <frowand.list@gmail.com>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Jérôme Pouiller" <jerome.pouiller@silabs.com>,
"Vivien Didelot" <vivien.didelot@gmail.com>,
"Vladimir Oltean" <olteanv@gmail.com>,
"Michael Walle" <michael@walle.cc>
Subject: [PATCH net-next v4 0/2] of: net: support non-platform devices in of_get_mac_address()
Date: Mon, 12 Apr 2021 19:47:16 +0200 [thread overview]
Message-ID: <20210412174718.17382-1-michael@walle.cc> (raw)
of_get_mac_address() is commonly used to fetch the MAC address
from the device tree. It also supports reading it from a NVMEM
provider. But the latter is only possible for platform devices,
because only platform devices are searched for a matching device
node.
Add a second method to fetch the NVMEM cell by a device tree node
instead of a "struct device".
Moreover, the NVMEM subsystem will return dynamically allocated
data which has to be freed after use. Currently, this is handled
by allocating a device resource manged buffer to store the MAC
address. of_get_mac_address() then returns a pointer to this
buffer. Without a device, this trick is not possible anymore.
Thus, change the of_get_mac_address() API to have the caller
supply a buffer.
It was considered to use the network device to attach the buffer
to, but then the order matters and netdev_register() has to be
called before of_get_mac_address(). No driver does it this way.
changes since v3:
- use memcpy() instead of ether_addr_copy() where appropriate.
Sometimes the destination is on the stack, thus the 2 byte
alignment requrement is not met.
- fix "return PTR_ERR(mac_addr)" as found by Dan Carpenter
- changed subject of patch 2/2, as suggested by Florian Fainelli
changes since v2:
- fixed of_get_mac_addr_nvmem() signature, which was accidentially
fixed in patch 2/2 again
changes since v1:
- fixed stmmac_probe_config_dt() for !CONFIG_OF
- added missing queue in patch subject
Michael Walle (2):
of: net: pass the dst buffer to of_get_mac_address()
of: net: fix of_get_mac_addr_nvmem() for non-platform devices
arch/arm/mach-mvebu/kirkwood.c | 3 +-
arch/powerpc/sysdev/tsi108_dev.c | 5 +-
drivers/net/ethernet/aeroflex/greth.c | 6 +-
drivers/net/ethernet/allwinner/sun4i-emac.c | 10 +--
drivers/net/ethernet/altera/altera_tse_main.c | 7 +-
drivers/net/ethernet/arc/emac_main.c | 8 +-
drivers/net/ethernet/atheros/ag71xx.c | 7 +-
drivers/net/ethernet/broadcom/bcm4908_enet.c | 7 +-
drivers/net/ethernet/broadcom/bcmsysport.c | 7 +-
drivers/net/ethernet/broadcom/bgmac-bcma.c | 10 +--
.../net/ethernet/broadcom/bgmac-platform.c | 11 ++-
drivers/net/ethernet/cadence/macb_main.c | 11 +--
.../net/ethernet/cavium/octeon/octeon_mgmt.c | 8 +-
.../net/ethernet/cavium/thunder/thunder_bgx.c | 5 +-
drivers/net/ethernet/davicom/dm9000.c | 10 +--
drivers/net/ethernet/ethoc.c | 6 +-
drivers/net/ethernet/ezchip/nps_enet.c | 7 +-
drivers/net/ethernet/freescale/fec_main.c | 7 +-
drivers/net/ethernet/freescale/fec_mpc52xx.c | 7 +-
drivers/net/ethernet/freescale/fman/mac.c | 9 +-
.../ethernet/freescale/fs_enet/fs_enet-main.c | 5 +-
drivers/net/ethernet/freescale/gianfar.c | 8 +-
drivers/net/ethernet/freescale/ucc_geth.c | 5 +-
drivers/net/ethernet/hisilicon/hisi_femac.c | 7 +-
drivers/net/ethernet/hisilicon/hix5hd2_gmac.c | 7 +-
drivers/net/ethernet/lantiq_xrx200.c | 7 +-
drivers/net/ethernet/marvell/mv643xx_eth.c | 5 +-
drivers/net/ethernet/marvell/mvneta.c | 6 +-
.../ethernet/marvell/prestera/prestera_main.c | 11 +--
drivers/net/ethernet/marvell/pxa168_eth.c | 9 +-
drivers/net/ethernet/marvell/sky2.c | 8 +-
drivers/net/ethernet/mediatek/mtk_eth_soc.c | 11 +--
drivers/net/ethernet/micrel/ks8851_common.c | 7 +-
drivers/net/ethernet/microchip/lan743x_main.c | 5 +-
drivers/net/ethernet/nxp/lpc_eth.c | 4 +-
drivers/net/ethernet/qualcomm/qca_spi.c | 10 +--
drivers/net/ethernet/qualcomm/qca_uart.c | 9 +-
drivers/net/ethernet/renesas/ravb_main.c | 12 +--
drivers/net/ethernet/renesas/sh_eth.c | 5 +-
.../ethernet/samsung/sxgbe/sxgbe_platform.c | 13 +--
drivers/net/ethernet/socionext/sni_ave.c | 10 +--
.../ethernet/stmicro/stmmac/dwmac-anarion.c | 2 +-
.../stmicro/stmmac/dwmac-dwc-qos-eth.c | 2 +-
.../ethernet/stmicro/stmmac/dwmac-generic.c | 2 +-
.../net/ethernet/stmicro/stmmac/dwmac-imx.c | 2 +-
.../stmicro/stmmac/dwmac-intel-plat.c | 2 +-
.../ethernet/stmicro/stmmac/dwmac-ipq806x.c | 2 +-
.../ethernet/stmicro/stmmac/dwmac-lpc18xx.c | 2 +-
.../ethernet/stmicro/stmmac/dwmac-mediatek.c | 2 +-
.../net/ethernet/stmicro/stmmac/dwmac-meson.c | 2 +-
.../ethernet/stmicro/stmmac/dwmac-meson8b.c | 2 +-
.../net/ethernet/stmicro/stmmac/dwmac-oxnas.c | 2 +-
.../stmicro/stmmac/dwmac-qcom-ethqos.c | 2 +-
.../net/ethernet/stmicro/stmmac/dwmac-rk.c | 2 +-
.../ethernet/stmicro/stmmac/dwmac-socfpga.c | 2 +-
.../net/ethernet/stmicro/stmmac/dwmac-sti.c | 2 +-
.../net/ethernet/stmicro/stmmac/dwmac-stm32.c | 2 +-
.../net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 2 +-
.../net/ethernet/stmicro/stmmac/dwmac-sunxi.c | 2 +-
.../ethernet/stmicro/stmmac/dwmac-visconti.c | 2 +-
drivers/net/ethernet/stmicro/stmmac/stmmac.h | 2 +-
.../net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
.../ethernet/stmicro/stmmac/stmmac_platform.c | 14 +--
.../ethernet/stmicro/stmmac/stmmac_platform.h | 2 +-
drivers/net/ethernet/ti/am65-cpsw-nuss.c | 19 ++---
drivers/net/ethernet/ti/cpsw.c | 7 +-
drivers/net/ethernet/ti/cpsw_new.c | 7 +-
drivers/net/ethernet/ti/davinci_emac.c | 8 +-
drivers/net/ethernet/ti/netcp_core.c | 7 +-
drivers/net/ethernet/wiznet/w5100-spi.c | 8 +-
drivers/net/ethernet/wiznet/w5100.c | 2 +-
drivers/net/ethernet/xilinx/ll_temac_main.c | 8 +-
.../net/ethernet/xilinx/xilinx_axienet_main.c | 15 ++--
drivers/net/ethernet/xilinx/xilinx_emaclite.c | 8 +-
drivers/net/wireless/ath/ath9k/init.c | 5 +-
drivers/net/wireless/mediatek/mt76/eeprom.c | 9 +-
.../net/wireless/ralink/rt2x00/rt2x00dev.c | 6 +-
drivers/of/of_net.c | 85 ++++++++++++-------
drivers/staging/octeon/ethernet.c | 10 +--
drivers/staging/wfx/main.c | 7 +-
include/linux/of_net.h | 6 +-
include/net/dsa.h | 2 +-
net/dsa/dsa2.c | 2 +-
net/dsa/slave.c | 2 +-
net/ethernet/eth.c | 11 +--
85 files changed, 243 insertions(+), 364 deletions(-)
--
2.20.1
next reply other threads:[~2021-04-12 17:47 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-12 17:47 Michael Walle [this message]
2021-04-12 17:47 ` [PATCH net-next v4 1/2] of: net: pass the dst buffer to of_get_mac_address() Michael Walle
2021-04-13 0:55 ` Andrew Lunn
2021-04-12 17:47 ` [PATCH net-next v4 2/2] of: net: fix of_get_mac_addr_nvmem() for non-platform devices Michael Walle
2021-04-13 0:57 ` Andrew Lunn
2021-04-16 3:24 ` Benjamin Herrenschmidt
2021-04-16 7:29 ` Michael Walle
2021-04-16 15:19 ` Rob Herring
2021-04-26 10:54 ` Michael Walle
2021-04-26 23:44 ` Benjamin Herrenschmidt
2021-04-28 8:09 ` Michael Walle
2021-04-13 21:40 ` [PATCH net-next v4 0/2] of: net: support non-platform devices in of_get_mac_address() patchwork-bot+netdevbpf
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=20210412174718.17382-1-michael@walle.cc \
--to=michael@walle.cc \
--cc=Mark-MC.Lee@mediatek.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=alexandre.torgue@st.com \
--cc=andreas@gaisler.com \
--cc=andrew@lunn.ch \
--cc=ath9k-devel@qca.qualcomm.com \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=benh@kernel.crashing.org \
--cc=bh74.an@samsung.com \
--cc=bryan.whitehead@microchip.com \
--cc=chris.snook@gmail.com \
--cc=claudiu.beznea@microchip.com \
--cc=claudiu.manoil@nxp.com \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=f.fainelli@gmail.com \
--cc=festevam@gmail.com \
--cc=frowand.list@gmail.com \
--cc=fugang.duan@nxp.com \
--cc=gregkh@linuxfoundation.org \
--cc=gregory.clement@bootlin.com \
--cc=grygorii.strashko@ti.com \
--cc=hauke@hauke-m.de \
--cc=hayashi.kunihiko@socionext.com \
--cc=helmut.schaa@googlemail.com \
--cc=hkallweit1@gmail.com \
--cc=jbrunet@baylibre.com \
--cc=jernej.skrabec@siol.net \
--cc=jerome.pouiller@silabs.com \
--cc=joabreu@synopsys.com \
--cc=john@phrozen.org \
--cc=joyce.ooi@intel.com \
--cc=kernel@pengutronix.de \
--cc=khilman@baylibre.com \
--cc=kuba@kernel.org \
--cc=kvalo@codeaurora.org \
--cc=leoyang.li@nxp.com \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-imx@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux-oxnas@groups.io \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=linux-wireless@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=lorenzo.bianconi83@gmail.com \
--cc=m-karicheri2@ti.com \
--cc=madalin.bucur@nxp.com \
--cc=martin.blumenstingl@googlemail.com \
--cc=matthias.bgg@gmail.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=michal.simek@xilinx.com \
--cc=mlindner@marvell.com \
--cc=mpe@ellerman.id.au \
--cc=mripard@kernel.org \
--cc=narmstrong@baylibre.com \
--cc=nbd@nbd.name \
--cc=netdev@vger.kernel.org \
--cc=nicolas.ferre@microchip.com \
--cc=nobuhiro1.iwamatsu@toshiba.co.jp \
--cc=olteanv@gmail.com \
--cc=pantelis.antoniou@gmail.com \
--cc=paulus@samba.org \
--cc=peppe.cavallaro@st.com \
--cc=radhey.shyam.pandey@xilinx.com \
--cc=rafal@milecki.pl \
--cc=robh+dt@kernel.org \
--cc=ryder.lee@mediatek.com \
--cc=s.hauer@pengutronix.de \
--cc=salil.mehta@huawei.com \
--cc=sean.wang@mediatek.com \
--cc=sebastian.hesselbarth@gmail.com \
--cc=sergei.shtylyov@gmail.com \
--cc=sgoutham@marvell.com \
--cc=shawnguo@kernel.org \
--cc=stephen@networkplumber.org \
--cc=stf_xl@wp.pl \
--cc=tchornyi@marvell.com \
--cc=thomas.petazzoni@bootlin.com \
--cc=vivien.didelot@gmail.com \
--cc=vkochan@marvell.com \
--cc=vkoul@kernel.org \
--cc=vz@mleia.com \
--cc=w-kwok2@ti.com \
--cc=wens@csie.org \
--cc=yisen.zhuang@huawei.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 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).