aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/bcm53xx/files
diff options
context:
space:
mode:
authorRafał Miłecki <zajec5@gmail.com>2015-04-02 12:01:56 +0000
committerRafał Miłecki <zajec5@gmail.com>2015-04-02 12:01:56 +0000
commit91071e366ce0e3e45d061014a9a41eb53b5330c4 (patch)
tree004215b6dc69156844d50f9f9b667653fe8f4e06 /target/linux/bcm53xx/files
parentbb0e931298090e0c2d62f3e545e369407c142ad5 (diff)
downloadupstream-91071e366ce0e3e45d061014a9a41eb53b5330c4.tar.gz
upstream-91071e366ce0e3e45d061014a9a41eb53b5330c4.tar.bz2
upstream-91071e366ce0e3e45d061014a9a41eb53b5330c4.zip
bcm53xx: sprom: simplify reading NVRAM after last backports
Signed-off-by: Rafał Miłecki <zajec5@gmail.com> SVN-Revision: 45229
Diffstat (limited to 'target/linux/bcm53xx/files')
-rw-r--r--target/linux/bcm53xx/files/drivers/misc/bcm47xx-sprom.c41
1 files changed, 3 insertions, 38 deletions
diff --git a/target/linux/bcm53xx/files/drivers/misc/bcm47xx-sprom.c b/target/linux/bcm53xx/files/drivers/misc/bcm47xx-sprom.c
index e9bca9fbaf..cf031c8cfa 100644
--- a/target/linux/bcm53xx/files/drivers/misc/bcm47xx-sprom.c
+++ b/target/linux/bcm53xx/files/drivers/misc/bcm47xx-sprom.c
@@ -32,9 +32,6 @@
struct bcm47xx_sprom_fill {
const char *prefix;
bool fallback;
- int (*getenv)(const struct bcm47xx_sprom_fill *fill, const char *name,
- char *val, size_t val_len);
- const void *priv;
};
static void create_key(const char *prefix, const char *postfix,
@@ -59,10 +56,10 @@ static int get_nvram_var(const struct bcm47xx_sprom_fill *fill,
create_key(fill->prefix, postfix, name, key, sizeof(key));
- err = fill->getenv(fill, key, buf, len);
+ err = bcm47xx_nvram_getenv(key, buf, len);
if (fill->fallback && err == -ENOENT && fill->prefix) {
create_key(NULL, postfix, name, key, sizeof(key));
- err = fill->getenv(fill, key, buf, len);
+ err = bcm47xx_nvram_getenv(key, buf, len);
}
return err;
}
@@ -635,15 +632,6 @@ static void bcm47xx_sprom_fill(struct ssb_sprom *sprom,
}
}
-static int bcm47xx_sprom_getenv(const struct bcm47xx_sprom_fill *fill,
- const char *name, char *val, size_t val_len)
-{
- return bcm47xx_nvram_getenv(name, val, val_len);
-};
-
-/* FIXME: This should not be static, but some callback argument */
-static struct platform_device *sprom_pdev = NULL;
-
static char prefix[20];
static void bcm47xx_sprom_apply_prefix_alias(char *prefix, size_t prefix_size)
@@ -681,26 +669,8 @@ static void bcm47xx_sprom_apply_prefix_alias(char *prefix, size_t prefix_size)
*/
static int bcm47xx_sprom_init(struct bcma_bus *bus, struct ssb_sprom *out)
{
- struct platform_device *pdev = sprom_pdev;
- struct device *dev = &pdev->dev;
- struct device_node *np = dev->of_node;
- const __be32 *handle;
- struct device_node *nvram_node;
- struct platform_device *nvram_dev;
struct bcm47xx_sprom_fill fill;
- handle = of_get_property(np, "nvram", NULL);
- if (!handle)
- return -ENOMEM;
-
- nvram_node = of_find_node_by_phandle(be32_to_cpup(handle));
- if (!nvram_node)
- return -ENOMEM;
-
- nvram_dev = of_find_device_by_node(nvram_node);
- if (!nvram_dev)
- return -ENOMEM;
-
switch (bus->hosttype) {
case BCMA_HOSTTYPE_PCI:
snprintf(prefix, sizeof(prefix), "pci/%u/%u/",
@@ -710,7 +680,7 @@ static int bcm47xx_sprom_init(struct bcma_bus *bus, struct ssb_sprom *out)
fill.prefix = prefix;
break;
case BCMA_HOSTTYPE_SOC:
- fill.prefix = of_get_property(np, "prefix", NULL);
+ fill.prefix = NULL;
break;
default:
pr_err("Unable to fill SPROM for given hosttype.\n");
@@ -718,8 +688,6 @@ static int bcm47xx_sprom_init(struct bcma_bus *bus, struct ssb_sprom *out)
}
fill.fallback = false;
- fill.getenv = bcm47xx_sprom_getenv;
- fill.priv = nvram_dev;
bcm47xx_sprom_fill(out, &fill);
@@ -728,9 +696,6 @@ static int bcm47xx_sprom_init(struct bcma_bus *bus, struct ssb_sprom *out)
static int bcm47xx_sprom_probe(struct platform_device *pdev)
{
- /* This is the only way to make pdev accessible to the callback */
- sprom_pdev = pdev;
-
return bcma_arch_register_fallback_sprom(&bcm47xx_sprom_init);
}