diff options
author | Rafał Miłecki <zajec5@gmail.com> | 2015-04-02 12:01:56 +0000 |
---|---|---|
committer | Rafał Miłecki <zajec5@gmail.com> | 2015-04-02 12:01:56 +0000 |
commit | 798bc562d90a6c6fb46d4c0bf32de4407ab95d1d (patch) | |
tree | f302b6673bca8373763974bc9fd297bbd77ce5ec /target/linux/bcm53xx/files | |
parent | 23656406274043c294bc4ce715bda3c6bb5cf2cd (diff) | |
download | master-187ad058-798bc562d90a6c6fb46d4c0bf32de4407ab95d1d.tar.gz master-187ad058-798bc562d90a6c6fb46d4c0bf32de4407ab95d1d.tar.bz2 master-187ad058-798bc562d90a6c6fb46d4c0bf32de4407ab95d1d.zip |
bcm53xx: sprom: simplify reading NVRAM after last backports
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@45229 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/bcm53xx/files')
-rw-r--r-- | target/linux/bcm53xx/files/drivers/misc/bcm47xx-sprom.c | 41 |
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); } |