diff options
author | Marc Kleine-Budde <mkl@pengutronix.de> | 2015-04-22 10:20:12 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2015-04-23 08:12:28 +0200 |
commit | 885a1cf27e6ae7a39113dd6c707d400c1585b35c (patch) | |
tree | 0042057d9f4946784d00c3f48aa71a3ed5a6fac3 /drivers/of/barebox.c | |
parent | 0238fb4c0da005421ed11b3e178558a140029972 (diff) | |
download | barebox-885a1cf27e6ae7a39113dd6c707d400c1585b35c.tar.gz barebox-885a1cf27e6ae7a39113dd6c707d400c1585b35c.tar.xz |
of_path: of_find_path(): add possibility to return .bb device
This patch adds a flags argument to the of_find_path() function. The only flag
defined for now is OF_FIND_PATH_FLAGS_BB. When used on NAND devices, the
function returns the bad block aware device (the ".bb" device).
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/of/barebox.c')
-rw-r--r-- | drivers/of/barebox.c | 20 |
1 files changed, 1 insertions, 19 deletions
diff --git a/drivers/of/barebox.c b/drivers/of/barebox.c index 0220bc6b31..1b3078eb47 100644 --- a/drivers/of/barebox.c +++ b/drivers/of/barebox.c @@ -31,28 +31,10 @@ static int environment_probe(struct device_d *dev) char *path; int ret; - ret = of_find_path(dev->device_node, "device-path", &path); + ret = of_find_path(dev->device_node, "device-path", &path, OF_FIND_PATH_FLAGS_BB); if (ret) return ret; - /* - * The environment support is not bad block aware, hence we - * have to use the .bb device. Test if we have a nand device - * and if yes, append .bb to the filename. - */ - if (!strncmp(path, "/dev/", 5)) { - struct cdev *cdev; - char *cdevname; - - cdevname = path + 5; - cdev = cdev_by_name(cdevname); - if (cdev && cdev->mtd && mtd_can_have_bb(cdev->mtd)) { - char *bbpath = asprintf("%s.bb", path); - free(path); - path = bbpath; - } - } - dev_info(dev, "setting default environment path to %s\n", path); default_environment_path_set(path); |