treewide: backport support for nvmem on non platform devices

In the current state, nvmem cells are only detected on platform device.
To quickly fix the problem, we register the affected problematic driver
with the of_platform but that is more an hack than a real solution.
Backport from net-next the required patch so that nvmem can work also
with non-platform devices and rework our current patch.
Drop the mediatek and dsa workaround and rework the ath10k patches.
Rework every driver that use the of_get_mac_address api.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
This commit is contained in:
Ansuel Smith
2021-07-23 20:19:43 +02:00
committed by David Bauer
parent edb6bc1990
commit 91a52f22a1
35 changed files with 4460 additions and 500 deletions

View File

@@ -167,7 +167,6 @@ static int ath9k_fixup_probe(struct platform_device *pdev)
struct device_node *node = dev->of_node;
struct ath9k_fixup *priv;
struct resource *res;
const void *mac;
int ret;
if (ath9k_num_fixups >= ATH9K_MAX_FIXUPS)
@@ -200,9 +199,8 @@ static int ath9k_fixup_probe(struct platform_device *pdev)
priv->pdata.led_active_high = of_property_read_bool(node,
"ath,led-active-high");
mac = of_get_mac_address(node);
if (!IS_ERR_OR_NULL(mac)) {
memcpy(priv->mac, mac, ETH_ALEN);
of_get_mac_address(node, priv->mac);
if (is_valid_ether_addr(priv->mac)) {
dev_info(dev, "mtd mac %pM\n", priv->mac);
} else {
random_ether_addr(priv->mac);

View File

@@ -1119,7 +1119,6 @@ static int b43_sprom_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev;
struct device_node *node = dev->of_node;
struct b43_sprom *priv = &b43_sprom;
const void *mac;
int ret;
priv->dev = dev;
@@ -1129,9 +1128,8 @@ static int b43_sprom_probe(struct platform_device *pdev)
of_property_read_u32(node, "pci-bus", &priv->pci_bus);
of_property_read_u32(node, "pci-dev", &priv->pci_dev);
mac = of_get_mac_address(node);
if (!IS_ERR_OR_NULL(mac)) {
memcpy(priv->mac, mac, ETH_ALEN);
of_get_mac_address(node, priv->mac);
if (is_valid_ether_addr(priv->mac)) {
dev_info(dev, "mtd mac %pM\n", priv->mac);
} else {
random_ether_addr(priv->mac);